Precision
noun
say it: “prih-SIZH-un” /prɪˈsɪʒən/
Of all the items a model labeled as positive, the share that really were positive.
What is precision for a classifier?
Precision is, of the examples a model flagged, the share that really were the positive class: true positives divided by everything it flagged, TP / (TP + FP). High precision means few false alarms. It says nothing about the positives the model missed; recall does.
from sklearn.metrics import precision_score
actual = [1, 0, 0, 1, 1, 0] # 1 = fraud
guessed = [1, 0, 1, 0, 1, 0]
print(round(precision_score(actual, guessed), 3)) # 0.667: 2 of 3 flags were fraud
In a sentence
- “Raising the threshold improved precision but let more fraud through.”
- “A precision of 0.667 meant two flags in three were real fraud.”
Level: Journeyman · More AI Basics terms at this level
Updated