Skip to content
LearnStatisticspowered by UpThink

Statistics and data science, defined

k-Nearest neighbor

K-nearest-neighbor (K-NN) is a machine learning predictive algorithm that relies on calculation of distances between pairs of records. The algorithm is used in classification problems where training data are available with known target values. The algorithm takes each record and assigns it the class to which the majority of its k nearest neighbors belongs. For a prediction problem, the algorithm assigns the record the average value among its k nearest neighbors.

Where this gets used

We teach data science and statistics online, one subject at a time, on fixed start dates with an instructor who marks your work.