Data Cleaning Exercises

Guide · updated 2026-11-04

Avoiding leakage in data preparation

Fitting cleaning statistics on training data only, and other leakage traps.

What leaks

Medians, means, category lists or scaling learned from all rows include test information. So do features computed from the future relative to the prediction date.

Fit, then apply

Learn statistics on the training rows, store them, and apply the stored values to test and new data.

Check the timeline

For every feature, ask whether it was known at prediction time.

Practise it