Supervised Learning

K-Nearest Neighbors (KNN)

Interactive classification visualizer. Add data points of two classes and see how new points are classified based on the 'K' closest neighbors.

Click on the plot to add points!

🔍 Classification Result

--
Class A: 0 Class B: 0

🧠 How it works

  • Step 1: Select a class and click to add training points.
  • Step 2: Select "Query Point" and click anywhere.
  • Step 3: The algorithm finds the K closest training points (Euclidean distance).
  • Step 4: The query point is assigned the majority class of its neighbors.

💡 Pro Tip

Try changing K to see how the decision boundary shifts. A small K is sensitive to noise, while a large K might smooth over small boundaries.

Riverside