Skip to main content
QUICK REVIEW

[Paper Review] Thresholding Classifiers to Maximize F1 Score

Zachary C. Lipton, Charles Elkan|arXiv (Cornell University)|Feb 8, 2014
Text and Document Classification TechnologiesComputer Science10 references97 citations
TL;DR

This paper derives the optimal decision threshold for binary and multilabel classifiers to maximize the F1 score, showing that for uninformative classifiers, predicting all instances as positive maximizes expected F1. It reveals that macro-averaged F1 can incentivize overprediction of rare labels even when predictions are uninformative, leading to counterintuitive behavior in low-base-rate settings.

ABSTRACT

This paper provides new insight into maximizing F1 scores in the context of binary classification and also in the context of multilabel classification. The harmonic mean of precision and recall, F1 score is widely used to measure the success of a binary classifier when one class is rare. Micro average, macro average, and per instance average F1 scores are used in multilabel classification. For any classifier that produces a real-valued output, we derive the relationship between the best achievable F1 score and the decision-making threshold that achieves this optimum. As a special case, if the classifier outputs are well-calibrated conditional probabilities, then the optimal threshold is half the optimal F1 score. As another special case, if the classifier is completely uninformative, then the optimal behavior is to classify all examples as positive. Since the actual prevalence of positive examples typically is low, this behavior can be considered undesirable. As a case study, we discuss the results, which can be surprising, of applying this procedure when predicting 26,853 labels for Medline documents.

Motivation & Objective

  • To understand how to optimally threshold classifier outputs to maximize F1 score in binary and multilabel settings.
  • To analyze the behavior of F1 maximization under different averaging schemes (micro, macro, per-instance) in multilabel classification.
  • To investigate the implications of F1's asymmetry and nonlinearity on threshold selection, especially when classifier outputs are uninformative or calibrated.
  • To demonstrate that optimal F1 thresholding can lead to counterintuitive predictions—such as predicting all examples as positive—when base rates are low.
  • To highlight the risk of macro-averaged F1 incentivizing overprediction of rare labels when models are uninformative for those labels.

Proposed method

  • Derives a theoretical relationship between the optimal F1 score and the decision threshold for any real-valued classifier output.
  • Proves that for well-calibrated probabilistic classifiers, the optimal threshold is exactly half the optimal F1 score.
  • Analyzes the behavior of F1 maximization under uninformative classifiers, showing that predicting all positives maximizes expected F1.
  • Uses concentration inequalities and Sanov’s Theorem to bound the probability of selecting suboptimal thresholds during empirical threshold selection.
  • Empirically evaluates threshold selection on synthetic data with varying base rates and sample sizes, simulating 10,000 runs to assess distribution of predicted positive fractions.
  • Applies the framework to a real-world case study: predicting 26,853 MeSH labels for Medline documents, where rare labels have low base rates and feature loss can lead to overprediction.

Experimental results

Research questions

  • RQ1What is the optimal decision threshold that maximizes the F1 score for a given classifier output distribution?
  • RQ2How does the optimal threshold depend on the base rate of positive examples, especially when the classifier is uninformative?
  • RQ3Why does macro-averaged F1 lead to overprediction of rare labels when the classifier is uninformative for those labels?
  • RQ4How does the nonlinearity and asymmetry of the F1 score affect threshold selection and prediction behavior?
  • RQ5Can the same set of classifier probabilities lead to drastically different optimal predictions depending on the F1 averaging method used?

Key findings

  • For uninformative classifiers, the optimal threshold to maximize expected F1 is to predict all examples as positive, regardless of base rate.
  • When classifier outputs are well-calibrated probabilities, the optimal threshold is exactly half the optimal F1 score.
  • The optimal F1 threshold depends not only on an example’s predicted probability but also on the distribution of probabilities across all examples in the batch.
  • For rare labels with low base rates, even perfectly calibrated models can yield F1 scores close to zero under optimal thresholding, while common labels always achieve high scores.
  • In macro-averaged F1, performance on rare labels is disproportionately weighted, leading to overprediction of such labels when the classifier is uninformative for them.
  • Empirical threshold selection on large datasets can still fail to identify the true optimal threshold, especially when base rates are low and sample size is insufficient, due to the sharp threshold behavior of F1.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.