K-nearest neighbor (knn) is a nonparametric lazy learning method. From a nonparametric view, it does not make any assumptions about data distribution. In terms of lazy learning, it does not require an explicit learning phase for generalization. The following recipe will introduce how to apply the k-nearest neighbor algorithm on the churn dataset.
You need to have the previous recipe completed by generating the training and testing datasets.
Perform the following steps to classify the churn data with the k-nearest neighbor algorithm:
classpackage and have it loaded in an R session:
> install.packages("class") > library(class)