Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2023/iii/paper-218/6/b/solution

Let index the closest training covariates to . The K-nearest neighbors algorithm estimates
and predicts one when this average is at least .
Small gives low smoothing bias but high sampling variance and a jagged decision boundary. Larger averages more labels, reducing variance and producing a smoother boundary, but it mixes increasingly distant covariates and raises bias. The optimal balance depends on sample size, dimension, and smoothness of , and is commonly selected by cross-validation.

New to topics? Read the docs here!