Micro average is concerned with the study of individual classes. For example, a firm’s micro average examines personal goods’ price and market structure.
Macro average is concerned with aggregations or totals. We study economy-wide phenomena such as unemployment, price levels of economic growth, and gross domestic product or GDP using macro average.
The difference between macro and micro averaging is that macro averaging gives equal weight to each category while micro averaging gives equal weight to each sample. If we have the same number of samples for each class, both macro and micro will provide the same score.
Let's suppose we have a multi-class classification system with three unbalanced classes. Here is the possible confusion matrix for these classes.
Predicted | Classes | Actual | ||
X | Y | Z | ||
X | 10 | 2 | 3 | |
Y | 1 | 8 | 2 | |
Z | 2 | 3 | 9 |
Next, the following table shows each class's metrics values (TP, FP, FN) and performance measures (Precision, Recall) values for the above confusion matrix.
Class | True Positive (TP) | False Positive (FP) | False Negitive (FN) | Precision | Recall |
X | 10 | 2 | 3 | 0.77 | 0.67 |
Y | 8 | 1 | 2 | 0.62 | 0.73 |
Z | 9 | 2 | 3 | 0.64 | 0.64 |
The micro average precision is the sum of all true positives divided by the sum of all true positives and false positives. In other words, we divide the number of correctly identified predictions by the total number of predictions. The micro average calculation of the data above would be as follows:
PrecisionMicroAvg
PrecisionMicroAvg
The macro average precision is the arithmetic mean of all the precision values for the different classes. The macro average calculation of the data above would be as follows:
PrecisionMacroAvg
PrecisionMacroAvg
The micro average recall is the sum of true positives for all classes divided by actual positives (rather than predicted positives). The micro average calculation of the data above would be as follows:
RecallMicroAvg
RecallMicroAvg
The macro average recall is the arithmetic mean of all recall scores for different classes. The macro average calculation of the data above would be as follows:
RecallMacroAvg
RecallMacroAvg
Here is what we can infer about micro and macro averages:
Micro average statistics evaluate models trained for multi-class classification problems.
We use micro averaging when we need an equal weight for each instance or prediction.
The micro average precision is the sum of true positives for a single class divided by the sum of predicted positives for all classes.
The micro average recall score is the sum of true positives for a single class divided by the sum of true positives for all classes.
Macro average statistics evaluate models trained for multi-class classification problems.
We use macro averaging in case of a class unbalance (different number of instances associated with different class labels).
The macro average is the arithmetic mean of the individual class related to precision, memory, and f1 score.
We use macro average scores when we need to treat all classes equally to evaluate the overall performance of the classifier against the most common class labels.