Topic summary

K-nearest neighbor

K-nearest neighbor

Extracted from the Wikipedia article K-nearest neighbors algorithm.

In statistics and machine learning, the k-nearest neighbors algorithm (k-NN) is a non-parametricsupervised learning method that assigns weightage only to the k (number of) nearest neighbors of an entity in making a decision about the entity. It is used both in classification -- where a new example is assigned a label based on the labels of its k nearest training examples; and in regression -- where the prediction is computed from the values of those neighbors. Its more frequent use is for classification, as the k-NN classifier, the output of which is a class membership decided by a plurality vote of its neighbors. k, an integer, is typically small; if k = 1, then the object is simply assigned to the class of that single nearest neighbor. It was first developed by Evelyn Fix and Joseph Hodges in 1951, and later expanded by Thomas Cover.