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?
[N/A] .
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable?
[N/A] .
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation?
[N/A] .
A Broader Impact and Limitation Discussion
Monitoring, estimating, and explaining performance of deployed ML models is a growing area with significant economic and social impact.
In this paper, we propose SJS, a new data distribution shift model to consider when both labels and features shift after model deployment.
We show how SJS generalizes existing data shift models, and further propose SEES, a generic framework that efficiently explains and estimates an ML model’s performance under SJS.
This may serve as a monitoring tool to help ML practitioners recognize performance changes, discover potential fairness issues and take appropriate business decisions (e.g., switching to other models or debugging the existing ones).
One limitation in general is adaption to continuously changing data streams.
An online algorithm for performance estimation and explanation under SJS is in need to address this challenge.
We will also open source our prototype of SEES serving as a resource for broad community to use.
B Missing Proofs
We provide all missing proofs in this section.
B.1 Proof of Theorem
Proof.
We prove the statement by contradiction.
Suppose not.
That is to say, there exists a distribution p a ( xxx, y ) ,
such that p a ( xxx ) =
p t ( xxx ) , and there exists some set J ⊂ [ d ] , |J | ≤ m , such that p a ( xxx J c |
xxx J , y )
=
p s ( xxx J c |
xxx J , y ) and p a ( xxx, y ) ̸
= p t ( xxx, y ) .
Let w a ( xxx, y ) ≜
p a ( xxx,y ) p s ( xxx,y ) denote the ratio between this alternative distribution p a and the source distribution.
Recall that w ∗ ( xxx, y ) =
p t ( xxx,y )
p s ( xxx,y ) .
To show the contradiction, we simply need to show p a ( xxx, y )
=
p t ( xxx, y ) , which is equivalent to show w a ( xxx, y ) =
w ∗ ( xxx, y ) .
By the m -SJS assumption, p t ( xxx cI |
xxx
I , y )
=
p s ( xxx cI |
xxx I , y ) , we have w
[Equation] [Equation]
Similarly, by the assumption p a ( xxx cJ | xxx J , y ) =
p s ( xxx cJ | xxx J , y ) , we have
[Equation]
Thus
[Equation]
we only need to show
[Equation]
Our approach is to show that the two ratios all satisfy a system of linear equations, which, however, should have only a unique solution.
To see this, let us first note that, for any ¯ ¯ xxx , we have
[Equation]
Here, the first equation is by the total probability rule, the second equation is by the conditional probability rule, the third equation is by the s -SJS assumption, and the last equation is by conditional probability rule again.
Similarly, we can obtain
[Equation]
where the first equation is by the total probability rule, the second equation is by the conditional probability rule, the third equation is by the assumption that p a ( xxx J c |
xxx J , y )
=
p s ( xxx J |
xxx J , y )
[Equation]
and the last equation is by conditional probability rule again.
Note that we have assumed that p a ( xxx ) =
p t ( xxx ) .
Thus
[Equation]
we must have
[Equation]
which is simply
[Equation]
By the assumption that { p s ( xxx J c ∩K c ,xxx J∪
I
=
¯ xxx
J∪
I , y = ¯ y ) } dy =1 are linearly independent, the above system of equations implies
[Equation]
Note that this holds for any ¯ xxx .
Thus, it is simply
[Equation]
That is to say, w ∗ ( xxx, y ) =
w a ( xxx, y ) and thus p a ( xxx, y ) =
p t ( xxx, y ) , which is a contradiction.
Thus, the assumption is incorrect and ( p s , p t ) is identifiable, which finishes the proof.
B.2 Proof of Theorem
Proof.
Proving the first half statement is straightforward: suppose ( p s , p t ) is under label shift.
Then by definition, p t ( xxx | y )
=
p s ( xxx | y ) .
That is basically p t ( xxx
[ d ] | y,xxx ∅ )
= p s ( xxx [ d ] | y,xxx ∅ ) , which corresponds to 0-SJS with I = ∅ .
Next we show the proof for the second half.
Suppose ( p s , p t ) is under sparse covariate shift,
i.e., p t ( xxx I c | xxx I ) =
p s ( xxx I c | xxx I ) for some I with size m < d , and p t ( y | xxx )
= p s ( y | xxx ) .
Adopting the definition of conditional probability, p t ( y | xxx )
= p s ( y | xxx ) can be rewritten as
[Equation]
By definition of conditional probability, p s ( xxx ) =
p s ( xxx I ) · p s ( xxx I c | xxx I ) and p t ( xxx ) =
p t ( xxx I ) · p t ( xxx I c | xxx I ) , and thus we have
[Equation]
By the assumption p t ( xxx I c | xxx I )
=
p s ( xxx I c | xxx I ) , we can simplify this as
[Equation]
By definition of conditional probability, this is basically
[Equation]
which means ( p s , p t ) is under m -SJS.
Now we show the last piece of the statement by construction.
Consider the case of d = 2 .
xxx 1 ,xxx 2 , y are all binary variables.
P s is generated as follows:
y is first generated from Bernoulli distribution
Bern (0 . 5) .
If y = 0 , xxx 1 ,xxx 2 are independently generated from Bern (0 . 7) and Bern (0 . 6) . If y = 1 , xxx 1 ,xxx 2 are independently generated from Bern (0 . 1) and Bern (0 . 2) .
P t is generated as follows:
y is first generated from Bern (0 . 6) .
If y = 0 , xxx 1 ,xxx 2 are independently generated from Bern (0 . 5) and
Bern (0 . 6) .
If y = 1 , xxx 1 ,xxx 2 are independently generated from Bern (0 . 5) and Bern (0 . 2) .
It is easy to see that ( p s , p t ) is under 1 -SJS with associated shift index set I = { 1 } , since xxx 2 is independent of xxx 1 and only depends on y .
However, p t ( xxx 1 = 1 | y = 1) = 0 .
5 ̸ = 0 .
1 =
p s ( xxx 1 = 1 | y = 1) and thus ( p s , p t ) is not under label shift.
In addition, p
[Equation]
( y = 1 | xxx 1 = 1 ,xxx 2 = 1) = 0 .
6 × 0 .
5 × 0 .0 .
6 × 0 .
5 × 0 .
2 + 0 .
4 × 0 .
5 × 0 .
6 =  p s ( y = 1 | xxx 1 = 1 ,xxx 2 = 1) =
[Equation]
and thus ( p s , p t ) is not under covaraite shift, which completes the proof.
B.3 Proof of Theorem
Proof.
We prove the statement via three main steps.
First, we show that given full access to the distribution, the optimization over the marginal mass functions are sufficient to obtain the correct shifted features and weights.
Next, we demonstrate that a large enough number of samples ensures the identified index set stays the same as when full access to the distribution is given with high probability.
Finally, we can prove that with high probability, the learned weight function with large number of samples is close to the learned weight function when full distribution is known.
To proceed, let us introduce a few more notations for convenience.
• The distance used by SEES-d: dd ( J, w J ) ≜ (cid:80) κ : J ⊆ κ, | κ | =2 m (cid:80)
L ¯ f =1 (cid:80) ¯ xxx κ ∈X κ ∥ p t (¯ xxx κ , ¯ f ) − (
cid:80) L ¯ y
=
1 w J
(¯ xxx J , ¯ y ) · p s (¯ xxx κ , ¯ f, ¯ y ) ∥ 22 .
• The empirical distance used by SEES-d with finite samples:
[Equation]
(cid:80) κ : J ⊆ κ, | κ | =2 m (cid:80)
L ¯ f =1 (cid:80) ¯ xxx κ ∈X κ ∥ ˆ p t (¯ xxx κ , ¯ f ) − (cid:80)
L ¯ y
=
1 w J
[Equation]
¯ xxx J , ¯ y )
[Equation]
ˆ p s
[Equation]
¯ xxx κ
[Equation]
¯ f
[Equation]
¯ y )
∥
[Equation]
• The optimal weight function when the shifted feature set is fixed to J : w ∗ J ≜ arg min w J ( xxx,y ) (cid:80) κ : J ⊆ κ, | κ | =2 m (cid:80)
L ¯ f =1 (cid:80) ¯ xxx κ ∈X κ ∥ p t (¯ xxx κ , ¯ f ) − (
cid:80) L ¯ y
=
1 w J
(¯ xxx J , ¯ y ) · p s (¯ xxx κ , ¯ f, ¯ y )
∥• The optimal weight function when the shifted feature set is fixed to J and full distribution is available: w ∗ J ≜ arg min w J ( xxx,y ) (cid:80) κ : J ⊆ κ, | κ | =2 m (cid:80)
L ¯ f =1 (cid:80) ¯ xxx κ ∈X κ ∥ p t (¯ xxx κ , ¯ f ) − (
cid:80) L ¯ y
=
1 w J
(¯ xxx J , ¯ y ) · p s (¯ xxx κ , ¯ f, ¯ y )
∥• The optimal weight function when the shifted feature set is fixed to J and only finite samples are available: ˆ w ∗ J ≜ arg min w J ( xxx,y ) (cid:80) κ : J ⊆ κ, | κ | =2 m (cid:80)
L ¯ f =1 (cid:80) ¯ xxx κ ∈X κ ∥ ˆ p t (¯ xxx κ , ¯ f ) − (cid:80)
L ¯ y
=
1 w J
(¯ xxx J , ¯ y ) ·
ˆ p s (¯ xxx κ , ¯ f, ¯ y ) ∥
Next we offer a few useful lemmas before giving the full proof
Lemma 4.
Let Ω be a compact set, and zzz ∗ 1 ,zzz ∗ 2 be the optimal solution to the problems
[Equation]
and
[Equation]
where f 1 ( · ) , f 2 ( · ) are two functions defined on Ω such that | f 1 ( zzz ) − f 2 ( zzz ) | ≤ ∆ , ∀ zzz ∈ Ω .
Then we have | f 1 ( zzz ∗ 1 ) − f 2 ( zzz ∗ 2 ) | ≤ ∆ .
If f 1 is strongly convex with parameter λ and Ω is the full real vector space, then ∥ zzz ∗ 1 − zzz ∗ 2 ∥ 22 ≤ 4∆ λ .
Proof.
We start with the first half statement.
By | f 1 ( zzz ) − f 2 ( zzz ) | ≤ ∆ , ∀ zzz ∈ Ω , we have f 1 ( zzz ∗ 1 ) ≤ ∆ + f 2 ( zzz ∗ 1 ) .
Subtracting f 2 ( zzz ∗ 2 ) from both sides gives
[Equation]
Observe that zzz ∗ 2 is the optimal solution to minimizing f 2 ( · ) on the set Ω .
Thus, f 2 ( zzz ∗ 1 ) ≤ f 2 ( zzz ∗ 2 ) must hold.
Thus, the above inequality becomes
[Equation]
By symmetry of the two functions, we can obtain
[Equation]
Combining the two inequalities gives
[Equation]
Next let us turn to the second half.
We first notice that | f 1 ( zzz ∗ 1 ) − f 2 ( zzz ∗ 2 ) | ≤ 2∆ .
To see this, we can decompose the difference f 1 ( zzz ∗ 2 ) − f 2 ( zzz ∗ 1 ) as
[Equation]
Here, f 1 ( zzz ∗ 2 ) − f 2 ( zzz ∗ 2 ) ≤ ∆ and f 2 ( zzz ∗ 1 ) − f 1 ( zzz ∗ 1 ) ≤ ∆ by the assumption | f 1 ( zzz ) − f 2 ( zzz ) | ≤ ∆ , ∀ zzz ∈ Ω .
zzz ∗ 2 is the optimal solution to minimizing f 2 ( · ) , and thus f 2 ( zzz ∗ 2 ) − f 2 ( zzz ∗ 1 ) ≤ 0 .
Therefore, combining all those leads to
[Equation]
Meanwhile, f 1 ( zzz ∗ 2 ) − f 1 ( zzz ∗ 1 ) ≥ 0 as zzz ∗ 1 is the optimal solution to minimizing f 1 ( · ) .
That is to say,
[Equation]
Note that f 1 ( · ) is a strongly convex function with parameter λ .
Thus, we have
[Equation]
for any zzz ′ ,zzz .
Now let us set zzz =
zzz ∗ 1 ,zzz ′ =
zzz ∗ 2 .
Remember that zzz ∗ 1 is the optimal solution to minimizing f 1 ( · ) and Ω is the full space.
Thus, ∂f 1 ( zzz ∗ 1 ) ∂zzz = 0 .
As a result, the above inequality becomes
[Equation]
By | f 1 ( zzz ∗ 2 ) − f 1 ( zzz ∗ 1 ) | ≤ 2∆ , we obtain
[Equation]
Rearranging the terms gives
[Equation]
which completes the proof.
Lemma 5.
Suppose the source and target are under exact s - SJS , and for any set J ⊂ [ d ] , |J | ≤ s and any ¯ xxx ∈ X , the marginal probability mass functions { p s ( f ( xxx ) ,
xxx J∪
I =
¯ xxx
J∪
I , y = ¯ y ) } dy =1 are linearly independent.
Then dd ( J, w J )
=
if and only if J = I and w J ( xxx J , y ) =
w ∗ ( xxx, y ) .
Proof.
Let us first relate the marginal density functions on the target domain to those on the source domain.
Recall that
[Equation]
denote the true weights between the target and source density functions.
Since the shift is only due to xxx I , w ∗ ( xxx, y ) only depends on xxx I .
Abusing the notation a little bit, we use w ∗ ( xxx I , y ) to denote w ∗ ( xxx, y ) .
Now we can write p t ( xxx, y ) =
w ∗ ( xxx I , y ) · p s ( xxx, y ) .
Thus, the marginal distribution of ( xxx κ , f ( xxx )) on the target domain can be written as
[Equation]
Now let us consider the two directions of the statement separately.
• J
=
I and w J ( x x x J , y )
=
w ∗ ( x x x, y ) =
⇒ dd
[Equation]
J, w J ) = 0 :
In this case, I =
J ⊆ κ and thus zzz I is forced to be ¯ xxx κ .
Hence, the marginal distribution becomes
[Equation]
where the second equation is because zzz I is fixed and does not depend on the inner summation, the third is by applying definition of conditional probability, and the last is simply change of notations.
The above equation is simply
[Equation]
which holds for every κ
Since w J ( xxx J , y ) =
w ∗ ( xxx J , y ) , it is equivalent to
[Equation]
Thus, summing over the square of it also leads to 0,
i
[Equation]
e.,
[Equation]
• dd ( J, w J ) =
= ⇒ I
=
J, w J ( xxx J , y ) =
w ∗ ( xxx, y ) : dd ( J, w J ) = 0 implies that
[Equation]
¯
[Equation]
=
[Equation]
holds for each κ .
In particular, consider κ that contains both I and J .
Then zzz κ = ¯ xxx κ implies zzz
I =
¯ xxx
I .
Hence, the marginal distribution can be written as
[Equation]
where the second equation is because zzz I is fixed and does not depend on the inner summation, the third is by applying definition of conditional probability, and the last is simply change of notations.
Comparing this with the above equation, we end up with
[Equation]
Or alternatively,
[Equation]
which holds for any ¯ f, ¯ xxx κ
By the linear independence assumption, this holds if and only if all the coefficients are 0, i.e., w ∗ (¯ xxx I , ¯ y )
− w J
(¯ xxx J , ¯ y )
=
for all ¯ xxx and ¯ y .
That is to say, the two functions are identical: w ∗ ( xxx I , y ) =
w J ( xxx J , y ) .
As w J ( xxx J , y ) and W ∗ ( xxx J , y ) are identical, they can only depend on variables in the set I ∩ J .
That is to say, there exists another importance weights w I
∩ J ( xxx I ∩ J , y ) which results in the same target distribution produced by W I (¯ xxx
I , y ) .
By the assumption, the shift among the two distribution is exactly s -SJS.
Hence, we have | I ∩ J | =
s .
| I | =
s and I ∩ J ⊆
I implies I ∩
J = I and thus
J ⊇ I .
| J | = s further implies J
= I .
Therefore, dd ( J, w J ) = 0 ⇔ I = J, w J ( xxx J , y ) =
w ∗ ( xxx, y ) , which completes the proof.
Lemma 6.
With probability at least 1 − δ , for any possible J ⊆
[ d ] , | J |
= s , we have | dd ( J, w ∗ J ) − ˆ dd ( J, ˆ w ∗ J ) | ≤ 3 · (2 s ¯ v ) s ML 2 (cid:112)
s log d + s log ¯ v + 2 log
L + log 1 /δ (cid:18)(cid:114)2 n s + LM (cid:114)2 n t (cid:19) .
and ∥ w ∗ J − ˆ w ∗ J ∥ 22 ≤ O   ML  (cid:115) log 1 /δ 2 n s + LM (cid:115) log 1 /δ 2 n t   

Proof.
Let us start by considering a fixed J .
By definition of w ∗ J and ˆ w ∗ J , we have
[Equation]
=2 s
L (cid:88) ¯ f = (cid:88)
¯ xxx κ ∈X κ ∥
[Equation]
t (¯
[Equation]
¯
[Equation]
) −
L (cid:88)
[Equation]
y =
[Equation]
and ˆ dd ( J, ˆ w ∗ J ) =
min w J ( xxx,y ) (cid:88) κ : J
[Equation]
, | κ | =2 s
L (cid:88) ¯ f = (cid:88)
¯ xxx κ ∈X κ ∥
[Equation] [Equation]
f ) −
L (cid:88) ¯
[Equation]
=
[Equation] [Equation]
Let us first show that the above two objective functions are close for any fixed w J .
To see this, we first apply difference of two squares to obtain
[Equation]
Note that all estimated probability mass must be bounded by
[Equation]
and by assumption, | w J | ≤ M .
Thus,
[Equation]
[Table]
[Equation]
Observe that, ˆ p t (¯ xxx κ , ¯ f ) is the standard empirical estimation of p t (¯ xxx κ , ¯ f ) .
Therefore, applying
Hoeffding’s inequality, we have with probability 1 − δ ,
[Equation]
Similarly, with probability 1 − δ ,
[Equation]
Thus, with probability 1 − (¯ v s L + ¯ v s L 2 )
δ
[Equation]
the above holds for any ¯ f
[Equation]
¯ y
[Equation]
¯ xxx κ .
Thus we have | ˆ p t
[Equation]
¯ xxx κ , ¯ f
[Equation]
¯
[Equation]
Combing this with inequalities B.1 and B.2, we have
[Equation]
Summing over κ, ¯ xxx κ , ¯ f , we have
[Equation]
That is to say, for all w J , | dd ( J, w J ) −
ˆ dd
[Equation]
J, w J
[Equation]
≤
[Equation]
s ML
[Equation]
with probability 1 − (¯ v s L + ¯ v s L 2 ) δ .
In addition, note that dd ( J, w J ) is a quadratic function over w J .
By the linear independence assumption, dd ( J, w J ) must be strongly convex.
Now applying Lemma 4, we have
[Equation]
and
[Equation]
2 n s + LM (cid:115) log 1 /δ 2 n t 
 where λ is the parameter corresponding to the strongly convexity of dd ( J, · ) .
This holds for a fixed J with probability 1 − (¯ v s L +¯ v s L 2 ) δ .
There are (cid:0) ds (cid:1) many possible choices of J .
Thus, with probability at least 1 − d s (¯ v s L + ¯ v s L 2 ) δ ≥ 1 − 2 d s ¯ v s L 2 δ , the above holds.
Replacing 2 d s ¯ v s L 2 δ by δ gives the desired form.
Finally we are ready to prove the statement.
By Lemma 5, dd ( I, w ∗ ) = 0 and for any J ̸
=
I , we have dd ( J, w J ) >
dd ( I, w ∗ ) .
Let c 1 =
min J ̸
= I
d ( J, w J ) > 0 , c 2 =
[Equation]
ML 2 , and the constant c = c 2 /c 1 .
Now we make progresses in two steps.
• First let us show with high probability, the estimated shifted features match the true shifted features.
This is equivalent to show, with high probability, ˆ dd ( I, ˆ w ∗ I ) <
ˆ dd ( J, ˆ w ∗ J ) for any J ̸
= I .
To do so, let us note that, for any J ̸
= I ,
[Equation]
By Lemma 6, with probability 1 − δ , for any J ,
[Equation]
=
[Equation]
(cid:18)(cid:114)
[Equation]
(cid:114)
[Equation]
n
[Equation]
(cid:19)
Therefore, we have ˆ
[Equation]
(cid:19)
+
[Equation]
By the assumption, (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) <
c 1 /c 2 .
Hence, we have
[Equation]
for any J ̸
= I .
Thus, the correct shifted features are selected with probability at least 1 − δ .
• Finally we show the learned ˆ w ∗
ˆ J is close to the true importance weights w ∗ .
By Lemma 6,
[Equation]
with high probability for all J .
Thus it holds for the selected features ˆ J .
We have just shown that with high probability, the correct shifted features are selected, i.e., ˆ J = I .
Thus, it simply means
[Equation]
which completes the proof.
C Additional Discussions
Here we provide additional discussions.
Motivating examples when SJS occurs.
In Section 1 we give one example when SJS occurs.
Now we give two more examples to show how SJS broadly exists in different scenarios.
• Cancer diagnosis: Suppose we wish to build an ML model to diagnose cancer based on patient health records.
The model is developed based on labeled dataset in some developed countries.
However, when deploying it to hospitals in a developing country, there might be much more young patients, and the cancer rate for the elderly can also increase.
Suppose the other features’ distribution remains unchanged given age and cancer diagnosis.
Then the distribution shift is naturally an SJS.
• Toxic text recognition: Consider a mobile app that detects and
filters toxic texts based on the content and senders’ information.
Due to unexpected events (for example, disappointing football games), the toxic texts rate, as well as the total number of texts, may both significantly increase in some locations at different time periods.
The shift of text locations and toxic text rate is thus another example of SJS.
Understanding sparse covariate shifts.
Sparse covariate shift is a special case of covariate shift [31].
It occurs when the shifts are caused by a few variables.
For example, consider two census datasets collected in two periods.
If a large population moved from one city to another between the two periods and everything else remains the same, then there is a sparse covariate shift (location alone).
It is also related to Adversarial patches: if adversarial noises are added to a few features (or a small number of pixels in image domains), it also corresponds to the sparse covariate shift.
D Experimental Details
Here we provide additional experimental details.
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
Datasets and ML tasks.
We use six datasets for evaluation, namely, BANKCHURN [1], COVID19 [2]
[Figure]
and CREDIT [39] for various SJS simulations, and EMPLOY, INCOME, and INSURANCE [11] for performance evaluation under real world distribution shifts.
BANKCHURN [1] contains 10 features such as gender, age, credit score and balance
[Figure]
and the goal is to predict whether a bank customer may churn.
COVID-
[2] is a subset of the publicly accessible COVID-19 dataset from the Israel government website, containing both demographic and symptom features.
Here, we select the subset that contains all tested cases in January,
[Figure]
and aim at predicting whether a person tests positive or negative for COVID-19.
CREDIT [39] includes age, gender, education, bill payments and several other features for 29946 individuals.
The goal is to predict the default payment.
EMPLOY, INCOME
[Figure]
and INSURANCE are subset of the public use microdata samples from the
US census [11].
EMPLOY contain 16 features for individual samples from four different states, CA,
PR, IA, and WI and our goal is to predict if a person is employed or not.
In INCOME, 245, anonymous census record samples from four states including CA, CO, KS, and OH are collected.
The goal is to predict if a person’s income is lower or higher than $50,000.
INSURANCE containsindividual samples from the state IA collected in year 2014, 2016, and 2018.
The task is to predict whether an individual is covered by an insurance plan.
The dataset statistics can be found in Table 2.
Experiment setups.
All experiments were run on a machine with 20 Intel Xeon E5-2660 2.
GHz cores, 160 GB RAM, and 80 GB disk with Ubuntu 18.04 LTS as the OS.
Our prototype was implemented and tested in Python 3.8.
To apply SEES-d, we discretized all continuous features.
To apply SEES-c, we set the trade-off parameter η = 0 . 001 .
For continuous features, linear functions were used as the basis.
For discrete features, indicate functions were adopted.
For example, if ¯ xxx 1 ∈ R and ¯ xxx 2 ∈ { 0 , 1 } , then the basis functions consist of three components, ϕ 1 (¯ xxx, y ) =
¯ xxx 1 , ϕ 2 (¯ xxx, y )
=
¯ xxx 2 =0 , and ϕ 3 (¯ xxx, y )
= 1 ¯ xxx 2 =1 .
For KLIEP, the maximum number of iterations was set as 2,500.
Effects of shift sparsity.
Figure 5 shows how the accuracy gap estimation performance vary as the number of shifted features increase.
For each dataset, we start with shifting no features (label shift), to shifting 1, 2, and 3 features together with labels.
Specifically, for BANKCHURN, shifts occur for (i) labels alone (0-SJS), (ii) then both labels and geography feature (1-SJS), (iii) then labels, geography, and gender (2-SJS), and (iv) finally labels, geography, gender, and credit card owned before.
For COVID-19, we start with shifting label alone (0-SJS), and then incrementally shift features age, gender, and contact risk to simulate 1-SJS, 2-SJS, and 3–SJS, respectively.
For credits, 0-SJS, 1-SJS, 2-SJS, and 3-SJS correspond to shift in (i) labels, (ii) labels and marriage status, (iii) labels, marriage status, and gender, and (iv) labels, marriage status, gender, and credit balance.
Overall, we observe that the estimation error of SEES-c and SEES-d slightly increases as the number of shifted features grows, but is consistently lower than that of BBSE and KLIEP.
Robustness to data randomness.
In Section 5 we mainly focus on the average performance metric ( ℓ 2 loss).
Here we provide additional robustness measurement: on the COVID-19 dataset, we repeat the case study experiments 200 times with different random seeds to generate the source and target datasets, and report the variance of the estimated accuracy gap.
As shown in Table 3, we observe that the variance for all of the methods is small: variance of SEES-c and KLIEP are are less than 0.00003, and the variance for SEES-d is 0.003 and for BBSE is 0.0003.
[Table]
Sensitivity of the sparsity parameter in SEES-d.
SEES-d needs knowledge of the sparsity parameter s , and thus a natural question is how sensitive its performance is when the sparsity parameter does not exactly match the true sparsity.
To study this, we first generate a source-target pair (each containing 10,000 data points) on the COVID-19 dataset where labels and 3 features (age, contact risk, and gender) shift, and then measure the ℓ 2 loss of the estimated performance gap by SEES-d with sparsity parameter ranging from 0 to 7 (the number of features).
Here, sparsity parameter being 0, 1, 2, 4, 5, 6, and 7 corresponds to the mismatched case.
Figure 6 summarizes the averaged ℓ 2 loss over 100 experimental runs.
The randomness comes from the choices of shifted features and the samples from source and target datasets, and the shaded area indicates the standard deviation.
Overall, we observe that SEES-d is robust to small parameter mismatch: there is little change of the estimation error when the sparsity parameter (2, 3, 4, 5) is close to the true number of shifted features (3).
When the parameter mismatch is too large, a relatively larger change in the estimation error can be observed (though SEES-d still works better than BBSE even when the model mismatch is large).
This is because a too small sparsity parameter restricts the search space, while a too large parameter often incurs an identifiability issue as our theory shows (i.e., different feature-label joint distributions correspond to the same observed target feature distribution).
In practice, if the user has a prior belief that the distribution shift is not sparse (i.e. number of shifted features is > d/ 2 ), then SEES-d may not be appropriate.
Comparison with additional baselines.
For more in-depth understanding, we compare the performance of SEES with an additional baseline DLU [25].
DLU basically adopts discriminative learning on the union of the source and target dataset, and then uses the classifier’s prediction to reweigh the source data.
We adopt it on the COVID-19 dataset for a case study and measure the performance of the weight and accuracy gap estimation for it along with SEES-c, SEES-d, BBSE, and KLIEP.
As shown in Table 4, DLU performs better than KLIEP, but is still much worse than SEES-c and
SEES-d. For example, the MSE of its estimated weights is 0.320, while that of SEES-d is only 0.002.
Hence, SEES-c and SEES-d still lead to the best estimated accuracy gap.
Robustness across different shifts.
Real world distribution shifts may vary, and thus it is important to understand how different methods behave when encountering different shifts.
To understand this, we study the performance of SEES-c and SEES-d along with all baselines (BBSE, KLIEP, and
DLU) on the COVID-19 dataset when different shifts occur.
Specifically, we generate source-target pair where (i) label shift, (ii) (
sparse) covariate shift (feature age), and (iii) 1-SJS (both label and feature age) occurs, separately.
Table 5 gives the squared ℓ 2 loss of the accuracy gap estimation for all methods.
Interestingly, we observe that SEES-c and SEES-d produce reliable accuracy gap estimation across different shifts, while all baselines are sensitive to shift types.
For example, KLIEP and DLU achieves decent performance when there is only covariate shift, but their estimation is much worse when label shift occurs.
Similarly, the estimation error of BBSE is small when labels
Sparsity
Parameter 0.
[Figure]
ss
[Table]
indeed shift but is much worse than other methods when the shift is due to covariate.
On the other hand, the performance of SEES-c and SEES-d is as good as that of the best baseline when label or covariate shifts.
For SJS, the proposed methods achieve significantly better estimation than all baselines.
Those suggest that SEES-c and SEES-d are more robust to different shifts and thus safer to be deployed in the wild.
[Table]
More models on datasets with real world shifts.
Next we provide the performance estimation for more models on datasets with real world shifts.
We study the estimation performance for three models, namely, a gradient boosting, a neutral network
[Table]
and a decision tree.
The maximum depth of the gradient boosting and deicision tree is 50, and the neutral network consists of two layers with 100 hidden units.
As shown in Table 6, SEES often provides significant error reduction over the compared baselines BBSE and KLIEP.
[Table]
INSURANCE
[Table]