Dataset shift, shortcut learning, hidden stratification, and confident mistakes
PTX-Detect scored 94% sensitivity in testing. This lesson is about why that number may not hold when the tool reaches your hospital, the surprising things models sometimes learn instead of the disease, and the habits that keep you safe when you work alongside AI. Each failure here has happened with real, published models. About 15-20 minutes.
By the end of this lesson you can:
A model learns from the images it was given. If the images at a new hospital look different, the model is working outside what it learned. This is called dataset shift. Images can differ because of the scanner brand and settings, the patients (age, illness, body size), how films are taken (upright in the department or lying flat in the ICU), and even the software that processes the image.
Remember from Lesson 1.2 that a model is only checked properly on data it never trained on. A test set from a different hospital (an "external" test) is a much tougher and more honest check than one from the same hospital.
Training rewards the model for getting the label right, and nothing else. If some feature of the image happens to go along with the label, the model will happily use it, even if it has nothing to do with the disease. This is called shortcut learning. Two real examples:
Shortcuts are hard to catch because the test score looks fine whenever the test set shares the same shortcut as the training set.
This drawing shows a portable chest X-ray that PTX-Detect flagged for pneumothorax. Click each numbered region to find out whether it is the real finding or something the model might have used as a shortcut.
Click a numbered region on the image. Some regions are the actual finding; others are clues that have nothing to do with the lung.
Portable films are taken on patients too sick to go to the X-ray department, and sicker patients have more pneumothoraces. A model can learn "PORTABLE means more likely positive" without looking at the lungs at all. This is the same kind of clue as the hospital in the Zech study.
A chest drain is the treatment for a pneumothorax. If many positive training films already had a drain in place, the model can learn "tube means pneumothorax." It then does well on patients who are already treated and poorly on the ones who still need help. See "Hidden stratification" below.
The thin white line near the top of the right lung, with no lung markings beyond it, is the visceral pleural line: the edge of the partly collapsed lung. This is what a radiologist looks for, and what we hope the model learned.
Side markers, text and the edges of the image differ between hospitals, machines and technologists. The COVID-19 models in the DeGrave study leaned on regions like these, outside the lungs, because they happened to differ between positive and negative films.
A real portable chest X-ray with a visible text marker (e.g. "PORTABLE" or "SUPINE"), to replace or sit beside the drawing.
A chest X-ray showing a pneumothorax with a chest drain in place.
PTX-Detect was trained and tested on upright chest X-rays of adult outpatients at one large hospital, using one brand of X-ray machine. For each new setting, decide whether you would expect its published performance to carry over.
Callback: go back to the model you trained in Teachable Machine in Lesson 1.2. Change the lighting, move to another room, or hold the pen at an odd angle. How quickly does it fail? That is dataset shift on your own desk.
An AI heatmap (colored overlay) on a chest X-ray, ideally one that highlights the wrong area, such as a tube or text marker. Could come from a published paper figure if its license allows.
You don't need to be a computer scientist to use AI safely. Three habits go a long way:
Answer each question to continue. Any answer is fine; read the explanation.
A fracture-detection model scores very well at the hospital where it was built. At a second hospital with a different X-ray vendor, it misses many more fractures. What is the most likely explanation?
Different machines produce images that look different to the model. Its performance was measured on images like its training data; the new images are outside that. Models don't forget once trained.
A heatmap shows a model focused on the correct area of the lung. What can you conclude?
A heatmap is a rough picture of which pixels influenced the answer. A well-placed map is reassuring but not proof. A map on a tube or text marker, however, is a red flag worth noticing.
On a rotation, the AI says a chest X-ray is normal, but you think you see a small pneumothorax. What should you do?
Disagreement is exactly when a second look matters. The AI can miss findings, especially subtle ones or in patients unlike its training data. Raise it, learn from the answer, and report the AI's error if it was wrong.
You now know what AI is, how it learns, what it learns from, how it is measured and how it fails. Module 2 covers radiology itself: how images are made, what they are to a computer, how a scan moves through the hospital and how to read the report, and Module 3 covers judging the evidence and using AI without losing your own skills.