Skip to content
Quantoros

What changes when a KNN classifier uses weights='distance' instead of uniform weights?

Classic MLLevel: IntermediateNeighbor influence

What changes when a KNN classifier uses weights='distance' instead of uniform weights?

Hints
  • Neighbor membership may stay the same.
  • The vote weights change.

Answer

Nearer neighbors receive more influence, typically inverse-distance weighting, instead of equal votes. This changes the local decision rule and can increase sensitivity to very close noisy points.

Source and licence: scikit-learn 1.7.2 — neighbors · BSD-3-Clause · answer: Quantoros editorial

Related questions