What is the advantage of distance-weighted voting over uniform majority voting in KNN?

Quick Overview

Asks why k-nearest neighbors might weight each neighbor's vote by distance instead of giving every neighbor one vote. Tests your grasp of the locality assumption in KNN, how the choice of k interacts with the voting rule, and the practical costs of a weighting scheme.

What is the advantage of distance-weighted voting over uniform majority voting in KNN?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

In k-nearest neighbors (KNN) classification, the k training points closest to a query vote on its label. With uniform majority voting every neighbor gets one vote; with distance-weighted voting each vote is scaled by how close that neighbor is. What is the advantage of distance-weighted voting over uniform majority voting in KNN? ```hint What a uniform vote ignores Think about what a uniform vote throws away about the k neighbors, and what happens to that loss as k grows. ``` ### What a Strong Answer Covers - What uniform voting ignores, and how that fails as k grows or near a class boundary - How a weighting scheme such as inverse distance or a kernel changes the vote, ideally with a small example - The effect on sensitivity to k, on ties and on probability estimates - The costs: noisy close points, zero distances and feature scaling ### Follow-up Questions - How would you choose between ${1/d}$, ${1/d^2}$ and a Gaussian kernel, and what does the kernel bandwidth control? - How does distance weighting change KNN regression? - In high dimensions distances tend to concentrate. What does that do to distance weights? - How would you handle a query that exactly matches a training point?

Overview: Asks why k-nearest neighbors might weight each neighbor's vote by distance instead of giving every neighbor one vote. Tests your grasp of the locality assumption in KNN, how the choice of k interacts with the voting rule, and the practical costs of a weighting scheme.

PracHub logo
General
Nov 24, 2026
easyMachine Learning EngineerOtherMachine Learning
0
0

In k-nearest neighbors (KNN) classification, the k training points closest to a query vote on its label. With uniform majority voting every neighbor gets one vote; with distance-weighted voting each vote is scaled by how close that neighbor is. What is the advantage of distance-weighted voting over uniform majority voting in KNN?

What a Strong Answer Covers Guidance

  • What uniform voting ignores, and how that fails as k grows or near a class boundary
  • How a weighting scheme such as inverse distance or a kernel changes the vote, ideally with a small example
  • The effect on sensitivity to k, on ties and on probability estimates
  • The costs: noisy close points, zero distances and feature scaling

Follow-up Questions Guidance

  • How would you choose between 1/d{1/d} , 1/d2{1/d^2} and a Gaussian kernel, and what does the kernel bandwidth control?
  • How does distance weighting change KNN regression?
  • In high dimensions distances tend to concentrate. What does that do to distance weights?
  • How would you handle a query that exactly matches a training point?