Show that, as n→∞, the error rate of the 1-nearest-neighbour classifier for two classes is at most 2R∗(1−R∗), where R∗ is the Bayes error. What does it say numerically for R∗=0.1?

Supervised learning, k-nearest neighbours
Level L4 Advanced. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can derive the Cover–Hart bound: the nearest neighbour's label behaves like an independent draw from the posterior.

Key idea

Given x with posterior η(x)=P(y=1∣x), the 1-NN error tends to 2η(1−η), and E[2η(1−η)]≤2R∗(1−R∗).

Steps

  1. As n→∞, the nearest neighbour x′ of x gets arbitrarily close to x, so its posterior is η(x′)→η(x). Its label y′ is then a fresh draw with P(y′=1)=η(x), independent of the test label y.
  2. 1-NN is wrong when y≠y′. So P(error∣x)=η(1−η)+(1−η)η=2η(x)(1−η(x)).
  3. The Bayes error at x is r(x)=min⁡(η,1−η), and η(1−η)=r(1−r) because the product is symmetric. So the 1-NN error is RNN=E[2r(1−r)].
  4. Expand: RNN=2E[r]−2E[r2]=2R∗−2E[r2], using E[r]=R∗.
  5. By Jensen's inequality, E[r2]≥(Er)2=R∗2 (equivalently E[r2]=R∗2+Var(r)). Hence RNN=2R∗(1−R∗)−2 Var(r)≤2R∗(1−R∗).
  6. Since 2R∗(1−R∗)≤2R∗, the 1-NN error is at most twice the Bayes error. For R∗=0.1: RNN≤2(0.1)(0.9)=0.18.
  7. Interpretation: 1-NN copies a single noisy label, so it is at most about twice as bad as the best possible rule. With a bigger k, the bound improves towards R∗.

Common mistakes

How long your answer should be

One page; 8 minutes.

Last checked on 4 December 2026.

Read this

Previous in Supervised learning: For a kernel density estimate f^(x)=1nh∑iK ⁣(x−xih) in one dimension, derive the leading terms of its bias and variance at a point x. Hence what is the bandwidth that minimises the asymptotic mean squared error, and at what rate does the error shrink with n?
Next in Supervised learning: LDA and logistic regression both give linear decision boundaries. When would you expect each to do better, and why, in terms of data size, model correctness and outliers?