Predicts a probability between 0 and 1 with an S-shaped curve.
logreg(X, y)
Key idea
It outputs the PROBABILITY (likelihood) of class 1, squashed into the 0-to-1 range by the S-shaped sigmoid curve. (e.g. P(y=1) = 1 / (1 + e^-(b0+b1 x)))
You usually predict class 1 when that probability passes 0.5. (e.g. p = 0.5 sets the decision boundary)
Despite the name, it does CLASSIFICATION (sorting into categories), not regression.
Coefficients are interpretable as log-odds — how much each feature shifts the betting odds.
Definition
P(y=1∣x)=1+e−(β0+β1x)1
β0
the intercept
β1
the slope (effect of x)
e
about 2.718
P(y=1∣x)
the predicted probability of class 1
In plain words
Instead of a yes/no jump, it draws a smooth ramp from almost certainly no up to almost certainly yes.
Where you'd use it
Email spam detection: probability an email is spam from its words.
Medical risk: the chance a patient has a condition given their test values.
Credit scoring: the probability a loan will default.
Frequently asked questions
What does logistic regression predict?
The probability of a class, via the log-odds. Each coefficient shifts the log-odds; exponentiate it (ecoef) to get an odds ratio.