Logistic regression predicts the probability of a class rather than a numeric quantity. It computes the same weighted sum of features that linear regression does. The difference is that the sum is passed through a squashing function, so the output stays between zero and one.
Three things change. The target is a category, not a continuous value. Fitting uses maximum likelihood with an iterative solver, not a closed-form least squares formula. The output is a probability, and you turn it into a label by comparing it against a threshold.
Running plain linear regression on zero-one labels is the mistake this fixes. That model happily predicts 1.4 or a negative probability, and neither can be acted on. Its errors also grow at the edges, so points far from the boundary drag the line around. Logistic regression keeps the readable linear score while making the output usable.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
The diagram below the answer is the concept . Jump to it ↓