A Unified View of Label Shift Estimation

Saurabh Garg, Yifan Wu, Sivaraman Balakrishnan, Zachary Chase Lipton

Abstract

Under label shift, the label distribution p(y) might change but the class-conditional distributions p(x|y) do not. There are two dominant approaches for estimating the label marginal. BBSE, a moment-matching approach based on confusion matrices, is provably consistent and provides interpretable error bounds. However, a maximum likelihood estimation approach, which we call MLLS, dominates empirically. In this paper, we present a unified view of the two methods and the first theoretical characterization of MLLS. Our contributions include (i) consistency conditions for MLLS, which include calibration of the classifier and a confusion matrix invertibility condition that BBSE also requires; (ii) a unified framework, casting BBSE as roughly equivalent to MLLS for a particular choice of calibration method; and (iii) a decomposition of MLLS's finite-sample error into terms reflecting miscalibration and estimation error. Our analysis attributes BBSE's statistical inefficiency to a loss of information due to coarse calibration. Experiments on synthetic data, MNIST, and CIFAR10 support our findings.

Introduction

In machine learning, the assumption that training (source) and testing (target) data share the same distribution is often violated. A common form of this mismatch is label shift, where the prevalence of classes $p(y)$ changes between domains, while the class-conditional distributions $p(x|y)$ remain invariant. For instance, in medical imaging, the symptoms of a disease given the diagnosis are stable, but the overall frequency of the disease may fluctuate significantly during a pandemic.

To adapt models to label shift, one must accurately estimate the target label marginal. Two primary methodologies have emerged: Black Box Shift Estimation (BBSE), a moment-matching technique utilizing confusion matrices, and Maximum Likelihood Label Shift (MLLS), an Expectation-Maximization (EM) based approach. While BBSE offers strong theoretical guarantees, MLLS consistently achieves superior empirical performance. This work bridges the gap between these two paradigms, providing a unified theoretical framework and explaining the source of MLLS's advantage.

A Unified Theoretical Framework

The authors propose a Unified Distribution Matching framework, demonstrating that both BBSE and MLLS seek a weight vector to align source and target distributions in a latent space. The fundamental difference lies in the granularity of the calibration used.

The Role of Calibration

MLLS typically employs granular calibration methods, such as Bias-Corrected Temperature Scaling (BCTS). In contrast, BBSE can be viewed as a variant of MLLS that uses a "coarse" calibration—specifically, the confusion matrix itself. The paper establishes that MLLS is consistent provided the classifier is "canonically calibrated" and the confusion matrix is invertible.

Error Decomposition

A key contribution is the decomposition of MLLS's finite-sample error into two distinct components:

  1. Finite-sample error: Error arising from the limited size of the target dataset.
  2. Miscalibration error: Error resulting from inaccuracies in the classifier's probability estimates.

Experimental Validation

The theory was tested across three settings: a synthetic Gaussian Mixture Model (GMM), MNIST, and CIFAR-10. For the image datasets, ResNet-18 architectures were used to evaluate the methods in high-dimensional spaces.

Key Results

The experiments confirm that MLLS (with BCTS) significantly outperforms BBSE, often reducing Mean Squared Error (MSE) by a factor of 2 to 10. A critical finding is the empirical equivalence of BBSE and a variant of MLLS called MLLS-CM, which uses the same coarse confusion-matrix-based calibration as BBSE.

Comparison of MSE for BBSE, MLLS, and MLLS-CM across GMM, MNIST, and CIFAR-10 datasets.

As shown in the figures above, the error curves for BBSE and MLLS-CM are nearly identical across all datasets and shift parameters. This supports the paper's central thesis: the performance gap is not due to the optimization objective (Maximum Likelihood vs. Moment Matching) but rather the information loss inherent in BBSE's coarse calibration. When MLLS is forced to use the same coarse calibration, its performance advantage disappears.

Conclusion

This work provides the first rigorous theoretical characterization of MLLS and unifies it with the BBSE framework. By identifying calibration granularity as the primary driver of performance, the authors clarify why MLLS excels and highlight the necessity of proper calibration for consistent label shift estimation. Future work may explore specialized calibration schemes designed to minimize the miscalibration error identified in this study.

Summary updated

Abstract

Under label shift, the label distribution p(y) might change but the class-conditional distributions p(x|y) do not. There are two dominant approaches for estimating the label marginal. BBSE, a moment-matching approach based on confusion matrices, is provably consistent and provides interpretable error bounds. However, a maximum likelihood estimation approach, which we call MLLS, dominates empirically. In this paper, we present a unified view of the two methods and the first theoretical characterization of MLLS. Our contributions include (i) consistency conditions for MLLS, which include calibration of the classifier and a confusion matrix invertibility condition that BBSE also requires; (ii) a unified framework, casting BBSE as roughly equivalent to MLLS for a particular choice of calibration method; and (iii) a decomposition of MLLS's finite-sample error into terms reflecting miscalibration and estimation error. Our analysis attributes BBSE's statistical inefficiency to a loss of information due to coarse calibration. Experiments on synthetic data, MNIST, and CIFAR10 support our findings.
BibTeX
@inproceedings{garg2020unified,
  author = {Saurabh Garg and Yifan Wu and Sivaraman Balakrishnan and Zachary Chase Lipton},
  title = {{A Unified View of Label Shift Estimation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
}
Figure