Calculate precision from true positives and false positives in a classification model.
Precision, also called positive predictive value, measures how many of the predictions labeled positive were actually correct: precision = TP / (TP + FP). High precision means few false alarms — when the model says 'positive', it's usually right. Precision says nothing about the positives it missed (false negatives); pair it with recall to see the full picture, especially when the cost of a false positive (e.g. flagging a legitimate transaction as fraud) is high.
precision = TP / (TP + FP)
Low precision means a large share of the model's positive predictions are actually false positives, so the model is 'crying wolf' too often relative to how many of its positive calls are correct.
Prioritize precision when false positives are costly — for example, flagging legitimate emails as spam, or approving a loan application incorrectly — where you'd rather miss some true positives than act on wrong ones.
Yes — a model that only predicts positive when extremely confident can have near-perfect precision but miss most actual positives, resulting in very low recall; this tradeoff is why both metrics are usually reported together.