What's the point of distance-weighted KNN?
easyAnswer
- Instead of every neighbour voting equally, weight closer neighbours more (e.g., weight = 1/distance or a Gaussian kernel).
- This makes KNN less sensitive to k, gives a smoother decision boundary near class overlaps, and gives the closest point the strongest vote — useful when the local geometry matters.
- In scikit-learn, weights='distance'.
Check yourself — multiple choice
- Weighted KNN uses more neighbours
- Closer neighbours get more voting weight — smoother decisions, less sensitive to k
- Weights come from cross-validation
- It changes the distance metric
Distance-weighted KNN gives closer points more influence and reduces k-sensitivity.
#knn
Practise Supervised Learning
215 interview questions in this topic.
Related questions
- How do you choose k in k-Nearest Neighbours?
- How do you choose the distance metric for KNN?
- Why does KNN degrade badly in high dimensions?
- How do KD-trees and ball-trees speed up KNN, and when do they stop helping?
- What is the nearest centroid (Rocchio) classifier and when is it useful?
- How does KNN imputation work and when is it a good choice?