Home Knowledge Base Normalization and Standardization

Normalization and Standardization are feature scaling techniques that transform numeric features to comparable ranges — essential preprocessing for distance-based algorithms (KNN, SVM) and gradient-based methods (neural networks, logistic regression) because unscaled features with different magnitudes (Age 0-100 vs Salary 0-200,000) cause the larger-magnitude features to dominate distance calculations and gradient updates, leading to biased models and slow convergence.

Why Scale Features?

Standardization (Z-Score Normalization)

FeatureOriginalStandardized
Age = 2525-1.2
Age = 50500.0
Age = 7575+1.2
Salary = $30K30,000-1.0
Salary = $60K60,0000.0
Salary = $90K90,000+1.0

Normalization (Min-Max Scaling)

FeatureOriginalNormalized
Age = 25250.25
Age = 50500.50
Age = 75750.75

Comparison

PropertyStandardization (Z-Score)Normalization (Min-Max)
Output rangeUnbounded (~-3 to +3)Fixed [0, 1]
Outlier sensitivityModerate (outliers shift mean/std slightly)High (one outlier compresses all other values)
Best forGeneral ML, regression, SVMNeural networks, image data
Preserves zeroYes (sparse data friendly)No
Rule of thumb"When in doubt, standardize"When bounded input is required

Critical Rule: Fit on Train, Transform Both

from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
X_train_scaled = scaler.fit_transform(X_train)   # Learn mean/std from train
X_test_scaled = scaler.transform(X_test)          # Apply train's mean/std to test

Never call fit_transform on test data — that would leak test statistics into the scaler, causing data leakage.

Normalization and Standardization are the essential preprocessing steps for fair feature comparison — ensuring that all features contribute proportionally to model learning regardless of their original scale, with standardization as the safe default for most algorithms and min-max normalization for neural networks and bounded-input requirements.

normalizationstandardizescale

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.