Coding Now – Best AI & Full Stack Courses in Delhi NCR | 100% Placement
Limited Offer: Get 50% OFF on AI & Full Stack Courses
📞 Call Now: +91 9667708830
Back to Machine Learning Notes
Topic #413

Normalization

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' = \frac{x - x_{min}}{x_{max} - x_{min}} \]

\(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\):

\[ x' = \frac{70 - 40}{100 - 40} = \frac{30}{60} = 0.5 \]
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 rangeFixed, e.g. [0, 1]Unbounded, centered on 0
Sensitive to outliers?Very — one extreme value stretches the whole rangeLess sensitive, but still affected
Best forNeural networks, image pixel data, algorithms expecting bounded inputMost 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 MinMaxScaler on 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\).

Related ML Notes

Want to go beyond the notes?

Join CodingNow's Machine Learning course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available
💬 Talk to Advisor
1
WhatsApp

Latest from Our Blog

Insights on AI, Data Science, Full Stack & Career

View All Articles →