What is data leakage?

Quick Overview

Asks what data leakage is in machine learning and how it shows up. Tests target leakage, train-test contamination from preprocessing, duplicates, time and group splits, the warning signs of a leaking feature, and how to prevent leakage with pipelines and proper validation.

What is data leakage?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

What is data leakage? ```hint Picture the prediction moment Think about the moment the model makes a real prediction in production, and list every way information from after that moment, or from the evaluation data, could reach the model during training. ``` ### What a Strong Answer Covers - A definition tied to what is known at prediction time, and why leakage inflates offline scores - Target leakage, with a concrete example of a leaking feature - Train-test contamination: preprocessing fit before the split, duplicates across splits, temporal leakage and group leakage - Warning signs that suggest leakage - Prevention: split first, fit transforms inside a pipeline, use time-based or grouped splits, check each feature's availability ### Follow-up Questions - Validation AUC is 0.99 on a problem where 0.75 would be good. How do you find the leaking feature? - Why is target encoding prone to leakage, and how do you compute it safely? - Can repeatedly tuning hyperparameters against the test set count as leakage? - In a churn model scored every Monday, how would you build features so each one uses only data available on that date?

Overview: Asks what data leakage is in machine learning and how it shows up. Tests target leakage, train-test contamination from preprocessing, duplicates, time and group splits, the warning signs of a leaking feature, and how to prevent leakage with pipelines and proper validation.

General logo
General
Nov 24, 2026
easyMachine Learning EngineerOtherMachine Learning
0
0

What is data leakage?

What a Strong Answer Covers Guidance

  • A definition tied to what is known at prediction time, and why leakage inflates offline scores
  • Target leakage, with a concrete example of a leaking feature
  • Train-test contamination: preprocessing fit before the split, duplicates across splits, temporal leakage and group leakage
  • Warning signs that suggest leakage
  • Prevention: split first, fit transforms inside a pipeline, use time-based or grouped splits, check each feature's availability

Follow-up Questions Guidance

  • Validation AUC is 0.99 on a problem where 0.75 would be good. How do you find the leaking feature?
  • Why is target encoding prone to leakage, and how do you compute it safely?
  • Can repeatedly tuning hyperparameters against the test set count as leakage?
  • In a churn model scored every Monday, how would you build features so each one uses only data available on that date?