Why do linear and distance-based models require feature scaling while decision trees do not?

Quick Overview

Asks why k-NN, k-means, SVMs and linear models are sensitive to feature scaling while decision trees and tree ensembles are not. It tests how distances, gradient descent and coefficient penalties depend on units, and why threshold splits only depend on the rank order of values.

Why do linear and distance-based models require feature scaling while decision trees do not?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

Why do linear and distance-based models require feature scaling while decision trees do not? ```hint Change the units Ask what happens to each model's computation if you record one feature in grams instead of kilograms, and whether the model mixes features together when it computes anything. ``` ### What a Strong Answer Covers - How distance-based models such as k-NN, k-means and RBF-kernel SVMs let a feature with a large numeric range dominate. - Why gradient-descent training of linear models converges poorly on unscaled features, and whether the fitted predictions of unregularized least squares change with scaling. - How a coefficient penalty in Ridge, Lasso or regularized logistic regression interacts with feature units. - Why tree splits stay the same under monotonic rescaling, for single trees, random forests and boosted trees. - Fitting the scaler on training data only. ### Follow-up Questions - Which scaler would you choose for a heavy-tailed feature such as income, and why? - After a log transform of one feature, a tree model gives slightly different predictions on new data. How can that happen if trees are invariant to monotonic transforms? - Do neural networks need feature scaling? What changes if the network uses batch normalization? - Is PCA sensitive to feature scaling, and when would you skip standardizing before it?

Overview: Asks why k-NN, k-means, SVMs and linear models are sensitive to feature scaling while decision trees and tree ensembles are not. It tests how distances, gradient descent and coefficient penalties depend on units, and why threshold splits only depend on the rank order of values.

General logo
General
Nov 25, 2026
easyMachine Learning EngineerOtherMachine Learning
0
0

Why do linear and distance-based models require feature scaling while decision trees do not?

What a Strong Answer Covers Guidance

  • How distance-based models such as k-NN, k-means and RBF-kernel SVMs let a feature with a large numeric range dominate.
  • Why gradient-descent training of linear models converges poorly on unscaled features, and whether the fitted predictions of unregularized least squares change with scaling.
  • How a coefficient penalty in Ridge, Lasso or regularized logistic regression interacts with feature units.
  • Why tree splits stay the same under monotonic rescaling, for single trees, random forests and boosted trees.
  • Fitting the scaler on training data only.

Follow-up Questions Guidance

  • Which scaler would you choose for a heavy-tailed feature such as income, and why?
  • After a log transform of one feature, a tree model gives slightly different predictions on new data. How can that happen if trees are invariant to monotonic transforms?
  • Do neural networks need feature scaling? What changes if the network uses batch normalization?
  • Is PCA sensitive to feature scaling, and when would you skip standardizing before it?