Back to Machine Learning Notes
Topic #62

Feature Scaling

Feature scaling puts numeric features on a comparable range. Without it, a feature measured in the thousands (income) can completely dominate a feature measured in single digits (years of experience) — not because it's more important, but purely because of its scale.

Before / After, Visually

Before Scaling income (0–100,000) age (0–100) (barely visible on the same axis) After Scaling (0–1) income_scaled income age

After scaling, both features occupy a comparable numeric range — neither dominates a distance or gradient calculation purely by scale.

Which Models Actually Need It

Sensitive to ScaleNot Sensitive to Scale
KNN, K-Means (distance-based)Decision Trees, Random Forest (threshold-based splits)
SVM (margin-based)Gradient Boosting / XGBoost (also threshold-based)
Linear/Logistic Regression, Neural Networks (gradient-based)Naive Bayes (probability-based, not distance-based)

The Three Main Techniques

  • Standardization — rescales to mean 0, standard deviation 1; the default choice for most models
  • Normalization (Min-Max) — rescales into a fixed [0, 1] range; useful when you need bounded values
  • Robust Scaling — uses median and IQR instead of mean and standard deviation; the right choice when outliers are present

Common Mistakes

  • Scaling before splitting into train/test — leaks test-set statistics into the scaler. Always fit the scaler on training data only.
  • Scaling features for tree-based models unnecessarily — harmless, but wasted effort; trees split on thresholds, not distances or gradients.
  • Forgetting to scale the target variable too, when the algorithm requires it (rare, but relevant for some regularized regression setups).

Interview Relevance

Q: "Does Random Forest need feature scaling?" No — tree-based models split on a single feature's threshold at a time (e.g. "income > 50000"), so the relative scale between different features never affects the split decision, unlike distance- or gradient-based models.

Practice Question

You're training a KNN classifier on features "age" (18–70) and "income" (20,000–500,000) without scaling. Explain what will go wrong and why.

Want to go beyond the notes?

Join Coding Now Tech Institute's Machine Learning course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Feature Scaling – FAQs

Quick answers about learning Feature Scaling in Machine Learning.

This free note from Coding Now Tech Institute explains Feature Scaling in Machine Learning — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Machine Learning topic on Coding Now Tech Institute, including Feature Scaling, is 100% free with no signup required.
With focused practice, most students grasp Feature Scaling in 1–3 days from these notes; pairing it with Coding Now Tech Institute's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the Coding Now Tech Institute Community (/community) — expert instructors answer within 24 hours.
Call NowEnroll Now