What is data leakage in machine learning, and how can you spot signs of it during EDA?

Quick Overview

Asks what data leakage means in a machine learning project and how to spot warning signs of it while exploring the data. Tests understanding of prediction-time availability, train and test contamination, temporal splits, and practical checks that expose suspicious features.

What is data leakage in machine learning, and how can you spot signs of it during EDA?

Role: Data Scientist

Category: Machine Learning

Difficulty: medium

Interview Round: Other

What is "data leakage" in the context of a machine learning project, and how might you spot suspicious signs of it during the exploratory data analysis (EDA) phase? ```hint Fix the prediction moment Pin down the exact moment a prediction would be made in production, then ask for each column when its value became known. ``` ```hint Look at missingness too A field's missing values can be as revealing as its values. Compare the target rate where a field is empty with the rate where it is filled. ``` ### What a Strong Answer Covers - A definition tied to what is available at prediction time, and why leakage inflates offline metrics. - The main forms of leakage, including at least one that comes from the pipeline or the split instead of from a single column. - Concrete EDA checks that surface suspicious features, and the pattern that should raise a flag in each. - How to confirm or rule out leakage for a suspicious feature, and how to prevent it in the split and the preprocessing. ### Follow-up Questions - Your fraud model scores 0.99 AUC offline and 0.70 in production. How would you find the cause? - How would you split the data for a model that predicts a customer's next purchase, and why would a random split leak? - How can target encoding leak, and how do you compute it safely? - A strong feature is legitimately available at prediction time, but only after a delay of a few hours. How do you handle it in training?

Overview: Asks what data leakage means in a machine learning project and how to spot warning signs of it while exploring the data. Tests understanding of prediction-time availability, train and test contamination, temporal splits, and practical checks that expose suspicious features.

General logo
General
Nov 24, 2026
mediumData ScientistOtherMachine Learning
0
0

What is "data leakage" in the context of a machine learning project, and how might you spot suspicious signs of it during the exploratory data analysis (EDA) phase?

What a Strong Answer Covers Guidance

  • A definition tied to what is available at prediction time, and why leakage inflates offline metrics.
  • The main forms of leakage, including at least one that comes from the pipeline or the split instead of from a single column.
  • Concrete EDA checks that surface suspicious features, and the pattern that should raise a flag in each.
  • How to confirm or rule out leakage for a suspicious feature, and how to prevent it in the split and the preprocessing.

Follow-up Questions Guidance

  • Your fraud model scores 0.99 AUC offline and 0.70 in production. How would you find the cause?
  • How would you split the data for a model that predicts a customer's next purchase, and why would a random split leak?
  • How can target encoding leak, and how do you compute it safely?
  • A strong feature is legitimately available at prediction time, but only after a delay of a few hours. How do you handle it in training?