What are some other things we can do with KNeighborsClassifier?



In the context of this exercise, what are some other things we can do with KNeighborsClassifier?


With the KNeighborsClassifier function, you have the option to set a few parameters which can change how the model will work, as well as access to methods that can perform useful tasks.

One parameter is the weights, which you can change to determine how each data point is weighted. You can set this parameter to “uniform”, which is the default value, or “distance”, which uses the inverse of each points’ distances so that close neighbors have more impact than farther neighbors.

Another parameter you can set is the algorithm parameter, which will determine what algorithm is used to compute the nearest neighbors. The values include ball_tree, kd_tree, brute, or auto.

The KNeighborsClassifier function also provides a kneighbors() method, which finds all the K-neighbors for given points and returns the indices and distances to the neighbors.

To see a full list of what the function provides, feel free to check out the official documentation.