statable Statistics for study and research

k-nearest neighbours (kNN)

A simple method for classification or prediction: for a new case, the k most similar cases are sought. It gets the most frequent class (or the mean) of these neighbours.

Example: k = 3. Of the three nearest neighbours, two have class A and one class B. The new case gets A.

Caution: The variables should be scaled equally, otherwise the one with the largest values determines the distance. The choice of k is checked by cross-validation.

Related

Open in Statable