Logistic regression
Supervised · Classification Despite its name, logistic regression is used to answer yes/no questions. It combines the features into a score, then squashes that score through an S-shaped curve (the sigmoid) into a probability between 0% and 100%. If the probability is above a threshold, usually 50%, the answer is "yes".
Everyday analogy
A weather app that says "70% chance of rain". You decide: above 50%, take an umbrella. Logistic regression gives the percentage; the threshold makes the decision.
Example
Used for: predicting customer churn, loan default risk, disease risk screening, whether a user will click an ad.
The S-curve turns a score into a probability
How it works, step by step
- Collect examples with a known yes/no outcome, such as customers who stayed or left.
- Give each feature a weight and add them up into a single score.
- Pass the score through the S-curve to get a probability between 0 and 1.
- Compare the probability with the threshold (often 0.5) to decide yes or no.
- During training, adjust the weights so the predicted probabilities match the real outcomes as closely as possible.
Worked example
A streaming app looks at how long customers haven't used the app. 0 months inactive → 5% chance of leaving. 3 months → 40%. 6 months → 85%.
With a 50% threshold, the 6-month customer is flagged, and the app sends them a special offer before they cancel.
✓ Good for
- Gives a probability, not just yes/no
- Fast, and easy to explain which factors raise the risk
- Works well when the groups are fairly easy to separate
⚠ Watch out for
- Draws only a simple, straight boundary between the groups
- The threshold matters: a false alarm and a missed case can have very different costs
- Needs features prepared carefully
Try it yourself
About 10 minTurn a score into a yes/no
- Make a list of 10 students with hours studied and pass or fail.
- Find the hours where most students switch from fail to pass.
- Ask an AI chatbot to explain how logistic regression would draw that S-curve.
What you should see: Logistic regression gives the probability of a yes, with a cut-off point.
Use any free AI chatbot (ChatGPT, Claude, Gemini or Copilot). Never paste private or confidential information.