Part 08 / Topic 5 of 7
Leakage case studies
Part 3 defined leakage; here is how it looks in the wild:
| Case | What happened |
|---|---|
| Target leakage | A hospital model's best feature was "received treatment X" — recorded after diagnosis. Perfect validation, useless at admission time. |
| Time leakage | Shuffled splits on time-series: training on March rows to "predict" January. Any trend leaks backwards. Use time-ordered splits. |
| Preprocessing leakage | Scaler fitted on all rows before the split — mild, common, and exactly what Pipelines prevent. |
| Duplicate leakage | The same customer in train and test after joining tables. Deduplicate by entity, not by row. |
The all-purpose detector: a result that looks too good. The all-purpose question: would this value exist at prediction time?
🧪 Quick quiz
- Which feature is a leakage risk when predicting churn: tenure, monthly charges, or "account closed date"?
Show the answer
"Account closed date" — recorded only after the outcome, so it cannot exist at prediction time.
Done here? The practice set for Part 8 — 4 exercises with solutions — is on the part page.