Concept

sklearn.neighbors.KNeighborsClassifier

Scikit-learn enables the creation of classifier objects. For example,

from sklearn.neighbors import KNeighborsClassifier knn = KNeighborsClassifier(n_neighbors = 5, weights = 'distance')

In this example, the classifier object (named knn) will consider 5 neighbors in its kneighbors queries. Setting the weights parameter to 'distance' means that closer neighbors will be more influential than those farther away (in terms of detemrining which category the "target" point belongs to).

0

1

Updated 2021-02-27

Tags

Data Science