- Load the scikit-learn KNN classification model and print the docstring by running the cell containing the following code:
from sklearn.neighbors import KNeighborsClassifier KNeighborsClassifier?
The n_neighbors parameter decides how many samples to use when making a classification. If the weights parameter is set to uniform, then class labels are decided by majority vote. Another useful choice for the weights is distance, where closer samples have a higher weight in the voting. Like most model parameters, the best choice for this depends on the particular dataset.
- Train the KNN classifier with n_neighbors=3, and then compute the accuracy and decision regions. Run the cell containing the following ...