🧮 Brain Teaser

Sunday, July 5, 2026

Today's topic: ML / statistics insight

The Blessing of Dimensions: When Does the Nearest Neighbor Lie?

You have nn training points drawn i.i.d. uniformly from the dd-dimensional unit hypercube [0,1]d[0,1]^d, and you want to predict at the origin 0\mathbf{0}.

The 1-nearest neighbor classifier uses the single closest training point to make its prediction.

To "capture" a fraction rr of the data (i.e., so that the expected number of training points within a ball of radius \ell around the origin is rnrn), the required edge length \ell of a sub-cube satisfies:

=r1/d.\ell = r^{1/d}.

The puzzle: Suppose you want to use the nearest r=1%r = 1\% of the data to make a local estimate. Compute \ell for d=1,2,10d = 1, 2, 10 and explain what this reveals about nearest-neighbor methods in high dimensions. What is the conceptual implication for the bias of 1-NN?

Note: Use r=0.01r = 0.01 throughout.

curse of dimensionalitynearest neighborbiashigh dimensionslocal methods

Ridge Regression as Augmented OLS: The Data-Augmentation Trick

Recall that the ridge regression estimator for y=Xβ+εy = X\beta + \varepsilon minimizes

RSSλ(β)=yXβ2+λβ2.\text{RSS}_\lambda(\beta) = \|y - X\beta\|^2 + \lambda\|\beta\|^2.

Problem: Show that this is exactly equivalent to performing ordinary least squares (no penalty at all) on an augmented dataset (X~,y~)(\tilde{X}, \tilde{y}), where

X~=(XλIp),y~=(y0).\tilde{X} = \begin{pmatrix} X \\ \sqrt{\lambda}\, I_p \end{pmatrix}, \qquad \tilde{y} = \begin{pmatrix} y \\ 0 \end{pmatrix}.

That is, show that β^ridge=(X~TX~)1X~Ty~\hat{\beta}_{\text{ridge}} = (\tilde{X}^T \tilde{X})^{-1}\tilde{X}^T \tilde{y}.

Bonus reflection: What does this say conceptually about what ridge regression is doing to the data?

ridge regressiondata augmentationshrinkagenormal equationsregularization

Questions generated automatically twice a day · browse the archive →