Macro F1 and Macro F1
Juri Opitz, Sebastian Burst
TL;DR
Two macro F1 definitions are compared: Averaged F1 (the arithmetic mean of per-class F1 scores) and F1 of averages (the harmonic mean of the average precision and recall). The authors prove a closed-form expression for the difference $Delta$ and show $Delta$ can reach $0.5$ when the number of classes $n$ is even, or $0.5 - 1/(2 n^2)$ otherwise. They also provide a Theorem and a Lemma establishing when equality holds and how class bias affects the gap. Through numerical experiments, they show that the metrics can yield different values and even reverse rankings, especially on imbalanced data, and conclude that Averaged F1 is more robust and advise reporting the chosen formula or preferring Averaged F1 for macro evaluation.
Abstract
The 'macro F1' metric is frequently used to evaluate binary, multi-class and multi-label classification problems. Yet, we find that there exist two different formulas to calculate this quantity. In this note, we show that only under rare circumstances the two computations can be considered equivalent. More specifically, one formula well 'rewards' classifiers which produce a skewed error type distribution. In fact, the difference in outcome of the two computations can be as high as 0.5. The two computations may not only diverge in their scalar result but can also lead to different classifier rankings.
