Skip to content
← All questions

When should feature scaling be used in machine learning?

Feature scaling should be used for algorithms that rely on Euclidean distance or gradient-based optimization, such as KNN, K-means, linear regression, logistic regression, and neural networks. It is generally not needed for tree-based models like decision trees, random forests, and XGBoost.

Conditions

  • Model uses distance metrics or iterative optimization sensitive to feature scale.
  • Model is not tree-based or an ensemble of trees.

Reasoning, step by step

  1. Identify the algorithm type.
  2. If it uses Euclidean distance (e.g., KNN, K-means) or gradient descent (e.g., ANN, CNN, linear/logistic regression), apply scaling.
  3. If it is tree-based (e.g., decision trees, random forests, XGBoost), scaling is usually unnecessary because splits depend on feature conditions, not absolute magnitude.

Example

The speaker lists KNN, K-means, linear regression, logistic regression, ANN, and CNN as needing scaling, while stating decision trees, random forests, and XGBoost do not.

Common misconceptions

  • Applying scaling to tree-based models unnecessarily.
  • Skipping scaling for distance-based or gradient-based models, leading to poor convergence or biased distance calculations.

Watch the explanation

Connected concepts

Explore next

Related questions

Understand why

↗
Understand why

↗
Find a method

↗
Meet the concept

↗

Answers are generated from source material and independently checked. Consult the original video or creator if something is unclear.