In k-nearest neighbours classification, what happens to the decision boundary when and when (the training set size)? How does this show the bias–variance trade-off, and how would you choose ?
Supervised learning, k-nearest neighbours
Level L1 Beginner. Length Short. Nature Th Theoretical.
What's being asked
Whether you can link to model flexibility and name a sensible way to choose it.
Key idea
Small gives a wiggly boundary (low bias, high variance); large gives a smooth boundary (high bias, low variance).
Steps
- For , each test point copies the label of its single nearest training point. The training error is zero, and the boundary follows every point, including noisy ones. This is low bias but high variance.
- For , every test point is compared with all training points, so every point gets the majority class of the whole training set. The boundary disappears. This is very high bias, very low variance.
- Intermediate averages over a neighbourhood: more neighbours cancel noise (less variance) but the neighbourhood grows and mixes classes (more bias).
- Choose by cross-validation on a validation set, never on the training set (where always looks best). For two classes, use odd to avoid ties.
Common mistakes
- Measuring training error with and concluding it is perfect. The training point is its own nearest neighbour.
- Mixing up the direction: a larger means a simpler model, not a more complex one.
- Choosing on the test set.
How long your answer should be
4–5 sentences.
Last checked on 4 December 2026.
Read this
Previous in Supervised learning: What is the difference between a generative and a discriminative classifier? What is one example of each, and when would you prefer each?
Next in Supervised learning: What is a kernel density estimate (Parzen window estimate), and what does the bandwidth control? Why is the method called non-parametric?