Welcome to logistic regression! While linear regression predicts continuous numbers (like house prices), logistic regression predicts probabilities and categories.
Instead of "this house costs $250,000," logistic regression says "there's a 73% chance this email is spam."
Engagement Message
Can you think of a yes/no question you'd want a computer to predict?
The key difference: linear regression outputs any number, but logistic regression outputs probabilities between 0% and 100%.
Think of it as answering "How likely?" instead of "How much?" - perfect for questions like "Will it rain?" or "Is this fraud?"
Engagement Message
What's a probability question you deal with daily?
Here's the magic: logistic regression uses something called the sigmoid function to squeeze any number into a probability between 0 and 1.
It's like a mathematical funnel that takes any input (positive or negative) and converts it to a valid probability.
Engagement Message
In a few words, how would you describe the sigmoid "funnel"?
The sigmoid formula is: 1 / (1 + e^(-z))
Where z is any number. Let's see it work:
- If z = 0, sigmoid = 0.5 (50% probability)
- If z = 2, sigmoid = 0.88 (88% probability)
- If z = -2, sigmoid = 0.12 (12% probability)
Engagement Message
Notice how larger z gives higher probabilities?
That z value comes from a linear equation, just like in linear regression! So logistic regression is actually linear regression + sigmoid transformation.
First calculate: z = (slope × input) + intercept
