QUESTION 1 OF 15

When is precision more important than recall?

Reveal the answer and explore the explanation.

01
EasyCoreVisual

When is precision more important than recall?

Answer
Answer

True positives divided by all predicted positives.

Deeper understanding

Precision = TP/(TP + FP), when the denominator is nonzero. For a spam filter, high precision helps avoid wrongly labeling legitimate emails. Recall answers a different question: what fraction of actual spam was caught?

Practical example

Measure how many flagged emails actually are spam.

PythonRelated concept example
from sklearn.metrics import precision_score, recall_score
y = [1, 1, 0, 0]
pred = [1, 0, 1, 0]
print(precision_score(y,pred), recall_score(y,pred))

Both metrics are 0.5 here; they capture different error types.

Reference: Further reading ↗

Last 30 min revisionHigh-yield interview Q&As