Scientist Stories: Ziad Obermeyer, Machine Learning about Sudden Cardiac Death from ECG Waveforms

Ziad Obermeyer built a machine learning model that predicts sudden cardiac death risk from raw ECG waveforms using 400,000 ECGs from Sweden. The model identifies a high-risk group that accounts for a quarter of SCD events and matches the threshold for implantable defibrillator trials. It validated strongly on Taiwanese cardiac arrest data despite different demographics, suggesting ECG patterns alone carry predictive power.
Chapters
OK, so welcome, everyone, to this joint Broad and MIT EECS colloquium, which is co-hosted by the Eric and Wendy Schmidt Center and AI&D in MIT EECS. And so in this colloquium series, we're featuring speakers who are bringing machine learning methods into answering important questions in the biomedical sciences and also going the other way around of looking at biomedical questions and how that then motivates foundational developments in machine learning. And we think there is a huge scope in doing this at all levels of biology, so from proteins to cells to tissues to organisms. And now, so far, many of you have been coming to this colloquium series. You've seen examples at cells and tissue level and where we're asking biological or more fundamental biological questions. And so I'm very excited today to have Ziad Obermayer here. Who is an emergency doctor and still practices emergency medicine in underserved communities and is also associate professor and Blue Cross of California distinguished professor at UC Berkeley, where he really works at the intersection of machine learning and health. Ziad is very well known for work on algorithmic bias and its implications in medicine, among many other works, and has won a lot of different awards from professional societies in medicine and economics. And he's also heavily involved in open science. And, you know, for example, a co-founder of Nightingale Open Science, which is a nonprofit that makes massive new medical imaging datasets available, which, you know, we are, for example, very excited to actually look at in the breast cancer setting. So that's something that you all should look into if you actually want to get into more imaging data instead of, you know, just sequencing data or other types of data modalities as well. And so I'm very excited. Oh, I should have probably gone one slide further. If it works up.
Nope. Okay.
Can we? Oh, perfect. Thank you, guys. Whatever made that work. So here with a picture, but you see Ziyad in front of you, so I don't think you need the picture. So, so I'm very excited to have you, Ziyad, and the floor is all yours and it does move.
So thank you.
Thank you.
All right. Wonderful to be here. I'm glad— I'm glad you've heard about cells and tissues. I'm going to talk to you about a collection of tissues that forms humans and tell you a little bit about a project where we're trying to predict what I think of as is one of the deepest mysteries in medicine. So I think you don't have to practice medicine to know that the science is just kind of this amazing— like on display in medicine is like amazing things that human minds can do and also like really dumb things and things that are incredibly frustrating. And so I'm going to focus on this one fact that 300,000 people, if you buy the epidemiological estimates, just kind of drop dead in the US every year without any warning. And when doctors, even with the benefit of knowing that someone dropped dead, when they look back to find causes or kind of risk factors, in the vast majority of cases, they don't really find any. So this is really just like a —total mystery on a massive scale with life-and-death implications. And I think that despite how little we know about that mystery, one of the miraculous things about medicine is that that has not always held us back from finding cures. So we actually have— there are two interesting technological developments that happened. The first in the '80s was because portable monitoring technology started getting cheaper and smaller, and you were able to put it on people, occasionally you would catch an arrhythmia that killed someone as it was happening. And so we started developing this knowledge that there were certain arrhythmias that developed right before someone experienced a sudden cardiac death that were the kind of proximal cause of that death. In the '90s, you know, and again, I think this is kind of like a miraculous thing, people started, you know, first in animal models inducing these arrhythmias electrically and then shocking the heart out of them. And so the intuition for these implantable cardioverter-defibrillators is basically it's a little bit like when your computer is doing something wrong and you don't really know what it is. Like, what do you do? You just reboot. And that's exactly what a defibrillator does, is it just reboots the heart. And that terminates a large fraction of these otherwise fatal arrhythmias. And so that was a discovery that was made in the '90s. It led to the development of these implantable devices that can just sit— the battery is the round part, the leads go into the heart muscle, and those things can just sit there waiting for one of those arrhythmias and terminate it with an electrical shock if it happens. So it is kind of an amazing development. And then once again, back to a kind of problem, which is that we're just really bad, even though we kind of have the cure, we're really bad at getting the cure into the people who need the cure. In both directions. One is that obviously a lot of people are still dying of this preventable thing. So that's one kind of error. The other kind of error is like possibly even more striking, which is that the majority of the time that we implant one of these things in a person, it does not fire and it does not save that person's life. So it's just this catastrophic misallocation of the cure and the disease that I think is really striking, but also a really exciting opportunity because of the nature of the information that's needed and the things that algorithms can tell us about someone's risk. So I want to talk today about two sections to this talk. The first is basically about a very concrete task that I alluded to, which is getting those defibrillators into the right people. So I think ML has just an enormous amount to add for this first order big problem of getting defibrillators into the people whose lives would be saved by a defibrillator. And I think the way I think about the problem is that even though there are hundreds of thousands of deaths, of course there are even more people. And so the risk on average for any given person at any given time is quite low. So given that we're talking about implanting a device and like messing around in someone's heart, like that's not something you wanna do for everyone. And so, the cost-benefit calculation is not favorable on average. But the higher the risk gets, of course, the more favorable that cost-benefit ratio gets. And so if we could just identify people who are at high risk of needing this thing and get the thing into them in time, it would be hugely valuable. And it's a great, great machine learning problem because you don't necessarily need to know why someone is high risk. You just need to know that they're high risk and that this thing would help. So that's Part 1. Part 2, I'm gonna totally switch gears and be completely impractical for a second and think about what we can actually learn from this enterprise. So at the end of Part 1, I'll hopefully have convinced you that we have an algorithm that has learned something that doctors don't know how to do. It's learned how to predict risk on the basis of a waveform. And then the question is, of course, like, well, is ML just this like kind of useful thing that's going to remain a black box and not be able to teach us anything? Or is it going to be something that we can actually use for science? And the particular framing that I'll use is that, you know, science is basically just a bunch of— we generate hypotheses, we test them, we iterate, we repeat. And I think a really important question and an interesting one that's germane to this is where those hypotheses come from. So we know how to test hypotheses, but where do those hypotheses come from and why is that such an art rather than a science like all of the rest of the pipeline is? And I think there's a huge way in which ML can help with that, and I'll try to convince you of that as well. All right. So part 1, very concretely, here's our setup for, for tackling this question. So we just get a bunch of ECGs. So we get every electrocardiogram that was done over a 4-year period in one region in Sweden. It's called Region Halland. It's on the west coast of Sweden. It's between like Copenhagen and Gothenburg. And thanks to a lot of hard work by the health system in that region, all of the electronic health record data is actually online in a data warehouse. And because it's Sweden, everything is linkable to everything. And in particular, those electrocardiograms that are done everywhere in the healthcare system are linkable to death certificates where we can get the time of death and the cause that was assigned by the physician as the cause of death. So that's the data setup, is all of the ECGs that were done inpatient and outpatient. It's about 80% outpatient, 20% inpatient, linked to death certificate, then linked to a bunch of other electronic health record data. So on the basis of that linkage, we can start to generate some basic facts about sudden cardiac death, SCD, in this sample. So if you look, you know, imagine the data table as one row per ECG. So we're going to be doing everything at the level of the ECG. If you look in the year after that ECG was done, the rate of sudden cardiac death is, under 1%. So it's rare. This is about like what it looks like in other epidemiological studies. It is about 15% of all deaths. And the way, so we replicate the epidemiological definition of this, which has some problems that we can come back to in a second. It is when the physician writes down this is a cardiovascular cause or there's this group of ill-defined causes, which is like someone died and I don't really know why and I can't really sort it out right now. So that's an ICD code. So they need to have that cause of death written down, and the death needs to have happened either outside of the hospital or within the first 24 hours of an inpatient hospitalization. So this is not people who have gotten into the hospital or hospitalized and died a week later after a long hospitalization. This is people who are like, they die suddenly and they die of an apparently cardiovascular or unknown cause that's like out of the blue. So that's the definition that's usually used in these retrospective data settings. For context, the best current predictor, so the thing that most doctors use clinically in the setting is called ejection fraction. So you get a cardiac ultrasound, you try to quantify the percent squeeze. So when the heart comparing the heart, when it's like, you know, not squeezing to squeezing, what's the fraction? And the lower that goes, the higher the risk goes. And that's thought to be a proxy for lots of like scarring and kind of like problems that happen in the heart muscle that's a setup for these arrhythmias to form. So this is the current kind of state of the art for predicting sudden cardiac death. And on the one hand, it's kind of good because if you look at the sudden cardiac deaths and you look at the ones who have an ejection fraction recorded, who have had this specialized cardiac ultrasound test, the majority have a low ejection fraction. So that's the good news. The bad news is that 75% have not had that test. And so it's kind of unhelpful in the people who have not had that test. And so as a result, only 20% of those sudden cardiac deaths would appear to be high risk on the basis of that criteria in our sample. When you go back and kind of look at abstracting from this cardiac ultrasound and just thinking about like, well, Do these people look high risk on other dimensions? If you kind of classify people as basically healthy, if they have either no medical history or just hypertension and high cholesterol, about two-thirds of those sudden cardiac deaths are in people with like, you know, either nothing or just like these hypertension, high cholesterol things. So it does often just come out of the blue in people who are basically healthy. Okay, so first thing to just lay out is like what we do with the data. So these 400,000 ECGs from about 120,000 patients, that's our full sample. And the first thing we did when we got those data is we put 40% of all patients and all of their ECGs into a lockbox that we still have not touched. We divided the rest half and half into a training sample and a validation sample. All the results I'll show you are from that validation sample. There's one little thing that I'll come back to in a second, which is that we take everyone with one of those implantable defibrillators out of the training sample and we put them in the validation sample. And I'll come back to that in a second. And then— oh, sorry, just some basic statistics about the sample. As I mentioned, Most of these electrocardiograms are done outpatient or in the ER. So someone either comes in with chest pain or they get a screening electrocardiogram when they turn a certain age and they go to their primary care doctor. So these are very commonly done, very cheap to do. And that's one of the benefits. Comorbidities, you know, ejection fraction, things like that. No surprises here. This looks like basically a primary care population. So the approach is we take each electrocardiogram and we train a ResNet that was basically inspired by the things that do well in the PhysioNet challenge. So there are these challenges for predicting different human visible features. We shamelessly steal from the things that do well there. We train a model that gets us to the top of— in the top 3 or 5 of the people entering that challenge. And we just use that. And so, you know, what we're predicting exactly is two things. We predict for everybody, will they die of sudden cardiac death in the next year? And then we predict for the people who die, will that death be of sudden cardiac death? So you can think of one as an unconditional predictor and the other as a conditional predictor only for the people who died. And then we ensemble those two things together. To predict the 1-year sudden cardiac death likelihood. The model, you know, we don't know how well a model should do for this thing because we, you know, who knows what good performance is. But at least this model, when we look at how it does for these human-visible features, it has high AUC. For things that doctors can't naturally do, like predict someone's age from the ECG, it also looks like it's doing pretty well. So for both the human-visible and the other features, it looks like it's doing reasonably well. Okay. And for model performance, here's the AUC. So now the talk is over. We can all just go. So the talk and the paper should never be over with the AUC is my view, because it's not really— it doesn't tell you that much about what you need to know about the model. So let me tell you a few other facts. So one thing that you might wonder is like, well, is it identifying people who are clinically high risk. And that involves defining what high risk means. And so here's our definition of high risk. So if you're risky enough that a doctor would put in an implantable defibrillator, you're risky enough for us to consider you high risk. So how do we operationalize that? Well, we look at randomized trials where people get randomized to either a defibrillator or not. And we just look at the sudden cardiac death rate in the control group. Of people who didn't get the defibrillator. And there's a range of those things, but the lowest one that's published in the New England Journal is like a 3.5% 1-year sudden cardiac death rate. So that's our kind of absolute cutoff for who gets to be considered high risk in our model. And so for other parts of the talk, I'll talk about high risk or not. That's our criterion for high risk is if you're if you'd be eligible based on your sudden cardiac death rate to get a defibrillator in a trial. So at that threshold, 4.4% of the ECGs in our sample would be considered high risk. And those 4.4% account for about a quarter of all of the sudden cardiac deaths. So it's pretty, you know, concentrated in that top group. That said, you know, I think, None of this really tells me as a, you know, if I put my clinical hat on what I'd need to know. And so I'm gonna try to triangulate a couple of other things that we'd wanna know about such a predictor. We don't just wanna predict risk, of course, we wanna use the prediction in the service of preventing risk. And so, you know, a really important question to ask is like, well, you know, sure you can predict this risk, but is that predictable risk preventable? And looking at the literature, it's very clear that the answer to that is not necessarily yes. So there's been a bunch of trials of implanting defibrillators in patients on the basis of novel risk scores. Some of those are ECG-based, some of them are not. But basically, a lot of the things that use things besides ejection fraction have— oh, thanks— have yielded negative randomized trials, which means that, sure, you can predict some kinds of risks,, but you can't necessarily prevent it. And so here's one. I think now my clicker is no longer in the screen. Oh, there we go. Thanks. So here's, here's one, I think, piece of circumstantial evidence is that we trained our model to predict this object of sudden cardiac death on a death certificate that was very useful as a training label. But that doesn't tell us if that death was preventable with an ICD. So what could tell us that? Well, Let's look at those arrhythmias that we know are the proximal cause of sudden cardiac death. So we didn't predict those things when we were training. So we're just going to bin people by risk and we're going to look at the incidence of those arrhythmias as a function of predicted risk. So each of these bins, I think, is a ventile or no, there's too many. Anyway, there are bins of predicted risk, low risk on the left, high risk on the right. And then we just follow those patients up over that next year and we see who has a code for ventricular fibrillation or ventricular tachycardia, which are these arrhythmias that are thought to be the genesis of sudden cardiac death. And you can see that that's going way up in predicted risk. So reassuring that at least mechanistically we're picking up on something that is a, something that can be terminated by an ICD. Here's another piece of evidence that's a little bit less circumstantial. So I think, you know, the question is not just do these arrhythmias happen, but would they be terminated and would the life be saved by a defibrillator? And going back to our data setup, you recall that we took all of the people with an implantable defibrillator out of our training set and put them in the validation set. And that's the group where we actually predict very poorly. So this is a 2x2 table that just shows low risk, high risk using that cutoff we discussed. And then it just looks at the all-cause 1-year mortality with similar results for the sudden cardiac death rate for the people with versus without an ICD. And what you can see is that like the low-risk people, if anything, have a marginally higher rate of dying at 1 year. When they have a defibrillator versus not. Whereas the trend is the exact opposite in the high-risk people. So why are the rates high? Because a lot of the ECGs get done in the inpatient setting. And so this is weighted by the number of ECGs. So that's why the rates are high. But overall, the interesting thing is that the low-risk people seem to die about the same or more when they have an ICD, whereas the high-risk people die less. And we get similar results when we look at sudden cardiac death as opposed to all-cause mortality. But the all-cause mortality is particularly nice because a lot of trials of defibrillators show that people have lower rates of sudden cardiac death when they have a defibrillator, but other death rates actually more than compensate for that. So the mortality— or compensate for that so that the all-cause mortality ends up staying the same. So the defibrillator can save your life from that one particular thing,, but you have so many other things going on that the overall mortality stays the same. And we're not seeing that here. So the last important question here is trying to figure out whether these predictions are generalizable or not. So what we've shown you is basically that when we take the training, the model fit on a training partition, it predicts well on patients the model hasn't seen in this particular region of Sweden. But Sweden is kind of a, it's an unusual place at a global level. And so you really wanna make sure that this holds for non-Swedish people too. So we're gonna go to another dataset. And this dataset comes from the largest hospital in Taiwan. And that hospital has for the past 10 years or so been collecting a registry of patients who come to the ER of that hospital in arrest of some kind. So their heart isn't beating. Over the course of that ER visit or hospitalization, physicians do, on the basis of whatever testing was done, code those deaths as either sudden cardiac death or something else. And so we have a lot of data, especially for the people who survive, that lets us— this is just a different way of defining cardiac arrest on the basis of hospital records. So that's the registry. So what we do is we take every patient who's in that registry and is coded as a cardiac arrest death, and then we find a matched control who visits the ER on the same day as that arrest patient. So that's our case definition and our control definition. And then we look in the electronic medical record of that hospital for both of those people's last ECG. So we throw out the ECG from when the person in arrest is in arrest. We look at their last ECG. We do the same for the control patients. And the median time from that last ECG to the, to the index visit is about a year. Then we take the model from Sweden and we apply it to generate predictions on that last ECG. So So that the one before the ER visit, and we ask whether that prediction can distinguish the cases from the controls. And the AUC, which was 0.846 in Sweden, is actually still, to me at least, surprisingly high in Taiwan. So this is able to distinguish about a year in advance cases from controls in this setup. There's one interesting fact that I was talking about with Pete earlier today, which is that this predictor, as I mentioned, it's just the waveform. So it is purely mapping the waveform data onto the probability of sudden cardiac death. And it doesn't use like age or sex or like anything else from the electronic record or otherwise. So there's some variables that overlap between our Swedish data and this Taiwan dataset. So it's not perfect, but there are a few variables that overlap. So the first iteration of this work, we actually took the age and the sex and a couple of other things that was in that shared set, and we froze the weights from SWEET. We trained using those things, we froze the weights, we applied it to Taiwan. And when we did that, the AUC was much lower. Which was quite surprising but quite interesting as well because it means that even though, of course, that model did better in our validation set in Sweden, it did much worse when we transferred it outside of Sweden. So there's something cool about building a predictor that's based on the waveform alone and not incorporating these other things, which might mean different things in different places, be collected in different ways in different places, et cetera. So interesting side fact about this. From a practical point of view, it's also very cool to be able to build a predictor that could run on a device without getting any other data input or pulled from the electronic health record too. So there are some practical things that are nice about this as well. Okay. Would love, you know, either now or later, any thoughts about what to do next. But here is preliminarily what we're thinking on a practical level. So the first thing, which is the easiest thing to do, is that when we look in our validation set, about 200 patients have a cardiac MRI just in the basis of their normal care in the electronic health record. And so we have a cardiologist in that, you know, who works in that region in Sweden who's just going to go through and code features of that cardiac MRI that are relevant to sudden cardiac death, blinded to the algorithm's predicted risk. And then we're going to look at those things as a function of the algorithm-predicted risk and see what kind of structural abnormalities are more common in those people, unusual as they may be, who have gotten a cardiac MRI. So that's one interesting way to get some insight into what are the structural correlates of risk in these people with MRI. We're going to, of course, we still haven't touched that 40% lockbox data. And so we're going to finalize all of our analyses and everything in this data. And then before we submit for publication, we're going to refit the model on 60% and report that 40% that neither us nor anyone else has ever touched before as a way to discipline this. And then I think, you know, if all of that looks promising, I think there's a lot of desire from our from our collaborators in Sweden to turn these big investments that they've made in data into better care for their patients. And so one of the things that we were thinking about doing in collaboration with them and with the appropriate IRB and ethical oversight is to basically run a trial where we can nudge primary care doctors or cardiologists to gather more information on people who are identified as high risk by the model but don't have an echocardiogram or a cardiac MRI or, or things like that. And so that's a way of, you know, in a way that is not harmful to patients, at least lets us get more information and identify people who are high risk on some of these other metrics. So I'm going to take a little interlude here and observe that I've always been interested in this problem since kind of understanding how big and important and tragic it was when I was in medical school. There are many deep mysteries in medicine that nobody understands and that are really important to solve. A lot of those things are very amenable to machine learning approaches in the sense that they require, like, a big part of understanding them is mapping some high-dimensional object to some low-dimensional object or a high-dimensional to a high-dimensional object. So, you know, like When I work clinically, I would say that 60, 70% of people, like many people come into the ER with pain, pain in their chest, pain in their knee, pain in their back. The majority of the time we do not get to the bottom of what's going on. We're like, well, you're not having a heart attack, you're not, you don't have a fracture. And they're like, well, great, what do I have? And we're like, well, you know, I don't know, but good luck. You know, come back if you need anything else. So, The vast majority of pain is unaccounted for and unexplained. Very interesting ML problem because, you know, we have pain scores, we have lots of imaging. Interesting problem. Cancer, great prediction problem. Some cancers can be watched. Which ones? Which ones won't metastasize? Really interesting, important problem. COVID, who's going to die from COVID Who's going to have an asymptomatic and/or a minor infection? Another great prediction problem. I think those kinds of problems, in my view, there should be a lot more papers on these things. So why is the market not providing papers on these things? Who is producing them? Well, it's people like, I imagine, most of the people in this room who are fortunate enough to be at a fantastic academic medical center with data use agreements and data sharing agreements and compute and a great— That's who's producing papers. There are a lot of people who would like to be producing papers who are not. A lot of Berkeley PhD students email me and they're like, I'm a third year in EECS and I'd really like to work in health. And I'm like, great, I'll add you onto my data use agreement. And in 2 years we'll get you a criminal background check. And then I'll, and it's like, it's just not. To put this in perspective, let me tell you about how we got the data for this Sweden project. So in 2015, so I was at the Brigham, so I was on faculty at the Brigham before Berkeley. One of my colleagues is a Danish-American doctor who spent a lot of time in Scandinavia. He invited me to this conference and I met this cardiologist from Sweden. Who was like just starting to get his electronic health record dataset like assembled. And so, you know, we started talking about this project. We got an IRB approved. It took a year to get permission to merge in the cause of death data. Then we had to pay Philips to extract the ECG data. That was super painful and a little expensive. They finally did that. At some point, someone in the region decided that people needed to have the right to opt out of being in this dataset if they didn't want to be in this. So all work stopped until they could notify everybody and give them the chance to opt out. Interestingly, because it's Sweden, I think 7 people opted out. So there's a lot of trust in government and institutions and stuff, but it did cost us a long time. Then we had to get an IRB amendment because something was wrong with the first one. And then finally, we got access to the data, like, from outside of Sweden in 2020. And we had one research assistant working on it. Now it's this great PhD student, and it's through this, like, this virtual, like, desktop setup. Where, like, you know, Alex will type the letter F and then a second later the letter F will appear on the screen. So this poor guy has to just— So anyway, oh, and then, and then we had to add GPUs inside of the— Okay, so you might ask, how would it— like, why did I— like, what rational person would wait this long? To like go through this process. And it turns out that in 2016, by an amazing coincidence, I met my future wife who happens to be from this region in Sweden, completely unrelated to the cardiologist that I met. Like it was just a ridiculous coincidence. And so every year we'd go to Sweden like for a vacation. And I'd have coffee with Marcus, the cardiologist. I was like, "Hey Marcus, how's that IRB amendment going?" And he'd be like, "Yeah." Anyway, so that model of marriage-based access to data is not scalable and shouldn't be scalable. But something needs to be scalable because fields— I think all of us in this room probably think that there's a field here. Like a new field that's at the intersection of health and policy and data and computation and biology. But fields need data. So where's the health data? Well, it's locked up inside of health systems, and the gatekeepers of that data have very little incentive to share the data. And so it's a classic kind of public goods problem. I mean, there's another model, which is that some tech companies just buy access to data, but they also don't really want to share. They want to monopolize it. That's a business model. And on the demand side, is it like health systems can't really compete for, like they're not gonna beat MIT or Google for, you know, in this competition for talent. And so basically what we're left with is that like the allocation of data, like the supply of data to the demand for data is both very inefficient because there's not enough of it. It's also very unfair because all of us in this room, are lucky enough to have access to data. But like, what about all the smart people who are not affiliated with MIT and Harvard? Like, it's just deeply unfair. So I wanted to mention— thanks, Caroline, for mentioning this in my introduction. This is a nonprofit that I co-founded called Nightingale Open Science. It's a computing platform that basically, you know, we work with health systems to identify problems that they want to solve. We create datasets inside of the health system using philanthropic funding, and then we de-identify those datasets and we put them on our cloud where anyone can access those data for free. And so the types of datasets that we have on there, they are large. So there's some rules. They're image-based. They're image-based because images are super interesting because they're also under HIPAA de-identifiable. And because they are pretty standardized across time and place, I think they have a lot of good ingredients and they make it easy. And a big focus of those datasets is that unlike a lot of public datasets in health, it's not just the digital pathology slide and what the pathologist said about the slide. It's not just the human label. We make a lot of effort to label these things with ground truth outcomes, or at least as close as we can get to ground truth. So we're not purely interested in automating human judgment. We want to learn from patients, not just learn from doctors. So let me contrast the— like, so we have these two datasets that I've mentioned. One is the Sweden EHR dataset, and the other is the Taiwan dataset. And the Taiwan dataset is actually on Nightingale Open Science. And so you can contrast the two processes for getting access. You can go to nightingalescience.org. You can hit the Register Now button, accept the terms of use, and then you will have access in a couple of days if you're interested in doing research in this space. And there are a bunch of other datasets on there as well. So I hope you use them for your papers. And we're launching some Kaggle-style challenges as well that I imagine the people in this room would be well equipped to do well on with cash prizes. All right. So that's the end of the interlude. But let me, let me stop there and see if there are any comments or questions on that part so far. And feel free. I normally present to economists, and economists are, you know, they're very interruptive, and that's good, I think. And so please don't hesitate to just interrupt me as we go. Okay. Oh, online questions. Oh, okay. Okay. So Brody Dub from Stanford asks, what are your thoughts about federated learning given the challenges about generalizability? Is there something ongoing? Yeah, I mean, I think I would be super excited if federated learning works because I think it's just— it's a lot easier when you don't have to persuade someone to take the data out. I think one of the things that, at least when I've tried to dip my toes into that pond, water, whatever, is it's very like 90% of the work that I have to do for these projects is the data cleaning part. And I think it's just really hard to get visibility into what actually is happening when you don't have the ability to pull the data from the source and make sure, like, so I think you're giving up a lot of control and maybe that's worth it because you're getting a lot more data in return. But I always have this residual discomfort that there's something going on in the backend that I don't fully understand and can't control. And I think a lot of people have that discomfort. That said, I would be super excited if that approach— I think we need more— we need a diversified portfolio of data. And I think that's a great one to invest in if you can't get the data out. Monty Krieger asks, have you looked at effects of patients on different drugs on predictions AUC? So the drugs, let me answer it. So no, but there's a related question that I think is really interesting. So if you imagine trying to ask questions about drugs and sudden cardiac death, What you have to do before you have this prediction is just run a regression of like death on drugs before death. And death is the realized outcome of like the risk. But now you have a risk score that, that's much higher frequency with every ECG. And so what we're trying to do now is trying to figure out the right way to capture the fluctuations in risk measured by the ECG as a function of different drugs that turn on and off and distinguish that from other things that are going on when the drugs get prescribed. I think one thing that makes it hard to run that regression is that the drugs aren't randomly allocated, like the drugs are allocated when people get a disease. And so it distinguishing the effect of the drug from the underlying disease that prompts the drug is hard. But I think having that high-frequency measure of risk is, is really useful.
Can I just ask very similar, oh, sorry, very similar. I mean, you had like data, ECG data taken from the ER or general checkups, and that seems exactly the same problem that you're now saying. So how do you deal with that?
I think that it's hard to get around the fact that people get ECGs for a reason and that those people are different from the people who get ECGs, who would get ECGs under a policy of like, oh, let's screen the whole population. So So right now, I think the only thing that I feel confident about is saying, okay, we've trained the algorithm on this population. Let's, you know, for the next year, people are going to come in and get ECGs in the exact same data generating process that we trained on. Let's focus on those people first. I think before we do anything in another population, I think we'd have to be really careful to make sure that the performance is good and that that selection isn't causing problems. But I feel pretty comfortable in a new year of the same data generating process. And that's where our first applications are gonna be. But yeah, it's a great question. I think this is sort of related to Caroline's question, but was there a difference going back to the age and sex and how it helped for Sweden but didn't help for Taiwan? Was there a difference in age and sex of for people studying cardiac death in Sweden versus Taiwan? And do you think that's just the mismatch? Yeah, it's very possible that that, that drop in performance is from the fact that like many things are different. For example, one is a case control study, one is a population-based study of you. So I think lots and lots of things could be going on and we're trying to find new datasets where we can kind of tackle that question among others more robustly. But yeah, it's a great point. The data generating process is completely different in these two places and that could distort the weights on these otherwise like very useful variables for sure. Okay. So moving on to the, to the hypothesis generation part, let me actually back up to, I think, 1982 and tell you a story about hypothesis generation that's quite related to sudden cardiac death. So, so there's a Spanish cardiologist working in the Netherlands. And one morning, this father comes in with his 3-year-old son who's just had a cardiac arrest. And the father, like one of the incredibly improbable twists in the story, the father was like trained as a Dutch mercenary soldier. And as part of his mercenary soldier training, I guess you learn CPR. So this father did CPR on his 3-year-old son, and the son survived to get to the hospital. And they did an ECG, and this was the ECG. And a couple of— just another, like, improbable thing— that the 3-year-old had already had a couple of cardiac arrests and survived. 3-year-old had a sister, an older sister, who died at 3 years old of a cardiac arrest. And this is from the account of this story. And so the cardiologist in Spain managed to get the records from the Warsaw hospital where the sister and the ECG looked exactly the same. And in particular, like the thing that, you know, might stand out or might not is this, this thing looks really weird. It just looks weird. Like, like it doesn't look like a normal ECG. Okay. And so this cardiologist assembled a couple of other patients that had died and had a similar thing. And everyone was, was really focused on that thing I pointed out. And in particular, they were like, yeah, it's a dolphin shape. Now, I don't know if you guys see a dolphin, but it was very salient. And then basically they tried to get this published and they could not get it published. It was just like, no, everyone was like, no, this is just a version of this. And they were like, no, there are all these like young, healthy people dying and they have this. So they went back and forth and they sent it to all the big medical journals and one of the— and they got really discouraged. And another improbable thing is that this cardiologist's older brother was also an electrophysiologist. And so they got a— he got a lot of moral support from his brother and, you know, like, and so persevered. And finally was at a conference, was seated next to the editor of the Journal of the American College of Cardiology. And was like, hey, I have this manuscript. Everyone's turned it down, but I think it's really good. And the guy was like, okay, send it to me. And then they published it. And now it's been cited like thousands and thousands of times. And that was the catalyst for investigating patients with this ECG abnormality, the dolphin-like shape, and ultimately pointing people in the direction that because this was a, this looked like a electrical problem rather than a structural problem, they were able to actually identify a sodium channel, a channelopathy that was— and so this is the Brugada syndrome. And you can see, I think it's actually like all 3 brothers are cardiologists, if I'm not mistaken. So there's just like lots of weird twists and turns to the story. So What, what do we learn about the process of generating a hypothesis from this story? Well, there are a few ingredients. So one important ingredient is an outcome. And that might seem obvious in this case, but it's not a given that this outcome would be considered important, because what if that patient had been old instead of 3 years old? Would the cardiologist have noticed and been like, oh, that's a weird EKG in a weird case? What if the sister hadn't had the exact same thing and had that ECG that they could get from the hospital in Warsaw? So like a lot of things had to happen to get this death to stand out and reach the level of like, oh, okay, maybe there's a hypothesis here. On the age point, I don't know if you know this story, but is anyone like one of the most prolific serial killers in history? Is a doctor. So he was a doctor, a primary care doctor practicing in England, and he would administer morphine to his patients and kill them. He killed 250 people. How did he get away with it? Well, who was he killing? Old people. And everyone was like, yeah, she lived a full life. And it's like, no, she was murdered. But, you know, like, age is going to make some things very salient or not salient. And so what are we missing in old people? That's just like killing a lot of old people. It's entirely preventable. Who knows? Because the outcome isn't salient. Okay, what else? So the other ingredient is a noticeable thing, a feature. And here it was like the dolphin-like ECG shape. So, but what if that feature had been not something that was just like it stood out from the background, right? What if it had been a large, like, negative covariance across two ECG leads? Would any human have noticed that? Not a chance. Like, there are all sorts of things that are very measurable and very much there that are just not going to stand out to a human. So that ECG could have been read as, like, totally normal, and we never would have found Brugada syndrome. And the reviewers didn't buy it either. So it's not just the— Yeah, even when it's obvious, people are always going to be like, oh no, this is just a special case of this other thing that we already know about. And then the last thing, which is the most obvious thing, is a correlation. So the X and the Y have to be correlated, but establishing that correlation is really hard because, you know, in a high-dimensional setting, lots of things are going to be different between someone who dies and someone who doesn't. So establishing which one is important, which one is worth pursuing, it's just like really hard. It's a little kind of curse of dimensionality, like, okay, so our model can help with many of these things. So we can write out the outcome however we want to write it. So we can define, as long as it's in a dataset, we can write it. That's our outcome. You know, model neural networks and fit arbitrarily complex things, correlations, no problem. But there is one problem. Which is that the features are very ill-defined. This is not like a regression where you can just like, there's a feature, there's a weight, like we can't inspect it, we can't interpret. So, so there is a big interpretability problem with these things in high dimensions. So what would we like a model like this to do? Basically, like the model knows something. That we don't know, and we want the model to teach us what it knows. And so there's another setting that this happens a lot in, which is like, you know, medical school or residency where somebody knows something that I don't know and they're like, no, you need to learn this thing. So how do we do that? Well, basically, like, so this is a kind of a classic teaching material. This is not a real ECG. So what do they do? They start with a normal ECG and then they're like, okay, this part goes up. Notice everything else is constant. So this goes up, this goes down. So that's how we learn. There's lots of potential things that can be different. Some things need to be held fixed that aren't important, and other things need to be changed so that we can focus on them and learn. So, oops. So, you know, a simple— like the first thing that occurred to me that sure is occurring to you is like, well, let's just take an ECG and tweak it to follow that risk gradient, like just kind of ablate or start, start messing with it. And you quickly start getting things that look nothing like ECGs because most waveforms, even if you constrain it to be a waveform like a continuous time series, most of those things are not ECG-like. I can tell you after having tried to do this for 3 months, 3 or 4 months. Okay, so what do we do? So we basically build— we model that ECG data manifold directly. So we train again. There's like an autoencoder generator and a discriminator, and then we generate a synthetic ECG on that manifold, and then we just start looking around. And pair that to the predictive model that we already have for sudden cardiac death, find higher risk, lower risk, and then orthogonalize against all the other features that we can, you know, that we measure as we move along that risk gradient. And so the first thing you can do is just verify that this works for known features. And so are there any, electrocardiographers here? You see like what's constant and what's changing? No, no cardiologists. All right. This is the spike in the middle, the QRS duration. So one of the things that humans look for is the width of that spike. And you can see that as you go from blue to orange, it's getting smaller and a lot of the other things are staying constant. This is all these results arrived late last night because I cannot get anything done before a deadline. So there are some, okay. So now here's the sudden cardiac death gradient. And so basically these are so similar. Orange is counterintuitively low risk and the purple is the highest risk. And I spent a while looking at these like at 11:00 PM last night as I was preparing my slides and I don't know I mean, I think the one thing that stood out to me is that like things seem to be varying less as you go up the risk. So everything just seems to be flatter. And so, so basically what's next? So that's a morphing in the direction of higher or lower risk. So what next? So we're going to show doctors a bunch of these things, and we're first going to train— and non-doctors. We're just going to train people to be able to distinguish which ones the model thinks are high risk and which ones are low risk. So there's a training step, and then we're just going to get people to interpret the ECG both along the traditional things that we look for in ECGs, but also in a freeform way. It's like I was attempting to do earlier, like everything's just a little flatter, or like maybe this thing is rotated, maybe this thing is twisted. Like, who knows? But just like describe it. And then the nice thing is that once you've described it, you can code it. So you can then go to a bunch of new ECGs and code that, and then you can orthogonalize against that first thing you found and then do the second thing you found. So you can just keep generating more and more hypotheses until you've explained a high proportion of the model's variation. And that's kind of cool. So let me— we're at time. So let me just summarize by saying that I think there are two ways in which ML is very, very useful in medicine. There's a very obvious just social welfare thing of like, we have this treatment, we have this disease, we're currently not matching these things very well. Predicting someone's risk or predicting someone's, you know, whatever is going to help us do this matching better. And that can unlock huge social value at the same cost. We're not increasing the number of treatments. We're just getting those treatments to the people where they're gonna do the most good. So that matching problem, I think, is a very important first-order thing that medicine is getting wrong today, 'cause it's a hard problem and that machine learning can really help with. I think this other thing of generating and testing new hypotheses is also very promising and really important. Because a lot of things are not in the data. So if you think about sudden cardiac death, how did we figure out that people needed to be shocked in the heart so that they wouldn't die? That is not in the dataset. So that required understanding, like some mental model of what was going on. It required understanding electricity, which is definitely not in it. So, Helping humans get better understanding of these problems is also a really important goal, not for solving like the thing in front of us, but for solving a bunch of other things that we can't even imagine now that require reasoning and more data collection and experiment, like collecting new experimental data where you perturb something in the world and get feedback. And I think one nice model for that is that I really liked is Regina's paper on antibiotic discovery. And I think there are a lot of things like that where you can kind of start imagining this loop that's automating parts of the scientific discovery process and specifically automating the parts that humans are not good at. So that— so those are a few things I'm excited about. Sorry, I went a little bit over time, but thank you so much for having me.
Thank you very, very much for a great talk. Questions? I'll maybe start with one. How well does your model do on the dolphin-shaped ECGs?
It's a great question that I should look at, and we'll write that down. I'm going to guess not that well because it's so rare. Not seen it so often. Yeah. And I don't even know how many there are in the dataset. Or how many are diagnosed. But yeah, it's a great question.
And sorry, anyone who has questions can just come up and I can also walk around.
Sorry, there is one here. Thank you. I was wondering, so on your last point on relating that to coming up with something like electrical shocking of the heart, so on the slides just before that you were talking about relating the risk to ECG waveforms. And I was wondering if you could go beyond that observable to electrophysiological features of the heart that then would maybe like allow you to, you know, like as a human to come up with fancier shocks or something. I don't know. Right. Is that possible to go from the ECG waveform to some intervention-ready electrophysiological features?
Yeah, it's what a, what a great question. So I think one of the nice things about like, we understand a lot about where this waveform comes from. So, so, you know, when like in the example I showed you earlier, ST elevation, we know from like a lot of experiments on a lot of poor dogs that when you completely infarct the wall of the heart, that produces a repolarization problem that elevates the ST segment. When you partially infarct it, it goes down. And so, so you can actually start coming up with mechanistic hypotheses about what's going on on the basis of some parts of that waveform. And so you could say, oh, this looks— so, you know, just on the basis of where it is, you could say, is this a depolarization problem or is it a repolarization problem. So that's already kind of helpful. But then you can start drilling down. You can start thinking, oh, if it's this kind of problem, maybe this drug works. So now let's go to the dog model and see if that works to stabilize the myocardium under these different conditions. So yeah, I think reasoning directly on the waveform is possible because we understand where that waveform comes from, from an electrophysiological point of view. Is that— or is that— does that—
yeah. Thank you very much for a great talk. Going back to the interpretability model that you were talking about where you generate the ECGs and then perturb them to kind of see what correlates with high-risk features, how are you choosing the kind of anchor points that you use for like the— I forgot what you called it, like the manifold older for the ECG, like that you gave the QRS interval as one of them, but where are those coming from?
Yeah. So there's a set of basically things that cardiologists currently code about the ECG. So there's just a vector of things. There's measurements, there's presence of this, absence of this. And so I think there are two ways to think about— I think both are useful. One is, Well, why are we conditioning on those things? We just want to see, okay, like, what does a high-risk beat look like? And then we can kind of see, okay, how much of that high-riskiness is explained by these features that we already know about? And so that's like one important question. But then the other question is like, you know, how do we learn? Like, we're really good at comparing things. But we have to be able to hone in on a small number of things, because if too many things are different, then you're not going to be able to like find the thing that we care about. And since we're particularly interested in new things that we don't know about already, I think there's also some value to that orthogonalization procedure. Thank you.
Thank you, Ziad. This last question reminded me of something interesting from ancient history. Hewlett-Packard, when they were working on diagnostic ECG algorithms, did something where they recorded a bunch of ECGs and then they clustered them using some for its time. I think this was 1980s, sophisticated clustering algorithm. And I'm just wondering if some approach like that wouldn't also help here, because you would, you know, by hierarchical clustering, you could identify from the data itself sort of typical patterns that might mean something to your algorithm.
Yeah, it's— so I think I've always been like, any time I've tried to do some kind of clustering procedure, like, I always get really excited about it. I'm like, oh, this is going to find out. And then you run the procedure and you get clusters. And then you're like, great, OK, how do I know these clusters are valuable? And you're like, oh, well, because the clusters predict this outcome that I care about. And then I'm always like, OK, but then I should just predict the thing I care. Do you— you've thought about this a lot more than I have, but like, I can imagine those, like, lots of valid clusters being clustered. I never quite know how to think about, like, are those good or not, except in the context of do they predict something? And then if that's the measure of goodness, then why don't I just predict that thing? But I'm probably missing something Or I've always thought I'm missing something in this area, but I've never been able to figure like how to get the clustering to like do work, if that makes sense.
Yeah, I haven't thought about it in this context, but I'm just wondering if you took those cluster centers and ran them through your algorithm.
Oh, that's, yeah, that's interesting.
Yeah, that's cool.
You would get a prediction. Yeah, yeah, yeah. No, it's worth— I'll think about it more. And I would love to find a way to make something like that work. It always seems very promising. Let's do the last question.
One question I had is, let's say this— you do more work on this and sudden cardiac arrest is a solved problem. What would be other things you would focus on at that point?
Conditions and stuff. Yeah, I think I'm going to cheat a little bit by just going back to when we were setting up this nonprofit Nightingale. I think I spent a lot of time thinking about what are some good machine learning problems and then trying to convince health systems to create datasets around those problems. And so I think the ones that I mentioned are kind of— I have always liked them and wanted other people to work on them. And so that was the genesis for a lot of these datasets. But I think like pain is a really, really interesting one. It's like a huge, you know, when we think about the opiate-like problem, I think there's been a lot of blame very justifiably placed on doctors for prescribing all these opiates. But no one ever asks like, well, why are they prescribing all these opiates? It's because a ton of people come to see them with pain and they have nothing useful to offer besides like, yeah, maybe do some PT. And like, it's like, what's the problem? What's the problem that PT is solving? It's like, well, pain. But if your diagnosis is pain, what's the treatment? So there's this scientific void in the study of pain, and opiates are filling that void. And it's a huge problem because it means that, like, people come— like, I don't know if any of you have had— like, I've had back pain for a few years and it's been on and off, and it's really hard to get to the bottom of what's going on, let alone start fixing it. Why is that? Like, we have a lot of imaging. Like, why are we still looking at disks when the disks are obviously not the problem? So I think that's a great one. Cancer, I think, is the other huge one, is which cancers will metastasize and need to be addressed and which ones don't. And there's misallocation on both sides of that problem. So I think those are— but I think that the datasets that we have on there are a good place to— at least where I would start.
Thank you very, very much, Ziyad, for a really awesome talk. Thanks.
More from Joshua

Scientist Stories: Hans Waterham, The value of phenotypic assays in peroxisomal disorders

Scientist Stories: Joel Zlotogora, Genetic carrier screening programs for reproductive purposes








