Skip to contents

Calculates the macro-F1 score as the unweighted arithmetic mean of class-specific F1 scores. Each class therefore contributes equally to the macro-F1 score, irrespective of its sample size or prevalence.

If standard errors of the class-specific F1 scores are provided, the standard error of the macro-F1 score is calculated by standard variance propagation for an arithmetic mean, assuming that the class-specific F1 estimates are independent:

$$ SE(\mathrm{macro\mbox{-}F1}) = \frac{\sqrt{\sum_{k=1}^{K} SE(F1_k)^2}}{K} $$

When class-specific F1 scores are calculated from the same confusion matrix or the same set of observations, they may not be statistically independent. In this case, the covariance terms between class-specific F1 estimates are not accounted for by this calculation, and the resulting standard error is an approximation. A covariance-aware delta method or a bootstrap approach should be used when the dependence between class-specific estimates needs to be accounted for.

Usage

aa_macro_f1(f1, f1_se = NULL)

Arguments

f1

Numeric vector containing the class-specific F1 scores.

f1_se

Optional numeric vector containing the standard errors of the class-specific F1 scores. If NULL, the standard error of the macro-F1 score is not calculated.

Value

A vector containing two numeric values:

  • f1: The macro-F1 score, calculated as the unweighted arithmetic mean of the class-specific F1 scores.

  • f1_se: The standard error of the macro-F1 score. This is NULL if f1_se is not provided. When provided, the calculation assumes independence between the class-specific F1 estimates.

Details

Macro-F1 score

Author

Dirk Pflugmacher