k-Nearest Neighbors

One of the simples algorithms in Machine Learning is k-Neares Neighbors. It is considered a “lazy learning” algorithm where all the calculations are deferred until classification.
It works like this:
You have out training data with its features and labels. Then upon classification, or testing the data, you take the k-nearest neighbors and assign the label for your test feature with what the majority vote of the k-nearest neighbors is. If k=1 then your features label with be that of its closes neighbor.

The Dataset

The 1NN classification map

The 5NN classification map

(Images from: wikipedia)

Leave a Reply

Your email address will not be published.