K-nearest neighbours classification algorithm.
@author: drusk
K-Nearest Neighbours classifier.
This algorithm classifies samples based on the ‘k’ closest training examples in the feature space. The sample’s class is predicted through a majority vote of its neighbours.
In the case of a tie, the distances to each tied class are summed amongst the neighbours. The class with the minimum distance to the sample is selected to break the tie.
This is an example of a ‘lazy learning’ algorithm where all computation is deferred until classification.
Constructs a new Knn classifier.