The Nearest Neighbor Algorithms Demo

by Kristof Van Laerhoven


This page contains the implementations of a few lazy learning algorithms from chapter 8 of the book Machine Learning by T.M. Mitchell. To use an algorithm, click with the mouse on the plot. The plot already has positive and negative training instances, which were generated at random. The current mousepointer position will be the x-y position of the test-input. Look at the source of this html-file to see how different parameters can be used for the algorithm.

The Nearest Neighbor Algorithm

alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."Your browser is completely ignoring the <APPLET> tag! alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."Your browser is completely ignoring the <APPLET> tag! Red = negative training instances
Green = positive training instances
White = current user-input
Black = the nearest neighbor
The colored bar at the bottom indicates to which class the current input belongs

The Nearest Neighbor Algorithm

alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."Your browser is completely ignoring the <APPLET> tag! alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."Your browser is completely ignoring the <APPLET> tag! Red = negative training instances
Green = positive training instances
White = current user-input
Black = the k nearest neighbors
The colored bar at the bottom indicates to which class the current input belongs

The Distance-Weighted Nearest Neighbor Algorithm

alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."Your browser is completely ignoring the <APPLET> tag! alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."Your browser is completely ignoring the <APPLET> tag! Red = negative training instances
Green = positive training instances
White = current user-input
Black = the distance-weighted k nearest neighbors
The colored bar at the bottom indicates to which class the current input belongs