Neighborhood
Rank training points by distance to the query and keep the closest k.
A training-free classifier built from nearby examples
KNN stores the training set and labels a new point by majority vote among its k nearest examples.
The essential idea: small k follows local detail; large k smooths the decision rule.
Rank training points by distance to the query and keep the closest k.
The most frequent label inside that local neighborhood becomes the prediction.
First inspect the neighbors behind one prediction. Then use the noisy half-moon example from the slides to see how k controls overfitting and underfitting.
The slides use two noisy interlocking half-moons. Change the only hyperparameter, k, and watch the decision boundary move from noise-sensitive to overly smooth.
KNN makes no parametric fit; its complexity is controlled mainly by the neighborhood size k.