Why not use linear regression for classification?

Quick Overview

This machine learning interview question asks why ordinary least squares regression on 0/1 labels makes a poor classifier. It tests whether you understand what the fitted values mean, which loss suits a binary target, and how the decision boundary gets placed.

Why not use linear regression for classification?

Role: Data Scientist

Category: Machine Learning

Difficulty: easy

Interview Round: Other

Why not use linear regression for classification? Suppose the labels are coded 0 and 1 and you fit ordinary least squares, then predict the positive class whenever the fitted value is above 0.5. Explain why this is usually a poor classifier. ```hint Try one extra point Fit a line to a few 0/1 labels on a single feature, then add one positive example far out on the x-axis. Watch what happens to the predictions and to the point where the line crosses 0.5. ``` ### What a Strong Answer Covers - Why the fitted values cannot be read as class probabilities - How squared error treats examples that are already classified correctly, and what that does to the decision boundary - Which loss matches a binary target and why - What logistic regression changes in the model and in the loss - When a linear model on 0/1 labels is still acceptable ### Follow-up Questions - With three or more classes, what goes wrong if you code the labels as 1, 2 and 3 and regress on them? - Why does logistic regression use log loss instead of squared error on the sigmoid output? - Economists often fit a linear probability model on purpose. When is that reasonable? - What happens to logistic regression when the classes are perfectly separable?

Overview: This machine learning interview question asks why ordinary least squares regression on 0/1 labels makes a poor classifier. It tests whether you understand what the fitted values mean, which loss suits a binary target, and how the decision boundary gets placed.

PracHub logo
General
Nov 24, 2026
easyData ScientistOtherMachine Learning
0
0

Why not use linear regression for classification? Suppose the labels are coded 0 and 1 and you fit ordinary least squares, then predict the positive class whenever the fitted value is above 0.5. Explain why this is usually a poor classifier.

What a Strong Answer Covers Guidance

  • Why the fitted values cannot be read as class probabilities
  • How squared error treats examples that are already classified correctly, and what that does to the decision boundary
  • Which loss matches a binary target and why
  • What logistic regression changes in the model and in the loss
  • When a linear model on 0/1 labels is still acceptable

Follow-up Questions Guidance

  • With three or more classes, what goes wrong if you code the labels as 1, 2 and 3 and regress on them?
  • Why does logistic regression use log loss instead of squared error on the sigmoid output?
  • Economists often fit a linear probability model on purpose. When is that reasonable?
  • What happens to logistic regression when the classes are perfectly separable?