QUESTION 5 OF 15

What is data leakage and how do you prevent it?

Reveal the answer and explore the explanation.

05
MediumHigh priority

What is data leakage and how do you prevent it?

Answer
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 ↗

Last 30 min revisionHigh-yield interview Q&As