You are viewing the RapidMiner Studio documentation for version 8.2 - Check here for latest version
k-NN
(RapidMiner Studio Core)
Synopsis
This Operator generates a k-Nearest Neighbor model, which is used for classification or regression.Description
The k-Nearest Neighbor algorithm is based on comparing an unknown Example with the k training Examples which are the nearest neighbors of the unknown Example.
The first step of the application of the k-Nearest Neighbor algorithm on a new Example is to find the k closest training Examples. "Closeness" is defined in terms of a distance in the n-dimensional space, defined by the n Attributes in the training ExampleSet.
Different metrices, such as the Euclidean distance, can be used to calculate the distance between the unknown Example and the training Examples. Due to the fact that distances often depends on absolut values, it is recommended to normalize data before training and applying the k-Nearest Neighbor algorithm. The metric used and its exact configuration are defined by the parameters of the Operator.
In the second step, the k-Nearest Neighbor algorithm classify the unknown Example by a majority vote of the found neighbors. In case of a regression, the predicted value is the average of the values of the found neighbors.
It can be useful to weight the contributions of the neighbors, so that the nearer neighbors contribute more to the average than the more distant ones.