Manuscript Offprint
arXiv:2611.02254Partial Invariance for Classification under Structural Causal Models
Abstract
Making predictions in an unseen environment from data collected across multiple training environments is challenging. This challenge is particularly pronounced when the target-generating mechanism varies across environments. In this work, we introduce environment-label separation, a form of partial environmental invariance that decomposes the target conditional distribution into an environment-invariant component and a label-invariant component. We show that this partial invariance enables estimation of the target conditional distribution in an unseen environment when using labeled training data together with unlabeled test features. Within the structural causal model framework, we provide sufficient conditions for environment-label separation. Building on these conditions, we develop an algorithm, dIMP-Classifier, which jointly minimizes an estimate of the test risk and encourages invariance across environments. We further provide finite-sample guarantees that characterize the test risk in terms of deviations from invariance, estimation error, and sample complexity. Experiments on simulated data and the real-world light tunnel Causal Chamber data demonstrate that the proposed approach can perform under interventions on the target mechanism and consistently outperforms the considered standard and invariance-based baselines.
1 Introduction and Problem Formulation
It is common practice to collect observations of a set of features and response from different environments to train a model. In this setting, the joint distribution of the features and the response may vary from environment to environment, particularly from the training environment to the test environment. Such distribution shifts pose a fundamental challenge to generalization, as statistical relationships learned in the training environments need not persist in the test environment. Consider the classification of a discrete random variable given the set of features for different environmental conditions indexed by the set , which consists of all the training environments and one test environment . In the test environment, let (X^t, Y^t) := (X^e^{\text{test}}, Y^e^{\text{test}}). While we observe the variables for all , only the variable is observed in the test environment. The goal is to make predictions on given . We assume that the supports of and do not vary with environment and are and , respectively.
One principled way to address this problem is to model distribution shifts as changes in the underlying data-generating process using structural causal models (SCMs) ([1, 2]). This perspective makes it possible to characterize which mechanisms remain stable across environments and which invariant relationships may therefore be exploited for prediction. The pioneer work of invariant causal prediction (ICP) [3] initiated a rich line of results (e.g., [4, 5, 6, 7]) following the invariance principle (also see [8, 9, 1, 10]), which requires that be invariant with respect to , where denotes a subset of the random variables in . In practical settings, requiring the entire conditional distribution of the target to remain invariant across environments can be overly restrictive, particularly when the target mechanism is subject to change. This motivates the use of weaker forms of invariance that preserve only certain components or relationships across environments while allowing the target conditional distribution itself to vary.
In this work, we introduce a form of partial environmental invariance for classification tasks where the label is discrete and takes on values from . We wish to identify a classifier
, for some , such that the target risk is small, where the risk for a given environment is defined as
The target risk (i.e., the risk for environment ) of a classifier is denoted by . Without further assumptions on the relationship between environments, there is no guarantee that the risk of any classifier constructed using training data from various environments will be close to that of . In an attempt to remedy this, our objective is to identify consistent relationships between all environments such that we can successfully minimize the risk over the test environment. For this to be possible, we consider a form of partial environmental invariance in which the probability of given can be separated into environmentally variant and invariant components. We call it environment-label separation or EY-separation for short.
Definition 1 (EY-Separation). For all and , if there exist , , and , such that admits the following factorization,
we say that is EY-separable.
Note that is not dependent on and is not dependent on . We stress that only is allowed to change with environments, and it should not depend on since the label is not available in the test environment. This enables flexible domain adaptation in the test environment , because does not rely on the test label , making its estimation possible at test time (we will elaborate on this crucial point shortly in (3)). We thus only require partial invariance via , while keeping adaptive. This is in contrast to the existing works (e.g., [3]) that require invariance for the whole conditional distribution.
Remark 1. We note that the set that satisfies (2) is determined by the joint distribution of . In general, the set is not unique, meaning that various can induce representations that permit EY-separation. We give examples of such settings in Section 2 and present specific sufficient conditions for in Condition 2 of Proposition 2.
How to make use of EY-separation? The identified EY-separable functions can lead to efficient classification in the test environment:
-
As does not depend on , an estimate of trained on any (or all) training environments will extend to the test environment.
-
As does not depend on , it is possible to estimate using only the test features, even though labels for the test environment are not available.
As a result, identifying EY-separable functions gives a path to estimate without access to test labels. For each class label , we can estimate in the test environment using only the test features as
which then leads to a natural classifier that chooses the label with the largest conditional probability.
Our main contributions are summarized as follows. We introduce a form of partial environmental invariance for classification called environment-label separation and show that it allows for estimation of the target without access to test labels. We provide sufficient conditions under the SCM framework that guarantee environment-label separation (Section 3). We then develop practical prediction and identification procedures using separable functions (Section 4) and provide finite-sample analysis of its
We say that is EY-separable and that and are EY-separable functions interchangeably, both referring to the factorization in Definition 1.
performance (Section 4.1). Finally, in Section 5, we evaluate the proposed approach on both simulated data and the real-world light tunnel Causal Chamber benchmark [11], a physically grounded optical system in which controlled interventions induce distribution shifts across environments. We show that the proposed method consistently outperforms the considered baselines, including existing invariant prediction approaches.
Definition 2 (Risk with EY-Separation). When EY-separation holds, we define the corresponding risk as
We make the following simple observation under EY-separation.
which follows from . When the EY-separation does not hold, we can still define a general target risk for generic functions and
where depends on and can be dependent on as well, and , while depends on but not on (again since the label is not available at test time). and should be viewed as dummy variables that will be specified in different ways as needed in our analysis in Section 4.
Assuming and are EY-separable, (5) shows that minimizing the target EY-separation risk will in turn minimize the risk over the target environment. Thus, with the ability to estimate without test labels, and the ability to minimize test risk according to (5), our roadmap moving forward is to: (I) determine under what conditions EY-separation is satisfied, and (II) create a practical methodology that leverages the useful properties of EY-separation.
1.2 Structural Causal Models (SCMs) and Notation
Our work is developed based on the structural causal models (SCMs) [1, 2] and we adopt the conventional notation (e.g., see [12]). That is, the predictors and denote the set of direct causal parents of and , respectively. Similarly, we refer to as a causal child of some . Additionally, we denote , , and as descendants, nondescendants, ancestors of , respectively. For some and , we often denote being a parent of as . The variables and are part of an acyclic SCM
where , and are independent noise variables with distribution , and the graph induced by is acyclic, meaning that a predictor cannot be both a descendant and an ancestor of another variable . We note that the underlying graph structure of does not change over environment as the function does not change over environment.
An intervention on a variable occurs if the structural assignment or noise distribution changes for some . Many approaches [3, 13, 14] make various assumptions on the types of interventions (e.g., shifts in the mean or variance) and which variables can and cannot be intervened. This formulation allows general interventions on most variables (see Proposition 1 for the few exceptions) and on the variable , which many other approaches fail to address.
1.3 Related Works
The authors of [15] provided a systematic treatment of domain adaptation using SCMs, leading to the conditional invariant residual matching (CIRM) method. The CIRM and its variants leverage the domain invariant projection (DIP)-type methods (also see [16, 17] and the generalized label shift to handle target label perturbation [18, 19]). Theoretical guarantees have been provided for the prediction performance under shift interventions on , while numerical studies are provided for interventions on the noise variance of [15]. More recently, the role of conditional invariance penalty [20, 21], which assumes the existence of conditional invariant components (CICs) in the anticausal setting, has been highlighted. It has also been pointed out that the general mixed-causal-anticausal domain adaptation problem remains open. To the best of our knowledge, all the existing frameworks, that concern either (e.g., [20, 21, 22]) or (e.g., [23]), only assume the existence of transforms without constructions and the transforms are not allowed to vary with . To construct the invariant transform for linear SCMs, the authors proposed a systematic way through the invariant matching property (IMP) [14, 24], when the conventional invariance principle fails, namely when the target variable is under intervention, with an explicit construction of transform (also see real-world applications in [14, 25, 26]). In this work, our goal is to extend this to the nonlinear setting, where is discrete/categorical in classification problems; it turns out that this is more challenging and requires a different set of tools.
Perhaps the most closely related work is the sparse joint shift (SJS) framework introduced in [27] (also see [28]). SJS permits distribution shifts in a subset of features , while assuming that the conditional distribution of remaining features is invariant given and . This condition is closely related to the dIMP property introduced in (23) that states for subsets of variables and , is invariant with respect to environments. Despite being closely related, there are important differences between the two. First, SJS is a stronger condition compared to the dIMP as SJS assumes invariance over a conditional distribution while the dIMP requires only invariance over the conditional expectation. Another important difference is the underlying problem being solved: while we consider a multinomial classification problem where we construct a classifier to estimate , the methods proposed in [27] already assume the existence of a classifier and mean to estimate the performance of said classifier on a test environment. The methods developed in [27] are based on the reweighting scheme and thus do not provide methods for estimating in the test environment. Finally, the invariance exploited in the dIMP is derived from sufficient conditions, building on the SCMs in (7), which helps provide specific causal interpretation to the invariant quantities that [27, 28] do not consider.
The role of causality in facilitating domain adaptation problems is first articulated in [29], focusing on causal and anticausal predictions. Reweighting methods have been extensively studied for covariate shift [30, 31, 32], which assumes that only the feature distribution changes over environments while the conditionals remain the same. The label shift, which aligned with the anticausal setting, has attracted much attention recently [33, 34, 35]. Many other interesting domain adaptation methods have been developed but they are less related to this work. The performance bounds using Vapnik-Chervonenkis (VC) theory have been initiated in [36]. There are fundamental works from the robust statistics perspective including distributional robust learning [37, 38, 39, 40, 41, 42] and adversarial machine learning [43, 44].
2 How to Construct EY-Separation? A Motivating Example
To illustrate EY-separation, we consider a binary classification setting (). We consider two toy SCMs starting with the SCM illustrated in Figure 1a. The target has three children and two parents. For the purpose of this example, the nodes , and will be of particular importance. Other nodes may also exist, making the graph increasingly complex.
The target is generated from a binomial logistic regression model,
In this motivating example, has two parent nodes and one invariant child node

(a)

(b)
Figure 1: The causal diagram detailing the motivating example. Variables inside the dashed box are used to identify EY-separable functions. Solid edges represent invariant mechanisms while dashed edges represent mechanisms that may vary over environment. We consider two settings with (a) and without (b) hidden confounders.
(defined below) along with other general child nodes. Other nodes may also exist making the graph increasingly complex, as illustrated in Figure 1. For the purpose of identifying EY-separable functions, we will see that the variables and can be used. We shall also see that other variables can be used in addition to and that lead to EY-separable functions.
We assume that for , the functional form of varies with such that
where it is crucial that does not depend on , for each , and that the noise term has zero mean. It is important to note that all the other child nodes are generated following the general assignment for as in (7), which can vary arbitrarily over environment.
Now we turn to the prediction task in the test environment , where is, of course, not available. At first glance, it seems unclear how to decompose the logistic function in (8) into two EY-separable functions as depends on both and . Let . The following observation can be made in the test environment where we can apply the law of total probability to get
(11)
Writing this in matrix form, we have
where the matrix V does not depend on environment
In generic cases, and are different, which means is invertible; we will make this explicit in Assumption 1 (also see a variation of this example in Section 2.0.1 and Remark 8.) Thus
It can then be said that and are EY-separable since
Because of this separation, each quantity can be estimated separately:
can be estimated using only the training environments , while can be evaluated in the test environment .
Then can be estimated, leading to the classification result.
In the example above, estimating relies on the subsets of predictors indexed by and 2. The choice of these variables is critical in estimating . Selecting other variables in place of or the child node may help or harm in various ways.
Functions are not EY-separable for any : Suppose that (see Figure 1). Then does not describe the parent-child relationship in (10) and will in general vary over environments. The matrix will then depend on environment and and will not be EY-separable. Thus, the selection of the predictors and is critical in estimating .
EY-separation can be found using various choices for : While does not produce EY-separable functions, is not the only set that can be used to identify EY-separable functions. Suppose that . The relationship between and other variables is not explicitly defined, but its causal relationship relative to other nodes in the graph is outlined in Figure 1. We note that the form of (11) remains the same as
which follows as . The rest of the example follows similarly, and EY-separable functions can be identified. See Proposition 2 (Condition 2) for details relating to how inclusive S can be.
2. 0.1 Variation 1: On the invertibility of V
To see why we expect V to be invertible in generic cases, we consider a slight variation from our motivating example. Suppose that L = 3 and Y has an additional invariant child node, say with
That is, in Figure 1a, both and Y will have solid arrows pointing toward . Then the same arguments lead to the corresponding V
The invertibility thus comes from two sources of variation: the difference between the generating mechanisms of the two child nodes (i.e., vs. ), and the variation introduced by different class labels, . The latter is potentially highly nonlinear due to the nature of classification, even though invertibility holds under linear relationships as well.
2. 0.2 Variation 2: With hidden confounder
We briefly examine the alternative setup in Figure 1b to illustrate both necessary and useful properties of EY-separation. In this setting, we assume that is still generated by a logistic model. However, we assume there exists a hidden confounder . Rather, has two causal parents and such that
The same process shown above holds even when we introduce the hidden confounder . That is, EY-separable functions can be identified that estimate for using the same process that was discussed in the previous example. As neither example leverages nor , the process remains the same.
3 Sufficient Conditions under SCMs
We now examine general conditions that allow and to be EY-separable under the SCMs (7). Recall that can take on . As in our motivating example, we will find it necessary that the target have child nodes, the number of which is dependent on . For each of these children, the generating mechanism must not be intervened, as we will soon show (a practical setting with one child node is discussed in Section 4.2.1).
For the pair , we define the following functions and in a similar fashion as the EY-separable functions of (15) in the motivating example. For simplicity of presentation, we will suppress the subscripts when the underlying is clear from the context. First, let be an matrix such that the -th entry of is
for , while the last row of is a row of 1's. The matrix is a generalization of (18) in the motivating example.
As in the motivating example along with the variation in Section 2.0.1, we expect the following assumption to hold in generic cases.
Assumption 1. Assume that is invertible for all and .
Remark 2. As will be further illustrated in Section 5.1, the invertibility of can arise from the dependence of the child generating mechanisms on the label , even when these mechanisms are linear in the predictors (see Remark 8 for details).
Based on this, we can then define
where denotes the -th row of . Next, we introduce
This leads to the following proposition providing sufficient conditions for EY-separation with simple causal interpretations. Let .
Proposition 1. Following the SCMs in (7) and under Assumption 1, if
-
For each , with , and ,
-
,
hold true for some pair , then and are EY-separable.
Instead of proving this directly, we state and prove a slightly more general result, where is a set of non-descendants of that contains .
Proposition 2. Following the SCMs in (7) and under Assumption 1, if
-
For each , with , and ,
-
,
hold true for some pair , then and are EY-separable.
In the proof of Proposition 2, one identity in (43) plays a critical role, and we will refer to this as the discrete invariant matching property (dIMP). Specifically, a pair satisfies dIMP over if
where does not depend on . In other words, dIMP is a sufficient condition for EY-separation. (A preliminary result was reported in [45].) Proposition 2 can be written in terms of dIMP as follows.
Corollary 1. If the pair satisfies the dIMP over all , then we can identify EY-separable functions as in Proposition 2.
With Proposition 2 and Corollary 1 in place, we now have explicit constructions demonstrating the power of partial invariance as alluded to before in (3). That is, when satisfies the conditions in Proposition 2, then we can estimate because,
-
The vector , which consists of the expectations , can be estimated using the available predictors in the test environment,
-
, which is composed of the expectations , does not depend on and can be estimated using the pooled data over all training environments.
Remark 3. This dIMP condition can be viewed as a discrete analogue of the IMP introduced in [14] (see in particular in [14, Equation (11)]). Following the IMP, the expected value of given some subset of variables is expressed as a linear combination of some matching parameters that remain invariant across environments and a combination of some subset of observed predictors at test time. Similarly to the proposed approach here, a portion of the result (the invariant matching parameters) must be estimated at training time, while the final result can only be obtained with an additional regression on only test data. The main distinction is that IMP is formulated as a relation between linear predictors for a continuous response, whereas the present relation is matrix-valued, requires more than one child, and applies to the class probability (not expectation) of a discrete response.
Remark 4. It is possible to identify other sufficient conditions than those presented in Proposition 1. We note the proof would follow similarly if Condition 2 were altered such that for all c. We will see, however, that the condition as stated in Proposition 1 will be important when developing an estimator of (see Section 4).
We now refer back to the motivating example containing the confounder . We note that the sufficient conditions in Propositions 1 and 2 do not consider all causal parents of . Thus, if one parent were a hidden confounder, it would have no effect on the estimation of (unless it was also a parent of a variable in ). Also note that if is a parent node of , it cannot be in because of the underlying acyclic graph. We note, however, that while Condition 2 of Proposition 2 states that , it would never be the case that as .
Remark 5. Condition 2 in Proposition 2 states that must index at least the parents of all children not including and at most any non-descendant of . In the special case of (that satisfies the sufficient conditions), describes the generating process of in (7), because
(24)
where (a) follows from (Condition 2), and (b) follows as are nondescendants of (Condition 2). In our motivating example, this would be the setting where indexes the parents of and describes the logistic model that generates .
4 Methods and Analysis
Recall that for a fixed , and are EY-separable given the sufficient conditions in Proposition 2. To begin our discussion, we assume that we have such a already identified. We will discuss how to select in practice in Section 4.1, .
Let be the number of samples observed for environment . For the test environment , we are given the unlabeled data , where each is distributed according to . For all other environments , we are given the labeled data and distributed according to and , respectively. We denote as the dataset containing pooled data from for each , and do similarly for . For each , let be the sub-vector of indexed by the set .
Assuming the conditions in Proposition 2 hold, we propose an estimate of based on and defined in (21) and (22), respectively. To do so, compute an estimate of (i.e., the expectation ) using and . Note that this estimate is computed on pooled data over all training environments. This can be reasonably done as does not depend on under the conditions in Proposition 2 (see (41)). Thus, pooling environments provides a single estimate that can be used for every environment. For , let
where, like , the last row of is ones. Then, for each , compute an estimate of (i.e., ) using , and let
where the last element in is one. We note that as the functions , and all depend on , so do their estimates , and . Again, we often drop to simplify notation. We then estimate using
for any . A summary of the procedure used to obtain the estimator is as follows: (a) Compute an estimator of called and use it to form . (b) Compute an estimator of called and together with , form . (c) Take the largest of this quantity for any to obtain the estimate . This process is a subroutine of Algorithm 1, which is detailed below. Assuming that the pair satisfies the dIMP, and are EY-separable functions and will approximate . The exact means of estimation of the expectations and may vary. In a non-parametric approach, a flexible method may accurately estimate . In this work, we examine linear and neural network estimators for these expectations as seen in Section 5.
4.1 Identifying Suitable (C,S) Pairs
Using dIMP, we can obtain a classifier, denoted by , that is sufficient to estimate when the pair is known to satisfy the dIMP. As a suitable pair is generally unknown, one must be identified methodologically. A common approach in deriving a classifier would be to minimize the risk over all training environments. Its not guaranteed, however, that a classifier trained in this manner will simultaneously minimize the test risk. We propose to rely on the EY-separation risk, defined in (6).
Assuming and are EY-separable, (5) shows that minimizing the target EY-separation risk will in turn minimize the risk over the target environment. Similarly, if a pair obeys (43) that in turn guarantees EY-separation, we can also have . Here we make the dependence of on explicit. In general, for any fixed that may not obey dIMP, we can adapt the notation from (6) and write the general form of target risk . Therefore, we define the pair that minimizes the target EY-separation risk while satisfying dIMP as,
The optimization above reflects the population case. In practice, and as we shall see below, one can only assess the dIMP (i.e., the invariance of ) over training environments. From a causal standpoint, this is akin to enforcing the conditional invariance of over all training environments as well as the nondescendant condition of in while also minimizing the test risk.
Remark 6. The dIMP itself does not identify a unique pair, as illustrated in the motivating example in Section 2. In general, multiple pairs may satisfy the dIMP. Among these valid pairs, the optimization in (28) selects the pair that minimizes the EY-separation risk, which, under the dIMP, is equal to the test risk defined in (1).
4.2 Finite-Sample Analysis
Recall the datasets , and defined in Section 4. For the finite-sample setting, we define the empirical risk of with respect to test samples for as
We first discuss the constraint in (28), as it needs to be quantifiable in the finite-sample setting. Based on dIMP, we make the following observation. If dIMP holds, does not vary over environment, which translates to for all in the finite-sample regime. In the causal sense of Proposition 1, this enforces the condition that the generating function does not vary over environment. One potential downside with computing for each is that estimates must be computed for each environment, which depending on the number of environments, could be computationally costly. This potential complexity can be alleviated. Specifically, if we assume each child variable follows an additive noise model, we can take a similar approach to that of the residual distribution test in [4]. That is, we estimate the mean of the noise distribution to be . The penalty term is introduced to capture this observation.
The following optimization objective is now proposed as a penalized risk,
where the penalty term is defined for an arbitrary and as
The parameter controls the tradeoff between the EY-separation risk and the invariance of . In practice, must be selected using some model selection criteria. In this work, we use cross validation over the training environments to select . We summarize the approach of finding suitable in Algorithm 1. From a complexity standpoint, is much simpler to compute as the estimate has already been computed in Step 1 of dIMP-Classifier.
Remark 7. Note that this is a relaxation of the condition enforces for all as we only enforce that the mean of the noise distribution is invariant. Even though enforces a weaker condition, it has been shown in practice that a comparison of residual distributions is often sufficient to identify invariances over environment [46, 4, 13, 14].
Algorithm 1 dIMP-Classifier
Input: , for each , and , for each
Output: A selected pair according to (30)
for each possible pair do
for each do
Using X and Y, estimate and call it .
Using , estimate and call it .
Form the functions , , and as in (25) and (26).
Form the function using , and according to (27).
Compute .
Return for each , where .
As the number of possible pairs grows exponentially with , Algorithm 1 quickly becomes infeasible for a large number of predictors. In such settings, one could search over a random subset of all possible pairs. Alternatively, a greedy approach may be adopted to identify a local minima with a small EY-separation risk. Empirically, we have observed that the objective function in (30) is more sensitive to the choice of than it is to . Consequently, exhaustively searching over and greedily searching over tends to yield a smaller local minima.
4.2.1 A Practical Variation: Parametric Modeling
Our Assumption 1 implies that (recall that the last row of the matrix consists of all 1's). In practice, when the number of labels is relatively large, this requires we must be able to identify at least invariant children of in order to form . In this subsection, we discuss a heuristic approach, allowing us to estimate (as defined in (45)) using at least one child node. In the case where , the system as described in (44) becomes underdetermined. In such settings, there is often an infinite number of solutions, only one of which corresponds to the true underlying probability distribution . The problem then becomes whether we can get close to recovering the correct solution . One possible approach is to place a parametric assumption on . For example, one can assume that is the popular multinomial logistic model parameterized by , i.e., . The goal is then to find a solution of (44) such that is multinomial logistic using
The resulting estimate of is then . The procedure used to estimate using a single child follows closely to that of the multiple child setting. One still needs to iterate over all pairs and find the optimal pairs that minimizes the EY-separation risk. The difference is how we compute the final classifier. In this case, we can define the classifier as for any . We refer to this parametric version of dIMP-Classifier as dIMPparm-Classifier.
4.3 Risk Upper Bounds for dIMP
We now present the main theoretical results that bound the test risk of our dIMP-based procedure. Consider generic functions and (not necessarily EY-separable) and their estimates and . We then use to denote the collection of over all .
We will show that test risk bound can be decomposed into several terms: the EY-separation risk, a term measuring how close functions are to being EY-separable, and terms measuring error in the estimates used. The proof of Proposition 3 can be found in Appendix A.2
Proposition 3. Assume that, for all , is Lipschitz continuous in the second argument with Lipschitz constant . For any fixed , the following target risk bound holds for any classifier ,
where denotes the norm, , , and .
Proposition 3 provides a general bound on the risk of some classifier in terms of the plug-in estimator of the target risk, the degree in which EY-separation fails, and the estimation errors associated with and . We now consider the performance of the estimate in (30) compared with the optimal in (28). Theorem 1 provides a risk bound that accounts for deviations from invariance across environments, estimation error, and finite sample-complexity. The proof for Theorem 1 can be found in Appendix A.3. For , we refer to
as the population EY-loss for any . Let be the of EY-loss function class over all .
Theorem 1. For each , , and , assume that of (21) is Lipschitz continuous in the second argument with Lipschitz constant . Assume that the EY-loss (34) is uniformly (over ) upper-bounded such that . For any , also assume .
Then, under Assumption 1, the following target risk bound holds for the dIMP-Classifier and any and with probability at least for some ,
where , , and are defined in (20), (25), and (31) respectively. contains the Rademacher complexity over the function class such that
Theorem 1 bounds the test risk of the dIMP–Classifier estimator into terms associated with invariance, complexity, and estimation error. Two terms involve the invariance over environments of . The first, , measures the extent of which the expectations induced by vary with respect to the test environment. Assuming the pair induces functions that satisfy the sufficient conditions of Proposition 2, will not depend on and this term will be zero. In general, this difference will be small when the inverse matrices are close across environments. The second invariance term, , quantifies how effective we are able to measure the dIMP property in the finite-sample setting. Intuitively, this term would be small as the ideal induces EY-separable functions and is constructed to penalize only functions not EY-separable. The term measures the finite sample complexity of evaluating the EY-separation risk using test samples. In particular, it used the Rademacher complexity as well as an additional term that scales with . The remaining two terms quantify the estimation error in estimating and over any pair. These two terms are expected to be small when the corresponding conditional expectations are estimated accurately, thanks to the universal approximation of neural networks that we adopt in our experiments.
5 Experiments
We now test the effectiveness of the proposed dIMP–Classifier approach using real and simulated datasets. For each real and simulated setting, it is assumed that the ground-truth causal model is unknown and must be estimated; i.e., we are unsure of the underlying true pair, and the approach laid out in Algorithm 1 must be used. Additionally, the approach in Algorithm 1 must be implemented, and methods chosen to model and , for given indices and . In this work, we model these in two ways, using ordinary least squares (OLS), which we denote using LIN, and neural nets, which we denote using NN. The neural nets used are feedforward neural nets with two 20-neuron ReLU hidden layers. In the case of OLS or neural networks, both and are modeled using the chosen function class for any and .
As a baseline comparison, various classification methods are used, including two causal-based, multi-environment prediction methods. Multinomial logistic regression (LR) and neural nets (NN) are also used. While LR and NN are not expected to perform well, as neither are able to adapt to environmental changes, it serves as a good baseline for determining whether the dIMP–Classifier can adapt to new environments and illustrates the need for more robust multi-environment methods. The implementation of NN follows that of the neural network implementation of the dIMP–Classifier. Two causal-causal based domain adaptation methods are used as comparisons, invariant causal prediction (ICP) [3] and stabilized regression (SR) [13]. While SR was originally proposed for regression settings, there exist straightforward extensions that allow for use in classification settings, which we implement here using logistic regression in place of OLS. For both ICP and SR these methods, . We note that the methods developed in [27] are based on the reweighting scheme and thus do not provide methods for estimating in the test environment; we thus do not consider these methods in this analysis.
5.1 Simulated Experiments
The data simulation used to illustrate the usefulness of the dIMP–Classifier approach is as follows. We consider the following three settings:
-
and (as in the motivating example).
-
. For this setting, we employ the dIMP–Classifier Algorithm 1.
-
. For this setting, we employ the dIMPparm–Classifier Algorithm (see Section 4.2.1).
For each setting, we create an SCM consisting of a target , its parents, and children. The number of parents () is chosen randomly from the interval . The number of children depends on the setting. Each parent is normally distributed such that , where the mean is chosen uniformly from for training environments and for the test environment.
Consider the following multinomial logistic model:
The target follows a multinomial logistic model where the number of labels is uniform on . The logistic coefficients are uniformly random on for the training environment and for the test environment. The difference in parameters between test and train is to elicit a joint distribution that is sufficiently different across environments to warrant a domain-adaptation approach. Each child is linear given . Specifically,
where is a vector, and . For each and , elements in the coefficient vector are sampled randomly from . Note that these child coefficients do not change over environment.
Remark 8. The dependence of the child generating mechanisms in (39) on the class label is important for satisfying the invertibility condition in Assumption 1. The linearity in alone does provide the needed variation in for invertibility. Rather, this needed variation is induced by the dependence on the class label . Specifically, since the conditional expectations and , they will be different in generic cases as and are generated randomly for each . Furthermore, is generated randomly for each child node . These two variations leading to invertibility.
The first setting considers SCMs where is binary and . This setting follows similarly to the motivating example in Section 2, where we leverage only a single child and the elements in one of the rows in are constant. The results for this simulation are presented in Figure 2. As can be seen, the dIMP–Classifier implemented using both linear and neural network models achieve average accuracies around 95%. The dIMP–Classifier methods outperform all other baselines, with the standard neural network a considerable distance behind them achieving an average accuracy of about 45%. As expected, LR performed poorly as it is unable to adapt to the new environment. SR averaged around 50% accuracy in this simulation. We note that in few cases did SR accept any subsets, meaning the best it could do was a random guess.
The second setting considers SCMs where . In these settings, there exist pairs with the invertible relationship needed to use the dIMP–Classifier algorithm in 1. We present the accuracy results of dIMP–Classifier compared to the other baseline methods in Figure 3a. As can be seen, the

Figure 2: Simulation results for the binary setting when .
dIMP-Classifier implemented using both linear models and neural nets outperforms other baseline methods, with the neural network implementation slightly outperforming the linear implementation. Logistic regression is the least performing out of the baseline methods with SR also producing low accuracy. This is to be expected as one of the principal assumptions of SR, that the target node is not intervened, is violated in this simulation.
The third setting considers SCMs where . In these settings, we use the approach described in Section 4.2.1. The accuracy results can be seen in Figure 3b. Results follow similarly to that of the with some adjustments. While the linear and neural network implementations of the dIMP-Classifier still outperform other baseline methods, their performance does drop when considering only one child. Similarly, the other baseline methods also perform slightly worse than they did in the setting.

(a) Results for the setting.

(b) Results for the setting.
Figure 3: Test accuracy across simulated datasets with a multinomial target.
5.2 Real Experiment: The Light Tunnel Causal Chamber
The light tunnel causal chamber is a tabletop laboratory that provides datasets from a well-understood optical system [11] and has been shown to be a reliable, physically grounded benchmark for evaluating prediction under distribution shift and invariance-based methods [47, 48, 49]. Light from an RGB LED is directed through a tube housing two linear polarizers that control the direction of light. Then, three photodiode sensors measure the intensity of the incoming light. The causal graph, as well as the individual variables and their descriptions, can be found in Figure 4a and Table 4b, respectively. Due to the adaptability in controlling parameters such as photodiode size, exposure time, or intensity of RGB values, such a system allows for the flexibility and control to create a wide variety of interventional datasets useful in environment-wise prediction.

(a) Ground truth causal DAG.
| Variable | Description |
|---|---|
| G | Brightness of the green component of main RGB LED |
| V | Visible light measurement for the i-th intensity sensor |
| I | Infrared measurement for the i-th intensity sensor |
| Brightness of the i-th LED placed by the light sensor | |
| Angle of the i-th polarizer frame | |
| E | Electric current drawn by the main LED |
(b) Variable names and descriptions.
Figure 4: Light tunnel Causal Chamber setup used in the real-data experiments.
We note that the DAG presented in Figure 4a and the subsequent variables used in this analysis are a subset of the 39 available variables presented in [11]. We present the variables outlined in Table 4b for the following reasons. (a) For the chosen environmental experiments, many of the variables were constant. (b) There are several sets of variables in those of [11] that measured the same physical process but in a slightly different way. For example, two photodiode sensors that are placed only slightly apart. Our analysis includes the largest set of variables where each variable represents a unique physical process while retaining each variable's parent nodes.
For these experiments, we consider the prediction of the target variable , discretized to three levels. In a purely observational setting, the value of the variable is chosen uniformly. Interventional datasets have been observed by limiting this uniform distribution such that the value falls in a low, medium, or high range. We choose these interventions specifically as they intervene on the child node, which is of particular interest in this work, while leaving the children nodes unintervened.
In the light tunnel causal chamber setting, we consider three environments: two training environments and one test environment. There are three potential options for the test environment. As none of them can be favored over the others, we run the analysis three times, once for each potential test environment. Given two train and one test environment (each 1000 samples), we take subsamples of 750 to use as inputs to dIMP–Classifier and other comparison methods. This is repeated 1000 times to produce the accuracy comparisons in Figure 5. Over all subsampled experiments, dIMP–Classifier (NN) outperforms all other baseline methods for all environment selections. As expected, SR performs poorly in all environments. NN and LR perform slightly better, achieving an average accuracy of up to 50% for the low and high environments and 25% for the medium environment.

(a) Test Env. - Green Low
(b) Test Env. - Green Medium

(c) Test Env. - Green High
Figure 5: Test accuracy results from the light tunnel causal chambers dataset.
6 Conclusion and Discussion
In this work, we consider classification under distribution shift when the target-generating mechanism varies across environments. We introduce environment-label separation (EY-separation), which relaxes the requirement that the full conditional distribution remain invariant and instead separates it into an environment-invariant component and an environment-dependent component. Within the SCM framework, we provide sufficient conditions for EY-separation, which motivate our main algorithm, dIMP Classifier. We provide finite-sample guarantees showing that test performance depends on deviations from invariance, estimation error, and sample complexity. The empirical results support these conclusions. Across the simulated settings, the proposed classifiers consistently outperform the baseline logistic and neural network methods, as well as invariance-based methods, when the target mechanism is intervened. The real-data experiments on the light tunnel Causal Chamber provide further evidence that the proposed framework is effective in physically grounded settings. Moreover, highly ranked pairs frequently reflect the child and spousal relationships predicted by the SCM-based analysis.
One important future direction is to relax the assumption of exact invariance. In realistic systems, otherwise stable mechanisms may vary slightly across environments due to measurement error, unmodeled effects, or gradual changes in system parameters. Extending EY-separation and dIMP to approximate invariance could therefore lead to guarantees that degrade smoothly with the magnitude of the invariance violation rather than requiring exact invariance.
References
[1] J. Pearl, Causality. Cambridge University Press, 2009.
[2] J. Peters, D. Janzing, and B. Schölkopf, Elements of causal inference: foundations and learning algorithms. The MIT Press, 2017.
[3] J. Peters, P. Bühlmann, and N. Meinshausen, “Causal inference by using invariant prediction: identification and confidence intervals,” Journal of the Royal Statistical Society. Series B (Statistical Methodology), pp. 947–1012, 2016.
[4] C. Heinze-Deml, J. Peters, and N. Meinshausen, “Invariant causal prediction for nonlinear models,” Journal of Causal Inference, vol. 6, no. 2, 2018.
[5] N. Pfister, P. Bühlmann, and J. Peters, “Invariant causal prediction for sequential data,” Journal of the American Statistical Association, vol. 114, no. 527, pp. 1264–1276, 2019.
[6] J. Runge, A. Gerhardus, G. Varando, V. Eyring, and G. Camps-Valls, “Causal inference for time series,” Nature Reviews Earth & Environment, vol. 4, no. 7, pp. 487–505, 2023.
[7] C. Toth, L. Lorch, C. Knoll, A. Krause, F. Pernkopf, R. Peharz, and J. Von Kügelgen, “Active bayesian causal inference,” Advances in Neural Information Processing Systems, vol. 35, pp. 16 261–16 275, 2022.
[8] T. Haavelmo, “The probability approach in econometrics,” Econometrica: Journal of the Econometric Society, pp. iii–115, 1944.
[9] J. Aldrich, “Autonomy,” Oxford Economic Papers, vol. 41, no. 1, pp. 15–34, 1989.
[10] G. W. Imbens and D. B. Rubin, Causal inference in statistics, social, and biomedical sciences. Cambridge University Press, 2015.
[11] J. L. Gamella, J. Peters, and P. Bühlmann, “Causal chambers as a real-world physical testbed for ai methodology,” Nature Machine Intelligence, vol. 7, no. 1, pp. 107–118, 2025.
[12] S. L. Lauritzen, “Causal inference from graphical models,” Monographs on Statistics and Applied Probability, vol. 87, pp. 63–108, 2001.
[13] N. Pfister, E. G. Williams, J. Peters, R. Aebersold, and P. Bühlmann, “Stabilizing variable selection and regression,” The Annals of Applied Statistics, vol. 15, no. 3, pp. 1220–1246, 2021.
[14] K. Du and Y. Xiang, “Learning invariant representations under general interventions on the response,” IEEE Journal on Selected Areas in Information Theory, 2023.
[15] Y. Chen and P. Bühlmann, “Domain adaptation under structural causal models,” Journal of Machine Learning Research, vol. 22, pp. 1–80, 2021.
[16] M. Baktashmotlagh, M. T. Harandi, B. C. Lovell, and M. Salzmann, “Unsupervised domain adaptation by domain invariant projection,” in Proceedings of the IEEE International Conference on Computer Vision, 2013, pp. 769–776.
[17] Y. Ganin, E. Ustinova, H. Ajakan, P. Germain, H. Larochelle, F. Laviolette, M. Marchand, and V. Lempitsky, “Domain-adversarial training of neural networks,” The Journal of Machine Learning Research, vol. 17, no. 1, pp. 2096–2030, 2016.
[18] Y. Li, M. Murias, S. Major, G. Dawson, and D. Carlson, “On target shift in adversarial domain adaptation,” in The 22nd International Conference on Artificial Intelligence and Statistics. PMLR, 2019, pp. 616–625.
[19] R. Tachet des Combes, H. Zhao, Y.-X. Wang, and G. J. Gordon, “Domain adaptation with conditional distribution matching and generalized label shift,” Advances in Neural Information Processing Systems, vol. 33, pp. 19 276–19 289, 2020.
[20] M. Gong, K. Zhang, T. Liu, D. Tao, C. Glymour, and B. Schölkopf, “Domain adaptation with conditional transferable components,” in International Conference on Machine Learning. PMLR, 2016, pp. 2839–2848.
[21] C. Heinze-Deml and N. Meinshausen, “Conditional variance penalties and domain shift robustness,” Machine Learning, vol. 110, no. 2, pp. 303–348, 2021.
[22] K. Wu, Y. Chen, W. Ha, and B. Yu, “Prominent roles of conditionally invariant components in domain adaptation: Theory and algorithms,” Journal of Machine Learning Research, vol. 26, no. 110, pp. 1–92, 2025.
[23] M. Arjovsky, L. Bottou, I. Gulrajani, and D. Lopez-Paz, “Invariant risk minimization,” arXiv preprint arXiv:1907.02893, 2019.
[24] K. Du and Y. Xiang, “Generalized invariant matching property via lasso,” in ICASSP 2023-2023 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2023, pp. 1–5.
[25] K. Du, Y. Xiang, and I. Soloveychik, “Identifying direct causes using intervened target variable,” arXiv preprint arXiv:2307.07736, 2023.
[26] A. V. Goddard, A. Y. Su, Y. Xiang, and C. J. Bryan, “Multi-environment prediction of suicidal beliefs,” Frontiers in Psychiatry, vol. 15, p. 1425416, 2024.
[27] L. Chen, M. Zaharia, and J. Y. Zou, “Estimating and explaining model performance when both covariates and labels shift,” Advances in Neural Information Processing Systems, vol. 35, pp. 11467–11479, 2022.
[28] D. Tasche, “Sparse joint shift in multinomial classification,” Foundations of Data Science, 2024.
[29] B. Schölkopf, D. Janzing, J. Peters, E. Sgouritsa, K. Zhang, and J. Mooij, “On causal and anticausal learning,” in 29th International Conference on Machine Learning (ICML 2012). International Machine Learning Society, 2012, pp. 1255–1262.
[30] J. Quinonero-Candela, M. Sugiyama, A. Schwaighofer, and N. D. Lawrence, Dataset shift in machine learning. MIT Press, 2008.
[31] A. Storkey, “When training and test sets are different: characterizing learning transfer,” Dataset shift in machine learning, vol. 30, pp. 3–28, 2009.
[32] M. Sugiyama and M. Kawanabe, Machine learning in non-stationary environments: Introduction to covariate shift adaptation, 2012.
[33] Z. Lipton, Y.-X. Wang, and A. Smola, “Detecting and correcting for label shift with black box predictors,” in International Conference on Machine Learning. PMLR, 2018, pp. 3122–3130.
[34] K. Azizzadenesheli, A. Liu, F. Yang, and A. Anandkumar, “Regularized learning for domain adaptation under label shifts,” in International Conference on Learning Representations, 2018.
[35] S. Garg, Y. Wu, S. Balakrishnan, and Z. Lipton, “A unified view of label shift estimation,” Advances in Neural Information Processing Systems, vol. 33, pp. 3290–3300, 2020.
[36] S. Ben-David, J. Blitzer, K. Crammer, and F. Pereira, “Analysis of representations for domain adaptation,” Advances in Neural Information Processing Systems, vol. 19, 2006.
[37] J. A. Bagnell, “Robust supervised learning,” in AAAI, 2005, pp. 714–719.
[38] Z. Hu and L. J. Hong, “Kullback-Leibler divergence constrained distributionally robust optimization,” Available at Optimization Online, pp. 1695–1724, 2013.
[39] A. Sinha, H. Namkoong, and J. Duchi, “Certifying some distributional robustness with principled adversarial training,” in International Conference on Learning Representations, 2018.
[40] R. Gao, X. Chen, and A. J. Kleywegt, “Distributional robustness and regularization in statistical learning,” arXiv preprint arXiv:1712.06050, 2017.
[41] J. Lee and M. Raginsky, “Minimax statistical learning with Wasserstein distances,” Advances in Neural Information Processing Systems, vol. 31, 2018.
[42] J. C. Duchi and H. Namkoong, “Learning models with uniform performance via distributionally robust optimization,” The Annals of Statistics, vol. 49, no. 3, pp. 1378–1406, 2021.
[43] I. Goodfellow, P. McDaniel, and N. Papernot, “Making machine learning robust against adversarial inputs,” Communications of the ACM, vol. 61, no. 7, pp. 56–66, 2018.
[44] A. Raghunathan, J. Steinhardt, and P. S. Liang, “Semidefinite relaxations for certifying robustness to adversarial examples,” Advances in Neural Information Processing Systems, vol. 31, 2018.
[45] A. Goddard, K. Du, and Y. Xiang, “Mining invariance from nonlinear multi-environment data: binary classification,” in 2024 IEEE International Symposium on Information Theory (ISIT). IEEE, 2024, pp. 190–195.
[46] J. Peters, D. Janzing, and B. Scholkopf, “Causal inference on discrete data using additive noise models,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 33, no. 12, pp. 2436–2450, 2011.
[47] A. R. Williams, A. Ashok, É. Marcotte, V. Zantedeschi, J. Subramanian, R. Riachi, J. Requeima, A. Lacoste, I. Rish, N. Chapados et al., “Context is key: A benchmark for forecasting with essential textual information,” arXiv preprint arXiv:2410.18959, 2024.
[48] T. Xu, S. Küçükyavuz, A. Shojaie, and A. Taeb, “An asymptotically optimal coordinate descent algorithm for learning bayesian networks from gaussian models,” arXiv preprint arXiv:2408.11977, 2024.
[49] A. Rahmani and P. Frossard, “Flow-based non-stationary temporal regime causal structure learning,” arXiv preprint arXiv:2506.17065, 2025.
[50] P. L. Bartlett, A. Montanari, and A. Rakhlin, “Deep learning: a statistical viewpoint,” Acta numerica, vol. 30, pp. 87–201, 2021.
A Proofs
A.1 Proof of Proposition 2
Proof. In the proof, we make the dependency on explicit. We first show that when the conditions on hold, then does not depend on . For an acyclic SCM in (7), we make the following two observations: (1) any variable is conditionally independent of all nondescendants given its parents (parental Markov condition [1]), and (2) the nondescendants of are also nondescendants its children. Thus, as is a child of (Condition 1), . Following this, we have because (Condition 2). On the other hand, observe that and the latter is contained in (Condition 2), which implies
Thus we have that and are all nondescendants of , and we can write the following due to the parental Markov condition,
Then, for each
(41)
where follows from replacing with (Condition 2), and by noting that (Condition 1), and follows from (40). Recall that . Let . Now, following (41)
(42)
where follows from as in (7) and in Condition 1. As and do not vary over environment, neither does , nor . Thus, .
With the invariant in place, we can write down a key property that decomposes using the law of total probability,
We now make use of (43) to show that . This can be written in a matrix form as
where
As is invertible, we can write and . Thus, and are EY-separable as the former does not depend on (by (41)) and the later does not depend on (by definition).
A.2 Proof of Proposition 3
Proof. The target risk can then be decomposed as
We now consider terms individually, starting with the term ,
For the term , observe
(51)
where holds due to the Lipschitz assumption on . Similarly, the term can be bounded such that
(52)
The bound in follows by considering all bounded terms together.
A.3 Proof of Theorem 1
Proof. For simplicity of presentation denote, , , , , , , and as , , , , , , and , respectively. Do similarly for their estimates. As done in the proof of Proposition 3, we then denote the EY-separation risk in terms of and using and do similarly for . Now expand such that
We now bound each term individually.
Term A: Following what was done in (50),
(60)
Then, as for any , and using the Cauchy-Schwarz inequality, (60) can be further bounded by
(61)
Terms B1 and B2: The term B1 + B2 can be bounded such that
where taking the supremum over is equivalent of taking the supremum over . Following of [50, Theorem 2.1], and since the EY-separation risk is bounded by , the term can be further bounded using the Rademacher complexity over the function class , denoted as , by
with probability at least .
Terms and : We start by showing that
(64)
where follows from (51) and (52) in the proof of Proposition 3. Briefly returning to the original notation, we can bound as
Thus, using (64), is bounded by
(68)
Term D: As minimizes the objective in (30),
Thus,
(70)
Term E: Since and are EY-separable according to (28), then following (5), .
Putting the terms together completes the proof Theorem 1.