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

Consistent Multiclass Algorithms for Complex Metrics and Constraints

Harikrishna Narasimhan, Harish G. Ramaswamy, Shiv Kumar Tavker, Drona Khurana, Praneeth Netrapalli, Shivani Agarwal

Abstract

We present consistent algorithms for multiclass learning with complex performance metrics and constraints, where the objective and constraints are defined by arbitrary functions of the confusion matrix. This setting includes many common performance metrics such as the multiclass G-mean and micro F1-measure, and constraints such as those on the classifier's precision and recall and more recent measures of fairness discrepancy. We give a general framework for designing consistent algorithms for such complex design goals by viewing the learning problem as an optimization problem over the set of feasible confusion matrices. We provide multiple instantiations of our framework under different assumptions on the performance metrics and constraints, and in each case show rates of convergence to the optimal (feasible) classifier (and thus asymptotic consistency). Experiments on a variety of multiclass classification tasks and fairness-constrained problems show that our algorithms compare favorably to the state-of-the-art baselines.

Introduction: The Challenge of Complex Goals

In standard machine learning, the objective is typically to minimize a "decomposable" loss, such as cross-entropy or 0-1 error. However, real-world applications often demand more nuanced performance metrics. For instance, in medical diagnosis with significant class imbalance, practitioners may prioritize the G-mean (the geometric mean of accuracies across all classes) to ensure performance isn't sacrificed on minority classes. In information retrieval, the F1-measure is often the gold standard.

Furthermore, modern machine learning increasingly requires satisfying specific constraints, such as maintaining a minimum precision threshold or ensuring fairness across demographic groups. While these complex goals are well-understood in binary classification, extending them to multiclass settings is non-trivial. A naive search for the optimal multiclass classifier might involve tuning $n^2$ parameters (where $n$ is the number of classes), leading to computational intractability. This paper introduces a unified, statistically consistent framework to address these non-linear metrics and constraints in multiclass environments.

A Unified Framework for Optimization

The core innovation of this work is viewing the learning problem as an optimization over the set of achievable confusion matrices. Most complex metrics and fairness requirements can be expressed as functions of the confusion matrix, $C$. By shifting the focus to this space, the problem becomes manageable.

The proposed framework reduces complex optimization to a sequence of cost-sensitive learning problems.

The authors propose a framework that reduces the complex objective into a sequence of simpler Linear Minimization Problems. These are solved using a Linear Minimization Oracle (LMO), which acts as a cost-sensitive learner. As shown in the framework diagram, the optimizer iteratively provides a loss matrix to the learner, which in turn provides a classifier and a confusion matrix estimate. This iterative process converges toward the final optimal classifier.

Versatility in Metrics and Constraints

The framework is remarkably flexible, supporting a wide array of performance metrics ($\psi(C)$) and constraint functions ($\phi(C)$). This includes non-smooth and non-linear functions that were previously difficult to optimize directly in a multiclass setting.

Examples of performance metrics and constraint functions supported by the framework.

Depending on the mathematical properties of the chosen metric, the paper provides four specific optimization strategies:

  1. Frank-Wolfe: For smooth, convex metrics (e.g., H-mean).
  2. Gradient Descent-Ascent (GDA): For non-smooth convex metrics and constraints.
  3. Ellipsoid Method: Optimized for problems with a relatively small number of classes.
  4. Bisection Method: Tailored for "ratio-of-linear" metrics like the F1-measure.

Implementation and Consistency

A key practical advantage of this approach is the "plug-in" capability. Instead of training a new model from scratch at every iteration, one can use a pre-trained class probability estimator (such as a neural network or logistic regression) and simply "post-shift" its decision boundaries based on the current requirements of the optimization.

Crucially, the authors prove that these algorithms are statistically consistent. This provides a mathematical guarantee that as the volume of training data increases, the classifier produced by the algorithm will converge to the best possible theoretical classifier for the specified metric and constraints.

Experimental Evaluation

The framework was evaluated across a diverse set of benchmarks, including:

  • Standard Multiclass Tasks: Abalone, PageBlock, Sat-Image, and CovType.
  • Astronomy: The MACHO dataset for celestial object classification.
  • Fairness Benchmarks: COMPAS, Adult, and Law School datasets, testing group-based fairness constraints like Demographic Parity.
  • Computer Vision: CIFAR-10 and a 55-class imbalanced version of CIFAR-100 using ResNet-50 backbones.

Results indicated that the proposed algorithms consistently matched or outperformed state-of-the-art baselines, such as the TensorFlow Constrained Optimization (TFCO) library. The "plug-in" LMO approach proved particularly efficient, offering faster execution and better generalization than traditional weighted logistic regression methods.

Conclusion and Future Directions

This research provides a robust foundation for multiclass learning with complex objectives. By optimizing in the space of confusion matrices, the framework naturally handles fairness and non-linear metrics with consistency guarantees. While the current methods may produce randomized classifiers—which can be a hurdle in certain regulated industries—and face scaling challenges with thousands of classes, they represent a significant step forward in making machine learning models align more closely with real-world human values and performance requirements.

Summary updated

BibTeX
@misc{narasimhan2022consistent,
  author = {Harikrishna Narasimhan and Harish G. Ramaswamy and Shiv Kumar Tavker and Drona Khurana and Praneeth Netrapalli and Shivani Agarwal},
  title = {{Consistent Multiclass Algorithms for Complex Metrics and Constraints}},
  year = {2022},
  eprint = {2210.09695},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2210.09695},
}
Figure