This is a Java implementation of the AI algorithm k-nearest neighbours (KNN) used for classification.

Constructor: NearestNeighbour(ArrayList<DataEntry> dataset, int k).


Main method included to give an example of use.

 

This algorithm has been enhanced and included in my more general ML library.

Attachments:
Access this URL (http://thiele.nu/attachments/article/3/NearestNeighbour.java)NearestNeighbour.java[ ]3 kB