EasyDeepLearn

How do you select the decision threshold for a binary classifier?

medium

Answer

  • 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 FPcostFP  +  FNcostFN\mathrm{FP}_{\mathrm{cost}} \cdot \mathrm{FP}\; + \;\mathrm{FN}_{\mathrm{cost}} \cdot \mathrm{FN}.
  • 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