Data science: numbers you can act on

Lesson 2 of 3

Leakage and broken pipelines

8 min

A feature leaks when it would not exist at the moment you must decide. “Cancellation reason” is filled in after the customer cancels. A model that uses it looks brilliant in a notebook and has nothing to read in production.

Leakage contaminates training. The model memorizes a shortcut that contains the label. Metrics on that same data look strong and then collapse on a true future week.

If click-through drops the day a pipeline ships and the model file did not change, look at the data first: null rates, join keys, units, and whether a feature suddenly shifted. Retraining a new architecture before that check hides the bug inside a new model.

Example

A training table joins “refund issued” onto the session that you are trying to score before purchase. Refunds happen later. The model learns “refunded sessions do not convert,” which you cannot know in time. Drop the column before the train split.

Practice

What do you call a feature that contains the outcome, and which split does it contaminate?