Precision vs Recall — Interview Answer — ML Technical Interview Questions & Answers

Model answer with a spam-detection example.

Precision vs Recall — Interview Answer

  • Say this: “Precision is of the ones I flagged, how many were right. Recall is of the real positives, how many I caught.” Then spam vs cancer in one breath.
  • Spam inbox: high precision (don’t bury real mail). Cancer screen: high recall (don’t miss sick).
  • F1 if they want one number. Threshold moves the trade-off.
  • Trap: formulas with no story. Trap: not naming the positive class.

Technical Interview Tip: Spam: precision. Disease: recall. Say the positive class.

Code Examples for Precision vs Recall — Interview Answer

Precision vs Recall — Interview Answer — working example

tp, fp, fn = 3, 1, 1
precision = tp / (tp + fp)
recall = tp / (tp + fn)
f1 = 2 * precision * recall / (precision + recall)
print(round(precision, 3), round(recall, 3), round(f1, 3))
# High precision: few false alarms. High recall: catch most real positives.

Precision vs Recall — Interview Answer — precision = TP/(TP+FP); Recall = TP/(TP+FN); F1 is the harmonic mean of both.

How to Explain Precision vs Recall — Interview Answer to an Interviewer

Precision vs recall?

Flagged correct vs found all positives

When recall matters more?

Missing a disease / a fail you must catch