this is code from the blog of wavecrafters: http://blog.wavecrafters.com
This is code for playing with the k-nearest neighbors (k-NN) classifier.
It has 2 classifiers, 2 k-nn methods, the weightedknn and the knnestimate, this one without weights, meaning that each point of the k set contributes the same to the estimation.
Original code from the Toby Segaran great book Programming Collective Intelligence, but instead of Python I'm using Ruby, I love Ruby.