05 · Metrics
Precision
A point on the ROC curve, read at a declared prevalence.
Section 02 sorted the confusion matrix into columns and rows, and left precision on the wrong side of that division. Every metric so far has divided by a column total, which is a class count. Precision divides by a row total, which is a decision count, and a row holds cases from both classes. This section works out what that costs.
A row, not a column
Precision, also called the positive predictive value (PPV), is the share of flagged cases that really were positive.
The conditioning bar has moved. Section 02 conditioned on the truth and asked what the model did. Precision conditions on what the model did and asks about the truth. It runs the same question backwards, which is why it needs something the two rates did not.
Write the two cells in terms of the rates. Of the
Substitute, then divide through by
This is the identity the whole section rests on (Richardson et al., 2024). Writing
which is Bayes' theorem, and it is worth naming as such.
The third input
Read the identity as a recipe and count what goes into it. Two of the three inputs,
Take one operating point and hold it still: a classifier that catches
Same model, same threshold, same scores on every case. The precision more than halves. Precision is not a property of the classifier. It is a property of the classifier and the population, fused into one number with no way to separate them.
The negative side of the table behaves the same way. The share of cases the model let through that really were negative is the negative predictive value, it divides by the other row, and it moves with
Which way it leans
Precision is often reached for as the answer to accuracy's problem under imbalance. It is worth putting the two side by side as
- Accuracy rises toward
, since the negatives take over the average and the model handles them well. - Precision falls toward zero, since the flagged row fills with false positives drawn from an ever larger negative class.
Both are reporting the crowd. One flatters the model as the positives get rarer and the other punishes it, and neither is measuring something the model did. Swapping accuracy for precision does not remove the prevalence commitment. It reverses the sign of the error.
There is a second, quieter problem at the same end of the scale. Push
When precision is the right number
None of the above makes precision a bad metric. It makes it a conditional one, and there is a question it answers better than anything else in this tutorial: this alert just fired, how much should I believe it?
That is the question the person on the receiving end actually asks, so precision is exactly the right object. For example radiologists reading flagged scans and analysts working a fraud queue. Sensitivity and specificity cannot answer it, because they condition on a truth nobody knows yet.
The condition is that the
Where it goes wrong
Two failures follow directly, and both are common.
- Comparing across populations. Two models evaluated on datasets with different base rates cannot be ranked by precision, because the comparison contains a term neither model is responsible for. The same holds for one model in two clinics.
- Inheriting a prevalence nobody chose. Test sets are often built by case-control sampling, or by keeping all the positives and subsampling the negatives. The resulting
is an artefact of collection. Precision computed on it is a real number about a population that was assembled for convenience.
Both have the same repair, and it is the one the identity suggests.