liveBook · Manning

Data leakage

As explained in Delivering Machine Learning Projects: From design to deployment

Data leakage is the unintended use or transfer of information from evaluation data or future observations into model training or selection, causing misleadingly optimistic performance estimates.

Data leakage occurs when evaluation information, especially test or validation data, enters training or model-selection decisions. The resulting performance estimate is optimistically biased and may fail in production. section 7.4.1

Control leakage through explicit modeling and testing work:

  • Keep test information out of training and avoid repeatedly optimizing against validation quirks. section 7.4.1
  • Inspect training and validation choices for time travel, especially when future observations can signal outcomes in evaluation data. section 7.4.1
  • Create a testing ticket that defines test-data creation and the controls used to prevent leaks in a reproducible test environment. section 8.2
  • Treat unexpectedly strong results as a model smell: check pipeline bugs, toolkit issues, configuration mistakes, and overfitting before productionization. section 7.5

A hot-summer validation split

A smart-building model uses data from a hot summer for validation, while the test set comes from the same summer. The model appears accurate because the split shares a seasonal signal that will not recur in production. section 7.4.1

Structured experiments, records, and automated testing make leakage easier to detect and enable fast reruns after pipeline or configuration defects are fixed. Multi-armed-bandit testing offers an alternative that is described as resistant to information leakage, though it does not quantify how much better one model is. section 7.5 section 8.2.6

Figure 8.2 Three one-arm bandits with pay-out records, where each block represents one pull. A light record indicates a zero reward, and a dark one indicates a positive reward. Machine A pays frequently, Machine B pays occasionally, and Machine C never pays.

Compare competing machines by observed reward records: the visual supports the bandit-based alternative to repeatedly optimizing against a fixed evaluation set. section 8.2.6

How Delivering Machine Learning Projects: From design to deployment covers it

How deep it goes
Explains leakage mechanisms, time-series split risks, detection checks, and testing controls, but stops short of algorithmic detail.
Examples
Uses repeated validation optimization, a hot-summer smart-building split, pipeline defects, and bandit reward records as concrete illustrations.
What it assumes
Assumes familiarity with model training, validation, testing, and production evaluation while clarifying leakage from those processes.
What you can do after
Diagnose leakage with controlled data splits, reproducible tests, pipeline checks, and cautious investigation of unusually strong results.
How it connects
Connects data leakage to model evaluation, validation data, test data, overfitting, time series prediction, and multi-armed bandits.

Also explained in

Compare how 9 books explain data leakage →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Delivering Machine Learning Projects: From design to deployment. The section links point to the parts of the book it draws on.