0% found this document useful (0 votes)
9 views6 pages

Normalization vs Standardization in ML

The document explains the concepts of normalization and standardization in machine learning, emphasizing the need to adjust feature scales to prevent one feature from dominating the learning process. Normalization rescales data to a fixed range (0 to 1), while standardization centers data around a mean of 0 and a standard deviation of 1. It provides guidelines on when to use each method based on the characteristics of the data and the algorithms employed.

Uploaded by

aisten.2025
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views6 pages

Normalization vs Standardization in ML

The document explains the concepts of normalization and standardization in machine learning, emphasizing the need to adjust feature scales to prevent one feature from dominating the learning process. Normalization rescales data to a fixed range (0 to 1), while standardization centers data around a mean of 0 and a standard deviation of 1. It provides guidelines on when to use each method based on the characteristics of the data and the algorithms employed.

Uploaded by

aisten.2025
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

⚖️ NORMALIZATION vs

STANDARDIZATION
“Making Features Speak the Same Language”

🧠 1️⃣ The Real Problem: Unequal Feature Scales


Machine Learning algorithms work by comparing values —​
distances, weights, and magnitudes.

If one feature has large numbers and another has small ones,​
the large one dominates the learning process.

Example:
Feature Scale

Salary ₹10,000 –
₹100,000

Age 18 – 60

When both are used in one model, “Salary” will overshadow “Age” —​
because 100,000 looks more important than 50 (even if it’s not).

💬 So we must bring both to a similar scale before training the model.

⚙️ 2️⃣ What Are Normalization and Standardization?


Method Purpose Resulting Range

Normalization Rescales data to a fixed range, usually 0 to [0, 1]


1

Standardization Centers data around mean = 0, std = 1 Mean = 0, SD = 1

🧩 3️⃣ NORMALIZATION
🧮 Formula:
Xnorm=X−XminXmax−XminX_{norm} = \frac{X - X_{min}}{X_{max} -
X_{min}}Xnorm​=Xmax​−Xmin​X−Xmin​​

Meaning:​
Scale all values between 0 and 1.

Example:
Original Marks Normalized

20 0.0

50 0.5

80 1.0

Code Example:

from [Link] import MinMaxScaler


import numpy as np

data = [Link]([[20], [50], [80]])


scaler = MinMaxScaler()
scaled = scaler.fit_transform(data)
print(scaled)

Output:

[[0. ]
[0.5]
[1. ]]

🎚️
Analogy:​
Like adjusting volume from 0 to 10 — everything fits within that range.

Use it when:

●​ You know min and max values clearly.​

●​ Features are of different scales but same importance.​

●​ Common in Neural Networks, KNN, Distance-based algorithms.​


🧮 4️⃣ STANDARDIZATION
🧮 Formula:
Xstd=X−μσX_{std} = \frac{X - \mu}{\sigma}Xstd​=σX−μ​

Meaning:​
Make the mean = 0 and standard deviation = 1.

Example:
Original Mean (μ) Std Standardized
(σ)

50 60 10 -1.0

60 60 10 0.0

70 60 10 +1.0

Code Example:

from [Link] import StandardScaler


import numpy as np

data = [Link]([[50], [60], [70]])


scaler = StandardScaler()
scaled = scaler.fit_transform(data)
print(scaled)

Output:

[[-1.]
[ 0.]
[ 1.]]

📏
Analogy:​
Like converting marks into z-scores to see how far each student is from the class
average.

Use it when:

●​ Data follows a normal distribution.​

●​ Used in Linear Regression, SVM, PCA, Logistic Regression.​


🎯 5️⃣ When to Use What
Situation Use Why

Distance-based algorithms (KNN, Normalization Keeps all features in 0–1


K-Means, Neural Networks) range

Algorithms assuming normal distribution Standardizatio Mean-centered scaling


(Linear, Logistic, SVM) n helps optimization

You have outliers Standardizatio Less sensitive to extreme


n values

You want to compare magnitudes Normalization Easy visual interpretation

📊 6️⃣ Visual Understanding


Before Scaling:
Feature A: 10,000 → 100,000
Feature B: 10 → 100

→ Feature A dominates.

After Normalization:
Feature A: 0 → 1
Feature B: 0 → 1

→ Equal importance.

After Standardization:
Feature A: -1.2 → +1.8
Feature B: -0.8 → +0.9

→ Centered around zero.

🧩 7️⃣ Real-Life Analogy: Exam Marks


Imagine students scored marks in different subjects:

Subject Marks Max Marks

Maths 90 100

Sports 8 10

A machine learning model might think “90 > 8”,​


but both are equally good (both 90%).

✅ Normalization fixes this — converts all to the same scale (0–1).

💬 8️⃣ Class Activity


Ask students:

1.​ Take 5 random numbers (e.g., 10, 25, 40, 50, 80).​

2.​ Compute:​

○​ Min = 10, Max = 80​

○​ Normalize each using (x - 10)/(80 - 10)​

3.​ Then compute mean and std, and standardize.​


They’ll see the numbers shrink and center — it clicks instantly.​

🧮 9️⃣ Combined Example Code


from [Link] import MinMaxScaler, StandardScaler
import numpy as np

data = [Link]([[10], [25], [40], [50], [80]])

# Normalization
norm = MinMaxScaler().fit_transform(data)
print("Normalized:\n", norm)

# Standardization
std = StandardScaler().fit_transform(data)
print("\nStandardized:\n", std)

⚡ 10️⃣ Summary Table


Aspect Normalization Standardization

Range 0→1 Mean = 0, SD = 1

Formula (x - min) / (max - min) (x - μ) / σ

Sensitive to Outliers Yes No

When to Use Distance-based Normal-distribution models


models

Analogy Volume knob 0–10 Compare how far from average

Example Neural Networks, KNN Linear/Logistic Regression, SVM

🧠 11️⃣ Final Analogy (To Stick in Mind)


ML Concept Real-Life Analogy

Normalization Converting all exam marks to percentages

Standardization Comparing each student’s mark to class average


(z-score)

“Normalization tells you how big something is.​


Standardization tells you how far it is from normal.”

💬 12️⃣ Summary Quote for Your Slide


“Scaling data is like tuning instruments before a concert —​

🎻
only when all features play in harmony can the algorithm perform beautifully.”

You might also like