Can KNN regression extrapolate predictions beyond the range of target values seen in the training set?

Quick Overview

Asks whether k-nearest neighbors regression can predict values outside the range of targets seen during training. Tests how KNN forms its predictions, how it behaves on queries far from the training data, and how it compares with linear and tree-based models on trending data.

Can KNN regression extrapolate predictions beyond the range of target values seen in the training set?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

Can KNN regression extrapolate predictions beyond the range of target values seen in the training set? ```hint Look at the weights Write the prediction as a weighted sum of training targets and check what you know about the weights, for both uniform and distance weighting. ``` ### What a Strong Answer Covers - A clear yes or no, with the argument from how the prediction is formed - Whether distance weighting changes the conclusion - What predictions look like for queries far outside the training feature range - How this compares with linear regression and tree-based models - Practical ways to handle data with a trend ### Follow-up Questions - You must forecast a growing time series and want to keep a nearest-neighbor model. How would you set it up? - Why can local linear regression extrapolate when plain KNN regression cannot? - How would you detect at serving time that a query lies outside the training feature range?

Overview: Asks whether k-nearest neighbors regression can predict values outside the range of targets seen during training. Tests how KNN forms its predictions, how it behaves on queries far from the training data, and how it compares with linear and tree-based models on trending data.

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

Can KNN regression extrapolate predictions beyond the range of target values seen in the training set?

What a Strong Answer Covers Guidance

  • A clear yes or no, with the argument from how the prediction is formed
  • Whether distance weighting changes the conclusion
  • What predictions look like for queries far outside the training feature range
  • How this compares with linear regression and tree-based models
  • Practical ways to handle data with a trend

Follow-up Questions Guidance

  • You must forecast a growing time series and want to keep a nearest-neighbor model. How would you set it up?
  • Why can local linear regression extrapolate when plain KNN regression cannot?
  • How would you detect at serving time that a query lies outside the training feature range?