What is the curse of dimensionality?
The curse of dimensionality is the set of problems that appear when data has many features: the volume of the space grows exponentially with the number of dimensions, so a fixed number of samples becomes sparse, and distances between points become nearly equal. The term was coined by Richard Bellman in the context of dynamic programming.
It matters wherever a model relies on distance or local density. k-nearest neighbors, k-means clustering, kernel methods, and anomaly detectors all degrade when many features carry little signal. Gene-expression studies with 20,000 genes and a few hundred patients, recommendation data with millions of sparse columns, and raw image pixels all face it. The standard responses are feature selection, dimensionality reduction such as PCA, regularization, and collecting more data.
Key ideas
- Volume grows exponentially with dimension, so a fixed sample becomes sparse.
- In high dimensions, almost all of a cube's volume lies in its corners.
- Pairwise distances concentrate, so the nearest and farthest neighbors are nearly the same distance away.
- k-NN neighborhoods must span most of each axis to hold even a few points.
- Irrelevant features dilute distances and hurt distance-based models most.
- Feature selection, dimensionality reduction, and regularization are the main remedies.
Common questions
Does the curse of dimensionality affect deep learning?
Less than the raw input size suggests. Neural networks learn their own low-dimensional representations, and natural data such as images lies near a low-dimensional manifold, so a 150,000-pixel image does not need 10^150,000 samples. The curse still shows up in nearest-neighbor search over embeddings, which is one reason vector databases use approximate methods and cosine similarity.
How many samples do I need per feature?
There is no universal rule. For linear models, a common heuristic is at least 10 to 20 samples per feature, while nonparametric methods like k-NN need far more because their data needs grow exponentially with dimension. Regularization and feature selection lower the requirement, and cross-validation shows whether a given dataset is enough.
Is there a blessing of dimensionality?
Yes. In more dimensions, classes are more often linearly separable, which is the idea behind kernel methods. Concentration of measure also makes random projections reliable: the Johnson-Lindenstrauss lemma says points can be projected to about log(n)/ε² dimensions while preserving pairwise distances within a factor of 1 ± ε.
Does using cosine similarity instead of Euclidean distance fix the problem?
Not fully. Cosine similarity removes the effect of vector length, which helps for text and embeddings, but similarities between random high-dimensional vectors still cluster tightly around zero. Aggarwal et al. found that metrics with smaller exponents, such as Manhattan distance, keep more contrast than Euclidean distance as dimension grows.
Related explainers
- K-Nearest Neighbors — Classification by proximity and distance metrics
- Dimensionality Reduction — PCA and t-SNE — seeing high-dimensional data
- Feature Selection — Filter, wrapper, and embedded methods for choosing features
- Norms & Distance Metrics — L1, L2, cosine similarity — measuring closeness in vector spaces
- Regularization — Dropout, L1, and L2 — keeping models honest
- K-Means Clustering — Unsupervised grouping by centroid distance
References
- Beyer, Goldstein, Ramakrishnan & Shaft (1999), "When Is 'Nearest Neighbor' Meaningful?", ICDT
- Aggarwal, Hinneburg & Keim (2001), "On the Surprising Behavior of Distance Metrics in High Dimensional Space", ICDT
- James, Witten, Hastie & Tibshirani, "An Introduction to Statistical Learning", ch. 6
Last updated