Verified Jobs Live
AI & Machine Learning Medium Level ~3 min read

What is data leakage, and how would you prevent it in a preprocessing pipeline?

Interactive Practice Mode
Formulate your thoughts or take notes before revealing the model solution.
Model Answer & Deep-Dive Explanation

Leakage occurs when training or evaluation uses information that would not be available at prediction time or information from the held-out data. Examples include scaling before splitting, selecting features using all labels, or using a refund status to predict an earlier fraud decision. Split first, fit transformations only on training partitions, and apply them unchanged to validation data. Keep preprocessing inside cross-validation folds. For repeated users or time-dependent records, choose group-aware or chronological splits so near-duplicate or future information does not cross the boundary.