What is data leakage and how do you prevent it?
Reveal the answer and explore the explanation.
05MediumHigh priorityWhat is data leakage and how do you prevent it?
Answer
MediumHigh priority
What is data leakage and how do you prevent it?
Answer
Use of information unavailable at prediction time or from held-out data during training.
Deeper understanding
Fit imputers, scalers, feature selectors and resampling only inside training folds. Also inspect time-dependent features, duplicates and features derived from the target. Leakage can produce impressive but misleading validation scores.
Practical example
Fit an imputer on all records before splitting and obtain overly optimistic evaluation.
Reference: Further reading ↗