Nearest Neighbor Applet
How to use the applet?
Note: The mean of the normal distribution is the center of the canvas and the standard deviation is 1/4 of the width. The points are generated using the polar method described in "Random variate generation in one line of code". Other links on random number generation can be found at Random Number Generation (Luc Devroye) .
Nearest Neighbor Search mode:
The search mode is where the projection methodsearch algorithm is tested. If you click in the canvas, you can see 5 things:
You will also find a message text field with some information about the nearest neighbors' search:
Simulation of random test points:
The search mode previously described allows you to input only a single test point at a time. However, we are also interested to see the average results of a lot of test points to observe how the algorithm performs in the long run. To accomplish that, the applet has a button "Go Simulation" that start a series of a 1000 uniformly distributed random tests point. The result of this series of test is the average number of distance computed per test compared to the brute force method. It is displayed in the message text field at the bottom of the applet. Here is an example with 300 normaly distributed points in the data set and k = 1:
Average Number Of Compare: 54/300 (18%)
"54" is the average number of compare (or distance computations) done per test and "300" is the number of compare using the bute force method. The ratio (%) is also displayed.
This option allows you to study the influence of the data set's distribution and size as well as the number of nearest neighbors to search.
Java Source :
(right click and save) Nearest.java