Sobes.tech
Middle

How do micro and macro averaging for F1 differ in multi-class classification?

sobes.tech AI

Answer from AI

In multi-class classification, the F1 metric can be averaged using two main methods — micro and macro, which reflect different approaches to evaluating model quality.

  • Micro-average: sums up the true positives, false positives, and false negatives across all classes, then calculates the F1 score. This means each individual example has the same weight, and the metric reflects the overall performance of the model without considering class balance.

  • Macro-average: calculates the F1 score for each class separately, then averages these values. Here, each class has the same weight regardless of the number of examples in it. This is useful when performance on each class is important, especially if the classes are imbalanced.

Example: If you have 3 classes with different numbers of examples, micro-averaging will better reflect the quality on larger classes, while macro-averaging will show the average performance across all classes evenly.