To view PDF files

You need Adobe Reader 7.0 or later in order to read PDF files on this site.
If Adobe Reader is not installed on your computer, click the button below and go to the download site.

Regular Articles

Positive-unlabeled AUC Maximization under Distribution Shift

Atsutoshi Kumagai

Abstract

Maximizing the area under the receiver operating characteristic curve (AUC) is a common approach to imbalanced binary classification. With current AUC maximization methods, it is usually assumed that training and test data distributions are identical and require labeled positive and negative data. However, in real-world applications, distribution shifts often occur, and labeled negative data are difficult to collect due to privacy concerns or the need for high expertise to annotate them. To overcome these limitations, my colleagues and I previously proposed a distribution shift adaptation method for maximizing the AUC that learns classifiers from positive and unlabeled data in the training distribution and unlabeled data in the test distribution, which do not overlap with the test data used for evaluation. We consider two types of distribution shifts: positive distribution shift and covariate shift. Under each shift, we theoretically show that the test AUC can be rewritten using only the available data, which enables classifier learning by maximizing the rewritten AUC.

Keywords: AUC maximization, distribution shift, positive-unlabeled learning

PDF PDF

1. Introduction

In many real-world binary classification tasks such as intrusion detection, fraud detection, and medical diagnosis, class-imbalance frequently occurs, where positive data are much smaller than negative data [1]. For example, malicious activities and disease cases (positive data) are much smaller than benign ones (negative data). In such problems, classification accuracy is an inappropriate evaluation metric because a classifier that predicts all instances as negative can achieve high accuracy while failing to detect positive instances. Instead, the area under the receiver operating characteristic curve (AUC) is widely used [2]. Since the AUC is the probability that a positive instance is scored higher than a negative one, it can adequately evaluate performance even with class-imbalanced data. Attention has thus been directed towards AUC maximization methods, which enable accurate classifiers to be learned from labeled positive and negative data in imbalanced classification tasks [2].

With current AUC maximization methods, it is usually assumed that the training and test data distributions are identical. However, this assumption rarely holds in real-world applications because data distributions can change over time or across environments, which is known as distribution shift [3, 4]. For example, attack patterns can evolve over time in intrusion detection, and patient characteristics can differ across hospitals in medical diagnosis. Although this problem could be alleviated by continuously collecting labeled data from the test distribution and re-training the classifier, such labeling is often costly and time-consuming. Labeled negative data are often difficult to collect even from the training distribution. In intrusion detection, for example, malicious data (positive data) can be collected from public blocklists, whereas benign data from legitimate users (negative data) are often unavailable due to privacy reasons, and manually identifying reliable negative data from unlabeled data requires a high level of expertise.

To overcome these limitations, my colleagues and I previously proposed a distribution shift adaptation method for maximizing the AUC in the positive and unlabeled (PU) setting [5, 6]. In this setting, we assume that PU data from the training distribution and unlabeled data from the test distribution are available, as illustrated in Fig. 1. Note that the unlabeled data in the test distribution do not overlap with the test data used for evaluation. Our goal is to learn a classifier that maximizes the AUC on the test distribution under distribution shift without using labeled negative data. We consider two practically important types of distribution shifts: positive distribution shift [3], where the positive-conditional density can vary, and covariate shift [4], where the input density can vary, as shown in Fig. 2. These shifts frequently arise in real-world imbalanced classification tasks. Under these shift-type assumptions, we theoretically show that the AUC on the test distribution can be rewritten using only the available data [5, 6]. By maximizing the rewritten AUC, we can obtain a desired classifier that maximizes the AUC on the test distribution. Through experiments across real-world public data­sets, we demonstrate that our method outperforms current AUC maximization methods in distribution-shift settings.


Fig. 1. Illustrations of our problem and current settings. (a) In the current AUC maximization setting, it is assumed that training and test distributions are identical and labeled positive and negative data are available for training. Classifiers that maximize the AUC can thus be easily learned. (b) In our problem setting, it is assumed that training and test distributions are different and labeled negative data are not available. Classifiers that maximize the AUC on the test distribution are thus impossible to learn without assumptions of shift types.


Fig. 2. Two specific distribution shifts tackled with our method.

2. Preliminary: AUC maximization

AUC maximization is briefly explained as follows. Let x ∈ X be an input instance and y ∈ {+1, −1} be its class label, where +1 and −1 indicate positive and negative classes, respectively. Here, pp(x) = p(x|y = +1) and pn(x) = p(x|y = −1) represent positive and negative-conditional densities, respectively. Let s(x) ∈ ℝ be a score function that outputs the positivity of x. The classifier is defined by s(x) with threshold t: y = sign(s(x) − t), where sign is a sign function. The (differentiable) AUC of s is defined as

anshin

where 𝔼 denotes the expectation, and σ is the sigmoid function [2]. The AUC takes a value between zero and one and becomes higher when the scores of positive instances are higher than those of negative instances.

When positive and negative data drawn from pp(x) and pn(x) are available, the AUC can be computed by approximating each expectation with the sample-mean, and we can directly learn the score function by maximizing it with standard stochastic gradient descent methods. However, when negative data are unavailable, we cannot directly compute the AUC, thus cannot maximize it.

3. Our method

Our problem setting is first described in Section 3.1. Our method under positive distribution shift and covariate shift is then described in Sections 3.2 and 3.3, respectively.

3.1 Problem setting

We are given positive data anshin and unlabeled data Xtr from the training distribution:

anshin
where anshin denote the positive and negative-conditional densities in the training distribution, respectively, ptr(x) is the marginal training density, and anshin is the positive class-prior in the training distribution. We are also given unlabeled data Xte from the test distribution:
anshin

where anshin denote the positive and negative-conditional densities in the test distribution, respectively, pte(x) is the marginal test density, and πte is the positive class-prior in the test distribution.

We assume that there is a distribution shift between the training and test distributions. Specifically, we consider two types of distribution shifts. The first is positive distribution shift [3], where the negative-conditional density does not change but the positive-conditional density can vary. The second is covariate shift, where the input density changes but the conditional density of the class label given the input remains unchanged [4]. Our goal is to learn score function s(x) that can maximize the AUC on the test distribution under the distribution shift by using anshin Xtr, and Xte.

3.2 Positive distribution shift adaptation

Positive distribution shift is formally defined as

anshin

This shift often occurs in real-world imbalanced classification tasks. For example, in intrusion detection, malicious adversaries rapidly change their attacks (positive data) to bypass detection systems, while the benign data (negative data) do not change much. Under this shift assumption, we can rewrite the AUC on the test distribution explained in Section 2 as

anshin

where we set anshin and C represents a constant term that does not depend on s(x) [5]. Each expectation in this rewritten AUC can be approximated from given PU data anshin and πtr can also be estimated from given PU data (anshin and Xtr). Since coefficient anshin and constant C do not affect the optimization of s(x), we can safely ignore them for training. We can thus learn s(x) that maximizes the AUC on the test distribution by maximizing the rewritten AUC with only the available data.

3.3 Covariate shift adaptation

Covariate shift is formally defined as

ptr(y|x) = pte(y|x), ptr(x) ≠ pte(x).

This shift often occurs in real-world imbalanced classification tasks. In medical diagnosis, for example, the distribution of patients (input instances) often varies due to the differences in hospitals and measurement instruments, even when the input-output relation does not change. Under this shift assumption, we derive two estimators of the AUC on the test distribution [6]. The first one is represented as

anshin

where anshin is an importance weight, which can be estimated from unlabeled data (Xtr and Xte) using off-the-shelf density-ratio estimation methods [7], and C represents a constant term that does not depend on s(x). Similarly, the second one is represented as

anshin

Since both estimators are equivalent to the original AUC, a linear combination of them is also equivalent to the AUC:

anshin

where β ∈ [0, 1] is a weighting hyperparameter. Similar to positive covariate shift, since coefficient anshin and constant C do not affect optimization of s(x), we can safely ignore them for training. Therefore, we can learn the desired s(x) by maximizing the rewritten AUC with only the available data.

4. Experiments

4.1 Data

We evaluated our method using commonly used public real-world datasets: Modified National Institute of Standards and Technology (MNIST), Fashion MNIST, Street View House Numbers (SVHN), and Canadian Institute for Advanced Research (CIFAR)10. For each dataset, we constructed a binary imbalanced classification task by grouping the original multiple class labels into two classes (positive and negative) and artificially induced shifts between the training and test distributions according to the shift types. For example, in MNIST and SVHN in the positive-distribution-shift experiment, even digits were assigned to the negative class and odd digits to the positive class; digits 7 and 9 (1, 3, 5, 7, and 9) were used for data in the training (test) positive-conditional density. All even digits were used for both the training and test negative-conditional densities. For the details of the data and shift creation, see our previous studies [5, 6].

For the positive-distribution-shift experiment, we used 10 positive and 5000 unlabeled instances in the training distribution and 5000 unlabeled instances in the test distribution for training. The positive class-priors πtr and πte were set to 0.01 and 0.3, respectively. For the covariate-shift experiment, we used 50 positive and 3000 unlabeled instances in the training distribution and 3000 unlabeled instances in the test distribution for training. The positive class-priors πtr and πte were set to 0.01 and 0.01, respectively. For each experiment, we additionally used 3000 test instances in the test distribution for evaluation. These evaluation data were disjoint from all data used for training.

4.2 Comparison methods

We compared our method with an AUC maximization method from PU data in the training distribution (PUAUC) [8] and a naïve distribution adaptation method for AUC maximization (DAAUC). PUAUC uses only PU data in the training distribution and does not handle distribution shift. DAAUC uses data from both the training and test distributions, like our method, but it naively applies a feature invariance-promoting loss [9], which is commonly used for general distribution shift adaptation, to AUC maximization. All methods including ours used the neural-network-based score function to be learned.

4.3 Results

Tables 1 and 2 show the average test AUCs of each method under positive distribution shift and covariate shift, respectively. Our method performed the best or comparably in all cases. Since PUAUC cannot handle distribution shift, its performance was not high. DAAUC also did not work well because it is not explicitly designed for a specific distribution shift and maximizing the AUC on the test distribution. These results indicate the effectiveness of our method, which is theoretically designed for maximizing the AUC under specific distribution shifts.


Table 1. The average test AUCs of each method under positive distribution shift. Values in bold are not statistically different at the 5% level from the best performing method in each row according to a paired t-test.


Table 2. The average test AUCs of each method under covariate shift. Values in bold are not statistically different at the 5% level from the best performing method in each row according to a paired t-test.

5. Conclusions

We previously proposed a distribution shift adaptation method for maximizing the AUC that uses PU data in the training distribution and unlabeled data in the test distribution. We consider two important types of distribution shifts with our method: positive distribution shift and covariate shift. Under each shift, we theoretically rewrite the AUC on the test distribution using only available data. By maximizing the rewritten AUC, we can learn accurate classifiers that maximize the test AUC. Experiments demonstrated the effectiveness of our method under distribution-shift settings. A limitation of the method is the need to assume a specific type of distribution shift. To alleviate this limitation, one interesting future direction is to extend the method to settings in which a small amount of labeled positive data is also available in the test distribution, which enables AUC maximization without assuming a specific type of distribution shift.

References

[1] J. M. Johnson and T. M. Khoshgoftaar, “Survey on Deep Learning with Class Imbalance,” Journal of Big Data, Vol. 6, Article no. 27, 2019.
https://doi.org/10.1186/s40537-019-0192-5
[2] T. Yang and Y. Ying, “AUC Maximization in the Era of Big Data and AI: A Survey,” ACM Computing Surveys, Vol. 55, No. 8, Article no. 172, 2022.
https://doi.org/10.1145/3554729
[3] Z. Hammoudeh and D. Lowd, “Learning from Positive and Unlabeled Data with Arbitrary Positive Shift,” Advances in Neural Information Processing Systems 33, pp. 13088–13099, 2020.
[4] H. Shimodaira, “Improving Predictive Inference under Covariate Shift by Weighting the Log-likelihood Function,” Journal of Statistical Planning and Inference, Vol. 90, No. 2, pp. 227–244, 2000.
https://doi.org/10.1016/S0378-3758(00)00115-4
[5] A. Kumagai, T. Iwata, H. Takahashi, T. Nishiyama, and Y. Fujiwara, “AUC Maximization under Positive Distribution Shift,” Advances in Neural Information Processing Systems 37, pp. 36071–36096, 2024.
[6] A. Kumagai, T. Iwata, H. Takahashi, T. Nishiyama, K. Adachi, and Y. Fujiwara, “Positive-unlabeled AUC Maximization under Covariate Shift,” Proc. of the 42nd International Conference on Machine Learning, pp. 31876–31891, Vancouver, Canada, July 2025.
[7] M. Sugiyama, T. Suzuki, and T. Kanamori, “Density Ratio Estimation in Machine Learning,” Cambridge University Press, 2012.
https://doi.org/10.1017/CBO9781139035613
[8] T. Sakai, G. Niu, and M. Sugiyama, “Semi-supervised AUC Optimization Based on Positive-unlabeled Learning,” Machine Learning, Vol. 107, pp. 767–794, 2018.
https://doi.org/10.1007/s10994-017-5678-9
[9] B. Sun and K. Saenko, “Deep CORAL: Correlation Alignment for Deep Domain Adaptation,” Proc. of the 14th European Conference on Computer Vision Work Shops, pp. 443–450, Amsterdam, The Netherlands, Oct. 2016.
https://doi.org/10.1007/978-3-319-49409-8_35
Atsutoshi Kumagai
Distinguished Researcher, Innovative Computing Architecture Laboratory, Computer and Data Science Laboratories, NTT, Inc.
He received a B.S. in informatics and mathematical science from Kyoto University in 2010, and M.S. in informatics from Kyoto University in 2012. In 2012, he joined NTT and is currently a distinguished researcher of NTT Computer and Data Science Laboratories and NTT Social Informatics Laboratories. His research interests include machine learning, data mining, and cyber security.

↑ TOP