AI engineering glossary · Classical ML algorithms
What is k-nearest neighbours?
k-nearest neighbours (also called kNN, k-NN): A method that predicts for a new point by finding the k most similar training points and taking their majority class or average value. It has no training phase beyond storing the data, works with any distance, and is simple, but slows down on large data and suffers from irrelevant features.
k-nearest neighbours: an example
With k=5, if 4 of the 5 closest customers to a new one churned, the model predicts churn.
Related terms
More Classical ML algorithms terms
Where you learn it
k-nearest neighbours is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.