How does KNN make predictions for a regression task?

Quick Overview

Asks how k-nearest neighbors turns the targets of nearby training points into a numeric prediction. Tests distance weighting, how the choice of K affects bias and variance, and the limits of the method, such as its inability to extrapolate.

How does KNN make predictions for a regression task?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

How does KNN make predictions for a regression task? ```hint Same search, different combine step The neighbor search is the same as in classification. Think about which combining step makes sense for a numeric target, and what the prediction looks like for a query far outside the training data. ``` ### What a Strong Answer Covers - The neighbor search and how it matches the classification case - How the neighbors' targets are combined into one number, including the distance-weighted version - How the choice of K trades bias against variance - Limitations of the prediction surface, including extrapolation and the need for feature scaling ### Follow-up Questions - How would you choose K for a regression problem? - With distance weighting, what happens when a query point exactly matches a training point? - Why can't KNN regression extrapolate, and when does that matter in practice? - How would you serve KNN regression over millions of training points?

Overview: Asks how k-nearest neighbors turns the targets of nearby training points into a numeric prediction. Tests distance weighting, how the choice of K affects bias and variance, and the limits of the method, such as its inability to extrapolate.

General logo
General
Nov 25, 2026
easyMachine Learning EngineerOtherMachine Learning
0
0

How does KNN make predictions for a regression task?

What a Strong Answer Covers Guidance

  • The neighbor search and how it matches the classification case
  • How the neighbors' targets are combined into one number, including the distance-weighted version
  • How the choice of K trades bias against variance
  • Limitations of the prediction surface, including extrapolation and the need for feature scaling

Follow-up Questions Guidance

  • How would you choose K for a regression problem?
  • With distance weighting, what happens when a query point exactly matches a training point?
  • Why can't KNN regression extrapolate, and when does that matter in practice?
  • How would you serve KNN regression over millions of training points?