http://afewguyscoding.com/2010/05/nearest-neighbors-java/
http://www.programcreek.com/2013/01/use-k-nearest-neighbors-knn-classifier-in-java/
this content :
Use K-Nearest Neighbors (KNN) Classifier in
Java
Case Study
Image you have a blog which contains a lot of nice articles. You put ads at the top of each
article and hope to gain some revenue. After a while and from your report, you see that some
posts generate revenue and some do not. Assuming that whether an article generates revenue
or not depends on how many pictures and text paragraphs in it.
Given the dataset:
we can plot them in the figure below.