K nearest neighbors (KNN) algorithm

In Machine Learning and Pattern Recognition, K nearest neighbors (K-NN) is an algorithm which is used for classification and regression and is based on the idea of considering the nearest K data points for calculations.

This is a companion discussion topic for the original entry at http://iq.opengenus.org/k-nearest-neighbors-algorithm/