Voting Among Several Nearby Examples
A nearest-neighbor classifier can predict from the labels of the k closest examples. Choice of k and a tie rule affect the decision.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace three neighbors
If the nearest labels are B, A, A, one-neighbor classification gives B and three-neighbor voting gives A. Frequency counts represent that vote.
Account for ambiguous distances
Two candidates can tie for the final included neighbor. Specify the distance and tie handling, or use appropriate weighting. Feature scaling influences which examples are close.[1]
Separate distance cutoff ties from equal label votes
With the three nearest neighbors labeled A, B and B, majority vote predicts B. With four neighbors labeled A, B, B and A, the label votes tie. Ties also occur if several points are equally distant at the cutoff for choosing the \(k\) neighbors. See one-dimensional nearest neighbors.
k=3: A,B,B → B
k=4: A,B,B,A → tie
A stable neighbor selection and label rule give repeatable behavior
Specify what an odd neighbor count guarantees
An odd count prevents equal top totals for two labels under a simple unweighted binary vote. Several labels can still tie, and weighted votes behave differently. Test these conditions explicitly.