threeand nine neighbors shown in figure - in[ ]figaxes plt subplots( figsize=( )for n_neighborsax in zip([ ]axes)the fit method returns the object selfso we can instantiate and fit in one line clf kneighborsclassifier(n_neighbors=n_neighborsfit(xymglearn plots plot_ d_separator(clfxfill=trueeps= ax=axalpha mglearn discrete_scatter( [: ] [: ]yax=axax set_title("{neighbor( )format(n_neighbors)ax set_xlabel("feature "ax set_ylabel("feature "axes[ legend(loc= figure - decision boundaries created by the nearest neighbors model for different values of n_neighbors as you can see on the left in the figureusing single neighbor results in decision boundary that follows the training data closely considering more and more neighbors leads to smoother decision boundary smoother boundary corresponds to simpler model in other wordsusing few neighbors corresponds to high model complexity (as shown on the right side of figure - )and using many neighbors corresponds to low model complexity (as shown on the left side of figure - if you consider the extreme case where the number of neighbors is the number of all data points in the training seteach test point would have exactly the same neighbors (all training pointsand all predictions would be the samethe class that is most frequent in the training set let' investigate whether we can confirm the connection between model complexity and generalization that we discussed earlier we will do this on the real-world breast cancer dataset we begin by splitting the dataset into training and test set then supervised learning