Logistic Regression
Machine Learning · Beginner
Definition
Logistic regression is a classification model that outputs a probability using the sigmoid function.
It is a fast, interpretable baseline for yes/no problems like spam detection.
Diagram
Flowchart
Example: Sigmoid
import math
sig = lambda z: 1 / (1 + math.exp(-z))
print(round(sig(2), 3))Output: 0.881
Key points
- Used for classification, not regression
- Outputs calibrated probabilities
- Extends to multiclass via softmax
Interview questions
Why not use MSE for classification?
Log loss gives a convex objective and better gradients.