For two classes, how do you derive the asymptotic error of the 3-nearest-neighbour rule as a function of the posterior η(x), and how do you show that it is never worse than the 1-NN rule at every x? What are the errors of both rules when the local Bayes error is r=0.1?

Supervised learning, k-nearest neighbours
Level L5 Expert. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can extend the Cover–Hart argument to a majority vote of three independent labels.

Key idea

With three neighbour labels distributed as independent Bernoulli(η), the conditional 3-NN error is η(1−η)+4η2(1−η)2.

Steps

  1. As n→∞, the three nearest neighbours of x converge to x, and their labels are independent draws of Bernoulli(η) with η=η(x), independent of the test label y.
  2. The vote is wrong when the test label is 1 and at least two neighbours say 0, or the test label is 0 and at least two say 1.
  3. P(≥2 zeros)=(1−η)3+3η(1−η)2=(1−η)2(1+2η). P(≥2 ones)=η3+3η2(1−η)=η2(3−2η).
  4. Error: η(1−η)2(1+2η)+(1−η)η2(3−2η)=η(1−η)[(1−η)(1+2η)+η(3−2η)].
  5. The bracket equals 1+η−2η2+3η−2η2=1+4η(1−η). So e3(η)=η(1−η)[1+4η(1−η)]=η(1−η)+4η2(1−η)2.
  6. Compare with e1(η)=2η(1−η). With t=η(1−η)≤14: e3=t+4t2 and e1=2t. Then e3≤e1  ⟺  4t2≤t  ⟺  t≤14, which is always true.
  7. Numbers: r=0.1 (so η=0.1 or 0.9, t=0.09): e1=0.18 and e3=0.09+4(0.0081)=0.1224. Both are above the Bayes value 0.1, but 3-NN is much closer.
  8. Sanity check: at η=12, t=14, e3=14+14=12=e1, the Bayes error, as it should be.

Common mistakes

How long your answer should be

About a page; 7 minutes.

Read this

Previous in Supervised learning: For a hard-margin SVM trained on n linearly separable points, how do you prove that the leave-one-out error is at most NSV/n, where NSV is the number of support vectors, and what does this imply about the expected test error?
Next in Supervised learning: Write the optimality (KKT) conditions for the lasso min⁡β12∥y−Xβ∥2+λ∥β∥1. Using them, what is the smallest λ at which β^=0, and how do you verify that β^=(1.5,0) is the solution for X=I2, y=(3,1), λ=1.5?