Part 5: AI, ethics and leadership

15 Machine learning in health

Why does a model that worked there fail here?

About 60 minutesPending final reviewLast checked 2026-11-30

In plain language

  • A prediction model learns the patterns of the hospital, the patients and the years it was trained on. When any of those change, its numbers can quietly become wrong.
  • Ranking patients well (discrimination) and giving the right percentages (calibration) are different things. A model needs both, checked on local patients, before anyone acts on its scores.
  • A model can be unfair without using any sensitive variable, because other data, especially missing data, can stand in for it. Check performance group by group, before and after go-live.

The core sections below build on these ideas. Sections marked "Going deeper" are optional and go further.

Why this matters for you

What it means for each role
Students
Most health AI headlines are about accuracy somewhere else. This module gives you the questions that decide whether a model works here.
Physicians and residents
You will be shown risk scores at the bedside. Knowing how they fail lets you weigh them, and spot when one has drifted.
Nurses and allied health
Deterioration and follow-up lists are often built from model scores, and you do the work they create. Calibration decides how much of that work is useful.
Researchers and analysts
Leakage, shift and miscalibration are the usual reasons a published model disappoints. Recalibration and subgroup checks are part of the job, not extras.
IT and administration
Buying a model is the start of a monitoring commitment. This module gives you the checks to ask for before go-live, and the ones to keep running after it.

A number at discharge

At 15:00 on Day 1, as Mira’s discharge is signed, a readmission model gives her a score of 0.31: a 31% chance, it says, that she will be back in hospital within 30 days. The model was bought from a vendor and trained at a hospital abroad. Above 25%, the rule says, the follow-up team should phone her within a week.

Is 31% true for Mira? The honest answer is that nobody at MENA Academic Hospital knows yet. The score is a fact about the patients the model learned from. Whether it is a fact about Mira depends on how much this hospital, its patients and this year resemble that one. This module is about how to find out, and what to do when they differ.

How a prediction model is made

A clinical prediction model is built in steps, and each step bakes in assumptions.

  1. Data. Records from one or more hospitals, over a period of time. Whatever those records miss, the model never sees.
  2. Label. The outcome the model predicts, such as “readmitted to this hospital within 30 days”. The definition matters: readmissions to other hospitals are invisible if only this hospital’s records are used. In the Gulf, many patients are expatriates who may leave the country after discharge, and a patient who dies cannot be readmitted, so “not readmitted” does not always mean “did well”.
  3. Features. The inputs: age, diagnoses, lab results, number of past visits. Many are records of what the health system did, not direct measures of the patient’s body.
  4. Training and validation. The model learns from part of the data and is tested on the rest, ideally also on data from another site or a later year.
  5. Deployment. The score appears in a workflow, with a threshold that triggers an action, such as a phone call.
  6. Monitoring. Someone checks, month after month, that the model still works and still helps.

Most failures you will read about happen at steps 2, 3 and 6, not in the mathematics of step 4. Most published scores use logistic regression, a classic statistical method that gives each input a weight. Newer machine-learning methods, such as gradient-boosted trees (many small decision trees combined) and neural networks, can find subtler patterns. On typical structured EHR data the gain is often small, and the failure modes below apply to all of them.

Ranking is not the same as being right

Module 12 measured a model by its discrimination: how well it ranks sick patients above well ones, summarised by the AUC. That is half the story. Calibration asks whether the percentages are right: of all the patients given 30%, do about 30% go on to have the outcome?

A calibration plot answers that. Patients are grouped by predicted risk, and each group’s average prediction is plotted against what actually happened. A well-calibrated model sits on the diagonal. Points below the diagonal mean the model overestimates risk; points above it mean it underestimates.

A model can rank perfectly and still be badly miscalibrated. Suppose it doubles everyone’s true risk: the order of patients is unchanged, so the AUC is unchanged, but every percentage is wrong, and any threshold set in percentages now flags the wrong number of people. Calibration matters whenever a score is shown to a clinician or patient as a probability, or used with a fixed threshold, which is most of the time.

When a model is miscalibrated, two corrections are common. One moves every score up or down by the same amount, fixing the average (the intercept). The other stretches or squeezes the scores, so the highest and lowest move most (the slope).

Going deeper Two numbers that summarise calibration

Observed ÷ expected (O/E) compares the number of outcomes that happened with the number the model predicted. 1.0 is right on average; 0.5 means the model predicted twice as many as occurred. The calibration slope comes from fitting the outcomes against the model’s own scores. A slope below 1 means predictions are too extreme (too high for high-risk patients, too low for low-risk ones), a common sign that a model was overfitted or moved to a less varied population. Van Calster and colleagues call calibration “the Achilles heel of predictive analytics” because it is reported so rarely.

Why models fail somewhere else, or later

A model that worked where it was built can fail in a new place or a new year for several distinct reasons. Naming the reason tells you what to fix.

  • Different patients (population shift). The case mix differs: younger expatriate workers, fewer frail elderly people, a different mix of diseases. Readmission rates in particular depend heavily on the health system around the hospital, which is one reason published readmission models discriminate only modestly even where they were built.
  • Different measurement or practice. A lab changes its assay, a ward starts a new note template, or a hospital orders some test far more often. The model’s inputs mean something different. A deep-learning model for pneumonia, trained on chest X-rays from two US hospital systems, learned to recognise which hospital an image came from. At one of them patients were sicker, so “this hospital” itself predicted pneumonia. Tested on a third system’s images, it did worse in three of five comparisons.
  • A different outcome (label shift). The outcome is defined or recorded differently: readmission to any hospital rather than this one, or a sepsis definition that differs from the vendor’s.
  • Time. Practice, populations and coding change. Kidney injury models built on years of US veterans’ data drifted out of calibration over time, even though the hospitals were the same. In spring 2020, COVID-19 changed who was in hospital almost overnight: across 24 US hospitals, a widely used sepsis model fired about 43% more alerts even though there were fewer patients in hospital.

Most published audits like these come from the US, where large EHR datasets are easiest to study. Few have been published from the Gulf, Africa or South Asia. That is a reason to check locally, not to assume a model transfers.

Two traps are built in before the model ever leaves the lab:

  • Label leakage. An input secretly encodes the answer, often because it records what a clinician already suspected: a blood culture order, a consult request, a note that says “sepsis?”. The model looks superb in testing and adds nothing at the bedside.
  • Feedback loops. Once a model triggers an action, the action changes the outcomes. If flagged patients get a follow-up call and come back less often, a model retrained on that data learns that patients like them are low risk. A model can become a victim of its own success.
Quick check A readmission model was trained on discharges from 2019 to 2022. In 2025 a new heart-failure clinic opens, and readmissions for heart failure fall by a third. What happens to the model's heart-failure predictions?

Choose an answer, then check it.

Lab: a model meets a new hospital

The lab uses 4,000 synthetic discharges from MENA Academic Hospital and the vendor’s readmission model, the one that gave Mira 0.31. You will predict what the calibration plot shows, choose how to update the model, and then check it for two groups of patients.

Your task

A pilot nurse at MENA Academic Hospital can phone about 25 patients a month after discharge, roughly 300 a year. A vendor offers a 30-day readmission model built at a hospital abroad, where 18% of patients were readmitted. Its recommended rule: call everyone scored 25% or more. Before anyone switches it on, you have 4,000 discharges from last year here, with what actually happened to each patient. Here, 9.3% were readmitted.

A. Predict before you look

The model's AUC here is 0.75, close to the 0.76 the vendor reported. That is good for a readmission model: many published ones sit nearer 0.7. A calibration plot puts patients into ten groups by predicted risk and compares each group's predicted rate with its observed rate. What will it show?

Notice what changed and what did not. Recalibrating moved every score, and Mira’s along with them, but did not change the order of patients, so the AUC stayed the same. The threshold, chosen by the vendor for their patients, flagged far more people than the nurse could phone before recalibration, and fewer than the nurse could phone afterwards, while Mira, at 15%, would no longer be called. Should a 57-year-old with new atrial fibrillation and a new anticoagulant get a call anyway? A threshold is a decision about workload and benefit for this hospital, and it has to be made here, with the people who will do the calls and the clinicians who know which patients worry them.

Going deeper Recalibrate, update or retrain?

Updating a model comes in increasing steps. Recalibration in the large shifts every score by the same amount, so the average matches local outcomes. Logistic recalibration also corrects the slope. Model revision re-estimates some of the model’s weights, or adds a local variable. Retraining builds a new model from local data. Each step needs more local data and validation than the one before, and a retrained model is in effect a new model that needs its own validation. A useful rule is to start with the smallest update that fixes the problem, fit it on one period, and confirm it on a later period of local patients that it has not seen.

Fair to whom?

The lab’s subgroup check found the model under-predicting for patients on basic insurance plans, although it has no insurance variable. Bias entered through a feature that measures the health system’s view of the patient, not the patient: visits recorded at this hospital. Patients who use cheaper clinics elsewhere look healthier than they are.

The best-known example is a US algorithm used to choose patients for extra care management. It predicted future health-care costs as a stand-in for health needs. Because less money had historically been spent on Black patients with the same level of illness, Black patients had to be considerably sicker than white patients to reach the same score. The researchers calculated that if patients were selected on health need instead, the share of Black patients selected for extra help would rise from 17.7% to 46.5%. Training the model on a label that measured health rather than cost removed most of the bias.

Three lessons follow. First, leaving a sensitive variable out does not make a model fair, because postcode, insurance, language, nationality and gaps in the record can stand in for it. Second, the label is a choice, and a convenient label such as cost or “seen at this hospital” can carry the system’s inequities straight into the model. Third, fairness has to be measured, group by group, on calibration and on error rates, before go-live and afterwards. In the Gulf, the groups that matter may be defined by nationality, insurance tier (such as Dubai’s Essential Benefits Plan for lower-paid workers), language, or occupation and visa category, and the data to check them must be collected with care for privacy (Module 16).

Quick check A model that prioritises patients for diabetes education is trained to predict 'number of clinic visits next year'. Who is most likely to be under-prioritised?

Choose an answer, then check it.

Generative AI in the record

Large language models now draft notes, summarise records and answer clinicians’ questions. In ambient scribe systems, a phone or microphone records the consultation, and the model drafts the clinical note for the clinician to edit and sign. Early large deployments report less time spent on documentation and positive feedback from clinicians and patients.

The risks are different in kind from those of a risk score. A generative model produces fluent text that can omit a finding that was discussed, add one that was not, or attribute a statement to the wrong person, and errors in fluent prose are easy to miss. Performance can differ by accent, by language and by switching between languages in one consultation, which is common in Gulf clinics where Arabic (in several dialects), English, Hindi, Urdu, Malayalam and Tagalog may all be spoken in one day. Recording consultations also creates new sensitive data that must be governed: where the audio is processed, how soon it is deleted, and whether the vendor may use it to train its models.

Hospitals that use these tools well keep a few rules:

  • the clinician who signs is responsible for the note;
  • patients are told, and can decline;
  • the tool is tested on local languages and specialties before go-live;
  • a sample of drafts is audited for errors, by language and specialty;
  • how much clinicians edit each draft is tracked, since a sudden fall can mean they have stopped reading;
  • the tool’s performance is monitored like any other model’s.

The WHO’s 2024 guidance on large multi-modal models sets out similar expectations for governments and developers.

Quick check An ED's scribe drafts 'denies chest pain' for an Urdu-speaking patient who described chest pain. Audits find the same error in other Urdu consultations. Which safeguard would have caught this pattern?

Choose an answer, then check it.

Who checks the model?

Responsibility for a model does not end with its purchase. A good governance process asks, before go-live: what was it trained on, how was it validated, and how does it perform on our patients, overall and by group? It sets a threshold with the people who will act on it. It writes down the model’s intended use and limits, for example as a one-page “model facts” label. And it names an owner who will monitor the model after go-live. Monitoring usually includes:

  • a silent period, when the model scores real patients but nobody acts on the scores, to check its performance locally first;
  • the inputs: how often each is missing, and whether labs, templates or codes have changed;
  • calibration, alert volume and subgroup performance, month by month, with agreed triggers for an update or a switch-off;
  • notice from the vendor before any change to the model, and from local teams before any change to the data it uses;
  • an impact evaluation: did the calls actually reduce readmissions, or only create work? Reporting standards such as TRIPOD+AI describe what a validation study should report.

Regulators are building rules for AI, at different speeds and with different scopes. The panel below compares a few.

How this works in… Rules for AI in healthcare

Compare how these places govern AI used in health care.

Compare 6 more

Think it through: If your hospital bought the readmission model in the lab, which body would you need to satisfy, and would anyone require you to check its calibration on your own patients?

From the Failure Museum: the model that learned the wrong label

The US cost-based care management algorithm was used to manage the care of millions of people. It was accurate at what it was trained to do: predict cost. The failure was in the choice of label. Spending reflects access to care as well as illness, so the model learned to direct extra help away from the patients who had historically received less of it. The bias was found only because researchers could see the algorithm’s inputs, scores and patients’ later health side by side.

Lesson: before asking whether a model is accurate, ask what exactly it is accurate about. Then check whether that target means the same thing for every group of patients it will be used on.

Check your understanding

Answer every question, then check. Each answer comes with an explanation. Score 80% or more to mark the module complete. Your progress is saved only in this browser.

1. A deterioration model at a Riyadh hospital ranks patients well (AUC 0.80), but its predicted risks average 12% while only 6% of patients deteriorate. What is the best next step?
2. A Nairobi team builds a sepsis model with an AUC of 0.95. Its strongest input is 'blood culture ordered in the last hour'. Why should this worry them?
3. A hospital phones every patient its readmission model flags, and readmissions among flagged patients fall. A year later the model is retrained on the new data. What is the risk?
4. A model for an Indian hospital network does not use income or caste. A reviewer still asks for its performance for patients covered by PM-JAY (Ayushman Bharat) compared with private insurance, and for rural compared with urban districts. Why is that reasonable?
5. A hospital lab in Casablanca changes its creatinine method, and results now run about 5% lower. A kidney injury model starts missing cases. Which kind of shift is this?
6. An emergency department adopts an AI scribe that drafts notes from the consultation audio. Which safeguard matters most?
7. A Jeddah hospital builds a model to predict 'admitted to the ICU' so it can find ward patients who need ICU-level care. ICU beds are often full, so many very sick patients stay on the wards. Where in the model's life cycle is the main problem?

0 of 7 answered

Sources

  1. Van Calster B, McLernon DJ, van Smeden M, Wynants L, Steyerberg EW. Calibration: the Achilles heel of predictive analytics. BMC Med. 2019;17:230.
  2. Finlayson SG, Subbaswamy A, Singh K, et al. The clinician and dataset shift in artificial intelligence [letter]. N Engl J Med. 2021;385(3):283-286.
  3. Zech JR, Badgeley MA, Liu M, et al. Variable generalization performance of a deep learning model to detect pneumonia in chest radiographs: a cross-sectional study. PLoS Med. 2018;15(11):e1002683.
  4. Obermeyer Z, Powers B, Vogeli C, Mullainathan S. Dissecting racial bias in an algorithm used to manage the health of populations. Science. 2019;366(6464):447-453.
  5. Davis SE, Lasko TA, Chen G, Siew ED, Matheny ME. Calibration drift in regression and machine learning models for acute kidney injury. J Am Med Inform Assoc. 2017;24(6):1052-1061.
  6. Lenert MC, Matheny ME, Walsh CG. Prognostic models will be victims of their own success, unless… J Am Med Inform Assoc. 2019;26(12):1645-1650.
  7. Kansagara D, Englander H, Salanitro A, et al. Risk prediction models for hospital readmission: a systematic review. JAMA. 2011;306(15):1688-1698.
  8. Sendak MP, Gao M, Brajer N, Balu S. Presenting machine learning model information to clinical end users with model facts labels. NPJ Digit Med. 2020;3:41.
  9. Collins GS, Moons KGM, Dhiman P, et al. TRIPOD+AI statement: updated guidance for reporting clinical prediction models that use regression or machine learning methods. BMJ. 2024;385:e078378.
  10. World Health Organization. Ethics and governance of artificial intelligence for health: guidance on large multi-modal models. 2024.
  11. Tierney AA, et al. Ambient artificial intelligence scribes to alleviate the burden of clinical documentation. NEJM Catal Innov Care Deliv. 2024;5(3).
  12. Wong A, et al. Quantification of sepsis model alerts in 24 US hospitals before and during the COVID-19 pandemic. JAMA Netw Open. 2021;4(11):e2135286.