The k-Nearest Neighbours algorithm in three dimensions: two classes of data points in 3D space, new points are classified live with their k nearest neighbours shown connected. The scene can be freely rotated and zoomed.
The app shows how the kNN algorithm works in a three-dimensional feature space. Two classes of training data — blue and red — are distributed as spheres in space. New, initially white data points appear one by one and are classified: first their k=5 nearest neighbours are shown connected by lines, then the point takes on the colour of the majority class.
The animation illustrates the fundamental principle of kNN: classification by similarity in feature space — without any training, solely through distances.
Rotate the scene by clicking and dragging. Zoom with the scroll wheel. The classification of new data points runs automatically — observe how points in the border region between the two classes are classified with more uncertainty than points deep inside a class.
Interested in AI visualisations for teaching?
The VisualApps are created as a teaching and transfer project at Reutlingen University and are used in corporate training and talks.
Get in touch