In pattern recognition, the k-nearest neighbors algorithm (k-NN) is a non-parametric method for classification and regression that predicts objects' "values" or class memberships based on the k closest training examples in the feature space. k-NN is a type of instance-based learning, or lazy learning where the function is only approximated locally and all computation is deferred until classification. The k-nearest neighbor algorithm is amongst the simplest of all machine learning algorithms: an object is classified by a majority vote of its neighbors, with the object being assigned to the class most common amongst its k nearest neighbors (k is a positive integer, typically small). If k = 1, then the object is simply assigned to the class of that single nearest neighbor.
renkun-ken / knn Goto Github PK
View Code? Open in Web Editor NEWA k-NN based non-parametric non-linear non-stationary time series predictor