Glossary

Data Leakage

A route by which information unavailable at prediction time slips into training or evaluation and makes a result look better than it is.


The classifier appears to recognize a remarkable number of cells. Zoom in on the test images, though, and there is a familiar speck of dust. Twenty frames came from each slide, and the random split let the same slide sit on both sides of the exam.

Leakage can come from near-duplicates, a future measurement used to predict the past, an outcome embedded in an input, or preprocessing fitted using the test set. To spot it, reconstruct what the researcher would actually have known on the day the prediction was needed.

Follow a single specimen through the split

Trace one slide identifier through the split. If any of its frames entered training, the others are weak evidence about a genuinely new specimen. Split by specimen and fit scaling or other learned preprocessing on the training portion. Then see how the score changes.

If another laboratory will use the model, try holding out a whole laboratory as well. That asks whether the classifier can cope with a new microscope and preparation practice, a question even a careful within-lab split leaves open. Scikit-learn guidance on data leakage

Reference

Project documentation on leakage