Skip to the calibration & thresholds demo

Medical AI lab · Calibration & thresholds ·

Calibration and decision thresholds: interactive demo

Two models with the same AUC can flag very different numbers of patients, because AUC measures ranking and says nothing about whether the predicted risks are right. In this demo both models have an AUC of 0.845 at a 10% treatment threshold: the calibrated one flags 301 of every 1,000 patients and misses 23 cases, while the miscalibrated one flags 918 and its net benefit falls from 52.6 to 8.8 per 1,000. Calibration and net benefit, not AUC alone, decide whether a threshold is usable.

In one line: At the same AUC of 0.845 and the same 10% threshold, a calibrated model flags 301 of every 1,000 patients and a miscalibrated one flags 918.

SYNTHETIC DATA

These demos are illustrative. Every signal, image, patient and note is synthetic and fictional, generated and scored in your browser, and every number shown is computed from that synthetic data. They show general principles, not the performance of any real model, product or project, and none of them is a medical device.

Nothing is uploaded. No patient data is used.

03

Clinical model validation / calibration

Same ranking. Different usefulness.

What this shows: a model that ranks patients just as well (same AUC) can still give wrong risks, flag the wrong number of people and deliver less net benefit, especially at a hospital where the disease is more or less common.

Set the decision

The model was developed where 10% of patients had the outcome. Move the prevalence to deploy it somewhere else.

Calibration and decision curve

4,000 synthetic patients
Calibration: predicted vs observed, 10 risk groups
Calibration plotPredicted against observed risk.
Decision curve: net benefit vs threshold
Decision curveNet benefit of the model, treat all and treat none.

Blue: modelAmber: treat everyoneGrey: treat no oneWhite dashed: perfect calibration, threshold

AUC—
Mean risk: predicted / observed—
Net benefit per 1,000—
Missed cases per 1,000—
False alarms per 1,000—
Flagged per 1,000—

Synthetic data · illustrative · not a medical device

Where this matters

Risk scores that trigger an action: a test, a referral, a treatment. Discrimination alone does not show whether the threshold makes sense, and a model moved to a new population usually needs its calibration checked again.

What this experiment models

4,000 synthetic patients with a risk score. True risk is the logistic function of the score plus an intercept set by the prevalence slider. The model is the same logistic function with the intercept that fits 10% prevalence; the miscalibrated variant multiplies its log-odds by 0.6 and adds 1, so most patients get too high a risk and the highest-risk patients too low a one. Outcomes are expected values, not random draws, so the numbers do not jitter. Net benefit follows decision-curve analysis: true positives minus false positives weighted by the threshold odds, t / (1 − t), per patient.

The principle

How it works

The 4,000 synthetic patients each have a risk score, and their true risk follows from it. The model was developed where 10% of patients had the outcome, and there it is perfectly calibrated. Move the prevalence slider and the same model is deployed in a hospital with more or less disease: the ranking barely changes, but every predicted risk is now too low or too high. The miscalibrated toggle compresses and shifts the model’s risks; it is a monotone change, so the AUC stays exactly the same.

The threshold turns risks into decisions. Every patient at or above it is treated or referred, which sets the missed cases and false alarms. Decision-curve analysis weighs the two using the threshold itself: choosing 10% means one case found is worth nine unnecessary treatments. Net benefit is the true-positive rate minus the false-positive rate times t / (1 − t), compared with treating everyone and treating no one.

That is why a clinical reviewer asks for calibration and clinical usefulness, not only discrimination, and asks again when the model moves to a new population. See clinical model validation.

Worked example

A referral threshold on a model that was judged by AUC alone

Picture a team with a risk model whose AUC is about 0.85. They plan to refer every patient whose predicted risk is 10% or higher, and the validation report so far contains the AUC and nothing else.

The demo’s default settings show the case where that works: 4,000 synthetic patients, 10% of them with the outcome, a 10% threshold and a well-calibrated model. The AUC is 0.845, and mean predicted risk and observed rate are both 10%. For every 1,000 patients the model flags 301, of whom 223 are false alarms, and misses 23 cases. Net benefit is 52.6 per 1,000, and the demo’s verdict is that the model gives more net benefit than treating everyone or no one.

Now tick the miscalibrated model and leave both sliders alone. The AUC is still 0.845, because the ranking of patients has not changed. But the mean predicted risk is 33% against an observed 10%, and at the same 10% threshold the model flags 918 of every 1,000 patients, 818 of them false alarms. It misses 0 cases only because it refers almost everyone, and net benefit falls to 8.8 per 1,000. The threshold no longer means what the team thinks it means, and the AUC gave no warning.

Untick the box and move prevalence to 20% instead, as if the well-calibrated model were deployed where the outcome is twice as common. The AUC is 0.835, mean predicted risk stays at 10% against an observed 20%, and missed cases rise from 23 to 60 per 1,000. Every risk is now too low.

The correct practice is to report calibration next to discrimination: a calibration plot and the mean predicted risk against the observed rate. Choose the threshold from the clinical trade-off between a missed case and an unnecessary referral, state the errors per 1,000 patients at that threshold, and compare net benefit with treating everyone and no one. Check calibration again in each new population, and if the model is recalibrated, validate the updated model.

Checklist

What to check in your own project

  • Does the validation report include a calibration plot and the mean predicted risk against the observed rate?
  • Was the threshold chosen from a stated trade-off between missed cases and unnecessary treatment, before the test results were seen?
  • Are missed cases, false alarms and patients flagged given per 1,000 patients at that threshold, and can the service handle the number flagged?
  • Is net benefit compared with treating everyone and treating no one over the range of thresholds clinicians would consider?
  • Is the prevalence in the target population close to the development data, and has calibration been checked there?
  • If the model was recalibrated, was the updated model validated on data not used for the update?

Related: our clinical model validation service, the wiki page on medical AI validation, and the demos on patient-level data leakage and heart rate from a noisy ECG.

FAQ

Common questions

Why do two models with the same AUC flag different numbers of patients?

AUC depends only on how the model ranks patients, so any monotone change to the predicted risks leaves it unchanged while moving patients across the threshold. In the demo both models have an AUC of 0.845, but at a 10% threshold the calibrated one flags 301 of every 1,000 patients and the miscalibrated one flags 918. A threshold only means what it says when the model is calibrated.

How do I check whether a clinical risk model is calibrated?

Plot predicted risk against the observed outcome rate in risk groups, and compare the mean predicted risk with the overall observed rate. In the demo the calibrated model reads 10% predicted against 10% observed, and the miscalibrated one 33% against 10%. Repeat the check in each population where the model is used, because a change in prevalence breaks calibration.

What happens to a risk model when disease prevalence changes?

The ranking usually survives, but every predicted risk becomes too low or too high. In the demo moving prevalence from 10% to 20% leaves the AUC at 0.835 while mean predicted risk stays at 10% against an observed 20%, and missed cases rise from 23 to 60 per 1,000 at the same threshold.

What is model calibration?

Calibration is the agreement between predicted risks and observed outcomes: of patients given a 20% risk, about 20% should have the outcome. It is assessed with a calibration plot, by comparing the mean predicted risk with the observed rate, and with the calibration slope.

Can a model have a high AUC and still be poorly calibrated?

Yes. AUC depends only on how patients are ranked, so any change to the risks that keeps their order leaves it untouched. In this demo the well-calibrated and the miscalibrated model both have an AUC of 0.845, but the miscalibrated one predicts a mean risk of 33% where the observed rate is 10%.

How do I choose a decision threshold for a clinical risk model?

Start from the consequences, not from a default of 50% or from maximum accuracy. A threshold of t means that finding one true case is judged worth (1 − t) / t unnecessary treatments; at 10% that is nine. Then check the missed cases, false alarms and workload at that threshold, and whether the model’s net benefit beats treating everyone and treating no one.

What is net benefit in decision curve analysis?

Net benefit is the proportion of true positives minus the proportion of false positives weighted by the threshold odds, t / (1 − t). A decision curve plots it over a range of thresholds for the model, for treating everyone and for treating no one. The model is useful at the thresholds where its net benefit is the highest of the three.

Medical AI lab

More demos

01 / Heart rate from ECGHeart rate from a noisy ECG – interactive demoMissed and false beats behind a correct average02 / Patient leakagePatient-level data leakage – interactive demoRecord-level vs patient-level train/test splits04 / Scanner shiftScanner shift in medical imaging – interactive demoSegmentation tuned on one scanner, tested on another05 / Dice vs clinical errorDice score vs clinical error – interactive demoDice, HD95 and lesions detected06 / Note de-identificationDe-identifying a clinical note – interactive demoEnglish, Hebrew and mixed notes vs a rule-based detector07 / Nodule volume 3DNodule volume and CT slice thickness – 3D interactive demoThe same nodule, measured on thin and thick slices08 / Sample sizeSample size for validating a clinical AI model – interactive demoHow wide the interval is around a measured sensitivity09 / SubgroupsHidden subgroup failure in clinical AI – interactive demoA good overall score next to a weak subgroup10 / Slice-by-slice 3DSlice-by-slice segmentation of a 3D lesion – 3D interactive demoA high per-slice Dice and a lesion reported in pieces11 / Predictive value 3DPositive predictive value and prevalence – 3D interactive demoWhat a positive result means when the condition is rare12 / Shortcut learningShortcut learning in medical imaging AI – interactive demoA model that reads the hospital tag, not the disease13 / DriftModel drift and performance monitoring – interactive demoHow late a monitoring rule notices a slow decline14 / Alert burdenAlert burden of a clinical early-warning model – interactive demoA threshold counted in alerts per nurse per shift

MLAIA DATA SCIENCE

Tell us what
you’re working on.

Share the problem, the data you have and what success would look like. We’ll discuss a practical next step.

Please don’t include confidential datasets, credentials or patient information.

yochai@mlaia.com
WhatsApp: +972 52 484 6282

Your inquiry is handled under our Privacy Policy.