1. Precision Recap (Binary Case)
- Precision = Of all items the model predicted as positive, how many were actually positive?
$Precision = \frac{TP}{TP + FP}$
Where:
- TP = True Positives
- FP = False Positives
2. Precision in Multiclass Problems
When you have K classes, each class can be considered in a one-vs-rest (OvR) fashion:
- Compute precision for each class individually (as if that class = “positive” and all others = “negative”).
Example (3 classes: A, B, C):
- Precision(A) = TP_A / (TP_A + FP_A)
- Precision(B) = TP_B / (TP_B + FP_B)
- Precision(C) = TP_C / (TP_C + FP_C)
3. Macro Precision Definition
- Take the arithmetic mean of precision values across all classes.
$Precision_{macro} = \frac{1}{K} \sum_{i=1}^{K} Precision_i$
- Each class contributes equally, regardless of how many samples that class has.
4. Macro vs Micro vs Weighted
- Macro Precision: Average across classes equally. Good when you want fairness across classes.
- Micro Precision: Compute global TP and FP across all classes, then calculate precision. More influenced by large classes.
- Weighted Precision: Average precision per class but weighted by the number of samples in each class.
5. Example
Suppose a 3-class classifier:
- Precision(A) = 0.80
- Precision(B) = 0.60
- Precision(C) = 0.40
- Macro Precision = (0.80 + 0.60 + 0.40) / 3 = 0.60
- If class C is very small, Macro Precision still penalizes the model because each class counts equally.
Summary
- Macro Precision = average precision across all classes (equal weight per class).
- Useful when all classes are equally important, even if some are rare.
- Different from Micro Precision, which weights by sample counts.
