ML Math Lab — KNN: Neighborhood Scanner
Move your scanner → nearest neighbors light up → majority vote decides the class
Mode: Explore
Goal: Understand K + Noise
Score: 0
Zoom
Section 1 — What you will learn
By the end you will understand
  • K: how many neighbors vote for the answer.
  • Majority vote: whichever team is bigger among the K neighbors wins.
  • Distance: Euclidean (circle) vs Manhattan (diamond).
  • Noise: infiltrators + jitter that tries to fool the scanner.
  • Why K matters: small K can overfit; big K can underfit.
Section 2 — Controls
Challenge adds scoring + auto-stop when accuracy becomes “smart”.
Tip: K=1 can be too jumpy. Higher K becomes smoother.
Watch the radar shape change.
Try 0.20 vs 0.80 and watch the territory change.
Noise is visual: more mismatched dots + wobble + weaker confidence.
This controls how fast probes and stats update.
Break it adds: extra label flips + drifting clusters + outliers.
The arena is a “feature space” map. Each dot is one real case.
How to play:
• Move mouse on the map → radar scans neighbors.
• Click → drop a probe (it will be scored).
• Yellow probes = training probes. Cyan probes = test probes (hidden until Reveal).

Section 3 — Live stats
Predicted class (cursor)
Confidence (vote %)
Global Accuracy
Test Accuracy
Hidden
Noise Confusion
Overfit Risk (Train−Test)
Hidden
Live Chart — Accuracy over time
This updates continuously while probes run.

Section 4 — Math (simple)
How KNN decides Hover = see distance + votes
Loading…
🧠 Kid Coach
Loading…
Tip: Try K=1 vs K=15 and compare the territory.

Section 5 — Arena legend (kept LEFT)
Green dots = class 1 (YES)
Red dots = class 0 (NO)
Blue glow = probability field (how likely class 1 is)
Radar = your scanner ring (or diamond)
Lasers = links to K nearest neighbors
Yellow probe = train probe, Cyan probe = test probe (truth)