NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Optimizing F-measure: A Tale of Two Approaches

Nan Ye, Kian Ming Adam Chai, Wee Sun Lee, Hai Leong ChieuICML 2012

Introduction

The F-measure (or F1-score) is the standard evaluation metric for classification tasks with highly imbalanced data, such as information retrieval or named entity recognition, where the "positive" class is rare. However, because the F-measure is a non-linear, non-decomposable metric—meaning it depends on the entire set of predictions rather than just individual instances—it is notoriously difficult to optimize directly during training.

Historically, researchers have tackled this optimization problem using two distinct paradigms:

  1. Empirical Utility Maximization (EUM): This approach attempts to learn a classifier that directly maximizes the F-measure on the training data, often by learning a scoring function and selecting an optimal threshold.
  2. Decision-Theoretic Approach (DTA): This method first learns a probabilistic model to estimate the true conditional probabilities of the data. During inference, it predicts the set of labels that maximizes the expected F-measure.

Before this research, it was unclear under what conditions one approach outperformed the other. Furthermore, DTA was rarely used in practice because the algorithms required to compute the optimal predictions were computationally prohibitive (scaling at $O(n^3)$ or worse).

Theoretical and Algorithmic Contributions

The authors provide a rigorous theoretical and empirical comparison of EUM and DTA. Through theoretical analysis, they establish consistency bounds for EUM and prove that, asymptotically (given large i.i.d. datasets and a perfectly specified model), EUM and DTA are mathematically equivalent. They also demonstrate that for EUM, simply thresholding a rank-preserving score function is optimal.

Crucially, to make DTA practically viable, the authors introduce a novel dynamic programming algorithm. Assuming label independence, this algorithm computes the optimal DTA predictions in $O(n^2)$ time. This breakthrough reduces the computation time for tens of thousands of instances from hours to mere seconds.

Algorithm 1: The proposed $O(n^2)$ dynamic programming algorithm for computing optimal DTA predictions.

Experimental Setup

To evaluate these methods, the authors utilized a mix of synthetic and real-world datasets:

  • Synthetic Data: Mixtures of Gaussians allowed precise control over data dimensionality, class imbalance, and the degree of model misspecification (forcing the model to learn on data it lacks the complexity to perfectly capture).
  • Text Classification: The standard Reuters-21578 dataset (ModApte split).
  • Multilabel Classification: Four standard benchmark datasets (Yeast, Medical, Scene, and Enron).

They compared EUM approximations—such as $ML^\delta$ (which learns probabilities and thresholds them) and $F^\delta$ (which maximizes empirical F-measure directly)—against DTA ($ML^E$, which uses the new algorithm to maximize expected F-measure based on learned probabilities).

Key Insights and Results

The empirical results reveal distinct "superpowers" for each approach depending on the data environment:

  • EUM's Superpower is Robustness: If the chosen model family is misspecified (e.g., using a linear model on highly non-linear data), EUM degrades much more gracefully than DTA. EUM only requires the model to correctly rank the instances (placing the most likely positive instances at the top) to find a good threshold. DTA, however, relies on the actual probability values being accurate; if they are poorly calibrated, DTA's performance suffers. In synthetic tests with severe misspecification, EUM maintained F1 scores in the ~85-92% range, while DTA plummeted to ~75%.
  • DTA's Superpower is Rare Classes: Given a reasonably accurate model, DTA is significantly better at maximizing performance when the positive class is extremely rare. On the Reuters dataset and multilabel benchmarks, DTA ($ML^E$) consistently outperformed EUM approaches on topics with very few positive instances.
  • DTA Excels at Domain Adaptation: In scenarios where the underlying distribution of features changes between training and testing (covariate shift), but the relationship between features and labels stays the same, DTA is vastly superior. EUM's hard-coded threshold tends to break under distribution shifts. In a synthetic covariate shift test, DTA achieved an F1 score of 36%, crushing the EUM approach which dropped to 11%.
Performance comparison of DTA ($ML^E$) and EUM approaches ($ML^\delta$, $F^\delta$) alongside error plots for varying class imbalances.

Limitations and Future Work

The theoretical bounds and the proof of asymptotic equivalence rely on a large sample assumption; the behavior of these methods on very small datasets remains an open question. Additionally, the fast $O(n^2)$ DTA algorithm assumes that the labels of different instances are independent, which may limit its application in highly structured prediction problems.

Future directions include exploring exact EUM classifiers (rather than approximations), quantifying exactly how inaccurate probabilities affect DTA predictions, and developing practical heuristics to help practitioners automatically select the best method for their specific dataset.

Summary updated

BibTeX
@inproceedings{ye2012optimizing,
  author = {Nan Ye and Kian Ming Adam Chai and Wee Sun Lee and Hai Leong Chieu},
  title = {{Optimizing F-measure: A Tale of Two Approaches}},
  booktitle = {International Conference on Machine Learning},
  year = {2012},
  url = {https://openreview.net/forum?id=DcjOdPy2ehJ},
}
Figure