Optimal Thresholding for Non-Decomposable Performance Metrics

37 concepts22 papers1 proposal

When training a binary classifier, the standard textbook approach is simple: minimize a loss function like cross-entropy or hinge loss over your dataset. These standard losses are decomposable, meaning the total loss is simply the sum of the losses incurred by each individual data point. If you minimize the loss on each point, you minimize the global loss.

However, real-world applications often care about non-decomposable metrics—such as the $F_1$-score, Jaccard index, True Negative Rate under a fairness constraint, or the Geometric Mean (G-mean). These metrics are non-linear functions of the entire confusion matrix. For instance, the $F_1$-score is a ratio of true positives to a combination of true positives, false positives, and false negatives. You cannot compute or optimize it point-by-point; a change in how a model predicts a single data point alters the denominator for all other points, coupling the decisions across the entire dataset.

Directly optimizing these metrics is notoriously difficult because they are non-differentiable and globally coupled. For years, practitioners relied on complex, metric-specific ad-hoc surrogates.

A powerful body of research reveals a elegant alternative: you can decouple the problem entirely. For a vast family of non-decomposable metrics, the mathematically optimal decision rule is simply a thresholded version of the conditional class probabilities. This insight motivates the plug-in classifier strategy, a two-stage framework that separates probability estimation from metric optimization.


The Core Insight: Decoupling via Thresholding

The fundamental reason the plug-in strategy works boils down to a geometric and statistical property of binary classification. As shown by Harikrishna Narasimhan et al. in On the Statistical Consistency of Plug-in Classifiers for Non-decomposable Performance Measures and Oluwasanmi Koyejo et al. in Consistent Binary Classification with Generalized Performance Metrics, for any performance measure that is a linear-fractional function of the confusion matrix or increases monotonically with true positive and true negative rates, the Bayes optimal classifier always takes the form:

$$\hat{Y} = \mathbb{I}(P(Y=1|X) > t^*)$$

where $t^*$ is an optimal scalar threshold.

While standard accuracy assumes a fixed threshold of $0.5$, complex metrics simply shift where that optimal threshold lies based on the data distribution and the specific metric constants. This realization reduces a daunting, high-dimensional optimization problem over a complex hypothesis space into a simple, one-dimensional search for a single scalar threshold $t$.

The resulting two-stage optimization strategy is beautifully straightforward:

  1. Probability Estimation: Train a standard probabilistic model to estimate the conditional class probabilities $P(Y=1|X)$ using a standard decomposable loss function.
  2. Threshold Selection: Keep the probability model fixed, and perform a one-dimensional search on a separate validation set to find the threshold $t$ that maximizes the target non-decomposable metric.

Why It Works: Surrogate Losses and Consistency

To understand why this two-stage process guarantees optimal performance, we must look at how the probability model is trained.

Wojciech Kotlowski demonstrated in Consistent optimization of AMS by logistic loss minimization that minimizing a standard surrogate loss, such as logistic loss, is mathematically consistent with optimizing complex metrics like the Approximate Median Significance (AMS) used in high-energy physics.

Expanding on this, Krzysztof Dembczynski et al. proved in Surrogate regret bounds for generalized classification performance metrics that if you use a "strongly proper" surrogate loss to estimate probabilities, the suboptimality (or regret) of your final classifier on the non-decomposable metric is strictly bounded by the regret of the surrogate loss.

In other words, as your probability estimates get closer to the true distribution, your thresholded classifier is guaranteed to converge to the absolute best possible metric performance. You do not need to bake the complex metric into the primary training phase; accurate probability calibration is a sufficient foundation.


The Power of Modularity

This decoupling provides immense practical advantages in terms of scalability and engineering flexibility.

In real-world machine learning pipelines, evaluation criteria change frequently. If a business decides to switch its target metric from Micro-$F_1$ to Macro-$F_1$, or introduces a new demographic fairness constraint, traditional methods would require retraining massive neural networks from scratch using a new custom loss function.

With the plug-in approach, the underlying model remains a fixed base. As highlighted by Apoorv Aggarwal et al. in Scalable Optimization of Multivariate Performance Measures in Multi-instance Multi-label Learning and Harish G. Ramaswamy et al. in Consistent Plug-in Classifiers for Complex Objectives and Constraints, you can repurpose the exact same probability model for entirely different objectives. You only need to re-run the lightweight threshold-tuning step on validation data, avoiding expensive retraining.

To make this threshold search even faster, Bowei Yan et al. identified in Binary Classification with Karmic, Threshold-Quasi-Concave Metrics that many common metrics possess a property called threshold-quasi-concavity. This mathematical structure guarantees that the metric behaves predictably as the threshold changes, allowing practitioners to use rapid binary search algorithms to find the exact global optimum in milliseconds.


Scaling to Multi-Label, Online, and Structured Settings

The intuition of optimal thresholding extends far beyond basic binary classification:

  • Multi-Label Classification: When predicting dozens of labels simultaneously, modeling the joint dependencies between labels is computationally brutal. Oluwasanmi Koyejo et al. proved in Consistent Multilabel Classification that for a wide range of multi-label metrics (like micro-averaged $F_1$ and Jaccard index), the optimal strategy is surprisingly simple: estimate the marginal probability of each label independently, and apply a single shared threshold across all of them.
  • Online Learning: For streaming data where validation sets aren't available beforehand, the authors of Faster Online Learning of Optimal Threshold for Consistent F-measure Optimization designed the FOFO algorithm. It splits the problem into two parallel online tasks: one model continuously updates posterior class probabilities, while a parallel stochastic optimization process tracks and updates the optimal decision threshold on the fly.
  • Missing Labels and Uncertainty: When training data is incomplete, Nagarajan Natarajan et al. demonstrated in Regret Bounds for Non-decomposable Metrics with Missing Labels that combining matrix completion with thresholding preserves strong theoretical guarantees. Similarly, Xinhua Zhang et al. in Bayesian Online Learning for Multi-label and Multi-variate Performance Measures showed how maintaining a posterior distribution over weights allows models to find optimal thresholds while explicitly accounting for epistemic uncertainty.

Even in structured domains like image segmentation or document filtering, the principle holds. Daniel Tarlow et al. showed in Revisiting uncertainty in graph cut solutions that producing well-calibrated marginal probabilities allows decision theory to maximize complex structural metrics like Intersection-over-Union (IoU). Rather than relying on raw, uncalibrated outputs, treating the problem through the lens of probability calibration and thresholding yields superior accuracy.

Ultimately, the literature demonstrates that optimizing for complex, global evaluation criteria does not require complex, global model architectures. By focusing on accurate local probability estimation near the decision boundaries—a concept echoed by Yves Grandvalet et al. in Support Vector Machines with a Reject Option, Marco Barreno et al. in Optimal ROC Curve for a Combination of Classifiers, and Nicola Cancedda et al. in Kernel Methods for Document Filtering—the plug-in strategy turns a seemingly intractable optimization problem into a simple matter of finding the right line to draw in the sand.

Key Foundational Work

To believe is to understand (1999) — contributed 2 concept elements to this direction.
Simple Bayesian Classifiers Do Not Assume Independence (1996) — contributed 1 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_optimal_thresholding_for_non_decomposabl_c0b890bc,
  title = {optimal thresholding for non-decomposable metrics},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/optimal-thresholding-for-non-decomposable-metrics/rdr_c0b890bc297e4a728552d167f356dce6},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-23},
}

This exact version (version 1, frozen text):

@misc{lacuna_optimal_thresholding_for_non_decomposabl_c0b890bc_v1,
  title = {optimal thresholding for non-decomposable metrics},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/optimal-thresholding-for-non-decomposable-metrics/rdr_c0b890bc297e4a728552d167f356dce6/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-23},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake