numberkof neighbors this is where the name of the -nearest neighbors algorithm comes from when considering more than one neighborwe use voting to assign label this means that for each test pointwe count how many neighbors belong to class and how many neighbors belong to class we then assign the class that is more frequentin other wordsthe majority class among the -nearest neighbors the following example (figure - uses the three closest neighborsin[ ]mglearn plots plot_knn_classification(n_neighbors= figure - predictions made by the three-nearest-neighbors model on the forge dataset againthe prediction is shown as the color of the cross you can see that the prediction for the new data point at the top left is not the same as the prediction when we used only one neighbor while this illustration is for binary classification problemthis method can be applied to datasets with any number of classes for more classeswe count how many neighbors belong to each class and again predict the most common class now let' look at how we can apply the -nearest neighbors algorithm using scikitlearn firstwe split our data into training and test set so we can evaluate generalization performanceas discussed in supervised learning