What is target leakage in the context of feature engineering?

Quick Overview

Asks what target leakage is in feature engineering, with examples of features that would not exist at prediction time. Tests how it differs from train/test contamination, the symptoms that reveal it, and prevention through point-in-time features and out-of-fold target encoding.

What is target leakage in the context of feature engineering?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

What is target leakage in the context of feature engineering? Explain how it happens, how you would notice it, and how you would prevent it. ```hint Think about timing For each feature, ask when its value is set relative to the moment the model has to make its prediction. ``` ### What a Strong Answer Covers - A definition tied to what is available at the moment a real prediction is made - At least one concrete example of a leaking feature and why it leaks - How target leakage differs from train/test contamination, and why a clean split does not catch it - Symptoms that suggest leakage, and ways to prevent it ### Follow-up Questions - How would you find a leaking feature in an existing model with 300 features? - How does out-of-fold target encoding work, and why does it reduce leakage? - A feature is known at prediction time and is very strongly correlated with the target. Is that leakage?

Overview: Asks what target leakage is in feature engineering, with examples of features that would not exist at prediction time. Tests how it differs from train/test contamination, the symptoms that reveal it, and prevention through point-in-time features and out-of-fold target encoding.

Nov 25, 2026
easyMachine Learning EngineerOtherMachine Learning
0
0

What is target leakage in the context of feature engineering? Explain how it happens, how you would notice it, and how you would prevent it.

What a Strong Answer Covers Guidance

  • A definition tied to what is available at the moment a real prediction is made
  • At least one concrete example of a leaking feature and why it leaks
  • How target leakage differs from train/test contamination, and why a clean split does not catch it
  • Symptoms that suggest leakage, and ways to prevent it

Follow-up Questions Guidance

  • How would you find a leaking feature in an existing model with 300 features?
  • How does out-of-fold target encoding work, and why does it reduce leakage?
  • A feature is known at prediction time and is very strongly correlated with the target. Is that leakage?