Binary Logistic Regression
The Logistic Function (Sigmoid)
Maps any real-valued number to a value between 0 and 1:
Where (linear combination of features)
Properties:
- Output range: (0, 1)
- S-shaped curve
- Differentiable everywhere
- Symmetric around 0.5
Model Equation
Prediction:
- If → Predict class 1
- If → Predict class 0
Log-Odds (Logit)
The logit is the natural logarithm of the odds:
This transforms the probability to a linear function of features.
Cost Function (Log Loss)
Also called Binary Cross-Entropy Loss:
Where:
- = number of samples
- = actual label (0 or 1)
- = predicted probability
Why not use MSE?
- MSE with sigmoid creates a non-convex optimization problem
- Log loss is convex → guaranteed to find global minimum
Training
Use gradient descent to minimize the cost function:
Where is the learning rate.