Normalization (Min-Max scaling) rescales a feature into a fixed range — usually [0, 1] — by stretching or compressing based on the feature's minimum and maximum observed values.
Formula
\(x\) is the original value, \(x_{min}\) and \(x_{max}\) are the feature's minimum and maximum. The result \(x'\) always falls in [0, 1]: the minimum value maps to 0, the maximum maps to 1.
Numerical Example
For a feature with \(x_{min}=40\), \(x_{max}=100\), and \(x=70\):
from sklearn.preprocessing import MinMaxScaler
import numpy as np
X_train = np.array([[40], [55], [70], [85], [100]])
scaler = MinMaxScaler()
X_train_scaled = scaler.fit_transform(X_train)
print(X_train_scaled.ravel()) # [0. 0.25 0.5 0.75 1. ]
Normalization vs Standardization
| Normalization (Min-Max) | Standardization (Z-score) | |
|---|---|---|
| Output range | Fixed, e.g. [0, 1] | Unbounded, centered on 0 |
| Sensitive to outliers? | Very — one extreme value stretches the whole range | Less sensitive, but still affected |
| Best for | Neural networks, image pixel data, algorithms expecting bounded input | Most classical ML — the more common default |
A single extreme outlier can wreck Min-Max scaling: if one income value is 50x the rest, every other (normal) value gets compressed into a tiny sliver near 0. See Robust Scaling for an outlier-resistant alternative.
Practical Use Cases
- Neural network inputs, especially image pixel values (naturally bounded 0–255, normalized to 0–1)
- Algorithms or visualizations that specifically require a bounded input range
Common Mistakes
- Using Min-Max scaling on data with significant outliers without addressing them first — the outlier compresses all other values into a narrow band.
- Fitting
MinMaxScaleron the full dataset before splitting, so the test set's min/max leak into the scaling — as always, fit on train only.
Interview Relevance
Q: "When would you use normalization instead of standardization?" When you need a specific bounded range (e.g. neural network inputs, or image pixels) and the data has no significant outliers — otherwise standardization is usually the safer default.
Practice Question
A feature ranges from \(x_{min}=10\) to \(x_{max}=210\). Compute the Min-Max normalized value for \(x=60\).