Skip to content
doubtly

1 answer

Linear regression predicts a continuous numeric value with a straight-line model; logistic regression predicts the probability of a class (usually yes/no) by passing a linear combination through the sigmoid function, so it is used for classification.

Linear regression

\[\hat y = \beta_0 + \beta_1x_1 + \dots + \beta_nx_n\]

Output can be any real number. Fitted by minimising the sum of squared errors (ordinary least squares). Example: predicting house price from area.

Logistic regression

\[p = \sigma(z) = \frac{1}{1 + e^{-z}},\quad z = \beta_0 + \beta_1x_1 + \dots\]

Output is between 0 and 1 and is read as \(P(y = 1)\); a threshold (often 0.5) gives the class. Fitted by maximum likelihood (minimising log-loss / cross-entropy). Example: predicting whether an email is spam.

PointLinear regressionLogistic regression
TaskRegressionClassification
OutputContinuous value \((-\infty, \infty)\)Probability in (0, 1), then class
FunctionStraight line / hyperplaneS-shaped sigmoid curve
Loss / fittingMean squared error, least squaresLog-loss, maximum likelihood
Target variableNumericCategorical (binary; multinomial for more classes)
Coefficient meaningChange in \(y\) per unit change in \(x\)Change in log-odds \(\ln\frac{p}{1-p}\) per unit change in \(x\)
EvaluationMSE, RMSE, \(R^2\)Accuracy, precision, recall, ROC-AUC
ExamplePredict salary, temperature, salesPredict pass/fail, disease/no disease

Using linear regression for a yes/no target is a poor idea because it can predict values below 0 or above 1 and is badly affected by outliers; the sigmoid in logistic regression avoids this.

Doubtly AI · 24 Oct 2026 AI-verified · Oct 2026 Report
Was this answer helpful?

Your answer

Log in or create a free account to answer this question.