SeeingML
Working With Data Guide 5 of 8 · tap to switch
✦ Interactive Visual Guide 8 min · 4 hands-on labs · Beginner friendly

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.

Interactive Lab 1: Why Unscaled Pounds Bully Years in Distance Models
Step 1: Notice how raw pounds squash Age into a thin strip so B sits inside your search circle. Step 2: Click "Scaled (Fair Units)".
£50k£55k£60kAge (20 to 70)squashed flat!Raw Annual Salary (£) stretches 200x wider than Age (Years)Candidate B (Closest!)62 yrs, £52.4k (dist 401)Candidate C (Looks far!)29 yrs, £58k (dist 6,000)You (28 yrs, £52k)
Model picks nearest neighbor: Candidate B (62 yrs, £52.4k) ✗Straight-line distance: B = 401 | C = 6,000
Without scaling, pounds stretch the Salary axis so wide that Age gets squashed nearly flat! Straight-line distance claims 62-year-old Candidate B (distance 401) is 15x closer to you than 29-year-old Candidate C (distance 6,000). Click "Scaled (Fair Units)" to fix the geometry!

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 0 and the largest value to 1. 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 0 and 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.

Interactive Lab 2: Min-Max vs. Z-Score vs. Robust Under an Outlier
Click across all three scalers on this fixed model window to watch the 10 normal worker dots visibly un-crush.
0.000.250.500.751.00Fixed Model Window: 0 to 1 (Min-Max Normalized)CEO (£520k → 1.00)10 Normal Workers (£28k to £66k): 0.00 to 0.08
Normal workers span 8% of model windowClean spacing kept: 8%
Min-Max crush! One £520k CEO stretched the 0 to 1 ruler so hard that all 10 normal workers got squashed into 0.00 to 0.08 (just 8% of the model window). Try clicking "Robust (Median & Middle Half)" next!
⚠️ Warning

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.

Interactive Lab 3: Why Gradient Descent Zigzags on Unscaled Bowls
Step 1: Click "Take 1 Step" or drag the slider to trace the unscaled zigzag. Step 2: Switch to "Scaled (Smooth Bowl)" to see a circular bowl!
Lowest ErrorStartNarrow canyon (mismatched scales) → steep walls cause wild bouncingWeight on Age (horizontal) vs. Weight on Salary (vertical)
Distance left to bottom: 107
4 / 16
Step 4 of 16: Because Salary is thousands of times bigger than Age, the mistake bowl stretches into a narrow canyon. Watch the ball bounce wildly from wall to wall (distance left: 107)! Keep stepping or switch to "Scaled (Smooth Bowl)".

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.

Interactive Lab 4: Which Models Need Scaling (and Which Don't)?
Live Unit-Stretch Test: Multiply Salary by 1,000 (£k to raw £)
Distance Model (KNN)Picks Alex ✓
Nearest neighbor to You (30 yrs, £48k):
Alex (31 yrs, £54k)dist 6.1
Sam (62 yrs, £49k)dist 32.0
Decision Tree SplitExact same split! ✓
Salary < £50k?YesNoJo, You, Sam£38k, £48k, £49kAlex£54k
In balanced units (Salary in £k), KNN picks 31-year-old Alex and the Decision Tree puts 3 people left and 1 right. Click "Multiply Salary × 1,000" to see which model breaks!
K-Nearest Neighbors (KNN)Needs Scaling
Measures straight-line distance between rows. Huge-number columns like salary completely drown out small-number columns like age.
Linear & Logistic Models (Ridge & Lasso)Needs Scaling
Penalizes large model weights to keep predictions steady. Unscaled columns get unfairly harsh or tiny weight penalties based purely on their units.
Neural Networks & Deep LearningNeeds Scaling
Learns by rolling downhill inside a mistake bowl. Mismatched scales cause wild zigzagging and push internal neurons into flat zones where learning stalls.
PCA & K-Means ClusteringNeeds Scaling
Looks for the biggest spread and shortest straight-line distances. £500k house prices overwhelm 1 to 5 bedroom counts unless scaled first.
Decision Trees & Random ForestsDoesn't Need Scaling
Splits one column at a time using simple cutoffs like "Salary < £50k". Multiplying every salary by 1,000 just shifts the cutoff to £50,000 and keeps the exact same split!
Gradient Boosted Trees (XGBoost / LightGBM)Doesn't Need Scaling
Also builds yes/no splits from sorted column order rather than distances or weight sizes, so stretching a column never changes which rows go left or right.
See the three scaling formulas, condition numbers & L2 penalty biasThesis / Reference

1. The Three Standard Transformations (all parameters estimated strictly on Training Set):

xminmax=x−xmin⁡xmax⁡−xmin⁡,xz=x−xˉs,xrobust=x−median(x)Q3−Q1x_{\text{minmax}} = \frac{x - x_{\min}}{x_{\max} - x_{\min}}, \qquad x_{\text{z}} = \frac{x - \bar{x}}{s}, \qquad x_{\text{robust}} = \frac{x - \text{median}(x)}{Q_3 - Q_1}

2. Optimization Condition Number: For quadratic loss 12w⊤Hw\frac{1}{2}\mathbf{w}^\top \mathbf{H} \mathbf{w}, gradient descent convergence rate depends on the condition number κ(H)=λmax⁡/λmin⁡\kappa(\mathbf{H}) = \lambda_{\max}/\lambda_{\min}. When feature scales differ by 10310^3, κ\kappa grows by 10610^6, requiring orders of magnitude more steps (or adaptive optimizers like Adam / L-BFGS). Standardizing features drives κ\kappa close to 1.

3. Why Ridge & Lasso Require Scaling: Penalized regression adds λ∑wj2\lambda \sum w_j^2 (or λ∑∣wj∣\lambda \sum |w_j|). If feature x1x_1 is measured in kilometres and x2x_2 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
python
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.

✓ Self-Check

Quick Intuition Check

Four quick real-world scenarios. No scores, just test your intuition.

1

Your salary column has 999 normal staff earning £30k to £70k plus 1 billionaire founder earning £12M. Which scaler keeps normal staff cleanly separated?

Pick an option first, or peek anytime
2

Which model will behave identically whether you scale your numeric columns or leave them in raw pounds and years?

Pick an option first, or peek anytime
3

Why does scaling features speed up gradient descent in linear models and neural networks?

Pick an option first, or peek anytime
4

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.

Pick an option first, or peek anytime
Quick Reference

Common Questions

What is the difference between Normalization (Min-Max) and Standardization (Z-Score)?
Min-Max Normalization rescales every value into a fixed bounded box, usually [0, 1]. Standardization (Z-Score) shifts the mean to 0 and divides by Standard Deviation so values represent how many standard deviations they sit from average. Standardization is far less fragile when extreme outliers appear.
When should I use RobustScaler instead of StandardScaler or MinMaxScaler?
Use RobustScaler whenever a feature contains extreme outliers or heavy skew (like incomes or transaction amounts). Because it subtracts the Median and divides by the Interquartile Range (IQR), outliers cannot squash all normal rows into a tiny sliver.
Do Decision Trees, Random Forests, or XGBoost need feature scaling?
No. Decision trees split one feature at a time using sorted thresholds (such as Salary > £50,000). Multiplying a column by 1,000 or subtracting 20 leaves the sorted order identical, so tree splits do not change.
Why does feature scaling make gradient descent train faster?
Mismatched feature scales stretch the loss surface into a steep, narrow elliptical canyon, forcing gradient descent to bounce back and forth across steep walls. Scaling turns the canyon into a round bowl so gradients point almost straight at the minimum.
Should I scale before or after splitting into train and test sets?
Always fit your scaler on the Training Set ONLY, then apply those frozen parameters (mean, SD, min, max) to Validation and Test. Fitting before splitting leaks test-set distribution statistics into training.

Written & illustrated by Muhammad Aashir Irshad · Updated December 2026 · Free open-access reference

https://seeingml.com/learn/feature-scaling-normalization/ Open GitHub issue Suggest an edit
Cite this guide in a paper, thesis, or course (BibTeX & APA)
BibTeX
@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}
}
APA

Irshad, M. A. (2026). Feature Scaling: Normalization vs Standardization: Interactive Visual Guide. SeeingML. https://seeingml.com/learn/feature-scaling-normalization/