Part VII: Health, Biosignals, and Wearable AI
Chapter 29: ECG and Cardiac AI

Clinical validation design

"My AUC was 0.94 on the held-out set. Then a real clinic ran me at a real prevalence, and I learned that nine out of ten alarms I raised were wrong. The test set never told me that."

A Chastened AI Agent

Why this section matters

Everything earlier in this chapter built cardiac models and measured them on curated datasets. This section asks the question that decides whether any of that reaches a patient: does the model actually help, in the setting where it will run, on the people it will run on? Clinical validation design is the discipline of answering that with a study you can defend to a regulator, a hospital committee, and a skeptical cardiologist. It is not a bigger test set. It is a sequence of study designs, each answering a different question: does the model discriminate, does it discriminate here, does it change what clinicians do, and does changing what clinicians do change patient outcomes. Getting the design right is the difference between a paper with an impressive area under the curve and a tool that survives contact with a real emergency department.

This section assumes the leakage-safe splitting discipline of Chapter 5 and the general evaluation-protocol machinery of Chapter 65, and it leans on the calibration and uncertainty ideas from Chapter 18. It is the cardiac-specific complement to Chapter 34, which covers the regulatory pathway and biometric-privacy law in full; here we stay on study design. We do not re-cover the false-alarm triage of Section 29.6 or the models of Section 29.5; we assume a model exists and ask how to prove it is worth deploying.

The validation ladder: from discrimination to outcomes

Clinical validation is not one study but a ladder, and each rung answers a strictly harder question than the one below it. Rung one, retrospective internal validation, holds out records from the development database and reports discrimination (AUROC, sensitivity, specificity). It is cheap, fast, and almost worthless as evidence of real-world value, because the held-out records share the same recruitment, hardware, and labeling pipeline as training. Rung two, external validation, runs the frozen model on data from institutions, devices, and populations that never touched development. This is where most impressive numbers deflate: an ECG model trained in one health system routinely loses several points of AUROC and, worse, loses calibration when it meets a new patient mix, a topic treated generally under distribution shift in Chapter 66. Rung three, prospective silent evaluation, deploys the model live but hides its output from clinicians, so you measure performance on the true incoming stream without letting the model affect care. Rung four, the pragmatic randomized trial, finally shows the output to clinicians in one arm and not the other, and measures a clinical outcome. Only rung four proves the model changes what happens to patients. The mistake that sinks products is stopping at rung one and reporting it as if it were rung four.

Discrimination is necessary and nearly meaningless alone

A high AUROC says the model can rank a sick patient above a healthy one. It says nothing about the operating threshold you will actually use, the prevalence you will actually face, or whether acting on the alarm helps. AUROC is prevalence-independent by construction, which is exactly why it hides the deployment problem: the same 0.94 curve yields a wonderful positive predictive value in a cardiology clinic and a useless one in a healthy screening population. Validation design exists to surface everything AUROC conceals.

Metrics that survive deployment: prevalence, PPV, and net benefit

The single most common failure in cardiac-AI validation is reporting sensitivity and specificity, which are properties of the model, and forgetting positive predictive value, which is a property of the model and the population. By Bayes' rule, at prevalence \(\pi\), sensitivity \(\text{Se}\), and specificity \(\text{Sp}\),

$$\text{PPV} = \frac{\pi\,\text{Se}}{\pi\,\text{Se} + (1-\pi)(1-\text{Sp})}.$$

For a low-ejection-fraction screen with \(\text{Se}=0.90\), \(\text{Sp}=0.90\), the PPV is a healthy \(0.89\) at \(\pi=0.5\) but collapses to \(0.08\) at a screening prevalence of \(\pi=0.01\). Nine of ten positive alarms are false, and every one triggers a downstream echocardiogram. This is the number a hospital committee cares about, and it is why validation must be run and reported at the deployment prevalence, not the enriched case-control prevalence of the development set. Beyond raw predictive values, decision-curve analysis (Vickers and Elkin, 2006) plots net benefit against the threshold probability a clinician would accept, folding the relative cost of a missed case versus a false alarm into a single curve; it answers "is acting on this model better than treat-all or treat-none" across the plausible range of clinical preferences. Report calibration too: a model can rank perfectly (high AUROC) yet systematically over-predict risk, and a miscalibrated probability is dangerous the moment a clinician reads it as a real chance.

import numpy as np

def ppv_npv(sens, spec, prevalence):
    """Predictive values at a target deployment prevalence."""
    tp = prevalence * sens
    fn = prevalence * (1 - sens)
    tn = (1 - prevalence) * spec
    fp = (1 - prevalence) * (1 - spec)
    return tp / (tp + fp), tn / (tn + fn)

def net_benefit(sens, spec, prevalence, threshold):
    """Decision-curve net benefit of the model at one threshold prob."""
    tp = prevalence * sens
    fp = (1 - prevalence) * (1 - spec)
    w = threshold / (1 - threshold)          # odds of the decision threshold
    return tp - fp * w                       # per-patient net benefit

for pi in (0.50, 0.05, 0.01):
    ppv, npv = ppv_npv(0.90, 0.90, pi)
    nb = net_benefit(0.90, 0.90, pi, threshold=0.05)
    print(f"prev={pi:>4}: PPV={ppv:0.2f}  NPV={npv:0.3f}  net_benefit={nb:+0.4f}")
Predictive values and decision-curve net benefit for a fixed-quality model (Se = Sp = 0.90) as deployment prevalence falls. The PPV column is the reality check the ROC curve hides: it drops from 0.89 to 0.08 while sensitivity and specificity never move. Referenced in the metrics discussion above.

Right tool: decision curves and DeLong intervals

The hand-rolled net-benefit loop above teaches the mechanics, but for a publication you want threshold-swept curves with confidence bands and correct handling of censoring. The dcurves package produces a full decision-curve analysis, including treat-all and treat-none reference lines, in about three lines, replacing roughly 40 lines of bootstrap and plotting glue. For the paired AUROC comparison that reviewers demand (model versus clinician, or model-plus-clinician versus clinician), sklearn.metrics.roc_auc_score plus a DeLong-test implementation gives correlated-ROC confidence intervals without writing the covariance algebra by hand. The library handles the statistics; you own the study design.

Splits that mirror the real generalization gap

A validation split is a hypothesis about how the model will be challenged in the world, and the split must match the challenge. Patient-level splitting is non-negotiable: multiple ECGs from one patient sharing training and test sets leaks identity and inflates every metric, the same beat-versus-record leakage warned about in Section 29.4. Beyond that floor, three stratified splits probe three real shifts. A temporal split (train on 2018 to 2021, test on 2023) exposes drift in acquisition hardware, coding practice, and patient case-mix over time. A site or geographic split (train on hospitals A and B, test on hospital C) exposes the institution-specific confounds that make single-site AUROC a fiction. A subgroup-stratified report breaks performance down by age, sex, and device type, because an aggregate number can hide that the model fails on exactly the group the confound was correlated with; fairness auditing across such subgroups returns in force for wearables in Chapter 30. The prospective validation cohort should be defined the way a clinical trial defines its population: with pre-registered inclusion and exclusion criteria and a locked analysis plan, so you cannot fish for the split that flatters the model.

The EAGLE trial: from AUROC to a randomized outcome

The low-ejection-fraction ECG screen from Section 29.3 reached rung one with an AUROC near 0.93 on held-out records. That number, alone, changes no care. So the Mayo Clinic team climbed the ladder. They ran the EAGLE trial (Yao and colleagues, Nature Medicine 2021): a pragmatic, cluster-randomized trial across dozens of primary-care sites and thousands of clinicians. In intervention clinics the AI result surfaced in the electronic record; in control clinics it stayed hidden. The pre-registered outcome was not AUROC but the rate of new low-ejection-fraction diagnosis, and the intervention arm found significantly more genuine cases of undiagnosed cardiac dysfunction. That is the whole point of the ladder: the trial converted a discrimination statistic into evidence that clinicians, prompted by the model, diagnosed real disease they would otherwise have missed. No held-out test set could have produced that claim.

Reader studies: standalone, assistive, and the human in the loop

A cardiac model is rarely deployed alone; it is deployed alongside a clinician, so the validation must measure the human-model team, not just the model. Three designs answer different questions. A standalone study compares the model against a reference standard (an adjudicated panel, an echocardiogram, a serum result) and reports how the algorithm does by itself. A reader study compares unaided clinicians against the model on the same cases. The design that actually predicts deployment is the multi-reader, multi-case (MRMC) assistive study: the same readers interpret the same cases twice, once unaided and once with the model's output, and the analysis isolates the incremental effect of the assistance while accounting for both reader and case variability. MRMC is the design regulators expect for assistive tools precisely because it answers the deployment question: does showing the output make clinicians better, worse (via automation bias or alarm fatigue), or unchanged? An assistive tool can have a superb standalone AUROC and still harm care if clinicians defer to its false positives, which is why the human-in-the-loop measurement, not the standalone number, is the one that governs the label.

Where the field is moving

Reporting is being standardized: the TRIPOD+AI statement (2024) for prediction-model studies, DECIDE-AI (2023) for early live-clinical evaluation, and SPIRIT-AI / CONSORT-AI for AI trial protocols and reports now define what a defensible cardiac-AI validation must contain. In parallel, the rise of ECG foundation models from Section 29.5 is reshaping validation itself: a single pre-trained encoder now spawns dozens of downstream heads, so the frontier question is how to validate a shared representation whose failure modes and subgroup biases are inherited, not learned fresh, by every task built on top of it. Continuous post-market surveillance of a live model's calibration, rather than one-time approval, is becoming the expected standard.

Exercise

You have a frozen AFib-detection model with sensitivity 0.95 and specificity 0.92, validated on an enriched dataset at 40% prevalence. It will be deployed for opportunistic screening in a general-practice population where true AFib prevalence is 2%. (a) Compute the deployed PPV and the number of false alarms per 1000 patients screened. (b) Sketch which rung of the validation ladder your enriched study reached, and design the next rung: state the split, the population definition, and the primary endpoint you would pre-register. (c) Explain why reporting only sensitivity and specificity would mislead the deploying clinic.

Self-check

  1. Why is AUROC unchanged when deployment prevalence drops, and which metric moves instead?
  2. What real-world shift does a site split probe that a random patient-level split cannot?
  3. In an MRMC assistive study, what is being estimated that a standalone AUROC study cannot estimate?

Lab 29

train an arrhythmia classifier with patient-level evaluation; probe an ECG foundation-model embedding.

Bibliography

Landmark cardiac-AI validation studies

Attia, Z. I., et al. (2019). Screening for cardiac contractile dysfunction using an artificial intelligence-enabled electrocardiogram. Nature Medicine.

The retrospective rung-one and external-validation study for the low-EF ECG screen; the AUROC that everything downstream had to justify.

Yao, X., et al. (2021). Artificial intelligence-enabled electrocardiograms for identification of patients with low ejection fraction: a pragmatic, randomized clinical trial (EAGLE). Nature Medicine.

The rung-four cluster-randomized trial that turned a discrimination statistic into a measured increase in real diagnoses; the model for how cardiac AI proves clinical value.

Perez, M. V., et al. (2019). Large-scale assessment of a smartwatch to identify atrial fibrillation (Apple Heart Study). New England Journal of Medicine.

A prospective, low-prevalence screening study whose PPV realities illustrate exactly why deployment prevalence, not enriched prevalence, must drive validation.

Metrics and study methodology

Vickers, A. J., & Elkin, E. B. (2006). Decision curve analysis: a novel method for evaluating prediction models. Medical Decision Making.

Introduces net benefit and the decision curve, the tool that folds clinical cost tradeoffs into model evaluation beyond AUROC.

Steyerberg, E. W., et al. (2010). Assessing the performance of prediction models: a framework for traditional and novel measures. Epidemiology.

The reference framework separating discrimination, calibration, and clinical usefulness; explains why a well-ranking model can still be dangerously miscalibrated.

DeLong, E. R., DeLong, D. M., & Clarke-Pearson, D. L. (1988). Comparing the areas under two or more correlated ROC curves. Biometrics.

The correlated-ROC test used to compare a model against a clinician or a model-plus-clinician team on the same cases.

Reporting standards for clinical AI

Collins, G. S., et al. (2024). TRIPOD+AI statement: updated guidance for reporting clinical prediction models that use regression or machine learning methods. BMJ.

The current checklist for what a defensible prediction-model validation report must contain, machine learning included.

Vasey, B., et al. (2022). Reporting guideline for the early-stage clinical evaluation of decision support systems driven by artificial intelligence: DECIDE-AI. Nature Medicine.

Guidance for the live, human-in-the-loop rung between silent evaluation and full trials, where automation bias and workflow effects first appear.

Liu, X., et al. (2020). Reporting guidelines for clinical trial reports for interventions involving artificial intelligence: the CONSORT-AI extension. Nature Medicine.

The trial-reporting standard for the randomized rung, defining how an AI intervention and its human-model interaction must be described.

What's Next

In Chapter 30, we leave the twelve-lead clinical ECG for the photoplethysmogram on your wrist, where the validation problems of this section get harder: prevalence is lower, signal quality is worse, and the population screened is everyone with a watch, which is where PPV, subgroup fairness, and prospective design stop being academic and start deciding whether a consumer alert helps or terrifies.