Skip to content
BENIBIX Learn

Feature Scaling

Also known as Normalization (Machine Learning), Standardization (Machine Learning), Min-Max Scaling

Puts number columns on one range. Then big numbers do not drown out small ones.

Think of it like

It is like putting grams and tons in one unit. Then you can compare them.

Example

Emma's model reads age and income. After scaling, both run from 0 to 1. Her k-nearest neighbors model stops ignoring age.

Why it matters

Models that measure distance or use gradient descent learn badly without it. Tree models do not need it.

Definition

Feature scaling puts number columns on a similar range before training. One column might be age, from 0 to 100. Another might be income, up to 200,000. Without scaling, the big numbers can drown out the small ones. Min-max scaling squeezes each column to 0 to 1. Standardization shifts it so the average is 0 and most values sit near it.
Price ran up to 900. Scaled, it runs from 0 to 1 like the other columns.

Common mistake

Scaling with numbers taken from the whole dataset. Fit the scaler on the training set only, or test data leaks in.

Key takeaways

  1. 1
    Same range. Columns become easy to compare.
  2. 2
    Two common ways. Squeeze to 0 to 1, or center on 0.
  3. 3
    Fit on training. Then apply it to the rest.

Compare

Learn it properly