Skip to main content
All terms
Foundations

K-Nearest Neighbors

A simple method that classifies a new item by looking at its closest known examples.

Definition

K-nearest neighbors (kNN) makes a prediction for a new item by finding the k most similar examples in the training data and taking their majority label or average value. It needs almost no training, but it can be slow and memory-heavy because it compares against all stored examples at prediction time.