Skip to content
Middle0 views

What is data leakage?

Practice

AI answer

Data leakage in machine learning is when information that would be unavailable in real-world use—or that effectively reveals the target variable—gets into model training or tuning. As a result, evaluation metrics appear inflated, while performance in production is worse. Examples: normalizing the entire dataset before splitting it into subsets; using a feature created after the event being predicted; duplicates of the same entity in both train and test; tuning hyperparameters using the test set. Prevention: split data correctly, especially by time and entity; fit transformations only on train; build features with the prediction time in mind; reserve test for the final evaluation.