K-Nearest Neighbors Visualizer

Class 1
Class 2
Test Point
Click on the plot to add a test point and see KNN classification.

How K-Nearest Neighbors Works

K-Nearest Neighbors (KNN) is a simple, instance-based learning algorithm that classifies new data points based on their similarity to existing data points.

Algorithm Steps:

  1. Store all training data points
  2. When classifying a new point:
    1. Calculate distances to all stored points
    2. Select the k nearest points
    3. Assign the most common class among these neighbors

Key Parameters:

Characteristics: