Compute precision with rare positives
Type each count alongside the label that gives it meaning. · 188 words
Precision measures how trustworthy a model's positive alerts are. Imagine a library scans 200 donated books for rare first editions. The model's positive class is 'rare first edition.' It flags 15 books, and a librarian checks all 15. Twelve really are rare; three are ordinary editions. The 12 checked books are true positives, meaning both the model and the librarian say they belong to the positive class. The 3 are false positives, meaning the model flagged books that do not belong. The other 185 books were negative and were not flagged.
Precision asks: of all books the model called positive, what fraction truly were? Divide true positives by every positive prediction: 12 / (12 + 3) = 12/15 = 0.80, or 80 percent. This matters when positives are rare. In another batch, suppose the model flags 50 books but only 10 are rare. Its precision is 10/50 = 20 percent, even if the model still catches many rare books. Precision therefore describes the purity of alerts, not how many actual rare books were found. A useful report should state both precision and the total number of positive alerts.
Check your recall
A model flags 40 donated books, and 28 are verified rare first editions. What is its precision?
Check your answer
Precision is 28/40 = 0.70, or 70 percent, because 28 of the 40 positive predictions are true positives.
Sources and credits
Original KeyTouch lesson. Background reading · Google · Classification metrics.