How does a larger feature range affect distance calculations in algorithms like KNN?
In algorithms relying on distance metrics, features with larger numerical ranges will disproportionately influence the total distance. The feature with the larger scale will dominate the distance metric, regardless of its actual predictive importance, because its coordinate differences are numerically much larger.
Conditions
- Applies to distance-based machine learning algorithms like KNN or K-means.
- Features are not scaled or normalized.
- Distance is computed using a standard metric like Euclidean distance.
Reasoning, step by step
- Calculate the Euclidean distance between two points using the formula .
- Observe that if the horizontal feature has a much larger range, .
- Conclude that the vertical component becomes negligible in the sum under the square root, so the distance is approximately .
- Recognize that this biases the algorithm to only consider the larger-scale feature.
Example
The video shows a scatter plot where a yellow line segment connecting two points is almost entirely horizontal because the horizontal feature has a much larger range. After normalization, the line redraws with significant contributions from both horizontal and vertical components.
Common misconceptions
- Believing that a feature dominating a distance calculation is inherently more important for the prediction task; it is often merely an artifact of the feature's numerical range.
- Assuming that distance-based algorithms automatically handle different feature scales correctly.
Watch the explanation
4:12 – 5:24Watch this moment ↗
Explore next
Answers are generated from source material and independently checked. Consult the original video or creator if something is unclear.