Micro Precision#
Precision computed from globally pooled true positives and false positives.
Important
✨ AI-generated content. This page was written with the assistance of an AI language model and is provided as a learning aid. Despite careful review, it may still contain mistakes, omissions, or out-of-date information. Whether you are new to the topic, a team lead, or a senior practitioner, treat it as a starting point rather than an authoritative reference: read it critically and independently verify anything you act on (code, commands, figures, and factual claims) against official documentation and primary sources before relying on it.
What it is#
Precision answers: of all the items the model flagged positive, how many were right?
so it is sensitive to false positives (false alarms). Micro precision extends it to \(K\) classes by pooling counts before dividing, rather than averaging per-class precision (macro precision).
How it’s computed#
Summing across classes first makes the metric a single global “of all predictions, how many correct”, so frequent classes carry the most weight.
The micro identity#
As with micro recall and micro F1, in single-label classification micro precision equals the other two (and accuracy), because the pooled denominators line up. They differ only under multi-label evaluation.
Worked example#
Three classes with TP = (40, 30, 10), FP = (10, 20, 20):
Precision(A)=0.80, Precision(B)=0.60, Precision(C)=0.33 → Macro precision = 0.58.
Micro precision \(= 80/130 \approx 0.615\).
The micro value sits near the large classes’ contribution; macro surfaces class C’s weaker 0.33.
When precision matters most#
Favour precision when a false positive is costly — spam filters (blocking real mail), recommending a bad product, flagging an innocent transaction — where the price of a wrong “yes” is high.
In code#
from sklearn.metrics import precision_score
micro = precision_score(y_true, y_pred, average="micro")
macro = precision_score(y_true, y_pred, average="macro")
Theme: Classification & Averaging Metrics · All terminology
Hint
More in Classification & Averaging Metrics
Accuracy · AUC (Area Under the Curve) · Average Precision (AP) · Binary Classification · Classification Probability · Discriminatory Power · F1-score · Gini Coefficient · Harmonic Mean · Log Loss (also called Logarithmic Loss or Cross-Entropy Loss) · Macro AUC · Macro AUROC (Macro-Averaged AUROC) · Macro Averaging · Macro F1
See also
Source article Adapted (context, re-expressed) in our own words from: Micro Precision (insightful-data-lab.com).