thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

AI & Machine Learning · Intermediate

K-Nearest Neighbors (k-NN)

A non-parametric algorithm that predicts by majority vote or average of the k closest training examples.

Definition

k-NN stores the training data and, at prediction time, finds the k nearest points by a distance metric. It needs no training phase but inference is slow on large datasets and it is sensitive to feature scaling and high dimensionality. Approximate nearest neighbor search applies the same idea to vector databases.

Exam tip

k-NN requires scaled features; k is the number of neighbors, not clusters.

Related terms