Lesson 3 of 10 · 2 min
Binary Classification
Exactly 2 output classes: Yes/No, 1/0, Spam/Not-Spam, Fraud/Legit.
Logistic Regression outputs a probability → threshold converts it to a class label.
# Custom threshold example threshold = 0.3 # lower threshold = catch more positives (better recall) y_custom = (y_prob >= threshold).astype(int) # 1 if prob >= 0.3, else 0
When to lower the threshold:
- Cancer detection: better to flag healthy people (FP) than miss sick ones (FN)
- Fraud detection: better to block a real transaction (FP) than miss fraud (FN)
