# Leaks in Preparing the Data

A preparation step fit on the whole table before the split, a scaler, an imputer or a step that chooses columns, learns from the rows it will be tested on, which barely moved StreamBox's score for a scaler but turned a worse model into one that looked better when columns were chosen against the label, and putting every step that learns in a pipeline that cross-validation fits inside each fold closes the leak.

![Cheat sheet: Leaks in Preparing the Data](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/d2a67c7ebc6f4537b7fcdae9debce06f.webp)

- Category: Machine Learning
- Level: Freelancer
- Tags: ai, Cross-Validation, Data Leakage, Feature Selection, Pipeline (python), python, StandardScaler
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/ml-leakage-in-preprocessing-cheat-sheet
