Encyclopedia · 176 concepts

Core ML Concepts · beginner · concept 18 of 176

k-Nearest Neighbors (kNN)

Classify a point by asking what its k closest neighbors are. No training at all, just distance and a vote, which makes it the clearest intuition pump in ML and a surprisingly modern one: nearest-neighbor search over embeddings is exactly how vector databases retrieve, so kNN quietly powers RAG.

Key terms

Distance metricsChoice of kLazy learningCurse of dimensionalityNearest-neighbor search

Learn these first

Where you meet it in the real world

Similarity search, recommendation fallbacks, anomaly detection, the retrieval half of RAG