How do you select the decision threshold for a binary classifier?
mediumAnswer
- Compute predicted probabilities on validation, then choose the threshold based on your business objective: (a) maximize F1 → argmax over t of F1(y, p > t); (b) fixed recall → smallest t with recall ≥ target, maximizing precision; (c) expected cost → t that minimizes .
- Never tune threshold on the test set.
- If probabilities are poorly calibrated, calibrate first, then threshold.
- Threshold tuning is often more impactful than model choice.
Check yourself — multiple choice
- Always use 0.5
- On validation, tune to your business objective (F1, fixed recall, expected cost)
- Only on the training set
- Threshold selection doesn't matter
Tune the threshold on validation using the actual downstream objective.
#metrics#classification#calibration#imbalance
Practise Supervised Learning
215 interview questions in this topic.
Related questions
- Why is accuracy a bad primary metric for many real-world problems?
- What is Cohen's kappa and why is it useful?
- What is the Matthews Correlation Coefficient (MCC) and when should you use it?
- What is log loss (cross-entropy) and what does a specific value mean?
- What is the Brier score and how does it compare to log loss?
- What is balanced accuracy?