K-nearest neighbors algorithm (source code)

= K-nearest neighbors algorithm
{c}
{wiki}

The K-nearest neighbors algorithm predicts from the labels or responses of the $K$ training observations closest to the query under a chosen distance.