Page6/20
Logistic Regression (Classification) · Page 1 of 2
From Linear to Logistic
Logistic Regression (Classification)
The Problem with Linear Regression for Categories
Linear regression outputs continuous numbers. But what if we want to predict if an email is Spam (1) or Not Spam (0)? We need an output between 0 and 1 representing a probability.
The Sigmoid Function
We pass the linear equation through a "squishing" function:
σ(z) = 1 / (1 + e^(-z))
- If
zis very large →σ(z)approaches 1. - If
zis very small →σ(z)approaches 0.
Decision Boundary
- Probability >= 0.5 → Class 1
- Probability < 0.5 → Class 0
main.py
Loading...
OUTPUT
▶Click "Run Code" to execute…