Precision: how many positive predictions survive checking?
Precision asks what fraction of the examples a classifier marks positive are actually positive. Its denominator is the system's positive decisions, not all examples.
This makes precision useful when a positive decision triggers expensive work: manually reviewing a flagged document, for example. False positives consume that review capacity.
A score is not yet a decision
A classifier can return the same scores while operating at different thresholds. In this NumPy example, raising the threshold from 0.5 to 0.8 removes two false alarms and one true detection.
import numpy as np
scores = np.array([0.95, 0.85, 0.7, 0.6, 0.55, 0.1])
actual = np.array([True, True, False, True, False, False])
results = {}
for threshold in (0.5, 0.8):
selected = scores >= threshold
results[threshold] = {
"precision": actual[selected].mean(),
"recall": (actual & selected).sum() / actual.sum(),
}
The two precisions are 60% and 100%, but the second policy finds only two of the three actual positives. Higher precision can therefore accompany lower recall without any improvement to the model itself.
Precision also depends on how frequent positives are in the population. A score measured on a balanced test set need not carry over to a stream containing very few positives.