← All cheatsheets
Data Scientist · #078 · October 19, 2026 · 2 min read

Linear or logistic regression: a number, or a yes/no

What linear and logistic regression each predict, why logistic outputs a probability through the sigmoid, why the 0.5 threshold is a business choice, and what both models have in common: one page.

Get the free PDF

One page, print-ready, free to share. No signup needed.

Download the PDF

Which model do you build first? It depends on the question. If the answer is a number, you want a linear regression. If the answer is a yes or a no, you want a logistic one. This page covers what each predicts, why logistic outputs a probability, the threshold that is a business choice, and the one thing both models share. The print-ready A4 PDF is at the bottom.

Linear

  • Predicts a number: price, demand, minutes.
  • The output can be any value, from minus to plus.
  • The loss is squared error.

Logistic

  • Predicts a probability: churn, fraud, click.
  • The output is between 0 and 1, through the sigmoid.
  • The threshold turns the probability into a yes or a no. 0.5 is a choice, not a law.

Same inputs, two outputs

Both models draw a line through the features. One reads the line as a number, the other pushes it through a sigmoid and reads a probability.

LinearLogistic
Formulay = b0 + b1·x1 + b2·x2p = sigmoid(b0 + b1·x1 + b2·x2)
The line isthe predictionthe log-odds
Fit byleast squaresmaximum likelihood
You read"price is about 240""72% chance of churn"

Remember

  • Both are linear in the inputs. The difference is the output.
  • With imbalanced classes, move the threshold and check recall.

Imbalance matters because a model on rare events, such as fraud, can look accurate by saying no every time. Recall tells you how many of the real cases you caught.

The trap: the threshold is a decision

A logistic model gives a probability. The yes/no comes from a threshold you choose.

ThresholdFlags moreUse when
0.5balancedclasses are balanced, errors cost the same
0.2yesmissing a case is expensive: fraud, churn
0.8noa false alarm is expensive: a manual review

A lower threshold flags more cases as yes, so you catch more real ones and accept more false alarms. A higher threshold does the opposite. There is no neutral setting: each value is a trade between the two kinds of error.

Interview phrasing worth memorizing: logistic regression gives me a probability; I pick the threshold with the business, from the cost of each kind of error.

Frequently asked questions

What is the difference between linear and logistic regression?
Linear regression predicts a number, such as a price, a demand or a duration in minutes. Logistic regression predicts a probability between 0 and 1, for a question such as churn, fraud or click. Linear is fit by least squares, logistic by maximum likelihood.
Why does logistic regression use a sigmoid?
The line b0 + b1x1 + b2x2 can take any value from minus to plus infinity. The sigmoid squeezes it into the range 0 to 1, so the output can be read as a probability. The line itself is the log-odds.
Is 0.5 always the right threshold for logistic regression?
No. 0.5 is a default, not a law. Choose the threshold with the business from the cost of each kind of error. Use a lower one when missing a case is expensive, such as fraud or churn, and a higher one when a false alarm is expensive, such as a manual review.
What do linear and logistic regression have in common?
Both are linear in the inputs: each builds a weighted sum of the features. The difference is the output. Linear reads the sum as a number, logistic pushes it through a sigmoid and reads a probability.

Get the free PDF

One page, print-ready, free to share. No signup needed.

Download the PDF

More cheatsheets