K-Nearest Neighbors

Interactive classification using K-nearest neighbors algorithm

Click on the canvas to classify a test point
Classes:

Sample Datasets

Algorithm Parameters

1 (Precise)15 (Smooth)

How KNN Works

K-Nearest Neighbors classifies a test point by finding the K closest training points and using majority vote.

Distance Metric: Euclidean distance between points in 2D space.

Decision Boundary: Shows regions where each class dominates. Boundaries become smoother with higher K values.

Interactive: Click anywhere on the canvas to see how a new point would be classified!