K-nearest neighbor

What is k-nearest neighbor?

The k-nearest neighbors algorithm (k-NN) is a non-parametric supervised learning method used for classification and regression. It works by selecting the k closest training examples in a dataset as input. The output depends on whether k-NN is used for classification or regression:

  • In k-NN classification, the output is the class membership.
  • In k-NN regression, the output is the property value for the object.

The k-NN algorithm is sensitive to the local structure of the data.

Back to all