Advanced 12 min

Precision and recall

Precision asks how many positive predictions were correct, while recall asks how many actual positives were found.

How it works

Choose the denominator by starting with the question. To check whether a warning is trustworthy, start from all predicted positives. To check how many real problems were found, start from all actual positives. In both cases, the numerator is the number correctly identified.

Walk through an example

If a filter flags five messages and four were truly unwanted, precision is 4 out of 5. If there were eight unwanted messages in total, recall is 4 out of 8.

What to watch for

The right metric depends on the cost of each mistake. Missing positives and incorrectly flagging negatives can affect people differently.

Check your understanding

What are precision and recall?

See the example and explanation
Worked example
Given Flagged: 5. Correctly flagged: 4. Actual positives: 8.
Answer Precision 80%, recall 50%.

Divide 4 by the 5 predicted positives for precision and by the 8 actual positives for recall.

Open practice problem