Estimating and Explaining Model Performance When Both Covariates and Labels Shift
Abstract
Deployed machine learning (ML) models often encounter new user data that differs from their training data.
Therefore, estimating how well a given model might perform on the new data is an important step toward reliable ML applications.
This is very challenging, however, as the data distribution can change in flexible ways, and we may not have any labels on the new data, which is often the case in monitoring settings.
In this paper, we propose a new distribution shift model,
Sparse Joint Shift (SJS), which considers the joint shift of both labels and a few features.
This unifies and generalizes several existing shift models including label shift and sparse covariate shift, where only marginal feature or label distribution shifts are considered.
We describe mathematical conditions under which SJS is identifiable.
We further propose SEES, an algorithmic framework to characterize the distribution shift under SJS and to estimate a model’s performance on new data without any labels.
We conduct extensive experiments on several real-world datasets with various ML models.
Across different datasets and distribution shifts,
SEES achieves significant (up to an order of magnitude) shift estimation error improvements over existing approaches.
Introduction
Deployed machine learning (ML) models often face new data different from their training data.
For example, mismatch of deployment-development data in geographical locations [21], demographic features [16] and label balance [20] is widely observed and known to affect model performance.
Thus, estimating and explaining how a model’s performance changes on the new data is an important step toward reliable ML applications.
Estimating and explaining performance shift is challenging for several reasons, however.
One major challenge is that the data distribution might shift in flexible ways.
Another obstacle is that we often do not have labels on the new data, especially in ML monitoring applications.
Without any assumption on the distribution shift, it’s impossible to estimate how well the model would perform on the unlabeled new data.
Previous work often assumes (i) label shift [22] where feature distributions conditional on the labels are fixed, or (ii) covariate shift [32], where label distributions conditional on features stay the same.
However, we often do not know whether the real data shift is limited to label or covariate shift, and naively applying estimation methods designed for one shift may produce inaccurate assessments [26].
Moreover, labels and features may shift simultaneously in practice, invalidating these common assumptions.
To tackle the above challenges, here we propose a new distribution shift model, Sparse Joint Shift (SJS), to consider the joint shift of both labels and a few features.
SJS assumes labels and a few features shift, but the remaining features’ distribution conditional on the shifted features and labels is fixed.
This unifies and generalizes sparse covariate shift and label shift: both of them are SJS, but some SJS is not label or sparse covariate shift (Figure 1).
We describe mathematical conditions
[Figure]
under which SJS is provably identifiable: if the non-shifted features are weakly correlated, then the marginal feature distribution uniquely determines the joint distribution under SJS.
This makes it possible to quantify the shift and estimate model performance on new data without any labels.
When SJS occurs: a motivating example.
Consider Alice, a data scientist who built an ML model for customer churn prediction.
Two years later, churn rate rose in some states but dropped in others, while the distribution of other features given label (churn) and location (state) remained.
This shift in customer distribution is a natural SJS and challenging to estimate without labels on the new data.
Furthermore, we propose SEES, an algorithmic framework for performance shift estimation and explanation under SJS.
SEES exploits correlation shifts between features and labels modeled by SJS to improve performance estimation accuracy over existing methods, such as BBSE [22] for label shift and KLIEP [32] for covariate shift (Figure 1).
It uses the identified shifted features and labels as a natural explanation of the performance shift.
We present an extensive empirical evaluation on real world datasets with both simulated SJS and real shifts.
Our experiments validate the effectiveness of
SEES: the estimation error of SEES is often an order of magnitude smaller than that of previous state-of-the-art methods.
All together, our contributions are :
We formulate and study sparse joint shift (SJS), a new distribution shift model that considers the joint shift of both labels and features.
We show how it unifies and generalizes existing shift models and when it is identifiable with unlabeled data.
We propose SEES, a general framework for performance shift estimation and explanation under SJS.
We design efficient substantiations of SEES for different data types.
We also release our code 1 . 3.
We provide comprehensive empirical analysis of our methods.
On real world datasets with natural distribution shifts, we found SEES leads to up to 66% performance estimation error reduction over standard approaches.
Related Work.
Label shift: Label shift has been observed and studied in various domains, such as epidemiologic [5], economics [23], and data mining [13].
Recently, there is an increasing interest in model evaluation and development under under label shift.
For example, [22, 3] study how to quantify label shift and evaluate an ML model’s performance under label shift accordingly.
[40] gives an algorithm for active learning under label shift.
Online adaptation to label shift [37] is also shown to be feasible.
Label shift can be viewed as a subset of our proposed shift model SJS.
Although simpler and easier to estimate, label shift does not capture the joint shift of labels and features.
Thus, methods developed for label shift may not work well under SJS.
Covariate shift: Covariate shift [30, 38, 24] is perhaps the most widely adopted assumption in data distribution shift.
Since studied in the seminal work [30], various methods have been proposed to estimate covariate shift, including KLIEP [33], KMM [15], and IWCV [31].
Adaptation to covaraite shift has been found useful in many applications, such as spam filtering [4], emotion recognition [19] and human activity detection [18].
More recently, covariate shift adaptation is jointly optimized with model robustness [29], fairness [28], and conformal prediction [35].
Unsupervised model performance evaluation : Model performance evaluation without labels has received relatively limited attention.
Domain-specific models’ performance can be estimated via certain statistics, such as confidence score [17], rotation prediction [9] and feature statistics of the datasets sampled from a meta-dataset [10] for image recognition.
General model evaluation often relies on different assumptions and accessibility [14, 7, 6, 12, 8, 36].
[7] assumes covariate shift and requires users to provide an approximation (slice) of the shifted features, while [6] needs white-box access to the ML models to train an ensemble as a reference.
[12] assumes the label distributions are known, while [8] needs a feature independence structure given the labels.
When a small number of labels can be obtained, [36] proposes an active model evaluation approach.
To our knowledge, this is the first paper that explicitly models the joint shift of both labels and a few features with provable identification guarantees.
Moreover, we do not require access to side information such as model design or metadata.
Preliminaries and Problem Statement
We start by giving the preliminaries and the problem of estimating and explaining performance shift.
Prediction tasks and ML models.
In this paper we consider the standard classification task: given a d -dimensional feature vector xxx ∈ X ⊆ R d from the feature space X , the goal is to predict its associated label y ∈ Y in the label space Y .
Let f ( · ) :
R d (cid:55)→ Y denote an ML model designed for such a task.
For simplicity, we assume that Y
= { 1 , 2 , · · · , L } .
Given the model’s prediction f
( xxx ) and its true label y , its performance is quantified by some loss function ℓ ( · , · ) .
A popular choice is the standard 0-1 loss: ℓ ( a, b ) = 1 a = b , which we focus on, but other losses are also applicable.
Joint distribution shift.
The training and inference data for ML often come from two different distributions, referred to as source domain and target domain.
Here, we consider the general case when the joint distribution vary across the source and target domains, and call this joint distribution shift .
Formally, let P s , P t : X × Y (cid:55)→ [0 , 1] denote the source and target domains, and p s , p t be their probability density (or mass) functions.
Then joint distribution shift means p s ( xxx, y )
̸
= p t ( xxx, y ) .
Problem statement.
Suppose we are given a labeled dataset D s ≜ { ( xxx s,i , y s,i ) }
n s i =1 from the source distribution P s , an unlabeled dataset D t ≜ { ( xxx t,i ) } n t i =1 from the target distribution P t , and an
ML model f ( · ) predicting the associated label given any feature vector xxx .
Our goal is to estimate how much performance changes from the source domain to the target domain.
More formally, we aim at estimating the performance shift ∆ ≜ E ( xxx,y ) ∼ P t [ ℓ ( f ( xxx ) , y )] − E ( xxx,y ) ∼ P s [ ℓ ( f ( xxx ) , y )] .
This is challenging as we do not observe labels on the target domain.
In many applications, attributing the performance shift to certain features is also desired.
Thus, we are also interested in identifying a set of features to explain the performance shift.
SJS: A Tractable Unification of Label Shift and Sparse Covariate Shift
At a first glance, estimating the performance shift under joint distribution shift without observing labels from target domain seems hopeless: if the marginal feature distributions are identical for both domains, then observing the features alone should give 0 as the estimated performance shift.
However, the label distribution given any feature on the target domain is arbitrary, and thus the estimated shift can be arbitrarily bad.
In other words, joint distribution shift is not identifiable with no target labels.
To mitigate nonidentifiability, it’s necessary to make additional assumptions.
The most popular assumptions in literature are label shift [22] and covariate shift [30].
Label shift assumes that only label distribution may change, but the feature distribution given a label remains, i.e., p s ( xxx | y ) =
p t ( xxx | y ) .
On the other hand, covariate shift assumes that feature distribution can shift, but the label distribution given the features is fixed, i.e., p s ( y | xxx ) =
p t ( y | xxx ) .
However, those assumptions disallow simultaneous changes of both features and labels, which often happen in real-world data [21, 27, 34].
To enable joint feature and label estimation which is tractable, we introduce a subclass of joint distribution shift, Sparse Joint Shift (SJS), as follows.
Definition 1 (Sparse Joint Shift (SJS)) .
Suppose for an integer m ≤ d and an index set I ⊂ [ d ] with size at most m (i.e., | I | ≤ m ), p s ( xxx I c |
xxx I , y )
=
p t ( xxx I c | xxx I , y ) .
Then we say the source and target pair ( p s , p t ) is under m -Sparse Joint Shift, or m - SJS .
Here, I c ≜ [ d ] − I .
We call I the shift index set.
Roughly speaking, SJS allows both labels and a few features to shift, but assumes the remaining features’ conditional distribution to stay the same.
Section 1 gives one example when SJS occurs, and more examples and discussions can be found in the appendix.
Next, we will study when this assumption allows tractable performance shift estimation.
All proofs are left to the appendix.
3.1 When is sparse joint shift identifiable?
Recall that additional assumptions are needed because the general joint distribution shift is not identifiable.
However, when m = d , m -SJS simply becomes general joint distribution shift.
Thus, it is worthy understanding when m -SJS resolves the identifiability issue.
To do so, let us first formally introduce the notation of identifiability.
Definition 2 (Identifiable) .
Suppose the source-target tuple ( p s , p t ) is under m - SJS .
( p s , p t ) is identifiable if and only if for any alternative distribution p
a ( xxx, y ) , if p a ( xxx ) =
p t ( xxx ) and ∃J ⊂ [ d ] , |J | ≤ m , such that p a ( xxx J c |
xxx J , y )
=
p s ( xxx J c |
xxx J , y ) , then p a ( xxx, y ) =
p t ( xxx, y ) .
The identifiability can be easily interpreted in words: If a joint feature and label distribution matches the target feature distribution and satisfies the m -SJS requirement together with the source distribution, it has to be the target distribution.
The following statement shows when ( p s , p t ) is identifiable.
Theorem 1.
Suppose ( p s , p t ) is under m - SJS .
Assume for any set J ⊂ [ d ] , |J | ≤ m and any fixed ¯ xxx ∈ X , the probability density (or mass) functions { p s ( xxx J c ∩ I c ,
xxx J∪
I =
¯ xxx
J∪
I , y = i ) }
Li =1 are linearly independent.
Then ( p s , p t ) is identifiable.
This statement sheds light on why uniquely identifying the target distribution without target label is feasible under sparse joint shift.
Roughly speaking, m -SJS requires that given the shifted features and labels, the remaining features’ distribution remains the same on both domains.
If those remaining features are different enough (linear independence), they can uniquely determine the distribution of the shifted features and labels.
We stress that the linear independence is necessary: if it does not hold, then for any m , we can always find some source-target pair ( p s , p t ) which is not identifiable.
Linear independence implicitly requires sparsity: if m > d/ 2 , then J c ∩ I c can be empty and the linear independence does not hold.
In other words, the sparsity is necessary for the shift to be identifiable.
3.2 How does SJS relate to label shift and covariate shift?
A natural question is how does SJS relates to standard label shift and covariate shift.
To answer this, let us first introduce label and sparse covariate shift formally.
Definition 3.
The source and target ( p s , p t ) is under Label Shift
iff p s ( xxx | y )
=
p t ( xxx | y ) , and under m -Sparse Covariate Shift iff p s
( xxx I c , y | xxx I ) =
p t ( xxx I c , y | xxx I ) for some index set I with size m < d .
Now we are ready to answer the above question.
Theorem 2.
If ( p s , p t ) is under label shift, then it is also under 0 - SJS .
If ( p s , p t ) is under m -sparse covariate shift, then it is also under m - SJS .
In addition, there exists ( p s , p t ) under m - SJS such that it is under neither label shift or covariate shift.
There are several takeaways.
First, label shift implies SJS without additional requirements.
In fact, as certain distribution pairs are under SJS but not label shift, SJS is strictly more general than label shift.
Second, SJS also includes sparse covariate shift.
When m = d , SJS completely unifies both label shift and covariate shift, though it is not identifiable.
Identifiable SJS, on the other hand, unifies label shift and sparse covariate shift.
Finally, SJS also allows shifts not covered by label shift and covaraite shift: the correlation between label and (a set of) features can be shifted.
[Figure]
Shift Estimation and Explanation under Sparse Joint Shift
Now we present SEES, an algorithmic framework to estimate and explain the performance shift ∆ when the source and target domain is under m -SJS.
As shown in Figure 2, it consists of three components: a sparsity-aware density matcher, an empirical gap calculator, and a shifted feature selector.
Given the labeled source samples and unlabeled target samples, we first adopt the sparsityaware density matcher to obtain an estimated ratio of the target and source density functions, denoted by ˆ w ( xxx, y ) .
Next, the empirical gap calculator is responsible to estimate the performance shift ∆ via appropriately reweighting source samples with ratio ˆ w ( xxx, y ) .
Finally, the shifted feature selector picks a set of features as the explanation for the shift.
We explain each component as follows.
4.1 Sparsity-aware density matcher
A key component of SEES is the sparsity-aware density matcher.
Here we want to find some weight function ˆ w ( xxx, y ) to induce an estimated target distribution ˆ p t ( xxx, y ) ≜ ˆ w ( xxx, y ) · p s ( xxx, y ) .
Our goals include (i) a small distance between the estimated target distribution and the true target distribution, (ii) m -SJS between the source and the estimated target distributions, and (iii) flexible parameterization of the weight function.
To achieve those goals, we propose the following optimization framework
[Equation]
and
[Equation]
xxx
[Equation]
y ) depends on at most m features of xxx
[Equation]
Here, D ( · , · ) is some distance metric that measures the difference between two density functions.
We minimize the distance between the induced feature density ˆ p t ( xxx ) and the target feature density p t ( xxx ) .
The minimization is not over joint label and feature distributions since target labels are not available.
The induced feature density function can be easily derived from source density function and the weight function, encoded in the first constraint.
m -SJS is enforced by the second constraint: m -SJS means given m features and labels, the distributions of remaining features are fixed across source and the induced domain, which holds if and only if their density ratio w ( xxx, y ) only depends on those m features.
W represents the set of all feasible weight functions.
Different parameterization can be easily realized by adopting different W .
Assume access to density functions p s ( xxx, y ) and p t ( xxx ) , and a weight function set W containing the true weight w ∗ ( xxx, y ) ≜
p t ( xxx,y ) p s ( xxx,y ) .
One can easily show the above optimization returns the true weight function w ∗ ( xxx, y ) for identifiable m -SJS.
One benefit of the above framework is the flexibility of concrete instantiations.
Different design choices, including the distance metric D ( · , · ) and the weight parameterization space W , can fit different feature types, incorporate domain knowledge, and tradeoff different sample and computational complexity.
We give two instantiations of the above optimization: SEES-c for continuous features, and SEES-d for discrete features.
SEES-c: SEES for continuous features.
For continuous features, we use KL-divergence D KL ( · , · ) as the distance metric, and initialize the parameterization space W by linear combinations of K fixed basis functions, ϕ 1 ( xxx, y ) , ϕ 2 ( xxx, y ) , · · · , ϕ K ( xxx, y ) .
That is to say, W = { w ( xxx, y ) | w ( xxx, y ) =
(cid:80) Kk =1 a k,y ϕ k
( xxx, y ) , a k,y ≥ 0 , E ( xxx,y ) ∼ P s (cid:104)(cid:80)
Kk =1 a k,y ϕ k
( xxx, y ) (cid:105) = 1 , α k,y ≥ 0 } .
The last two constraints ensure w ( xxx, y ) · p s ( xxx, y ) is a valid probability density.
Those basis functions encode users’ prior knowledge about the shift.
A simple choice, for example, is linear functions (when xxx k ≥ 0 ): setting K = d and ϕ k
( xxx, y ) =
xxx k .
To model the dependence on different features, let e i denote all indexes k
such that ϕ k ( · ) depends on feature
xxx i , and introduce a vector βββ ∈ R d such that βββ
i ≜ (cid:113)(cid:80)
k ∈
e i (cid:80)
Ly =1 a 2 k,y .
The feature dependence requirement in Problem 4.1 is equivalent to sparsity constraint ∥ βββ ∥ 0 ≤ s .
We can relax the 0 -norm by 1 -norm and obtain one instantiation as
[Equation]
where η > 0 controls the trade-off between sparsity and the KL distance.
One benefit of this instantiation is computational efficiency: the constraint is linear in the optimization variables, and the objective is convex.
Thus, the problem is convex and can be efficiently solved.
The label distribution given feature p s ( y | xxx ) is unknown but can be approximated by the ML model f ( · ) trained on the source domain.
Given finite samples, the expectations can be replaced by their empirical estimation.
SEES-d: SEES for discrete features.
Another interesting instantiation exists for discrete features.
With no prior knowledge, we parameterize W to include all possible m -SJS: specifically, W contains all tuple ( J, w J ( xxx J , y )) , where index set J ⊂ [ d ] , | J | = m represents the shifted features, and weight function w J
( xxx J , y ) only depends on xxx J and y .
Features only take finite values, so we can view the density (mass) functions as vectors with finite dimensions.
Thus, we adopt the squared ℓ 2 distance, i.e., D ( zzz,zzz ′ ) =
(cid:80) | zzz | i =
( zzz i − zzz ′ i )
2 to measure distance.
However, naively measuring ℓ 2 distance between p t ( xxx ) and ˆ p t ( xxx ) leads to a computational complexity exponential in d .
Instead, we measure the distance on a set of marginal densities: given an index set J , for every index set with size 2 s that contains J , denoted by κ , we measure the squared ℓ 2 distance between p t ( xxx κ , f ( xxx )) and ˆ p t ( xxx κ , f ( xxx )) , and then aggregate over κ .
This design leads to the following instantiation of Problem 4.
[Equation]
.t.
| J | = m (4.2) where p t (¯ xxx κ , ¯ f ) and p s (¯ xxx κ , ¯ f, ¯ y ) are short for p t ( xxx κ = ¯ xxx κ , f ( xxx ) =
¯ f ) and p s ( xxx κ = ¯ xxx κ , f ( xxx ) =
¯ f, y = ¯ y ) , respectively.
Compared to the naive approach, the above formulation is much more computationally efficient: the number of parameters in the above objective is only polynomial in the feature dimension d .
For fixed
J , the problem is simply a linear regression over the weight w J ( xxx J , y ) and thus can be efficiently solved.
In practice, one can estimate p t (¯ xxx κ , ¯ f ) and p s (¯ xxx κ , ¯ f, ¯ y ) via labeled source and unlabeled target samples, and then solve the empirical version of the above problem.
Compared to using
KL-divergence, solving the empirical version produces the correct shifted index set and a weight function close to the true weight w ∗ ( xxx, y )
(under mild conditions).
This is formally stated as follows.
Theorem 3.
Consider when all features are discrete, i.e., for each i , xxx i ∈ { 1 , 2 , · · · , v } .
Suppose (i) the source and target are under exact m - SJS , (ii) for any set J ⊂ [ d ] , |J | ≤ m and any ¯ xxx ∈ X , the marginal probability density (or mass) functions { p s ( f ( xxx ) ,
xxx J∪
I =
¯ xxx
J∪
I , y = i ) } di =1 are linearly independent, and (iii) w ( xxx, y ) is bounded by a constant M .
Then there exists some constant c (independent of d, n s and n t ), such that if (cid:113) 12 n s + LM (cid:113) 12 n t <
c/ (cid:112) 2 m log d + m log v + 2 log
L + log 1 /δ , then with probability 1 − δ , (i) the index set ˆ J learned by Problem 4.2 matches the true shift index set I , and (ii) the produced weights w ˆ J ( xxx
ˆ J , y ) satisfies (cid:12)(cid:12) w ˆ J ( xxx ˆ J , y ) − w ∗ ( xxx, y ) (cid:12)(cid:12) ≤
O (cid:16)(cid:112) 2 m log d + m log v + 2 log
L + log 1 /δ (cid:16)(cid:113) 12 n s + LM (cid:113) 12 n t (cid:17)(cid:17) .
Roughly speaking, this statement ensures that, when source and target sample sizes are large enough, with high probability, the true shift index set can be identified with finite samples, and the error rate of the learned weight function is approximately the inverse of sample sizes’ square root.
Comparisons of SEES-c and SEES-d.
SEES-d enjoys mathematical guarantees, but SEES-c can be computationally more efficient.
In practice, we can discretize continuous features to use SEES-d.
4.2 Empirical gap calculator and shifted feature selector
Now we explain how the other two components of SEES work.
The empirical gap calculator computes the performance shift ˆ∆ via three steps.
First, it estimates the source performance by 1 n s (cid:80) n s i =1 ℓ ( xxx s,i , y s,i ) .
Next, it estimates the performance on the induced target distribution.
Note that the performance on the induced target domain is (cid:82)
[Equation]
(cid:82) ˆ w ( xxx, y )
p s ( xxx, y ) ℓ ( xxx, y ) dxxxdy =
E ( xxx,y ) ∼ P s [ ˆ w ( xxx, y ) ℓ ( xxx, y )] .
Thus, we use the weighted loss on the source samples 1 n s (cid:80) n s i =1 ˆ w ( xxx s,i , y s,i ) ℓ
xxx s,i , y s,i ) as the estimation.
Finally, their difference, i.e., ˆ∆ = 1 n s (cid:80) n s i =
1 ( ˆ w ( xxx s,i , y s,i ) − 1) ℓ ( xxx s,i , y s,i ) is returned as the estimated performance shift.
The shifted feature selector picks a set of features as the shift explanation.
For discrete data, the weight function ˆ w ( x x x, y ) learned by the density matcher’s instantiation is parameterised as a shifted index ˆ J and the corresponding weight ˆ w ˆ J (
xxx ˆ J , y ) .
Thus, a natural choice is to return ˆ I =
ˆ J as the explanation.
For continuous data, the weight function is ˆ w ( xxx, y )
=
(cid:80)
Kk
=
ˆ a k,y ϕ k
( xxx, y ) , where ˆ a k,y is learned by the corresponding instantiation.
Recall that e i denotes all basis functions that depends on feature i .
Then ˆ βββ i ≜ (cid:113)(cid:80)
k ∈
e i (cid:80)
Ly =1 ˆ a 2 k,y can be viewed as the total contribution of feature i .
Thus, a simple choice is to pick features with the m largest contributions.
Formally, we use ˆ I
= { i | ˆ βββ i >
ˆ βββ ( d − m ) } , where ˆ βββ ( d − m ) is
the d − m smallest value in ˆ βββ .
Experiments
In this section, we study the performance of SEES on several real world datasets with synthetic and natural distribution shifts.
Our goal is four-fold: (i) understand when and how SEES estimates the performance shift, (ii) evaluate the trade-offs between the estimation performance reached by SEES and the required dataset sizes, (iii) explore the effects of shift sparsity on SEES’ performance, and (iv) validate the effectiveness of SEES on datasets with real world distribution shifts.
Datasets, ML models and baselines.
Six datasets are used for evaluation purposes.
we first simulate various SJS on BANKCHURN [1], COVID-19 [2], and CREDIT [39] to systematically understand the performance of SEES.
Next, we apply SEES on EMPLOY, INCOME, and INSURANCE [11] with real world distribution shifts and perform an in-depth analysis.
We use a gradient boosting tree model as the ML model, and results for more models can be found in the Appendix.
For comparison, we adopt two state-of-the-art methods for comparison: BBSE [22] for label shift and KLIEP [32] for covariate shift.
More details on the experiments can be found in the Appendix.
Case study.
We start with a case study on the dataset COVID-19.
The task is to predict whether a person tests positive for COVID-19.
We simulate a joint shift of the feature aged and label.
Specifically, both source and target data contain 5000 young and aged individuals.
The positive rate is 40% for both young and aged group from the source.
In the target data, we raise the positive rate to 80% for aged group and 50% for young group.
This simulates a shift due to a COVID variant more harmful to the elder than its ancestor.
We adopt SEES-d as all features are categorical.
Figure 3 summarizes this case study.
First note that identifying which feature is shifted is not obvious.
As shown in Figure 3(a), the marginal distribution of most features except age and gender has changed from the source to the target.
The actual joint shift (Figure 3(b)) is, on the other hand, due to age group and the labels.
Identifying shifted age is challenging as the label on the target (last red bar in Figure 3(a)) also shifts but cannot be observed.
On the other hand, SEES-d correctly identifies the shifted feature age, and produces a weight function close to the true weight (Figure 3(b) and (c)).
This is primarily because SEES-d explicitly exploits the joint shift modeled by SJS.
In fact,
SEES-d’s performance is significantly better than existing methods.
As shown in Figure 3(d), the
[Figure]
𝑤 ∗ (𝒙,𝑦) =
𝐼 = {𝒂𝒈𝒆} 𝐼 = {𝒂𝒈𝒆} 𝑤(𝒙,𝑦) =
Method
MSE
PCC
Est Gap
True Gap
SEES-d 0.002 0.
15.5 BBSE 0.
KLIEP 0.
[Figure]
mean square error (MSE) between the true weights and learned weights is only 0.002 when adopting
SEES-d, but 0.144 and 0.573 when using BBSE and KLIEP, respectively.
The Pearson correlation coefficient (PCC) between the true weights and weights learned by SEES-d is 0.996, indicating a strong correlation.
The weight estimation performance directly affects how precise the estimated accuracy gap is.
The estimated gap ˆ∆ of SEES-d is 16.7%, which is close to the true gap (15.5%).
By contrast, BBSE tends to overestimate the gap (26.3$) while KLIEP underestimates it (1.58%).
Trade-offs between estimation performance and sample size.
Next, we study the trade-offs between estimation performance and the number of available samples.
For simplicity, we simulate various sparse joint shifts with s = 1 via (i) specifying marginal distribution of the shifted feature and labels first, and (ii) then drawing random samples from the original dataset conditional on values of specified labels and shifted feature.
Same number of samples are allocated to both source and target datasets.
Figure 4 shows the simulated data shift (column 1), the squared ℓ 2 loss of accuracy estimation (column 2), weight estimation (column 3), and the shifted feature discovery rate (column 4) for three datasets.
Overall, we observe that the estimation error of SEES-c and SEES-d diminishes as the number of samples increases, while that of BBSE and KLIEP is almost flat.
[Table]
Effects of shift sparsity.
We have focused on 1 -SJS for simplicity, but how the sparsity s affects the estimation performance remains unknown.
To answer this, we fix the number of samples to be 10,000, and then measure the performance of all compared methods for joint distribution of label and different number of features.
Overall, we observe that the estimation error often grows as more features shift jointly with the labels.
This is because more shifted features often implies higher complexity in the distribution shifts and thus more parameters to estimate.
It is worthy noting that
[Figure]
Overall, both SEES-c and SEES-d consistently outperforms existing estimation approaches.
0 -SJS degenerates to label shift, and the performance of SEES-c and SEES-d is slightly worse than
BBSE (designed for label shift) under 0 -SJS.
More details can be found in the appendix.
Accuracy gap estimation on real shifts.
Finally we validate the effectiveness of SEES on accuracy estimation with real world shifts.
EMPLOY and INCOME are partitioned by geography (states) and
INSURANCE is partitioned by time (year).
For each partition pair, we train a gradient boosting model on one and estimate its performance on the other.
Table 1 shows the estimation error averaged over all partition pairs for each dataset.
SEES consistently outperforms BBSE and KLIEP, and reduces the estimation error by up to 66% (1-1.7/5.0).
We also evaluate other models (including a neural network) and observe similar results.
More results can be found in the Appendix.
Conclusion
In this paper, we propose Sparse Joint Shift (SJS), a new distribution shift model that accounts for both label and covariate shifts.
We show how SJS unifies and generalizes existing distribution shift models and remains identifiable under reasonable assumptions.
We develop SEES, an algorithmic framework for unsupervised model performance estimation and explanation under SJS.
Both theoretical analysis and empirical study validates the effectiveness of SEES.
Our work contributes to making ML more reliable when data can change.
A natural next step is how to improve estimation performance under
SJS when a small number of target labels can be queried.
To stimulate more research on SJS, we also release our code in https://github.com/stanford-futuredata/SparseJointShift .
Acknowledgement
This work was supported in part by a Google PhD Fellowship, a Sloan Fellowship, NSF CCF 1763191,
NSF CAREER AWARD 1651570 and 1942926, NIH P30AG059307, NIH U01MH098953, grants from the Chan-Zuckerberg Initiative, Sutherland, and affiliate members and other supporters of the
Stanford DAWN project, including Meta, Google, and VMware.
We also thank anonymous reviewers for helpful discussion and feedback.
Checklist
For all authors... (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope?
[Yes] (b) Did you describe the limitations of your work?
[Yes] .
See Appendix A. (c) Did you discuss any potential negative societal impacts of your work?
[Yes] .
See Appendix A. (d) Have you read the ethics review guidelines and ensured that your paper conforms to them?
[Yes] . 2.
If you are including theoretical results... (a) Did you state the full set of assumptions of all theoretical results?
[Yes] .
(b) Did you include complete proofs of all theoretical results?
[Yes] .See
Appendix B 3.
If you ran experiments... (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)?
[Yes] (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?
[Yes] .
Please see Appendix D. (c) Did you report error bars (e
g., with respect to the random seed after running experiments multiple times)?
[Yes] (d) Did you include the total amount of compute and the type of resources used (e
g., type of GPUs, internal cluster, or cloud provider)?
[Yes] .
Please see Appendix D. 4.
If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... (a) If your work uses existing assets, did you cite the creators?
[Yes] .
(b) Did you mention the license of the assets?
[N/A] (c) Did you include any new assets either in the supplemental material or as a URL?
[N/A] (d) Did you discuss whether
and how consent was obtained from people whose data you’re using/curating?
[N/A] (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content?
[N/A] 5.
If you used crowdsourcing or conducted research with human subjects... (a) Did you include the full text of instructions given to participants and screenshots, if applicable?
[-= 
-]
[-• dd ( J, w J ) = 
-]
[N/A] .
[-= 
-]
[-= s , we have | dd ( J, w ∗ J ) − ˆ dd ( J, ˆ w ∗ J ) | ≤ 3 · (2 s ¯ v ) s ML 2 (cid:112) 
-]
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable?
[N/A] .
[-COVID-
-]
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation?
[N/A] .