Data Preprocessing

Cleaning and transforming raw data before training or inference.

Can these readings share a column?

A fictional equipment log contains 68 °F, 20 °C and a blank cell. Sorting the raw numbers puts 68 above 20, although the two measured temperatures are equal.

Raw recordNormalized valueStatus
68 °F20 °CConverted
20 °C20 °CAs supplied
BlankMissingNo reading

What changed during preprocessing?

Subtract 32 from the Fahrenheit value and multiply by 5/9. Keep the original unit and value for traceability. A blank reading carries different information from a measured zero. Imputation, if appropriate, needs a documented rule and a way to identify estimated values.

Two analog gauges share a tray with an empty recess.
Two readings can be converted to a common unit. A missing observation needs its own status.

Where can information leak into the pipeline?

A fixed unit conversion uses no learned statistics. An imputer or scaler fitted to the complete dataset can reveal information about held-out records. Fit those steps on training data and apply the fitted transformations to validation, test and production inputs.

Follow the idea

Data Governance · Inspect the evidence behind a missing or inconsistent value.

Feature Engineering · See how a new predictive variable is derived.

Source · Scikit-learn on consistent preprocessing and leakage

Return to Data Preprocessing in the A–Z glossary