Class Probability Matching Using Kernel Methods for Label Shift Adaptation

Hongwei Wen, Annika Betken, Hanyuan HangarXiv 2023

Abstract

In domain adaptation, covariate shift and label shift problems are two distinct and complementary tasks. In covariate shift adaptation where the differences in data distribution arise from variations in feature probabilities, existing approaches naturally address this problem based on feature probability matching (FPM). However, for label shift adaptation where the differences in data distribution stem solely from variations in class probability, current methods still use FPM on the $d$-dimensional feature space to estimate the class probability ratio on the one-dimensional label space. To address label shift adaptation more naturally and effectively, inspired by a new representation of the source domain's class probability, we propose a new framework called class probability matching (CPM) which matches two class probability functions on the one-dimensional label space to estimate the class probability ratio, fundamentally different from FPM operating on the $d$-dimensional feature space. Furthermore, by incorporating the kernel logistic regression into the CPM framework to estimate the conditional probability, we propose an algorithm called class probability matching using kernel methods (CPMKM) for label shift adaptation. From the theoretical perspective, we establish the optimal convergence rates of CPMKM with respect to the cross-entropy loss for multi-class label shift adaptation. From the experimental perspective, comparisons on real datasets demonstrate that CPMKM outperforms existing FPM-based and maximum-likelihood-based algorithms.

Introduction: The Challenge of Label Shift

Domain adaptation is a critical challenge in machine learning, occurring when a model trained on a source distribution must perform accurately on a different target distribution. A specific and common form of this is label shift. In label shift scenarios, the conditional distribution of features given a label ($p(x|y)$) remains constant, but the marginal distribution of the labels ($p(y)$) changes between the source and target domains. For example, a diagnostic model trained in a region with low disease prevalence may struggle when deployed during an outbreak where the disease is much more common, even if the symptoms (features) associated with the disease haven't changed.

Traditionally, researchers have addressed label shift using Feature Probability Matching (FPM). FPM attempts to align distributions within the high-dimensional feature space ($d$-dimensions). However, the authors of this paper argue that FPM is conceptually misaligned for label shift. Since the shift is fundamentally about the one-dimensional label space, solving it in a complex $d$-dimensional space is computationally expensive and often requires arbitrary dimensionality reduction, leading to suboptimal performance.

The Proposed Framework: Class Probability Matching (CPM)

To address these inefficiencies, the authors introduce Class Probability Matching (CPM). Unlike FPM, which operates on features, CPM matches class probability functions directly on the one-dimensional label space.

Comparison between Feature Probability Matching (FPM) and the proposed Class Probability Matching (CPM).

The core insight behind CPM is a derivation based on the Law of Total Probability and Bayes' Rule. The authors demonstrate that the feature density ratio can be expressed as a reciprocal of a linear combination of conditional probabilities. This allows the estimation of the class probability ratio ($w^*$) by solving a system of $M$ equations, where $M$ is the number of classes. This "dimensionality shortcut" bypasses the curse of dimensionality that often plagues feature-matching methods.

Implementation: CPMKM and Truncated KLR

The practical implementation of this framework is called CPMKM (Class Probability Matching using Kernel Methods). It utilizes two main components:

  1. Class Probability Matching: The framework estimates the shift ratio $w$ using unlabeled target data and then reweights the source-trained classifier to adapt to the target domain.
  2. Truncated Kernel Logistic Regression (KLR): KLR is used to estimate the necessary conditional probabilities. To ensure theoretical stability, the authors introduce a probability truncation method. Standard cross-entropy loss can become infinite if a model predicts zero probability for a true label. By truncating the probability estimator (ensuring it stays above a small threshold), the authors keep the loss bounded, allowing for rigorous theoretical analysis.

Theoretical and Experimental Results

The paper provides significant theoretical contributions, establishing the first minimax optimal convergence rates for KLR under unbounded cross-entropy loss. This is achieved by carefully decomposing the loss based on probability thresholds.

Experimentally, CPMKM was evaluated on several multi-class benchmark datasets, including Dionis (355 classes), Volkert (10 classes), Covertype (7 classes), and Gas Sensor (6 classes). Label shift was simulated using a Dirichlet distribution to create varying levels of class imbalance.

Key findings include:

  • Superior Performance: CPMKM consistently outperformed established baselines like Black Box Shift Estimation (BBSE) and Maximum Likelihood Label Shift (MLLS).
  • Scalability: The advantage of CPM was most pronounced on the high-dimensional Dionis dataset. While feature-based methods struggled with 355 classes, CPMKM’s focus on the label space maintained high accuracy.
  • Lower Estimation Error: CPMKM achieved significantly lower Mean Squared Error (MSE) in estimating class probabilities compared to FPM and maximum-likelihood approaches.
  • Stabilization Phase: The experiments confirmed a theoretical "stabilization phase," where performance gains from additional unlabeled target data eventually plateau, limited by the quality of the initial source-domain probability estimation.

Conclusion

CPMKM represents a significant shift in how label shift adaptation is approached. By moving the matching process from the feature space to the label space, the method achieves better scalability and accuracy while maintaining theoretical optimality. While the method currently relies on the assumption that $p(x|y)$ remains constant, it provides a robust foundation for future work in hybrid domain adaptation and deep learning applications.

Summary updated

BibTeX
@misc{wen2023class,
  author = {Hongwei Wen and Annika Betken and Hanyuan Hang},
  title = {{Class Probability Matching Using Kernel Methods for Label Shift Adaptation}},
  year = {2023},
  eprint = {2312.07282},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2312.07282},
}
Figure