A General Online Algorithm for Optimizing Complex Performance Metrics

Wojciech Kotlowski, Marek Wydmuch, Erik Schultheis, Rohit Babbar, Krzysztof Dembczynski

Abstract

Optimizing non-decomposable performance metrics, such as the F-measure or G-mean, presents a significant challenge in online learning environments where data arrives sequentially. Traditional methods often require storing historical data or are limited to specific metrics. We introduce the Online Metric Maximization Algorithm (OMMA), a general and memory-efficient framework that linearizes complex metrics using gradients of the running confusion matrix. OMMA achieves state-of-the-art performance with a constant memory footprint and provides strong theoretical guarantees, including an $O(\ln n / n)$ regret bound for concave and smooth metrics.

1. Introduction

Standard machine learning objectives typically focus on decomposable metrics like accuracy or log-loss, where the total loss is a simple sum of individual instance losses. However, real-world applications frequently demand optimization of complex, non-decomposable metrics. For instance, in imbalanced classification, the F-measure is preferred, while the Area Under the ROC Curve (AUC) is critical for ranking tasks. These metrics are functions of the entire confusion matrix, making them difficult to optimize in a streaming setting where predictions must be made immediately upon observing an instance.

2. The Online Metric Maximization Algorithm (OMMA)

OMMA addresses these challenges by treating the complex metric as a function of the cumulative confusion matrix. The algorithm operates through a linearization process: at each time step $t$, it computes the gradient of the performance metric $\psi$ with respect to the current confusion matrix $C_{t-1}$. This gradient serves as a cost-sensitive weight, transforming the complex global optimization into a local cost-sensitive classification problem for the current instance $x_t$.

The Online Metric Maximization Algorithm (OMMA) pseudocode.

The algorithm integrates a Conditional Probability Estimator (CPE) to predict label probabilities $\hat{\eta}_t$. These estimates are used to make the optimal prediction $\hat{y}_t$ based on the current gradient. A key feature of OMMA is its efficiency; it maintains only the running confusion matrix, requiring $O(1)$ memory regardless of the stream length. A variant, OMMA($\hat{\eta}$), updates the confusion matrix using predicted probabilities instead of true labels, which can reduce variance in noisy environments.

3. Theoretical Foundations

The authors provide rigorous theoretical backing for OMMA. For metrics that are concave and smooth, the algorithm is proven to achieve a regret bound of $O(\frac{\ln n}{n})$, indicating that its performance converges to that of the optimal batch classifier as more data is processed. Furthermore, the study establishes that in adversarial (non-i.i.d.) settings, no algorithm can guarantee zero regret for these complex metrics, justifying the focus on stochastic data streams.

4. Experimental Evaluation

OMMA was evaluated against several baselines, including Online F-measure Optimization (OFO) and Online Frank-Wolfe, across a wide range of multi-label and multi-class datasets. These benchmarks, such as YouTube, Flickr, and AmazonCat, feature high-dimensional label spaces and significant class imbalance.

Performance comparison of OMMA against baselines across various multi-label datasets.

As shown in the experimental results, OMMA consistently matches or outperforms specialized baselines across diverse metrics like Micro-F1, Macro-F1, G-mean, and H-mean. Notably, OMMA maintains this high performance while being significantly more memory-efficient and faster than methods like Online-FW, which require periodic batch optimizations on stored history.

5. Conclusion

OMMA provides a robust and general framework for online optimization of complex performance metrics. By leveraging the gradient of the confusion matrix, it simplifies non-decomposable objectives into manageable online tasks. While the algorithm's performance is tied to the quality of the underlying CPE and the smoothness of the metric, its theoretical guarantees and empirical success make it a powerful tool for large-scale streaming applications. Future work may extend these methods to non-concave metrics or explore automated smoothing techniques for non-differentiable objectives.

Summary updated

BibTeX
@inproceedings{kotlowski2024general,
  author = {Wojciech Kotlowski and Marek Wydmuch and Erik Schultheis and Rohit Babbar and Krzysztof Dembczynski},
  title = {{A General Online Algorithm for Optimizing Complex Performance Metrics}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=pfnBLXgFVS},
}
Figure