Why do distance-based algorithms require numerical features to be on the same scale?

Quick Overview

Asks why distance-based algorithms such as kNN and k-means need numerical features on a common scale. Tests how distance metrics combine features, which models are sensitive to units, and how to scale data correctly without leakage.

Why do distance-based algorithms require numerical features to be on the same scale?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

Why do distance-based algorithms require numerical features to be on the same scale? ```hint Write out one distance Take two people described by age in years and income in dollars. Write out the Euclidean distance between them term by term and see which term decides the result. ``` ### What a Strong Answer Covers - How a distance metric combines the per-feature differences - Why a feature with a large numeric range dominates, independent of how informative it is - Which algorithms are affected, and which are not - Common scaling methods and when to pick each - Fitting the scaler without leakage, and weighting a feature on purpose when it should count more ### Follow-up Questions - When would you prefer a robust scaler or a log transform over standard scaling? - How should binary or one-hot features be treated next to scaled numeric features in kNN? - Does switching to cosine distance remove the need for scaling? Why or why not? - Why do tree-based models not need feature scaling?

Overview: Asks why distance-based algorithms such as kNN and k-means need numerical features on a common scale. Tests how distance metrics combine features, which models are sensitive to units, and how to scale data correctly without leakage.

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

Why do distance-based algorithms require numerical features to be on the same scale?

What a Strong Answer Covers Guidance

  • How a distance metric combines the per-feature differences
  • Why a feature with a large numeric range dominates, independent of how informative it is
  • Which algorithms are affected, and which are not
  • Common scaling methods and when to pick each
  • Fitting the scaler without leakage, and weighting a feature on purpose when it should count more

Follow-up Questions Guidance

  • When would you prefer a robust scaler or a log transform over standard scaling?
  • How should binary or one-hot features be treated next to scaled numeric features in kNN?
  • Does switching to cosine distance remove the need for scaling? Why or why not?
  • Why do tree-based models not need feature scaling?