Data Leakage interview question

Preprocessing & Feature EngineeringData Leakagebasic

In model training and evaluation, what does the term data leakage mean?

  1. ARows being lost or dropped in the ETL pipeline, so the model trains on fewer examples than were collected.
  2. BThe model memorizing noise in the training data, so it scores well on training rows but poorly on new data.
  3. CInformation that is unavailable at prediction time, or that comes from the test set, getting into training.
  4. DA gradual change in the input data distribution after deployment, which makes a trained model less accurate.
Show the answer and explanation

Correct answer: C, Information that is unavailable at prediction time, or that comes from the test set, getting into training.

Explanation Data Leakage

Data leakage happens when information that would not be available when the model is used for real (at prediction time), or information from the held-out test data, gets into training. The model then looks better in evaluation than it will be in production.

Why the other descriptions are different concepts:

  • Learning noise so that training scores beat test scores is overfitting; it can happen with perfectly clean splits.
  • A shift in the input distribution after deployment is data drift, a monitoring problem rather than an evaluation bug.
  • Rows dropped in an ETL job are a data quality issue; they shrink the data but do not leak future or test information.

The two classic forms are target leakage (a feature that is only known after, or because of, the outcome) and train–test contamination (test data influencing fitting, e.g. a scaler fitted on all rows).

Interview tip: the typical symptom is a validation score that looks too good to be true; the check is to ask, for every feature and preprocessing step, "would I have this at prediction time?"

Practice it as a quiz

Answer this and the other free questions with instant grading, streaks and weak-topic tracking, or unlock all 4,000 questions.

More Preprocessing & Feature Engineering questions

  1. What is a main reason to perform feature selection before training a model?
  2. A temperature sensor produced 20 readings: 17 between 48 and 52, plus 99, 100 and 101. The table shows their summary statistics. A rule that flags z > 3 using…
  3. A colleague reports a cross-validated AUC of 0.91 with this code on 200 customers and 10,000 features. As a sanity check you rerun it with randomly permuted…
  4. For an offline consumption report (not a forecasting feature), an analyst fills gaps in a building's daily energy readings. The readings were logged on…
  5. A card-fraud dataset was extracted on 30 June. A transaction's label is 1 if a chargeback had arrived by the extraction date, and chargebacks can arrive up to…