Machine Learning Data Leakage Explainer
Data leakage occurs when a machine-learning process uses information that would not be legitimately available when future predictions are made. The model or preprocessing pipeline gains an unfair clue, so evaluation results look better than real-world performance.
Leakage can happen when the target is embedded in a feature, future events appear in historical records, duplicate subjects cross the train-test boundary, or preprocessing is fit on the full dataset before evaluation. Even a global mean or vocabulary can transfer test information.
Random splitting is not always appropriate. Time-dependent applications may require chronological splits, and repeated measurements from one person or device may need group-based separation. Feature creation must reproduce the information and timing of the production decision.
Prevention depends on end-to-end pipelines, locked evaluation sets, provenance tracking, and reviews of how every feature is computed. Suspiciously strong results should trigger leakage checks before they are celebrated or deployed.
Data leakage occurs when model training or evaluation uses information that would not be legitimately available at prediction time.
Key terms include train-test split, target leakage, future information, preprocessing, pipeline, group split, time split, duplicate and evaluation bias.
Target-derived features, future records, duplicated entities, and preprocessing fit before the split can all expose evaluation information.
Leakage may be indirect, such as a timestamp, identifier, or workflow artifact that strongly encodes the answer.
All learned preprocessing should be fit only on training data and applied to validation or test data afterward.
Splits must reflect production timing, repeated entities, and data collection so the evaluation represents the decision the model will actually face.
Explore more "Explainers"
Discover additional explainers across politics, science, business, technology, and other fields. Each explainer breaks down a complex idea into clear, everyday language—helping you better understand how major concepts, systems, and debates shape the world around us.
