Concept 05 / A misleading shortcut
Data leakage.
A model predicts whether a patient will return within 30 days. One tempting feature is recorded only after that outcome. Watch how it inflates the score—and what happens when the model is used on admission day.
Move the prediction through time
Fictional patient records; real browser-side model fitting.
01 / When do we need the answer?
Time mattersAdmissionDay 0
decision needed
decision needed
DischargeDay 4
care completed
care completed
OutcomeDay 30
return known
return known
Billing codeDay 35
late feature recorded
late feature recorded
02 / The score that fooled us
Holdout performanceAdmission-only features—
Valid comparison at decision time
Historical test with late code—
A look-ahead result
Same model, used on admission—
Late code missing → filled with zero
Historical recall—At 35% threshold
Admission recall—Same model, missing code
Late feature timeDay 35After the outcome
03 / Inspect individual patients
Select a fictional recordSelected patient——
—Historical score—
At admission—