MA
DOCUMENT

Machine Learning Data Preprocessing Cheat Sheet

A machine learning preprocessing reference for missing values, outliers, scaling, encoding, feature selection, data splits and leakage prevention.

Version 2026-08-03通用Public reference material; verify the included notice and project terms before redistribution

What this reference covers

This preprocessing reference follows raw fields into model-ready features. It covers missing values, outliers, numeric scaling, categorical encoding, feature selection, dimensionality reduction, data splitting and reproducible preprocessing pipelines.

Preserve the prediction boundary

Record field meaning, prediction time, missing-value semantics, ranges, duplicates and future information before choosing a rule. Estimate imputation, scaling, encoding, reduction and selection parameters from training data only, then apply the learned rule to validation, test and inference data.

Treat categories and scales as contracts

Choose an encoding or scaling method based on model behavior and field meaning. Preserve units, category mappings and an explicit unseen-category strategy. Compare row count, column count, ranges, missingness and feature order after every transformation.

Maintenance note

Removing outliers or filling missing values can change the study population. Keep original fields, preprocessing version and logs, and apply access controls when data contains personal, financial or health information. Content review date: 2026-08-23.

SAVE TO CLOUD

Save to your cloud drive

Save the complete collection first so files remain together and are easier to access across devices.

Links checked 2026-08-06
Save first, access when you need itOn desktop, scan with the matching cloud-drive app. On mobile, tap the save button.
GUIDE

Machine learning preprocessing study guide

Inventory field semantics and the prediction time first, fit rules within the training boundary, then reuse and validate the same pipeline elsewhere.

Before you start

  • Prepare a PDF reader and define target, prediction time and feature types.
  • Design train, validation and test splits before fitting preprocessing parameters.
  • List missing-value, unit, category and unseen-category policies.
02

Quick start

  1. 01

    Inventory fields and missingness

    Classify numeric, categorical, text, date and identifier fields, then inspect missing values, ranges, duplicates and post-outcome information.

  2. 02

    Fit rules on training data

    Estimate imputation, scaling, encoding, reduction and feature selection only from training data to avoid validation or test leakage.

  3. 03

    Handle categories and scale

    Choose transformations that match the model and field meaning, and record units, mappings and behavior for unseen categories.

  4. 04

    Reuse and validate

    Apply the training rules to every other split and check rows, columns, ranges, missingness, feature order and dropped or added fields.

Usage tips

  • Document the business reason for outlier treatment instead of deleting records only to improve a metric.
  • Split time-dependent data chronologically rather than allowing future records into training.
  • Preserve original fields and version the preprocessing pipeline for offline and production comparison.
Troubleshooting and uninstall

Why is the test metric unexpectedly high after preprocessing?

Check whether imputation, scaling, encoding or selection was fitted on all data, and look for fields created after the prediction time.

What should happen when production has a new category?

Define an unseen-category policy such as an other bucket or monitored missing state, and keep mapping versions consistent.

FAQ

Frequently asked questions

What is the key preprocessing principle?

Fit rules inside the training boundary and apply the same learned rules to validation, test and inference data.

Should missing values be deleted or imputed?

Choose based on missingness mechanism, field meaning, sample size and model needs, and record the rule and any missingness indicator.

Which models care most about feature scaling?

Distance, gradient and regularized models are often more scale-sensitive, while tree models are less so; the inference pipeline still needs consistent semantics.

How can a transformation be checked?

Compare columns, types, units, ranges, category mappings and missing counts before and after, and hand-check a small sample.