← chapter

The curse of dimensions

Every intuition you have about distance was trained in 2D. It lies in 200D.

High-dimensional space is mostly empty — and in an empty space, everything is about equally far from everything else.

Two names, two problems

Same root: space empties out as you add axes, and finite data can't keep up.

Distances concentrate

200 random points, distances ÷ mean, as the dimension climbs.

Nearest and farthest start miles apart — and converge to the same value.

The math

Relative contrast — how much farther the farthest is than the nearest:

contrast(q)=maxid(q,xi)minid(q,xi)minid(q,xi)\text{contrast}(q) = \frac{\max_i \, d(q, x_i) - \min_i \, d(q, x_i)}{\min_i \, d(q, x_i)}

It collapses (Beyer et al., 1999):

limd  contrast(q)    0\lim_{d \to \infty} \; \text{contrast}(q) \; \to \; 0

Volume grows like rdr^d, so to keep the same density you need N(1/ε)dN \propto (1/\varepsilon)^{d} points — exponential in the dimension.

Watch it collapse

Each frame: 200 fresh points at one dimension, the spread of their pairwise distances (÷ mean). Nearest (cyan) and farthest (orange) march together.

Contrast falls from 41.90 at d = 2 to 0.10 at d = 1000.

When the histogram is a spike, "nearest neighbor" means nothing — and kNN, k-means, and kernels are running on noise.

The peaking phenomenon

5 informative features, the rest pure noise. kNN peaks at 5, then falls off a cliff. A regularized linear model barely notices the noise.

kNN: 0.9958 at 5 features → 0.6708 at 500. Logistic: still 0.9208 at 500.

Fighting back

At 200 features, kNN is stuck at 0.7250. Three defenses:

Takeaways