Working With Data Guide 5 of 8 · tap to switch
Feature Scaling: Normalization vs Standardization
Why salary in pounds bullies age in years, how Min-Max, Standardization, and RobustScaler compare under outliers, and which models actually care.
Suppose a bank recommends savings plans by finding the most similar customer to you (age 28, earning £52,000). Two candidates sit in the database:
- Candidate B: Age 62, earning £52,400 (nearly identical salary, 34 years older).
- Candidate C: Age 29, earning £58,000 (same life stage, £6k higher salary).
Putting every column onto a fair, shared scale, known as feature scaling (normalization and standardization), stops giant numbers from overpowering smaller clues when a model measures similarity or adjusts its weights.
Clearly Candidate C is far closer to a 28-year-old. Toggle between Unscaled and Scaled below to watch the geometry snap into proportion and see why raw math disagrees until both clues speak the same language.
Because £6,000 numerically swamps 34 years by nearly 200-to-1, unscaled distance effectively deletes Age from your dataset. Rescaling every feature to a shared scale restores equal footing immediately.
Normalization vs. Standardization: Min-Max, Z-Score & RobustScaler
Three scalers cover 95% of real machine learning workflows:
- Min-Max Normalization (0 to 1): Squishes the smallest value to
0and the largest value to1. Great for fixed-range clues like pixel brightness or bounded audio, yet fragile if even one extreme outlier appears. - Standardization (Z-Score): Centers the typical average at
0and measures how many typical spread steps (standard deviations) each value sits above or below average. A reliable everyday default for clean data. - Robust Scaling (Median & Middle Half, or IQR): Centers on the middle value (median) and measures spread using only the middle 50% of rows (called the interquartile range, or IQR), so extreme outliers cannot crush ordinary rows.
Toggle through all three scalers below with the £520k CEO Outlier turned on to see how the 10 ordinary workers bunch up or spread cleanly across the model’s working window.
Always fit your scaler on Practice (Training) rows only. Compute your scaling minimums, maximums, averages, or medians strictly on the Training rows, then freeze those numbers and reuse that exact ruler on your Unseen Test rows. Scaling the entire dataset before splitting lets future exam clues leak into training and makes your test score look artificially rosy.
Why neural networks and linear models train dramatically faster after scaling
Many models learn by rolling downhill inside a mistake bowl, taking small adjustment steps called gradient descent until they reach the lowest error at the bottom. If one column is 1,000× bigger than another, a tiny weight tweak on Salary (£50,000) causes a massive swing in predictions while the same tweak on Age (30) barely moves anything, stretching the bowl into a narrow canyon where the ball bounces wildly side to side!
Toggle between Unscaled (Steep Canyon) and Scaled (Smooth Bowl) below, then step forward to watch the ball stop bouncing off the walls and walk straight to the lowest error.
Which models need scaling (and which don’t)?
Not every algorithm cares about units. Models that measure straight-line distances, roll downhill to tune weights, or penalize large weights (like K-Nearest Neighbors, Ridge and Lasso regression, Neural Networks, and PCA) all rely on fair feature scales. Meanwhile, decision tree models (like Decision Trees, Random Forests, and XGBoost) only check one column at a time using sorted threshold cutoffs, so stretching a column by 1,000× never changes which rows go left or right.
Try multiplying Salary by 1,000 in the quick comparison below, then filter the six everyday models to build a crisp mental checklist.
See the three scaling formulas, condition numbers & L2 penalty biasThesis / Reference
1. The Three Standard Transformations (all parameters estimated strictly on Training Set):
2. Optimization Condition Number: For quadratic loss , gradient descent convergence rate depends on the condition number . When feature scales differ by , grows by , requiring orders of magnitude more steps (or adaptive optimizers like Adam / L-BFGS). Standardizing features drives close to 1.
3. Why Ridge & Lasso Require Scaling: Penalized regression adds (or ). If feature is measured in kilometres and in metres, equivalent effects require a 1,000× larger weight on kilometres, causing the penalty to crush the kilometre feature unfairly while leaving metres untouched.
See leak-free scaling inside a Pipeline in PythonOptional Code
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler, RobustScaler
from sklearn.neighbors import KNeighborsClassifier
# Standard default for clean numeric columns
clean_pipe = make_pipeline(StandardScaler(), KNeighborsClassifier(n_neighbors=5))
# Outlier-safe default for skewed money/traffic columns
robust_pipe = make_pipeline(RobustScaler(), KNeighborsClassifier(n_neighbors=5))
# Fit strictly on X_train; transform X_test using frozen training stats
robust_pipe.fit(X_train, y_train)
print("Honest test score:", round(robust_pipe.score(X_test, y_test), 3))Next step: how machines measure similarity and distance
Now that every clue sits on an honest scale, how does a search engine, music recommender, or AI embedding actually judge whether two items are “similar”? Next up in Distance Metrics & Cosine Similarity, we compare straight-line distance, city-block distance, Cosine angle, and why high dimensions distort everyday geometry.
Quick Intuition Check
Four quick real-world scenarios. No scores, just test your intuition.
Your salary column has 999 normal staff earning £30k to £70k plus 1 billionaire founder earning £12M. Which scaler keeps normal staff cleanly separated?
Which model will behave identically whether you scale your numeric columns or leave them in raw pounds and years?
Why does scaling features speed up gradient descent in linear models and neural networks?
To save time, it is fine to compute your scaling average, minimum, and maximum across the entire dataset before splitting into Practice (Training) and Unseen Test rows.
Common Questions
What is the difference between Normalization (Min-Max) and Standardization (Z-Score)?
When should I use RobustScaler instead of StandardScaler or MinMaxScaler?
Do Decision Trees, Random Forests, or XGBoost need feature scaling?
Why does feature scaling make gradient descent train faster?
Should I scale before or after splitting into train and test sets?
Related Visual Guides
K-Nearest Neighbors (KNN Algorithm)
Predict a new example simply by asking its K closest neighbors to vote, and see why choosing K and scaling features make or break the result.
Gradient Descent, Learning Rate & Adam Optimizer
Master the engine that trains every deep model: tune learning rates, race SGD vs. Momentum vs. Adam, pick mini-batches, and schedule cosine decay.
Principal Component Analysis (PCA)
How to rotate and compress dozens of correlated features into a few clean axes without throwing away the real story.
Written & illustrated by Muhammad Aashir Irshad · Updated December 2026 · Free open-access reference
Cite this guide in a paper, thesis, or course (BibTeX & APA)
@misc{irshad2026featurescalingnormalization,
author = {Irshad, Muhammad Aashir},
title = {Feature Scaling: Normalization vs Standardization: Interactive Visual Guide},
howpublished = {SeeingML},
year = {2026},
month = {dec},
url = {https://seeingml.com/learn/feature-scaling-normalization/},
note = {Interactive visual guide}
} Irshad, M. A. (2026). Feature Scaling: Normalization vs Standardization: Interactive Visual Guide. SeeingML. https://seeingml.com/learn/feature-scaling-normalization/