# When using KNeighborsClassifier, what is the motivation of using weights="distance"?

When using KNeighborsClassifier, what is the motivation of using weights="distance"?

According to the scikit-learn documentation:

‘distance’ : weight points by the inverse of their distance. In this case, closer neighbors of a query point will have a greater influence than neighbors which are further away.

What is the motivation for using this?

weights = 'distance' is in contrast to the default which is weights = 'uniform'. When weights are uniform, a simple majority vote of the nearest neighbors is used to assign cluster membership.