Start hereWhat happens when prediction is literally “look at similar examples”?
KNN stores training examples and predicts from the labels or targets of nearby points. The geometry of the feature space is therefore the model.
Building interactive view…
Technical lensFormalise what the visual is doing
Distance metric, scaling, k and weighting define neighbourhoods. Small k lowers bias but raises variance; large k smooths local structure.
Technical questionUse a tiny case to make the mechanism observable. Distance metric, scaling, k and weighting define neighbourhoods. Small k lowers bias but raises variance; large k smooths local structure. Verify one intermediate quantity, state change or mapping independently; then predict the consequence of this change: Move k from 1 to a large value and watch local boundaries become smoother.
Practitioner lensUse it responsibly
Scale features and consider dimensionality. KNN can be expensive at inference and deteriorates in high-dimensional sparse spaces.
Transfer testTransfer this idea to a new example and justify each decision using this practitioner rule: Scale features and consider dimensionality. KNN can be expensive at inference and deteriorates in high-dimensional sparse spaces. Then explain what should change if you deliberately test: Move k from 1 to a large value and watch local boundaries become smoother.
Worked explorationUse the visual as an experiment, not decoration
Place labelled points on a line and classify a new point using k=1, 3 and 5. Observe how small k reacts strongly to local noise while larger k smooths the boundary.
Technical lens
Distance metric, scaling, k and weighting define neighbourhoods. Small k lowers bias but raises variance; large k smooths local structure.
Practitioner check
Scale features and consider dimensionality. KNN can be expensive at inference and deteriorates in high-dimensional sparse spaces.
Prediction before interactionMove k from 1 to a large value and watch local boundaries become smoother.
Exploration walkthroughTurn the interaction into an evidence trail
Place labelled points on a line and classify a new point using k=1, 3 and 5. Observe how small k reacts strongly to local noise while larger k smooths the boundary. Before moving the control, state your prediction. After the visual changes, name the specific state, statistic, boundary or mapping that changed and explain why that change is consistent—or inconsistent—with your prediction.
- Record one observable quantity before the interaction and the same quantity afterwards.
- Change one factor at a time so the causal effect of the control is inspectable.
- Use an edge or failure case to discover where the concept stops behaving as the simple story suggests.