Contents
08Interview questions and model answers
Q1What is the curse of dimensionality?
As the number of features d grows, the volume of the feature space grows exponentially, so a fixed amount of data becomes sparse: with 10 bins per feature there are 10^d cells, and 100 points leave 90.5\% of 1{,}000 cells empty in three dimensions. Neighborhoods must become large to contain any data (e_d(r)=r^{1/d}, 0.79 for 10\% of the data in ten dimensions), volume moves to the boundary, and distances concentrate. Methods that rely on local similarity need exponentially more data. The phrase is due to Bellman (1957).
Q2Why does k-nearest neighbors suffer in high dimensions?
Two reasons. Its neighbors are far away, so it averages points unlike the query (bias): the median distance to the nearest of 500 points in the unit ball is 0.52 in ten dimensions. And distances concentrate, so the nearest and farthest neighbor are almost equally far (D_{\max}/D_{\min} fell from 3.9 to 1.13 on the noisy digits), and irrelevant features decide who is “nearest”.
Q3Show that most of the volume of a high-dimensional ball is near its surface.
Volume scales as r^d, so the inner ball of radius 1-\epsilon holds (1-\epsilon)^d of the volume and the shell 1-(1-\epsilon)^d. For \epsilon=0.1 that is 27\% in three dimensions, 65\% in ten and 99.997\% in a hundred. Uniform points have radius density d\rho^{d-1}; Gaussian samples have norm about \sqrt d.
Q4Why do distances lose their meaning? Can you quantify it?
The squared distance is a sum of d independent terms, so its mean grows like d while its standard deviation grows like \sqrt d; the distance itself has a nearly constant spread (about 0.24 in the unit cube) around a mean \sqrt{d/6}, a relative spread of 0.59/\sqrt d. Beyer et al. (1999): if the relative spread goes to zero, D_{\max}\le(1+\epsilon)D_{\min} with probability tending to one.
Q5Does cosine similarity or the L_1 distance fix it?
Partly. Cosine between random vectors concentrates around 0 with standard deviation 1/\sqrt d. L_1 and fractional norms keep more contrast than L_2 (Aggarwal et al., 2001), but relative contrast still falls. The real fix is fewer, better features or a better representation.
Q6Which models suffer most, and which least?
Most: k-nearest neighbors, kernel methods with a fixed bandwidth, density estimation, histograms and distance-based clustering, which reason by locality. Less: models with strong assumptions, such as regularized linear models (error about \sigma^2(1+p/N)), trees that pick one feature at a time, and convolutional networks, whose locality and weight sharing encode the structure of images.
Q7If high dimensions are so bad, why does deep learning work on images with millions of pixels?
Real images are not spread through pixel space: a random point is static. They lie near a low-dimensional manifold (one rotating digit traces a circle on two principal components out of 4{,}096 dimensions), and convolutional networks build in locality and translation invariance. Large data sets help too.
Q8How would you detect and fix the curse in practice?
Detect: plot validation error against the number of features (peaking), compare training and validation error, and check the ratio D_{\max}/D_{\min} or the histogram of pairwise distances. Fix: feature selection or L1 regularization (on the noisy digits, 64 selected pixels gave 98.5\%), dimensionality reduction with PCA or an autoencoder (checking that the kept directions predict the label), a model with built-in structure, a better distance, or more data.