How does the shape of a KNN decision boundary compare to that of logistic regression?

Quick Overview

Asks how the decision boundary of k-nearest neighbors differs in shape from that of logistic regression. It tests understanding of linear versus local, non-parametric boundaries, the effect of k on bias and variance, and when each model suits a problem.

How does the shape of a KNN decision boundary compare to that of logistic regression?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

How does the shape of a KNN decision boundary compare to that of logistic regression? ```hint Find where the boundary is For logistic regression, look at the set of points where the predicted probability is exactly 0.5. For KNN, think about which points are equally close to training examples of two different classes. ``` ```hint Vary k Picture the KNN boundary for `k=1` and for `k` close to the number of training points. ``` ### What a Strong Answer Covers - The form of the logistic regression boundary and how it can be made to curve - How the KNN boundary is built from the training points, starting from `k=1` - How `k` changes the boundary, in terms of bias and variance - What else shapes each boundary, such as feature scaling and the distance metric - When each model's boundary suits a problem better ### Follow-up Questions - What does the boundary of multinomial (softmax) logistic regression look like with three classes? - How does standardizing the features change each boundary? - What happens to KNN's boundary as the number of features grows? - How does distance-weighted voting change the KNN boundary compared with uniform voting?

Overview: Asks how the decision boundary of k-nearest neighbors differs in shape from that of logistic regression. It tests understanding of linear versus local, non-parametric boundaries, the effect of k on bias and variance, and when each model suits a problem.

PracHub logo
General
Nov 25, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

How does the shape of a KNN decision boundary compare to that of logistic regression?

What a Strong Answer Covers Guidance

  • The form of the logistic regression boundary and how it can be made to curve
  • How the KNN boundary is built from the training points, starting from k=1
  • How k changes the boundary, in terms of bias and variance
  • What else shapes each boundary, such as feature scaling and the distance metric
  • When each model's boundary suits a problem better

Follow-up Questions Guidance

  • What does the boundary of multinomial (softmax) logistic regression look like with three classes?
  • How does standardizing the features change each boundary?
  • What happens to KNN's boundary as the number of features grows?
  • How does distance-weighted voting change the KNN boundary compared with uniform voting?