The Curse of Dimensionality
Concentrating distances, empty space and minimax rates.
In a thousand dimensions, almost all of a ball's volume lies within 1% of its surface, and every point is nearly the same distance from every other. For learning, the consequence is stark: the best possible error for estimating a -smooth function decays like , so each added dimension multiplies the data you need. Yet real data rarely fill the space they live in, and nearest neighbors adapt to the dimension the data actually have.
What you’ll learn
- Compute volumes of balls, shells and neighborhoods in high dimension, and explain why local neighborhoods stop being local.
- Prove that distances concentrate when coordinates are independent, and state the results of Beyer et al. and Aggarwal et al. on relative contrast.
- Explain hubness: why some points become nearest neighbors of many others in high dimension.
- State Stone's minimax rate , derive the matching k-NN bound for Lipschitz functions and sketch the lower bound.
- Explain how low intrinsic dimension and other structure let local methods escape the curse.
Empty space
Richard Bellman coined the phrase curse of dimensionality for the exponential growth of a grid with the number of variables. For local learning methods it shows up as geometry. The volume of a ball of radius in is
and three consequences follow.
| Dimension | Ball inside the unit cube, | Cube side holding 1% of uniform data, | Mass of the unit ball within 0.01 of its surface, |
|---|---|---|---|
| 2 | 0.785 | 0.10 | 2.0% |
| 3 | 0.524 | 0.22 | 3.0% |
| 10 | 0.0025 | 0.63 | 9.6% |
| 100 | 0.955 | 63% | |
| 1000 | 0.995 | 99.996% |
In dimensions, what fraction of the volume of a ball lies within 1% of its radius from the surface?
Show the answer
63 %
The inner ball of radius has volume of the whole, so the thin shell holds . Volume scales like , so a 1% change in radius changes volume by about percent when is small, and swallows nearly everything when is large.
The same thinness holds for probability. If , then and , so : a high-dimensional Gaussian lives in a thin shell of radius , not near its mode at the origin (Vershynin, 2018, §3.1). And with points uniform in the unit ball of , the median distance from the center to the nearest point is : for and that is about , more than halfway to the boundary (Hastie, Tibshirani & Friedman, 2009, §2.5). Neighborhoods that hold any data at all are no longer small.
Distances concentrate
Let and be independent, each with i.i.d. coordinates, and set with mean and variance . The squared distance is a sum of i.i.d. terms.
Mean and variance of the squared distance grow linearly in :
So the relative spread shrinks like , and Chebyshev's inequality gives concentration around the typical value:
For coordinates uniform on : and , so and the relative spread is : 37% at , 12% at , under 4% at .
In a simulation with 1,000 points uniform in the cube and a uniform query, the median farthest-to-nearest ratio was about 70 in 2 dimensions (with large variation), 3.8 in 10, 1.4 in 100 and 1.12 in 1,000. Aggarwal, Hinneburg and Keim (2001) refined the picture for distances with i.i.d. coordinates: the absolute gap grows like , so it diverges for , stays bounded for and vanishes for with , while the relative contrast decays like for every with a constant that favors small . Manhattan distance, and even "fractional" distances with , kept more contrast in their experiments.
The hypothesis matters as much as the conclusion. Concentration needs many independent coordinates that all contribute, that is, high intrinsic dimension. Clustered data, or data near a low-dimensional set, keep their contrast however many raw features there are; Beyer et al. themselves stressed that their result does not make high-dimensional search meaningless on such workloads.
Hubness. Let count how often appears among the nearest neighbors of the other points. Its average is exactly , since every point has neighbors. Radovanović, Nanopoulos and Ivanović (2010) showed that as the intrinsic dimension grows, the distribution of becomes strongly right-skewed: a few hubs appear in very many neighbor lists, and many anti-hubs appear in none. The mechanism is concentration again: points slightly closer than average to the data mean are slightly closer to everyone. In their simulations with i.i.d. uniform data, the (Spearman) correlation between and the distance to the data mean was about in 3 dimensions, in 20 and in 100. Hubs spread their labels to many queries, so a mislabeled hub damages k-NN classification, and retrieval systems return the same items for many unrelated queries.
The statistical curse: minimax rates
Concentration is a geometric statement. The statistical curse is about how much data learning needs. Consider regression, with and in a compact subset of , and ask for the best worst-case mean squared error over a smoothness class.
Take : . As in the Descent lesson, the error at is a variance term plus a squared bias bounded by the distance to the -th neighbor:
A ball of radius has mass of order , so it holds of points once . For bounded inputs and this gives a squared -th neighbor distance of order , averaged over (Györfi, Kohler, Krzyżak & Walk, 2002, chapter 6):
Balance the two terms: , and the error is of order , Stone's rate with . Plain local averaging does not exploit higher smoothness everywhere; local polynomial fits do, and reach for larger .
Lower bound, sketched. Split into small cubes, and place in each a smooth bump of height , the tallest a -smooth function can be at that width, with sign or . That gives functions in the class. Each cube receives about observations, and a bump's sign can be detected only if . Choosing makes every sign a coin flip for any estimator, which then errs by about on a constant fraction of cubes: an error of order . Assouad's lemma makes this rigorous (Tsybakov, 2009, chapter 2).
With and , the minimax mean squared error scales like . By about what factor must grow to cut the error tenfold?
Show the answer
3162 ×
falls tenfold when grows by . In one dimension the same improvement costs a factor of . Ignoring constants, reaching an error of 0.01 needs about 300 points in one dimension, in ten and in a hundred.
Escaping the curse
Minimax rates are worst cases over all -smooth functions on a -dimensional set. Real problems are rarely that bad, and nearest neighbors are well placed to exploit it, because they never use the ambient dimension explicitly: only the mass of balls around the query matters.
Low intrinsic dimension. If the data lie on or near a set of dimension , so that balls around a query have mass of order , then the -th neighbor distance scales like and the k-NN rates hold with in place of . Kpotufe (2011) proved that k-NN regression adapts to the local intrinsic dimension at each query, and that choosing locally from the data nearly achieves the minimax rate there, without knowing the dimension. Estimated intrinsic dimensions of natural image datasets are far below their pixel counts, and datasets of lower intrinsic dimension are easier for neural networks to learn (Pope et al., 2021).
| Structure | What replaces in the rate | Typical methods |
|---|---|---|
| Data near a -dimensional manifold or set | k-NN, kernel methods, trees: adaptive automatically | |
| depends on of the features | (if the relevant features can be found) | feature selection, metric learning |
| is a sum of one-dimensional functions | 1 | additive models |
| is a composition of low-dimensional functions | the effective dimension and smoothness of the hardest piece | deep networks (Schmidt-Hieber, 2020) |
Images of a rotating object are stored as vectors of pixels, but they are generated by a single rotation angle. What governs how many examples k-NN needs?
- The pixel dimensions, since distances are computed in pixel space
- Nothing: k-NN cannot work on images
- The intrinsic dimension of the image set, here about 1, since ball masses scale with that dimension
- The number of classes
Show the answer
C. The intrinsic dimension of the image set, here about 1, since ball masses scale with that dimension
k-NN's rates depend on how fast the mass of a ball around the query grows with its radius. On a one-dimensional curve of images that is like , however many pixels each image has. (Whether pixel distance tracks the angle well is a separate question: that is what learned metrics improve.)
Key takeaways
- High-dimensional space is empty and its volume sits in corners and thin shells: , and neighborhoods holding any data must span most of every coordinate's range.
- For i.i.d. coordinates, distances concentrate with relative spread , so the farthest and nearest neighbors become nearly equidistant (Beyer et al.); concentration requires high intrinsic dimension.
- Hubness: in high intrinsic dimension a few points become neighbors of many others, typically those closest to the data mean.
- The minimax mean squared error for -smooth regression is of order (Stone, 1982); k-NN attains for Lipschitz functions with .
- Local methods escape the curse when the data have low intrinsic dimension: k-NN adapts to the local intrinsic dimension automatically (Kpotufe, 2011).
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
In , roughly what fraction of a ball's volume lies within 1% of its radius from the surface?
- About 1%
- About 5%
- About 63%
- Over 99%
Show the answer
D. Over 99%
. Volume scales as , so for large nearly all of it sits next to the surface.
Points have i.i.d. coordinates. With the number of points fixed, what happens to the ratio of the farthest to the nearest distance from a query as the dimension grows?
- It tends to 1, because every distance concentrates around the same typical value
- It grows without bound, because space gets bigger
- It stays constant, because both distances scale like
- It tends to 0
Show the answer
A. It tends to 1, because every distance concentrates around the same typical value
Each squared distance is a sum of i.i.d. terms, so its relative fluctuation shrinks like . Both the largest and the smallest of finitely many such distances are , so their ratio approaches 1.
For a Lipschitz regression function () in dimensions, how does the best achievable mean squared error scale with ?
Show the answer
C.
. Halving the error takes times as much data. k-NN with achieves it.
In high-dimensional data with i.i.d. coordinates, which points tend to become hubs, appearing in many other points' nearest-neighbor lists?
- Outliers far from the data
- Points close to the data mean, which are slightly closer than average to everyone
- Points chosen at random, with no pattern
- Only duplicated points
Show the answer
B. Points close to the data mean, which are slightly closer than average to everyone
Distances to the mean concentrate but keep some spread. A point slightly nearer the mean is, on average, slightly nearer to all other points, and when every distance is almost equal that small edge puts it into many neighbor lists. Radovanović et al. measured a correlation of about between and the distance to the mean for uniform data in 100 dimensions.
Further reading
- K. Beyer, J. Goldstein, R. Ramakrishnan & U. Shaft, "When is 'nearest neighbor' meaningful?" Database Theory — ICDT'99, LNCS 1540, 217–235 (1999).
- C. J. Stone, "Optimal global rates of convergence for nonparametric regression," Annals of Statistics 10(4), 1040–1053 (1982).
- S. Kpotufe, "k-NN regression adapts to local intrinsic dimension," Advances in Neural Information Processing Systems 24 (2011).
- C. C. Aggarwal, A. Hinneburg & D. A. Keim, "On the surprising behavior of distance metrics in high dimensional space," Database Theory — ICDT 2001, LNCS 1973, 420–434 (2001).
- M. Radovanović, A. Nanopoulos & M. Ivanović, "Hubs in space: popular nearest neighbors in high-dimensional data," Journal of Machine Learning Research 11, 2487–2531 (2010).