Projection & neighbours
Rotate a 2D dataset into one dimension. Watch distances change—and predictions stay the same.
1. Drag the axis to rotate the projection
2. The same points, projected onto a line
3. High variance ≠ better classification
180 evenly spaced directions, sorted by retained variance. Click a position to explore it.
Why the plateau?
Geometry changes continuously; votes don’t. Many angles keep the same neighbours. Even when a neighbour changes, its class may be the same, so the prediction—and test accuracy—can stay flat.
Order swaps are only part of the story. Training points can cross each other in the 1D projection without changing the neighbour set. Conversely, points on opposite sides of a query can exchange which is closer without crossing. “Next neighbour change” finds either kind of distance tie at the k-neighbour boundary.
Variance ignores labels. It measures spread, not class separation. The sorted plot hides the size of the gaps between directions. Accuracy also changes in discrete steps: one test prediction at a time.
Opposite axes are equivalent. Angles θ and θ + 180° reverse the line but preserve every distance. We only need a half turn. The demo is synthetic—not penguin measurements.