The laziest classifier that works: to label a point, just ask its nearest neighbors to vote. Watch the decision regions shift as you change k.
k-Nearest NeighborsLive
classify by your neighbors
Controls
Presets
k-NN classifies a point by majority vote of its k nearest labeled neighbors. Small k gives jagged, overfit boundaries that chase noise; large k smooths them out but can blur real structure. It is the simplest possible classifier — no training at all. Educational tool.
★ Sign in to save this setupSave your tuned setup, or drop this simulation into your own site, docs, or course page.
How it works
k-NN stores the training data and classifies a new point by majority vote of its k closest examples. A small k hugs every point (low bias, high variance); a large k smooths the boundary (higher bias, lower variance). It needs no training but grows costly at prediction time. Educational tool.
✦
Ask the AI about this model
The math, the assumptions, real-world uses, or a code translation — explained for this exact simulation.
Is this knn classifier simulator tool really free?▾
Yes. k-Nearest Neighbors runs entirely in your browser using your device's own compute, so local use is free forever. You only pay Compute Tokens if you scale a job to the cloud.
Do I need to install anything?▾
No. Everything runs client-side in a modern browser — no downloads, no license, no account required to start.
Can I save or share my simulation?▾
Create a free account to save projects, and use a shareable embed or minted DOI to publish a live, interactive version anywhere.
How accurate are the results?▾
The solver uses established numerical methods, but results are for research and educational purposes and should be validated against experiment or professional review before you rely on them.