Representation Learning as Finding Necessary and Sufﬁcient Causes
Abstract
Representation learning constructs lowdimensional representations to summarize essential features of high-dimensional data.
This learning problem is often approached by describing various desiderata associated with learned representations; e.g., that they be non-spurious or efﬁcient.
It can be challenging, however, to turn these intuitive desiderata into formal criteria that can be measured and enhanced based on observed data.
In this paper, we take a causal perspective on representation learning, formalizing non-spuriousness and efﬁciency (in supervised representation learning) using counterfactual quantities and observable consequences of causal assertions.
This yields computable metrics that can be used to assess the degree to which representations satisfy the desiderata of interest and learn non-spurious representations from single observational datasets.
1. Introduction
Representation learning constructs low-dimensional representations that summarize essential features of highdimensional data.
For example, one may be interested in learning a low-dimensional representation of MNIST images, where each image is a 784 -dimensional vector of pixel values.
Alternatively, one may be interested in a product review corpus; each review is a 5 , 000 -dimensional word count vector.
Given an m -dimensional data point, X =
( X 1 , . . .
X m ) ∈ R m , the goal is to ﬁnd a d -dimensional representation Z
=
( Z 1 , . . .
, Z d ) (cid:44) ( f 1 ( X ) , . . .
, f d ( X )) that captures d important features of the data where f j : R m →
R , j = 1 , . . .
, d are d deterministic functions and d (cid:28) m .
A heuristic approach to the problem has been to ﬁt a neural network that maps from the high-dimensional data to a set of labels and then take the top layer of the neural network as the representation of the image.
When labels are not available, a related heuristic is to ﬁt a latent variable model (e.g., a variational autoencoder (Kingma & Welling, 2014)) and output a low-dimensional representation based on the inferred latent variables.
In both cases, the hope is that these low-dimensional representations will be useful in the performance of downstream tasks and provide an interpretation of the statistical relationships underlying the data.
These heuristic approaches do not, however, always succeed in producing representations with desirable properties.
For example, as we will discuss in detail, common failure modes involve capturing spurious features that do not transfer well.
For example, in ﬁtting a neural network to images of animals, with the goal of producing a labeling of the species found in the images, a network may capture spurious background features (e.g., grass) that are highly correlated with the animal features (e.g., the face of a dog).
Such spurious features can often predict the label well.
But they are generally not useful for prediction in a different dataset or for performing other downstream tasks.
While non-spuriousness is a natural desideratum of representations, they are often intuitively deﬁned, challenging to evaluate, and hard to optimize over algorithmically.
Lacking formal metrics for these desiderata, and not having access to manually labeled features (e.g., grass, animal fur, or background lighting) that provide empirical guidance, prevents us from developing representation learning algorithms that satisfy natural desiderata.
In this work, we take a causal inference perspective on representation learning.
This perspective allows us to formalize representation learning desiderata using causal notions, speciﬁcally causal relationships among the label Y and the d features captured by Z 1 , . .
, Z d .
This yields calculable metrics obtained from the observable implications of the underlying causal relationships.
These metrics enable representation learning algorithms that target these desiderata.
We focus on efﬁciency and non-spuriousness in supervised representation learning—i.e., the representations shall efﬁciently capture non-spurious features of the data.
The key idea is to view representations as capturing features that are potential causes of the label.
From this perspective, a non-spurious representation should capture features that are sufﬁcient causes of the label.
This property ensures that the same representation is still likely to be informative of the label when employed on a new dataset.
In the running example of images, a representation that captures the dog-face feature is non-spurious because the presence of a dog face is sufﬁcient to determine the dog label (i.e., whether a dog is present in the image).
In contrast, a representation based on the grass feature is spurious because it cannot causally determine the dog label, even though it is highly correlated.
We formalize this connection between non-spurious representations and sufﬁcient causes by deﬁning non-spuriousness using the notion of probability of sufﬁciency (PS), due to Pearl (2011).
The same causal perspective also allows us to formalize the efﬁciency of representations, which are those that do not pick up redundant features.
Again viewing the representation as a potential cause of the label, its efﬁciency corresponds to the necessity of the cause.
In the image example, a representation of both “dog-face” and “four-leg” is inefﬁcient because it is not necessary to know both “dog-face” and “four-leg” to determine the dog label.
As dogs always have four legs (in our simpliﬁed world), “four-leg” is a redundant feature given “dog-face.”
We therefore formalize efﬁciency of a representation using the notion of probability of necessity (PN).
As we will discuss, PN and PS are aspects of a general notion of probabilities of causation , also due to
Pearl (2011).
While these causal deﬁnitions formalize efﬁciency and non-spuriousness, they do not immediately imply calculable metrics for these desiderata, because not all causal quantities are estimable from observational data.
To obtain calculable metrics, we have to study observable implications of these causal deﬁnitions, a problem known as causal identiﬁcation (Pearl, 2011).
We discuss the unique challenges of causal identiﬁcation with high-dimensional data—speciﬁcally, high-dimensional data are often rankdegenerate (Stewart, 1984; Golub et al., 1976)—and we develop identiﬁcation strategies to address these challenges.
These strategies lead to calculable metrics of efﬁciency and non-spuriousness in the high-dimensional setting, along with the conditions under which they are valid.
Based on these deﬁnitions, we develop an algorithmic framework that we refer to as CAUSAL-REP that formulates representation learning as a task of ﬁnding necessary and sufﬁcient causes.
In a range of empirical studies, we ﬁnd that
CAUSAL-REP is more successful at ﬁnding non-spurious representations in both images and text compared to standard benchmarks.
Through the study of non-spuriousness/efﬁciency, we illustrate how causality can provide a fruitful perspective for representation learning.
Many intuitively deﬁned desiderata in representation learning can be formalized using causal notions.
These causal notions can further lead to metrics that quantify these desiderata and representation learning algorithms that enforce these desiderata.
(We defer the discussion of related work to Section 4.)
2. Supervised Representation Learning: Efﬁciency and Non-spuriousness
We begin by formulating a set of desiderata for supervised representation learning.
As a running example, we consider a dataset of images and their labels.
We focus on settings where the labels are obtained by annotators viewing each image and then labeling; they describe the perceived features of the image, as opposed to the intended features of the image.
The goal is to construct a low-dimensional image representation that efﬁciently captures its essential features.
Formally, we consider a dataset that contains n mdimensional data points and their labels, { x i , y i } ni =1 ∈
X m × Y , assumed to be sampled i.i.d., with x i =
( x i 1 , . . .
, x im ) .
The variable x il might be the value of the l th pixel of an image, with X =
[0 , 255] ; it might also be the number of times the l th word in the vocabulary occur in the document, with X
=
Z + .
The goal of representation learning is to ﬁnd a deterministic function f : X m → R d mapping the m -dimensional data into a d -dimensional space ( d << m ) .
Thus each data point x i has a d -dimensional representation
z i (cid:44) f
( x i ) , or equivalently z i =
( z i 1 , . . .
, z id ) (cid:44) ( f 1 ( x i ) , . . .
, f d ( x i )) , with f j : X m → R .
Ideally, such a representation should be efﬁcient and nonspurious.
It shall efﬁciently capture features of the image that are essential for determining the label.
Below we formalize the desiderata of non-spuriousness and efﬁciency using counterfactual notions.
2.1. Deﬁning Efﬁciency and Non-spuriousness using Counterfactuals
To formalize the desiderata of efﬁciency and nonspuriousness, we posit a structural causal model ( SCM ) that describes the data generating process.
This SCM will enable us to deﬁne these desiderata through counterfactual quantities deﬁned via this model.
2.1.1. A STRUCTURAL CAUSAL MODEL OF SUPERVISED REPRESENTATION LEARNING
We describe a structural causal model ( SCM ) for supervised representation learning and the counterfactual quantities therein.
The structural causal model ( SCM ) of the labeled dataset.
We posit Figure 1 as the SCM of a data-generating process.
(For notational simplicity, we suppress the datapoint index i and focus on categorical Y .)
The ﬁgure embodies the assumption that the high-dimensional object
X =
( X 1 , . . .
, X m ) causally affects its label Y .
Moreover, there is no confounder between the two; the label Y can be fully determined by the object X .
These assumptions hold because we assume the labels are obtained by annotators viewing the images; the labeling is solely based on the images.
Figure 1 also posits that different dimensions of the highdimensional object, X 1 , . . .
, X m , are correlated due to some unobserved common cause C , which can potentially be multi-dimensional.
For example, C can represent the design of an image; nearby pixels tend to be highly correlated if an image has a smooth design.
This assumption holds because pixel values of images are not independent; they are determined by common latent variables (Kingma & Welling, 2014; Goodfellow et al., 2014).
The representation f ( X ) and its interventions.
The representation Z = f ( X ) captures features of the highdimensional data X .
For example, Z = ( Z 1 , Z 2 ) =
( 1 { X 125 ×
X 38 < 0 .
01 } , X 164 + 0 .
· X 276 ) is a twodimensional representation of X , whose ﬁrst dimension represents whether pixels 125 and 38 are close to black.
More complex representations may capture more meaningful features; e.g., whether a dog face is present in the image.
The representation Z = f ( X ) is not included in the SCM as a separate causal variable in addition to X .
The reason is that the representation Z = f
( X ) is a deterministic function of the image pixels X
and the causal variables of a
SCM must be related by functional relationships perturbed by random disturbances.
In particular, Z is not a descendant of X because a value change in Z would imply a value change in X (unless f is a constant function).
Nor is Z an ancestor of X because a change in the value of X would also imply a change in Z .
Despite Z being not explicitly included in the SCM , Figuredoes imply that Z = f ( X ) is an ancestor of the label
Y .
This is because X is an ancestor of Y .
Moreover, interventions on the representation Z = f
( X ) are also well deﬁned; they are functional interventions (Puli et al., 2020; Correa & Bareinboim, 2020; Eberhardt & Scheines, 2007), also referred to as stochastic policies (Pearl, 2011,
Ch. 4.2).
(We will deﬁne them rigorously in Section 5.1.)
Roughly, suppose a one-dimensional representation Z = f
( X ) captures the univariate binary feature of whether the grass is present in the image.
Then the intervention do( Z = 1) —equivalently do( f ( X ) = 1) —means turning on the grass feature in the image.
That is, holding the design of the image C ﬁxed, we change the pixels of the image X such that the grass is present:
Z = 1 .
Accordingly, the intervention do( Z = 0) means turning off the grass feature. C
X m X X Y ... Holding the design C ﬁxed, we change the pixels X such that the grass is absent, Z = 0 .
Counterfactuals in the SCM .
The SCM (Figure 1) results in a family of counterfactuals, “what would the value of a variable be if we intervene on some variables of the causal model.”
Here we focus on the counterfactuals obtained when we intervene on the image features captured by the representation Z .
These counterfactuals will allow us to deﬁne the efﬁciency and non-spuriousness of the representations.
We denote Y ( Z = z ) as the counterfactual label of an image if we force its representation Z to take value z .
For example, if a univariate representation Z captures the feature “whether grass is present in the image,” then Y ( Z = 0) is the counterfactual label had the image had no grass.
Accordingly, Y ( Z = 0) is the counterfactual label had the image had grass being present.
The key idea here is to evaluate the quality of the representation Z by reasoning about the counterfactual labels:
What would the label Y be had Z taken different values?
We will show how the desiderata of non-spuriousness and efﬁciency can be formalized via these counterfactuals.
This connection will allow us to develop metrics and algorithms for these desiderata.
2.1.2. C OUNTERFACTUAL DEFINITIONS OF NON - SPURIOUSNESS AND EFFICIENCY
We next discuss how these counterfactual notions can allow us to formalize the non-spuriousness and efﬁciency of a representation f ( x ) , for a single observed data point ( X = x , Y = y ) .
Non-spuriousness and its counterfactual deﬁnition.
A non-spurious representation captures features that can (causally) determine the label.
In the causal model, we say that a representation captures non-spurious features if, given an image without the feature, including this feature would change its label.
As an example, suppose the label Y indicates whether the image contains a dog.
Then a representation Z capturing the presence of dog-face is a non-spurious feature.
Given a nondog image without a dog face ( Y = 0 , Z = 0) , adding a dog face to the image turns on the dog label, i.e., Y ( Z = 1) = 1 .
In other words, dog-face is a sufﬁcient case of a dog label.
In contrast, a representation Z that captures the presence of grass is a spurious feature.
Though the presence of grass and the dog label may be highly correlated, adding grass to a non-dog image does not turn on the dog label.
Viewing the representation Z as a potential cause of the label, a non-spurious representation shall be a sufﬁcient cause of the label.
Turning on the feature (captured by)
Z should be sufﬁcient to turn on the label.
We thus measure the non-spuriousness of a representation by the probability of sufﬁciency ( PS ) of the feature Z causing the label Y .
Deﬁnition 1 (Non-spuriousness of representations) .
Suppose we observe a data point with representation Z = z and label Y =
y .
Then the non-spuriousness of the representation Z for label Y is the probability of sufﬁciency ( PS ) of 1 { Z = z } for 1 { Y = y } :
[Equation]
When both the representation Z and the label Y are univariate binary with z = 1 , y = 1 , then Equation (1) coincides with classical deﬁnition of PS (Deﬁnition 9.2.2 of Pearl (2011)).
PS is the probability of the representation 1 { Z = z } being a sufﬁcient cause of the label 1 { Y = y } .
In Pearl’s language, it describes the capacity of the representation to “produce” the label.
PS measures the probability of a positive counterfactual label if we make the feature 1 { Z = z } be present (and all else equal), conditional on the feature being absent and the label being negative { 1 { Z = z } = 0 , 1 { Y = y } = 0 } .
A non-spurious representation shall have a high PS for the label of interest.
Efﬁciency and its counterfactual deﬁnition.
An efﬁcient representation captures only essential features of the data; it does not capture any redundant features.
In the causal model, we say that the representation is efﬁcient if, given an image with the feature it captures, removing this feature would change its label.
Returning to the image example with the dog label, a representation that captures “dog-face + four-leg” is inefﬁcient.
The reason is that, for an image with both a dog face and four legs, removing one of the dog legs and hence turning off the “dog-face + four-leg” feature does not necessarily turn off the “dog label.”
In contrast, the feature “dog-face” is efﬁcient as removing a dog face from an image will turn off the “dog label.”
An efﬁcient representation must capture features that are necessary causes of the label.
We can therefore deﬁne the efﬁciency of a representation by the probability of necessity ( PN ) of the feature causing the label (Pearl, 2011).
Deﬁnition 2 (Efﬁciency of representations) .
Suppose we observe a data point with representation Z = z and label
Y =
y .
Then the efﬁciency of the representation Z for the label Y is the probability of necessity ( PN ) of 1 { Z = z } for 1 { Y = y } :
[Equation] Y =
y =
P ( Y ( Z (cid:54) =
z ) (cid:54) =
y | Z
= z , Y = y ) .
When both the representation Z and the label Y are univariate binary with z = 1 , y = 1 , then Equation (2) coincides with classical deﬁnition of PN (Deﬁnition 9.2.1 of Pearl (2011)).
PN is the probability of the representation 1 { Z = z } being a necessary cause of the label 1 { Y = y } .
It measures the probability of a negative counterfactual label if we remove the feature (i.e., setting 1 { Z = z } = 0 and all else equal), conditional on the feature being present and the label being positive { 1 { Z = z } = 1 , 1 { Y = y } = 1 } .
An efﬁcient representation shall have a high PN for the label of interest.
These deﬁnitions suggest that we could leverage probability of sufﬁcient and necessary causation for evaluating nonspurious and efﬁciency.
Moreover, representation learning amounts to ﬁnding necessary and sufﬁcient causes.
We defer the formulation of representation learning and the algorithm for learning non-spurious features to Section 5.
3. Discussion
Targeting the desiderata of efﬁciency and non-spuriousness in the supervised setting, we view the representation as a cause of the label and formalize these desiderata as the probability of necessity and sufﬁciency ( PNS ) of the cause.
Studying the observable implications of PNS enables us to measure efﬁciency and non-spuriousness with observational data.
It also allows us to formulate representation learning as a task of ﬁnding necessary and sufﬁcient causes. We
[Equation] operationalize this task by developing the CAUSAL-REP algorithm.
En route, we develop identiﬁcation results for the PNS given high-dimensional (rank-degenerate) data.
4. Related work
There has been a ﬂurry of recent work at the intersection of representation learning and causal inference.
We provide a brief review, highlighting the contrast between this literature and our work.
Learning non-spurious representations via invariance.
Many works have considered causal formulations of representation learning given datasets from multiple environments (Khasanova & Frossard, 2017;
Zhao et al., 2019; Moyer et al., 2018;
Lu et al., 2021; Mitrovic et al., 2020; Moraffah et al., 2019; Arjovsky et al., 2019; Cheng & Lu, 2017; Veitch et al., 2021;
Creager et al., 2021; Puli et al., 2021).
The basic idea is to enforce the invariance of the mapping between the learned representation and the outcome label, thereby encouraging non-spurious representations and enabling out-of-distribution prediction.
Similar to these works, our CAUSAL-REP algorithm targets non-spurious representations.
However, it differs in its focus on the setting in which only a single observational dataset is available.
That is, we do not assume access to datasets from multiple environments, nor do we leverage the invariance principle.
Reverse causal inference.
Our work is also related to a body of work on reverse causal inference, a task that aims to ﬁnd “causes of effects” (Schölkopf et al., 2013; Janzing & Schölkopf, 2015; Weichwald et al., 2014; Kilbertus et al., 2018;
Schölkopf et al., 2012; Paul, 2017; Wang & Culotta, 2020; 2021; Kommiya Mothilal et al., 2021;
Galhotra et al., 2021;
Watson et al., 2021;
Chalupka et al., 2015; 2017; Gelman & Imbens, 2013; Atzmon et al., 2020).
Existing approaches formulate the search for causes as causal hypotheses generation and testing.
In contrast, our CAUSAL-REP algorithm formulates this search as maximizing probabilities of causation ( POC ) (Pearl, 2011; 2019b; Tian & Pearl, 2000; Mueller et al., 2021), speciﬁcally in the context of representation learning.
We develop identiﬁcation conditions for these POC for high-dimensional data such as images and text (Nabi et al., 2020;
Puli et al., 2020; Wang & Blei, 2019a; 2020; Ranganath & Perotte, 2018; Wang & Blei, 2021; Pryzant et al., 2020; Grimmer & Fong, 2021; Fong & Grimmer, 2016; Wang &
Culotta, 2020; 2021).
Our results build on existing identiﬁcation results around multiple causes with shared unobserved confounding (Wang & Blei, 2019a; 2020; Puli et al., 2020) and its positivity issues (D’Amour et al., 2020a; D’Amour, 2019b;a; Imai & Jiang, 2019), but are tailored to the representation learning setting where no unobserved confounding is present.
Causal structure learning.
Our causal approach to disentanglement also relates to causal structure learning; both involve assessing the existence of causal connections between variables.
Traditional approaches to causal structure learning relies on independence tests or score-based methods, often assuming all variables are observed; see Heinze-Deml et al.
(2018) for a review.
independence-of-support score ( IOSS ) differs from these works in that we allow for unobserved common causes among the observed variables; we also rely on a different observable implication of the lack of causal connections.
Representation learning for causal inference.
Representation learning and dimensionality reduction have signiﬁcantly improved the estimation efﬁciency of causal inference with high-dimensional covariates and treatments (Johansson et al., 2019;
Nabi et al., 2020; Johansson et al., 2020; Shi et al., 2020; Wu & Fukumizu, 2021; Veitch et al., 2019; 2020).
The focus in these work is on how representation learning can help causal inference with high-dimensional covariates.
In contrast, we focus on how causal inference can help produce useful representations.
5. Non-spuriousness, efﬁciency, and CAUSAL-REP 5.0.1. S IMULTANEOUS ASSESSMENT OF NON - SPURIOUSNESS AND EFFICIENCY
Representation learning often targets representations that are both non-spurious and efﬁcient.
How can one assess nonspuriousness and efﬁciency simultaneously?
Assessing non-spuriousness and efﬁciency simultaneously.
We invoke the notion of PNS .
In more detail, non-spuriousness is intuitively the effectiveness of turning on the label by turning on the feature captured by the representation; efﬁciency is the effectiveness of turning off the label by turning off this feature.
Thus a representation is both non-spurious and efﬁcient if the label responds to the feature in both ways.
If the feature is turned on, then the label will be turned on; if the feature is turned off, then the label will be turned off too.
PNS calculates exactly this probability.
Deﬁnition 3 (Efﬁciency & non-spuriousness of representations) .
Suppose we observe a data point with representation
Z = z and label Y =
y .
Then the efﬁciency and non-spuriousness of the representation Z for label Y is the probability of necessity and sufﬁciency ( PNS ) of 1 { Z = z } for 1 { Y = y } :
[Equation]
When both the representation Z and the label Y are univariate binary with z = 1 , y = 1 , then Equation (3) coincides with classical deﬁnition of PNS (Deﬁnition 9.2.3 of Pearl (2011)).
Requiring both necessity and sufﬁciency of the cause is a stronger requirement than requiring only necessity (or only sufﬁciency).
Accordingly, PNS is a weighted combination of PN and PS ,
[Equation]
as per Lemma 9.2.6 of Pearl (2011).
We note that our deﬁnitions of PN , PS , PNS (Equations (1) to (3)) generalize those in
Pearl (2011, Ch. 9) from univariate binary causes to general (continuous, discrete, or multi-dimensional) causes.
We next consider two further extensions of the PNS notion.
Extension: Efﬁciency and non-spuriousness over a dataset.
The discussion of efﬁciency and non-spuriousness (Deﬁnitions 1 to 3) has focused on individual data points up to this point, reﬂecting the fact that probabilities of causation ( POC ) notions are most commonly discussed with respect to a single occurred event—given that the event Z
= z
and
Y =
y has occurred, what is the probability that Z = z is a sufﬁcient or necessary cause of Y =
y ?
In practice, however, we are often interested in whether a representation, f : X m → Y , can produce an efﬁcient and non-spurious summary for datasets of n data points, { ( x i , y i ) } ni =1 .
We thus extend Deﬁnition 3 to this setting:
[Equation]
where z i = f
( x i ) is the representation for data point i .
Loosely, this means that a representation is efﬁcient and nonspurious for a dataset if its efﬁciency and non-spuriousness holds jointly across all the data points.
(One can similarly extend
Deﬁnitions 1 and 2 for PS and PN .)
Extension: Conditional efﬁciency and non-spuriousness.
For multi-dimensional representations, one is often interested in the efﬁciency and non-spuriousness of each of its dimensions.
We expect each dimension of the representation to be efﬁcient and non-spurious conditional on all other dimensions.
We thus extend Deﬁnition 3 to formalize a notion of conditional efﬁciency and non-spuriousness .
Consider a d -dimensional representation Z
=
( Z 1 , . . .
, Z d ) =
( f 1 ( X ) , . . .
, f d ( X )) .
The conditional efﬁciency and non-spuriousness of the j th dimension Z j for data point ( x i , y i ) is
[Equation]
where z ij = f j ( x i ) is the j th dimension of the representation, and z i, − j = ( z ij [Equation] j
[Equation]
∈{ 1 ,...,d }\ j .
Accordingly, the conditional efﬁciency and non-spuriousness of Z j across all n data points is
[Equation]
Conditional efﬁciency and non-spuriousness describes how the label responds to the j th feature captured by the representation, holding all other features ﬁxed.
Its deﬁnition resembles the deﬁnition of (unconditional) efﬁciency and non-spuriousness.
The only difference is that the conditional notion contrasts the counterfactual label of { Z j (cid:54) =
z ij , Z − j
=
z
i, − j } and { Z j = z ij , Z − j
=
z
i, − j } , while the unconditional notion contrasts that of { Z j (cid:54) =
z ij , Z − j (cid:54) =
z i, − j } and { Z j = z ij , Z − j
=
z
i, − j } .
The conditional efﬁciency and non-spuriousness across all dimensions of a representation is generally a stronger requirement than (unconditional) efﬁciency and non-spuriousness.
For example, suppose a dataset of ( X , Y ) with X
=
( X 1 , X 2 , X 3 ) is generated by Y =
X 1 + (cid:15) y .
Now consider a two-dimensional representation, Z = ( Z 1 , Z 2 ) , where Z 1 = X 1 and
Z
=
Z 1 + (cid:15), (cid:15) ∼ N (0 , σ 2 ) .
When σ 2 is small, Z 1 and Z 2 are highly correlated.
In this case, the (unconditional) efﬁciency and non-spuriousness of Z is high because ( Z 1 , Z 2 ) is indeed non-spurious and (nearly) efﬁcient; Z 2 only introduces a negligible amount of useless information.
However, the conditional efﬁciency and non-spuriousness of Z 2 given Z 1 is low because Z 2 is completely useless given Z 1 .
We will leverage this conditional efﬁciency and non-spuriousness notion for representation learning in Section 5.2.
First, however, we study how to measure (conditional) efﬁciency and non-spuriousness from observational data.
5.1. Measuring Efﬁciency and Non-spuriousness in Observational Datasets
Deﬁnitions 1 to 3 formalize the efﬁciency and non-spuriousness of representations using POC .
These POC are counterfactual quantities; calculating them requires access to a causal structural equation (i.e., the true data generating process), which is rarely available in practice.
In this section, we study the observable implications of Deﬁnitions 1 to 3.
They lead to strategies to evaluate the efﬁciency and non-spuriousness of representations with observational data; these strategies are known as causal identiﬁcation strategies (Pearl, 2011).
For simplicity of exposition, we focus on identifying the PNS in Deﬁnition 3.
(Identiﬁcation formulas for PN and PS in Deﬁnitions 1 and 2 can be similarly derived using Theorem 9.2.15 of Pearl (2011).)
To identify the counterfactual quantity PNS from observational data, we perform two steps of reduction, climbing down the ladder of causation (Pearl, 2019a): (1) connect PNS to interventional distributions, and (2) identify these interventional distributions from observational data.
We describe these steps in detail in the next sections; they lead to an algorithm for calculating a lower bound on the PNS (Theorem 7).
5.1.1. F ROM COUNTERFACTUALS TO INTERVENTIONAL DISTRIBUTIONS
To connect the counterfactual quantity PNS with intervention distributions, we generalize the classical identiﬁcation results for PNS that have been developed for univariate binary causes and outcomes.
It turns out that the PNS cannot be pointidentiﬁed by interventional distributions; for each set of interventional distributions, there may exist many values of PNS that are consistent with the interventional distributions (Pearl, 2011).
However, PNS can be bounded by the difference between these two interventional distributions.
Lemma 4 (A lower bound on PNS ) .
The PNS is lower bounded by the difference between two intervention distributions:
[Equation]
The inequality becomes an equality when the outcome Y is monotone in the representation
Z (in the binary sense); i.e.,
P ( Y ( Z = z ) (cid:54) =
y, Y ( Z (cid:54) =
z ) =
y )
= 0 .
Lemma 4 generalizes Theorem 9.2.10 of Pearl (2011) to non-binary Z .
(The proof is in Appendix A.)
It connects the counterfactual quantity PNS to the intervention distribution P
( Y | do( Z = z )) .
An upper bound on PNS can be similarly obtained by generalizing the upper bound in Theorem 9.2.10 of Pearl (2011).
We focus on PNS here because a larger lower bound on PNS implies a large PNS .
In contrast, a larger upper bound on PNS does not necessarily imply a large PNS .
Reducing the counterfactual quantity PNS to the lower bound in Lemma 4 has climbed down one level of the ladder of causation (Pearl, 2019a); we have converted a counterfactual quantity (level three) to one with interventional distributions (level two).
Next we will descend one level further, discussing how to identify the interventional distributions P ( Y | do( Z = z )) from the observational data distribution P ( X , Y ) (level one);
Z = f ( X ) is the representation of X via some known function f .
These identiﬁcation results would also enable the identiﬁcation of
P ( Y | do( Z (cid:54) =
z ))
= (cid:82) P ( Y | do( Z ))
P ( Z | Z (cid:54) =
z ) d Z .
5.1.2. F ROM INTERVENTIONAL DISTRIBUTIONS TO OBSERVATIONAL DATA DISTRIBUTIONS
To calculate the lower bound of PNS in Equation (7), we need to identify the intervention distribution
P
( Y | do( Z = z )) — equivalently P ( Y | do( f ( X ) =
z )) —from observational datasets ( X , Y ) .
Below we ﬁrst state the formal deﬁnition of functional interventions do( f ( X ) = z ) .
We then discuss the challenges in identifying P ( Y | do( f ( X )
=
z )) for high-dimensional X .
To tackle this challenge, we further provide an identiﬁcation strategy and discuss its theoretical and practical requirements.
The functional intervention do( f ( X )) .
We begin with stating the formal deﬁnition of a functional intervention.
Deﬁnition 5 (Functional interventions (Puli et al., 2020)) .
The intervention distribution under a functional intervention
P ( Y | do( f ( X ) =
z )) is deﬁned as
[Equation]
8) where C denotes all parents of X .
The functional intervention on f ( X ) is a soft intervention on X (Correa & Bareinboim, 2020; Eberhardt & Scheines, 2007) conditional on all its parents C , with a stochastic policy p ( X | C , f ( X )
=
z ) (Pearl, 2011, Ch. 4.2).
In other words, a functional intervention do( f ( X ) =
z ) considers all interventions on X that are consistent with the functional constraint f ( X ) =
z and its parental structure C .
Functional interventions recover the standard backdoor adjustment as special cases if we take the function f to be an identity function f ( X ) =
X or one that returns a subset f ( X ) =
X S , S ⊂ { 1 , . . .
, m } ; see Appendix B for detailed derivations.
Following this deﬁnition, one can write the intervention distribution of interest, P ( Y | do( f ( X )
= z )) , as follows:
[Equation]
This equality is due to the SCM in Figure 1: there is no unobserved confounding between X and Y , which implies
P ( Y | do( X ) , C ) =
P ( Y | X ) .
Equation (9) provides a way to identify P ( Y | do( f ( X )
= z )) , provided that one can calculate P ( Y | X ) and (cid:82)
P ( X | C , f ( X ) =
z ) P ( C ) d C .
At ﬁrst sight, both quantities seem easy to calculate: one can estimate P ( Y | X ) from observational sampling of P ( Y, X ) .
To calculate (cid:82) P ( X | C , f ( X )
= z ) P ( C ) d C , one may leverage probabilistic factor models (e.g., probabilistic principal component analysis ( PPCA ), Gaussian mixture model ( GMM ), or vhvariational autoencoder ( VAE )) because the latent C renders X 1 , . . .
, X m conditionally independent in Figure 1.
One can often read off P ( X | C , f ( X )
=
z ) and P ( C ) from the probabilistic factor model ﬁt, if the factor model is identiﬁable.
However, P ( Y | X ) turns out to be challenging to calculate in practice, especially when X represents high-dimensional objects such as images or text, as we now discuss.
The challenge of identifying P ( Y | X ) with high-dimensional X .
The key challenge in identifying P ( Y | X ) lies in the high-dimensionality of X .
High-dimensional objects such as images or text are often only supported on a low-dimensional manifold, i.e., X j = g 0 ( { X 1 , . . .
, X m }\ X j ) for some j ∈ { 1 , . . .
, m } and some function g .
we refer to this problem as the rank-degeneracy problem (Stewart, 1984; Golub et al., 1976).
It is akin to the classical challenge of having highly correlated variables in a linear regression; it is also an example of the underspeciﬁcation problem in deep learning (D’Amour et al., 2020b).
The rank degeneracy of high-dimensional X =
( X 1 , . . .
, X m ) challenges the identiﬁcation of P ( Y | X ) , even if both
X and Y are observed.
Intuitively, this non-identiﬁability problem occurs because the data can only inform P ( Y | X ) on the low-dimensional manifold in X m where P ( X ) is supported.
The behavior of P ( Y | X ) outside this manifold is unconstrained, hence non-identiﬁable.
In more detail, suppose p ( x , y ) , p ( x ) , p ( y | x ) denote the relevant densities (and assume they exist).
Any h 0 ( · , · ) function that satisﬁes
[Equation]
Under rank degeneracy, it turns out that there exist many different functions h 0 ( x , y ) that satisfy Equation (10).
Hence p ( y | x ) is non-identiﬁable.
The reason is that rank degeneracy implies p ( x ) = 0 for x ∈ (cid:101) X ⊆
X m , where (cid:101)
X is a set with positive measure.
If some function h (cid:48) 0 satisﬁes Equation (10), then the function h (cid:48)(cid:48) 0 would also satisfy Equation (10) if they differ only on the set ( x , y ) ∈ (cid:101)
X × Y .
Note that h (cid:48) 0 and h (cid:48)(cid:48) 0 are not almost surely equal; they differ on a set with positive measure.
Thus, h (cid:48) 0 and h (cid:48)(cid:48) 0 are two different densities both valid for p ( y | x ) , which implies the non-identiﬁability of p ( y | x ) .
As a concrete example, consider a high-dimensional vector of image pixels X that lives on a low-dimensional manifold; i.e., such that X j − g
( { X 1 , . . .
, X m }\ X j ) is identically zero in the observational data (Kingma & Welling, 2014; Goodfellow et al., 2014).
This rank degeneracy implies that for any p ( y | x ) =
h 0 ( x , y ) compatible with the observational data distribution, the conditional p ( y | x ) = h 0 ( x , y )
+ α · ( x j − g 0 ( { x 1 , . . .
, x m }\ x j )) , ∀ α ∈ R , is also compatible with the observational data.
This fundamental non-identiﬁability of P ( Y | X ) with high-dimensional X suggests that we cannot hope to identify functional interventions P ( Y | do( f ( X )
= z )) where the function f non-trivially depends on all X 1 , . . .
, X m , or any of its subset that are also rank degenerate.
of P ( Y | X ) is also why, for high-dimensional X , directly ﬁtting a neural network for P ( Y | X ) can pick up spurious correlations and fail in out-of-distribution prediction.
Similar failure can also occur with linear regression when X is approximately low rank; e.g., when different dimensions of X are highly correlated.
Causal identiﬁcation of P ( Y | do( f ( X )) for a restricted set of f .
Given the fundamental non-identiﬁability of P ( Y | X ) with high-dimensional X =
( X 1 , . . .
, X m ) , we restrict our attention to representations that only nontrivially depends on a “full-rank” subset; i.e., Z = f ( X ) =
˜ f
(( X j ) j ∈ S ) , for some function ˜ f : X | S | → R d , and a set S ⊆ { 1 , . . .
, m } ,
where p (( x j ) j ∈ S ) > 0 for all values ( x j ) j ∈ S ∈ X | S | .
We term this requirement “observability.”
Focusing on such representations f ( X ) =
˜ f
(( X j ) j ∈ S ) , we calculate its intervention distributions by returning to the deﬁnition of functional interventions (Deﬁnition 5),
[Equation]
Equation (11) implies that P ( Y | do( f ( X )
= z )) is identiﬁable as long as one can identify the unobserved common cause
C from data.
This condition is often called the “pinpointability” (or “effective observability”) of C (Wang & Blei, 2020; 2019a).
The following lemma summarizes the identiﬁcation of P ( Y | do( f ( X ) =
z )) under these conditions.
Lemma 6 (Identiﬁcation of P ( Y | do( f ( X ) = z ) ) .
Assume the causal graph in Figure 1.
Suppose the representation only effectively depends on a subset ( X j ) j ∈ S of ( X 1 , . . .
, X m ) ; i.e., f ( X ) =
˜ f
(( X j ) j ∈ S ) for some function ˜ f : X | S | → R d and some set S ⊆ { 1 , . . .
, m } .
Then the intervention distribution P ( Y | do( f ( X )
=
z )) is identiﬁable by
[Equation]
if the following conditions are satisﬁed:
(pinpointability) the unobserved common cause C is pinpointable; i.e., P ( C | X ) =
δ h ( X ) for a deterministic function h known up to bijective transformations, 2.
(positivity) ( X j ) j ∈ S satisﬁes the positivity condition given C ; i.e., P (( X j ) j ∈ S ∈ (cid:101) X | C ) > 0 for any set (cid:101)
X
⊂ X | S | such that P X j j ∈ S ∈ (cid:101) X ) > 0 , 3.
(observability) P (( X j ) j ∈ S ∈ (cid:101) X ) > 0 for all sets (cid:101)
X ⊂ X | S | with a positive measure.
Lemma 6 describes a set of representations Z = f ( X ) for which can we evaluate their intervention distribution, and hence the lower bound of their PNS for Y .
(The proof is in Appendix C.)
Lemma 6 is based on three conditions.
The pinpointability ensures that the terms in Equation (11) involving C (e.g.
P ( C ) , P (( X j ) j ∈ S | C , f ( X ) = z ) ) are estimable from observational data.
We note that pinpointability serves a different purpose here than in Wang & Blei (2019a; 2020) and Puli et al.
We invoke pinpointability for Lemma 6 because functional interventions require the knowledge of C ; there is no unobserved confounding issue.
In contrast, Wang & Blei (2019a; 2020) and Puli et al.
(2020) invoke pinpointability to handle unobserved confounders.
Pinpointability is often approximately satisﬁed when the high-dimensional X is driven by a low-dimensional factor C .
In this case, P ( C | X ) is often close to a point mass (Chen et al., 2020b).
For example, when the m -dimensional data X is generated by a known d -dimensional probabilistic factor model, then the latent factor C is approximately pinpointable when m (cid:29) d .
In these probabilistic factor models, P ( C | X ) becomes increasingly closer to a point mass as m → ∞ but d ﬁxed (Chen et al., 2020b; Bai & Li, 2016).
In practice, one assess pinpointability by ﬁtting probabilistic factor models to X .
We will discuss these practical details in the next section.
The second condition of Lemma 6 is the positivity of ( X j ) j ∈ S given C
= h ( X ) , also known as the overlap condition (Imbens & Rubin, 2015).
This condition ensures that P ( Y | ( X j ) j ∈ S , C ) in Equation (11) is estimable from observational data.
Positivity loosely requires that all values of ( X j ) j ∈ S are possible conditional on C
= h ( X ) .
For example, it is violated when S = { 1 , . . . , n } because it is impossible to observe X = x and C =
c simultaneously when h ( x ) (cid:54) =
c .
In practice, positivity is more likely to be satisﬁed when ( X j ) j ∈ S is a low-dimensional vector; e.g., the image representation only depends on a few image pixels that are far away from each other.
Finally, the observability condition requires that it must be possible to observe all possible values of ( X j ) j ∈ S .
Together with the positivity condition, this implies that P (( X j ) j ∈ S | C ) > 0 for all ( X j ) j ∈ S and, therefore, P ( Y | ( X j ) j ∈ S , C ) in
Equation (12) is estimable from observational data.
This condition is violated if the observed ( X j j ∈ S is rank degenerate;
e.g., ( X j ) j ∈ S =
X represents the whole high-dimensional image vector supported only on a low-dimensional manifold.
This rank degeneracy would render P ( Y | ( X j ) j ∈ S , C ) non-identiﬁable, for the same reason as why P ( Y | X ) is nonidentiﬁable with rank-degenerate X .
In practice, this observability condition is more likely to hold when ( X j ) j ∈ S is low-dimensional.
Lemma 6 describes a class of representations Z = f ( X ) whose intervention distributions are identiﬁable from observational data.
Combining Lemmas 4 and 6 allows us to lower bound the PNS of these representations and evaluate their efﬁciency and non-spuriousness.
Theorem 7 (Evaluating efﬁciency and non-spuriousness with observational data) .
Under the assumptions of Lemma 6, the efﬁciency and non-spuriousness of the representation Z = f ( X ) = ˜ f
(( X j ) j ∈ S ) in the dataset { x i , y i } ni =1 is lower bounded by
[Equation] [Equation]
where C = h ( X ) is the unobserved common cause pinpointed by the observational data X in Lemma 6.
Similarly, the conditional efﬁciency and non-spuriousness of the j th dimension of ( f 1 ( X ) , . .
, f d ( X )) is lower bounded by
PNS
[Equation]
Theorem 7 suggests that we evaluate efﬁciency and non-spuriousness using Equations (13) and (14) in practice.
We operationalize this result in the next section.
5.1.3. M EASURING EFFICIENCY AND NON - SPURIOUSNESS IN PRACTICE
We operationalize Theorem 7 to measure efﬁciency and non-spuriousness for a representation f ( X ) .
The full algorithm is in Algorithm 1.
The algorithm involves three steps: (1) Pinpoint the unobserved common cause C ; (2) Estimate the conditional P ( Y | f ( X ) , C ) ; (3) Calculate the lower bounds in Theorem 7 (Equations (13) and (14)) to measure efﬁciency and non-spuriousness.
We discuss each step below.
Pinpointing the unobserved common cause C .
Theorem 7 requires that the unobserved common cause C must be pinpointable by the observational data: P ( C | X )
=
δ h ( X ) for some deterministic function h .
Moreover, this pinpointing function h needs to be known up to bijective transformations.
How can we assess pinpointability and extract h in practice?
One can assess pinpointability by ﬁtting a probabilistic factor model, viewed as a generative model; e.g., probabilistic principal component analysis ( PPCA ) (Tipping & Bishop, 1999), variational autoencoder ( VAE ) (Kingma & Welling, 2014;
Rezende et al., 2014), mixture models (McLachlan & Basford, 1988), or mixed membership models (Pritchard et al., 2000;
Blei et al., 2003; Airoldi et al., 2008; Erosheva & Fienberg, 2005).
Speciﬁcally, suppose the dataset of n i.i.d.
datapoints ( x i ) ni
=1 is assumed to be generated by a PPCA model, then one can assess pinpointability by ﬁrst ﬁtting a PPCA model,
[Equation]
where c i is the latent variable for each data point x i
=
( x i 1 , . . .
, x im ) , and θ = ( θ 1 , . .
, θ m ) is the set of parameters.
One then infers the parameters θ and the posterior p ( c i | x i ) for each i , using standard posterior inference algorithms like variational inference (Blei et al., 2017) or Markov chain Monte Carlo methods (Gilks et al., 1995).
Pinpointability then approximately holds if p ( c i | x i ) is close to a point mass for all i .
The choice of the latent dimensionality K is a challenging task.
We choose K in practice by searching for a factor model that can both ﬁt data well (e.g., via a posterior predictive check (Gelman et al., 1996)) and approximately satisfy pinpointability.
A larger d tends to have a better ﬁt to the data, while a smaller d is more likely to satisfy pinpointability.
We proceed if pinpointability holds, along with the other conditions—observability and positivity–from Theorem 7.
Given a ﬁtted factor model, one can extract the pinpointing function h by computing the posterior mean, h ( x ) ≈
E [ c i | x i = x ] .
The same procedure applies if the data is generated by other probabilistic factor models.
A reader might ask: Why probabilistic factor models?
The reason is that the causal graph Figure 1 encodes a conditional independence structure that coincides with the deﬁning feature of probabilistic factor models.
In more detail, Figureassumes that each dimension of the data X =
( X 1 , . . .
, X m ) is rendered conditionally independent given an unobserved common cause C .
This conditional independence is precisely the deﬁning structure of probabilistic factor models,
[Equation]
with i.i.d.
data x i =
( x i 1 , . . .
, x im ) and latent c i .
We therefore use probabilistic factor models to assess the pinpointability of C in Figure 1.
Calculate the conditional P ( Y | f ( X ) , C ) .
After pinpointing C , we still need the conditional P ( Y | f
( X ) , C ) to calculate the lower bound in Theorem 7.
To estimate P ( Y | f
( X ) , C ) , we can ﬁt a model to the observational data ( x i , y i ) ni
=1 , with f ( · ) being the representation function of interest and c i
= h
( x i ) estimated from the ﬁrst step.
As an example, we may posit a linear model,
[Equation]
and estimate the parameters β = ( β 1 , . .
. , β d ) and γ via maximum likelihood.
One may also posit other more ﬂexible models like a partially linear model and target a categorical outcome:
[Equation]
Calculate the lower bounds in Theorem 7.
We ﬁnally calculate the lower bounds in Equations (13) and (14) using the pinpointed C and the estimated conditional P ( Y | f ( X ) , C ) from the previous two steps.
As an example, we calculate the lower bound of the conditional efﬁciency and non-spuriousness PNS n ( f j ( X ) , Y | f − j ( X )) with the linear model (see Appendix E for the detailed derivation):
[Equation]
Similarly, we can obtain the lower bound of the (unconditional) efﬁciency and non-spuriousness,
PNS
[Equation]
[Equation]
Equations (21) and (22) illustrate how conditional efﬁciency and non-spuriousness differ from the unconditional version.
The conditional notion considers each β j · f j ( X ) at a time.
The unconditional notion lumps together all d dimensions of the representation and considers (cid:80)
dj
=1 β j · f j ( X ) as a whole.
In this sense, the conditional PNS is ﬁner-grained notion than the (unconditional) PNS .
A Linear example.
We illustrate Algorithm 1 on a toy rank-degenerate image dataset.
(We analyze more complex and higher-dimensional data in Section 5.3.)
Imagine we collect a dataset of n = 1000 images.
Each image is characterized by its values on m = 5 chosen representative pixels, X =
( X 1 , . . .
, X 5 ) , accompanied by a label about the image brightness
Y .
Both the pixel values X and the labels Y are real-valued.
We simulate such a dataset of image pixels and labels.
As the pixel values are often highly correlated, we generate x i =
( x i 1 , . . .
, x i 5 ) from a multivariate Gaussian distribution with strong (positive or negative) correlations—all pairwise correlations are > 0.8.
As the brightness label only depends on a small number of pixels, we simulate y i from a linear model that only uses two of the ﬁve pixels
[Equation]
where β ∗ 1 = 0 .
5 , β ∗ 2 = 1 . 0 .
The goal is to evaluate the efﬁciency and non-spuriousness of a representation f ( X ) =
( X 2 , 0 .
5 · X 1 + X 4 ) .
We apply
We ﬁrst pinpoint C .
Suppose it is known that the data X is generated by a PPCA .
We ﬁt a one-dimensional PPCA (Equation (15)) to { x i } ni =1 ; the latent variable c
i is thus a scalar.
The ﬁt leads to the posterior of the unobserved common cause, p ( c i | x i ) .
We assess the pinpointability of C by calculating Var( c i | x i ) for all i .
We ﬁnd the variance is smaller than 0.01 for all i , implying that p ( c i | x i ) is fairly close to a point mass and pinpointability is approximately satisﬁed.
(The threshold of 0.01 is a subjective choice.)
We then calculate ˆ c i
=
E [ c i | x i ] for all i .
We next estimate P ( Y | f
( X ) , C ) by ﬁtting a linear model to the dataset { ( y i , f ( x i ) , ˆ c i ) } ni
=1 with f ( x i ) =
( x i 2 , 0 .
5 · x i 1 + x i 4 ) ,
[Equation]
Fitting this linear model returns the regression coefﬁcients { ˆ β 0 , ˆ β 1 , ˆ β 2 , ˆ γ } .
Finally, plugging in these regression coefﬁcients to Equations (21) and (22) gives the efﬁciency and non-spuriousness, with f 1 ( x i )
=
x i 2 and f 2 ( x i ) = 0 .
5 · x i 1 + x i 4 .
5.2. CAUSAL-REP: Learning Efﬁcient and Non-spurious Representations
We have developed a strategy to evaluate the efﬁciency and non-spuriousness of a given representation in Section 5.1.
Here we utilize this strategy to improve representation learning in both supervised and unsupervised settings.
5.2.1. R EPRESENTATION LEARNING AS FINDING NECESSARY AND SUFFICIENT CAUSES
As representation learning requires efﬁcient and non-spurious representations, we formulate representation learning as a task of ﬁnding necessary and sufﬁcient causes of the label.
Representation learning as ﬁnding necessary and sufﬁcient causes.
To operationalize this formulation, we search for a representation that maximizes the conditional efﬁciency and non-spuriousness for a given dataset, following Deﬁnitionand Equation (6).
Thus we view an ideal representation as one in which each dimension of the representation captures features that are essential and non-spurious given all other dimensions.
We perform representation learning by maximizing the sum of log PNS across all dimensions of the representation,
[Equation]
where PNS n ( · , Y | · ) measures the conditional efﬁciency and non-spuriousness of f j ( X ) as in Equation (6).
Classes of representation functions.
To perform this maximization over representations in practice, we consider parameterized classes of representation functions f ( · ) .
One option is to consider a class of neural network functions with a ﬁxed architecture, subject to the constraint that each output dimension has zero mean and unit standard deviation: { f : multilayer perceptrons R m → R d with two hidden layers of size
[Equation] sample [Equation] [Equation]
Another option is to consider representations that are convex combinations of the m -dimensional data,
[Equation]
[Equation]
Each dimension of such representations is a convex combination of X 1 , . . .
, X m , that is, f j ( X ) =
(cid:80) ml =
[Equation] lj X [Equation] [Equation]
d .
A third option is to consider representations that select relevant subsets of the m -dimensional data,
[Equation]
Each dimension of such representations selects one (or none) of X 1 , . . .
, X m .
The d -dimensional representation f
( X ) thus selects at most d features from X 1 , . . .
, X m .
CAUSAL-REP: Maximizing PNS in practice.
Solving Equation (25) involves calculating counterfactual quantities such as conditional PNS .
As is discussed in Section 5.1, these quantities are not directly calculable without access to the causal structural equations.
To employ Equation (25) in practice, we employ the lower bound of PNS derived in Equation (7).
Speciﬁcally, we restrict our attention to representations whose lower bound of PNS is identiﬁable via Theorem 7, and ﬁnd the representation that maximizes this lower bound:
[Equation]
where PNS n ( f j ( X ) , Y | f − j ( X )) is the PNS lower bound (Equation (14)) in Theorem 7.
The parameter λ ≥ 0 indicates regularization strength.
The term R ( f ; { x i , y i , c i } ni =1 ) is a regularization penalty,
[Equation]
where Rsq( { f j ( x i ) ; c i } ni =1 ) is the R-squared of regressing the j th-dimension of the representation f j ( x i ) against the unobserved common cause
c i .
The quantity || W ( f ) || 2 represents the L 2 -norm of the f function’s parameters, e.g., all the weight parameters of a neural network f ; α is the relative weight of the two regularization penalties.
The ﬁrst part of the objective (Equation (29)) is the lower bound of conditional PNS developed in Theorem 7.
Following the practical discussions in Section 5.1, its calculation requires pinpointing the unobserved common cause
The second part of the objective is the regularization penalty.
It encourages representations whose lower bound of PNS is identiﬁable from observational data.
Speciﬁcally, these regularization penalties aim to enforce the positivity and observability conditions in Lemma 6.
(The pinpointability condition is enforced in a separate step.)
In more detail, the ﬁrst penalty 1 d (cid:80) dj
=1 log(1 − Rsq( { f j ( x i ) ; c i } ni =1 )) in Equation (30) encourages the positivity of f ( X ) given C in Lemma 6.
The sample R-squared Rsq( { f j ( x i ) ; c i } ni =1 ) evaluates the variation of f j ( X ) explainable by C .
When the R-squared is equal to one, then the positivity condition is violated.
Accordingly, a close-to-one value of R-squared implies that f j ( X ) nearly violates the positivity condition.
The penalty 1 d (cid:80) dj
=1 log(1 − Rsq( { f j ( x i ) ; c i } ni =1 )) takes a large negative value if any dimension of the representation f ( X ) nearly violates the positivity condition.
The second penalty − α · || W ( f ) ||
22 encourages representations that satisfy the observability condition.
Speciﬁcally, it penalizes the coefﬁcients in front of ( X 1 , . . .
, X m ) in the representation function f .
Imposing a large regularization parameter α > 0 leads to representations f ( X ) that only effectively depend on a small subset of ( X 1 , . . .
, X m ) ; i.e., f ( X ) =
˜ f
(( X j ) j ∈ S ) for some function ˜ f , with S ⊆ { 1 , . . .
, m } being a set with only a few elements.
Such representations are more likely to satisfy the observability condition—namely, P (( X j ) j ∈ S ) > 0 for all values of ( X j ) j ∈ S —because lower-dimensional ( X j ) j ∈ S are more likely to have full rank (Udell & Townsend, 2019).
Out-of-distribution prediction with CAUSAL-REP.
Given a representation returned by CAUSAL-REP, how do we make predictions, especially on out-of-distribution data?
To make predictions, we train a prediction function that maps the CAUSAL-REP representation to the labels.
We note that the predictions are only made using the CAUSAL-REP representation; it does not involve the unobserved common cause
C .
This prediction function is different from the prediction model ﬁtted for P ( Y | f
( X ) , C ) (cf.
Equations (19) and (20)).
The rationale is that CAUSAL-REP encourages non-spurious representations; it implies that the relationship between the representation and the label should generalize to out-of-distribution data.
However, CAUSAL-REP places no constraints on the relationship between C and Y .
Speciﬁcally, suppose CAUSAL-REP returns ˆ f ( · ) as the representation function; i.e., it maximizes Equation (29).
Then we posit a model for P ( Y | ˆ f ( X )) ; e.g., a linear model:
[Equation]
31) or a ﬂexible exponential family model:
[Equation]
where EF indicates an exponential family distribution and g pred indicates a link function.
We ﬁt this model to the training data { ( ˆ f ( x i ) , y i ) ni
=1 } using maximum likelihood estimation, and then use this ﬁtted model to predict on out-of-distribution data; e.g., we calculate E (cid:104)
( Y | ˆ f ( X test ))
(cid:105) .
CAUSAL-REP with perfectly correlated spurious and non-spurious features.
We have described CAUSAL-REP, a representation learning algorithm that targets non-spurious and efﬁcient representations.
A reader might ask: What if spurious and non-spurious features are perfectly correlated in the training dataset?
That is, what if the spurious feature is on if and only if the non-spurious feature is also on?
Intuitively, we can not hope to tease apart spurious and non-spurious representations in this case.
How would CAUSAL-REP fare?
In such a perfect correlation case, the CAUSAL-REP algorithm would capture neither the spurious feature nor the non-spurious one.
The reason is that both features are excluded from the feasible set of representations considered by
CAUSAL-REP.
Their PNS lower bounds are both not identiﬁable, but CAUSAL-REP only considers representations whose
PNS lower bound is identiﬁable.
In more detail, suppose f s (( X j ) j ∈ T s ) captures the spurious feature and f n (( X j ) j ∈ T n ) captures the non-spurious features, where T s , T n ⊂ { 1 , . . .
, m } .
They depend on disjoint subsets of X , T s ∩ T n = ∅ , but they are perfectly correlated f s (( X j ) j ∈ T s ) =
f n (( X j ) j ∈ T n ) .
Then both features must be measurable with respect to the unobserved common cause
C : f s (( X j ) j ∈ T s ) =
f n (( X j ) j ∈ T n ) =
q ( C ) for some function q .
This measurability makes their PNS lower bounds non-identiﬁable; it violates the positivity assumption required by Theorem 7.
5.2.2. CAUSAL-REP AND THE LINEAR EXAMPLE CONTINUED
We described each step of CAUSAL-REP in the previous section.
Algorithm 2 summarizes these steps.
The key step is to maximize the CAUSAL-REP objective (Equation (29)).
This step involves a nested loop of optimization: an outer loop with respect to the representation parameters W ( f ) , and an inner loop to estimate P ( Y | f
( X ) , C ) .
This nesting is required because calculating the CAUSAL-REP objective involves estimating P ( Y | f ( X ) , C ) by maximum likelihood.
To maximize the CAUSAL-REP objective, one can use standard gradient-based algorithms to handle this nested loop.
When the inner loop—the maximum likelihood estimation of P ( Y | f ( X ) , C ) —has a closed-form solution (e.g., under the linear model in Equation (19)), we can plug in the solution to the CAUSAL-REP objective and directly apply a gradient-based method for optimization.
When the inner loop does not admit a closed form, we can alternate between the gradient updates of the two optimizations, e.g., alternating between (1) one gradient update step to maximize the CAUSAL-REP objective, and (2) multiple gradient update steps until convergence to estimate P ( Y | f ( X ) , C ) with maximum likelihood.
The linear example continued.
We illustrate CAUSAL-REP (Algorithm 2) with the linear example in Section 5.1.3: pinpoint the unobserved common cause C from the training data { x train i , y train i } n train i =1 , obtain the CAUSAL-REP objective ˆ f , and predict on some out-of-distribution test data { x test i } n test i =1 .
We focus on learning two-dimensional representations, f ( X ) =
( f 1 ( X ) , f 2 ( X )) .
We ﬁrst perform the same pinpointability step to obtain ˆ c i as in Section 5.1.3.
We next maximize the CAUSAL-REP objective (Equation (29)).
We calculate the CAUSAL-REP objective by plugging in the calculation of PNS n ( f j ( X ) , Y | f − j ( X )) in Equation (21), where we adopt a linear model for P ( Y | f
( X ) , C ) .
In more detail, to optimize the CAUSAL-REP objective, we need to write (the parameters of) the ﬁtted model of P ( Y | f
( X ) , C ) as a function of the representation function f .
We use the closed-form estimates of these linear model parameters when ﬁtted to the training data { x train i , y train i } n train i =1 : (ˆ β 0 , ˆ β 1 , ˆ β
[Equation]
where ˜ X is an n train × 4 matrix with ˜ X i 1 = 1 , ˜ X i 2 = f 1 ( x train i ) ,
˜ X
i 2 = f 2 ( x {+train i ) , ˜ X i 
+}
[-i 
-]
=
ˆ c
i , and ˜ Y is an n ×vector with ˜ Y
i 1 =
y train i , i = 1 , . . . , n .
(When closed-form solutions are not available, we need to perform gradient-based optimization to obtain the ﬁtted model parameters.)
Plugging in these terms, we maximize the CAUSAL-REP objective via gradient descent with respect to the parameters of the representation function W ( f ) .
The optimal ˆ W ( f ) give the CAUSAL-REP representation function ˆ f .
Finally, we perform out-of-distribution prediction with the CAUSAL-REP representation ˆ f .
We train a prediction function by ﬁtting a linear model to P ( Y | ˆ f ( X )) ,
[Equation]
We obtain the estimated regression coefﬁcients { ˆ β pred0 , ˆ β pred1 , ˆ β pred2 , σ pred } by maximum likelihood.
They allow us to make predictions on the test data { x test i } n test
[Equation]
[Equation]
5.2.3. E XTENDING CAUSAL-REP TO UNSUPERVISED SETTINGS
We extend CAUSAL-REP to unsupervised settings where labels are not available.
We focus on the task of instance discrimination in unsupervised representation learning (Hadsell et al., 2006), where the goal is to ﬁnd representations that can distinguish the different subjects.
The unsupervised CAUSAL-REP.
We focus on the unsupervised setting where some form of data augmentation is available.
That is, the dataset contains one raw observation for each subject; this raw observation is then augmented multiple times, which leads to multiple observations per subject.
Given this unsupervised dataset, which attach the subject ID to each observation as a supervised label.
We can thereby formulate the instance discrimination problem as a supervised task, one that ﬁnds representations that are informative of the subject IDs and extend CAUSAL-REP to an unsupervised setting.
The resulting algorithm turns out to be closely related to contrastive learning (Chen et al., 2020a).
In more detail, we begin with a dataset with n i.i.d.
samples, ( x 1 , . . .
, x n ) .
Assume that each data point is associated with a different subject i .
Next, we augment each data point with U − 1 augmentations, producing an augmented dataset, {{ x ui } Uu =1 } ni =1 , U ≥ 2 .
We then create an n -dimensional label, y ui =
( y ui 1 , . . .
, y uin ) ,
for each data point in the augmented dataset, where
[Equation]
[Equation]
ui belongs to subject s }
[Equation]
[Equation]
[Equation]
[Equation]
This labeling turns the unsupervised problem into a supervised one with respect to the augmented labeled dataset {{ x ui , y ui } Uu =1 } ni =1 .
We then employ the CAUSAL-REP objective to ﬁnd representations that are necessary and sufﬁcient causes of the n outcomes ( Y 1 , . . .
, Y n ) :
[Equation]
where PNS n · U ( f j ( X ) , Y s | f − j ( X )) is the conditional efﬁciency and spuriousness (Equation (6)) for the s th outcome; it is calculated on the augmented dataset {{ x ui , y ui } Uu =1 } ni =1 .
The penalty term R ( · ) is the same penalty as in the CAUSAL-REP objective (Equations (29) and (30)).
Solving Equation (36) produces non-spurious and efﬁcient representations of X for instance discrimination.
(We summarize the algorithm in Algorithm 3.)
The optimization objective in Equation (36) considers the n outcomes { Y s } one at a time and averages over the n outcomes.
It focuses on the contrast of one-vs-all, ﬁnding representations that distinguish each subject from the rest.
This objective does not consider the n outcomes as a single n -dimensional outcome ( Y 1 , . .
, Y n ) and calculate its PNS .
Contrastive learning targets the same instance discrimination task as the unsupervised CAUSAL-REP does.
Contrastive learning aims for representations that can determine whether two data points come from the same subject.
It thus is able to predict whether each data point belongs to subject s , for s = 1 , . . . , n .
From this perspective, both contrastive learning and the unsupervised CAUSAL-REP target the same outcome.
That said, the two algorithms only coincide when different dimensions of X are independent—they do not share an unobserved common cause as in Figure 1.
The two algorithms behave very differently when such a common cause exists, especially when the common cause induces some spurious feature (e.g., image color).
Concretely, there may be a subset of ( X 1 , . . .
, X m ) that is highly correlated with the label Y but cannot causally determine Y .
In such cases, contrastive learning may pick up these spurious features if no augmentations are performed for these features (e.g., there is no augmentation that randomly changes the color of images).
In contrast, the unsupervised CAUSAL-REP would not capture these spurious features.
This difference illustrates how CAUSAL-REP learns non-spurious representations in a different way than data-augmentationbased methods (including contrastive learning).
CAUSAL-REP capitalizes on a causal perspective and its treatment of high-dimensional X .
Data-augmentation-based methods instead wipe out the correlation between spurious features and the label by performing data augmentation.
We will illustrate this difference further in Section 5.3.
P N S ( Z 1 , Y 1 | Z 2 ) P N S ( Z 2 , Y 1 | Z 1 ) P N S ( Z 1 , Y 2 | Z 2 ) P N S ( Z 2 , Y 2 | Z 1 ) 0.0 0.
(a) Conditional PNS 1.
1.0 Corr( Z 1 , Z 2 ) 0.
P N ( Z 1 , Y 2 ) 1. 1.0 Corr( Z 1 , Z 2 ) 0. PS ( Z 1 , Y 2 ) 1.
1.0 Corr( Z 1 , Z 2 ) 0.
P N S ( Z 1 , Y 2 )
[Figure]
5.3. Empirical Studies of CAUSAL-REP
We study CAUSAL-REP in both image and text datasets.
We ﬁnd that probabilities of causation ( POC ) are effective in distinguishing efﬁcient/inefﬁcient and non-spurious/spurious representations.
Moreover, CAUSAL-REP ﬁnds non-spurious features in both supervised and unsupervised settings; it also outperforms existing unsupervised representation learning algorithms in downstream out-of-distribution prediction. H
OW WELL DO PROBABILITIES OF CAUSATION MEASURE EFFICIENCY AND NON - SPURIOUSNESS OF FEATURES ?
We ﬁrst study the correspondence between probabilities of causation ( PS , PN , PNS ) and the efﬁciency/non-spuriousness of representations.
We generate features with known efﬁciency and non-spuriousness properties; we ﬁnd that the (lower bound of) probabilities of causation in Lemma 4 are consistent with these properties.
The simulated data.
We simulate two binary features Z 1 , Z 2 and two binary outcomes Y 1 , Y 2 :
[Equation]
where ⊕ indicates the XOR operator.
We vary the parameter p ; a small p implies a high correlation between Z 1 and Z 2 .
The generative process of Y 1 , Y 2 implies that (1) Z 1 is necessary (a.k.a. efﬁcient) and sufﬁcient (a.k.a.
non-spurious) for Y 1 , but is necessary and insufﬁcient for Y 2 ; (2) Z 2 is neither necessary nor sufﬁcient for Y 1 , but is necessary and insufﬁcient for Y 2 ; (3) Z 1 & Z 2 is necessary and sufﬁcient for Y 2 .
Moreover, when the correlation between Z 1 and Z 2 increases, then using both features as a representation become increasingly inefﬁcient; the conditional necessity decreases.
We calculate the lower bound of PS , PN , PNS of Z 1 , Z 2 for both outcomes Y 1 , Y 2 ; the exact value is not identiﬁable from data.
Results.
Figures 2, 6 and 7 present the probabilities of causation of the features.
Figure 2a shows that the (lower bound of) conditional PNS can correctly signal the non-spuriousness of features: Z 2 is spurious for Y 1 , but Z 1 is non-spurious for Y 1 , and both Z 1 , Z 2 are non-spurious for Y 2 .
Moreover, we study how probabilities of causation ( POC ) fare when the correlation between Z 1 and Z 2 increases.
Figure 2 shows that the (lower bounds of) POC of Z 1 for Y 2 increase as the correlation increases, which is consistent with the intuition that Z 2 becomes less necessary for Y 2 given Z 1 given increasingly higher correlations.
Similarly, Figures 6 and 7 show that (the lower bounds of) the unconditional POC of Z 2 for Y 1 also increase.
It is also consistent with the intuition: Z 2 is an increasingly better surrogate of Z 1 for Y 1 under higher correlations between Zand Z 2 .
5.3.2. D OES THE SUPERVISED CAUSAL-REP PICK UP SPURIOUS FEATURES IN SYNTHETIC DATA ?
We next study the performance of the supervised CAUSAL-REP in a toy synthetic dataset.
We use PPCA as the pinpointing factor model and linear functions as the class of representation functions.
The simulated data.
We generate a dataset of core and spurious features ( X 1 , . . .
, X 5 ) , who are highly correlated in the
[Figure]
OO
[Figure]
P r ed i
c t i v e
R - s qua r ed
[Figure]
training set but not so in the test set,
[Equation]
[-. . , ¯ X test5 ∼ N (0 , 0 . 
-]
[-· I 5 + 0 . 
 · J 5 ) ,-] where I 5 is a 5 × 5 identity matrix and J 5 is a 5 × 5 all-ones matrix.
For both training and test sets, we inject noise to features to lower the signal-to-noise ratio of the problem: X j ∼ N ( ¯ X j , 0 .
4 2 ) , j = 1 , 2; X j ∼ N ( ¯ X j , 0 .
3 2 ) , j = 3 , 4 , 5 .
Finally, we generate an outcome Y that only depends on the core features Y ∼ N ( β 1 X 1 + β 2 X 2 , 1) , where the coefﬁcients are drawn from a uniform β j ∼ Unif[0 , 10] , j = 1 , 2 .
Results.
We compare the performance of CAUSAL-REP, linear regression, and an oracle algorithm; the oracle is equipped with the knowledge of which features are spurious and only performs linear regression against the non-spurious features.
We study whether these algorithms pick up spurious features by evaluating their the out-of-distribution ( OOD ) predictive performances.
If an algorithm picks up spurious features, then its OOD predictions will suffer, because spurious features are much less predictive in test data than in training data.
Figure 3a presents the result: CAUSAL-REP outperforms linear regression in OOD predictive R-squared; its predictive performance is not far from the oracle algorithm.
5.3.3. D OES THE SUPERVISED CAUSAL-REP PRODUCE NON - SPURIOUS REPRESENTATIONS FOR IMAGE DATA ? A STUDY ON C OLORED MNIST AND C ELEB A
We next study the supervised CAUSAL-REP in image datasets: Colored MNIST (Arjovsky et al., 2019) and CelebA (Liu et al., 2015).
We consider the version of supervised CAUSAL-REP algorithm which adopts a VAE with 64 latent dimensions as the probabilistic factor model for pinpointing.
For representation functions, we consider a two-layer neural network with 20-dimensional outputs.
We again evaluate the non-spuriousness of the representations by the OOD predictive accuracy; if the learned representation captures spurious features, then it will suffer in OOD prediction.
Competing methods.
We compare CAUSAL-REP with a baseline representation learning algorithm that ﬁts a neural network to the labels and extracts its penultimate layer as the representation (Bengio et al., 2013).
As we use VAE for pinpointing in CAUSAL-REP in this study, we also compare with directly adopting the VAE representation for OOD prediction.
The Colored MNIST study.
We focus on the colored MNIST data with the digits ‘3’ and ‘8’ and colors ‘red’ and ‘green’; see Appendix G.2 for the detailed experimental setup.
Figure 4a presents the OOD predictive accuracy of CAUSAL-REP across different levels of spurious correlations.
CAUSAL-
[Figure]
[Figure] OO D P r ed i c t i v e
A cc u r a cy
[Figure]
REP outperforms other baseline methods in OOD predictive accuracy when the spurious correlation is larger than 0.5.
Its performance remains close to the theoretical maximum (the yellow dashed line) across different levels of the spurious correlation, suggesting that CAUSAL-REP does not pick up spurious features.
In contrast, the OOD performance of representation learning by directly ﬁtting neural networks quickly degrades as the spurious correlation increases; so does
OOD prediction with the VAE representations.
Figure 4b evaluates the robustness of CAUSAL-REP against the latent dimensionality choice of the pinpointing factor model, ﬁxing the spurious correlation at 0.9.
We ﬁnd that the performance of CAUSAL-REP does not change much as we vary the latent dimensionality of pinpointing VAE .
The relative performance of CAUSAL-REP and the competing methods also stay stable.
The CelebA study.
We next study CAUSAL-REP on the CelebA dataset (Liu et al., 2015).
We create training and test sets, each containing 5,000 data points, by subsampling the CelebA datasets.
We focus on face attributes with a relatively balanced distribution in the raw CelebA dataset.
We designate pairs of target attributes and spurious attributes, and subsample such that the two are highly correlated in the training set and not as correlated in the test set.
We then perform representation learning and OOD prediction for the target labels, using CAUSAL-REP and other competing methods.
Table 1 presents the results for different pairs of target and spurious face attributes.
Though the spurious label and the target label are highly correlated, CAUSAL-REP can pick up non-spurious features that inform the target label and outperform the baseline algorithm that directly ﬁts a neural network.
In most settings, CAUSAL-REP also outperforms OOD prediction with
VAE representations.
The exception is that VAE representations can outperform CAUSAL-REP representations when the spurious correlations climb up to 0.9, though the performance of CAUSAL-REP is still competitive.
The spurious features in these settings violate the positivity condition:
Mustache and goatee exclusively appear on males in the subsampled dataset.
5.3.4. D OES THE SUPERVISED CAUSAL-REP PRODUCE NON - SPURIOUS REPRESENTATIONS FOR TEXT DATA ? A STUDY ON REVIEWS CORPORA AND SENTIMENT ANALYSIS
We next study CAUSAL-REP on text datasets: the Amazon (Wang et al., 2011; 2010), Tripadvisor, 6 and Yelp 7 reviews corpora, and the IMDB-L, IMDB-S, and Kindle dataset as is processed in Wang & Culotta (2020; 2021).
In these studies, we convert these corpora into bags of words.
We use PPCA as a pinpointing factor model for CAUSAL-REP and consider representations whose each dimension is a convex combination of words.
The reviews corpora study. We begin with the raw reviews datasets from Amazon, Tripadvisor, and Yelp. We create a
[Table]
[Table]
P r ed i
c t i v e A cc u r a cy
In-Dist. Test Out-of-Dist. Test (b) Tripadvisor reviews CAUSAL-REP
Logistic regression 0.
P r ed i
c t i v e A cc u r a cy
In-Dist.
Test Out-of-Dist.
Test (c) Yelp reviews binary label for each review by converting 4 and 5 stars to a positive label and 1 and 2 stars to a negative label.
We then inject irrelevant words to the training dataset as spurious features by randomly adding in “as”, “also”, “am”, “an” to reviews with positive labels; the resulting spurious correlation is around 0.9.
We create two test datasets: one is in-distribution with the spurious words present as in the training set; the other is out-of-distribution without the randomly added spurious words.
Figure 5 presents the predictive accuracy of CAUSAL-REP in both test sets.
We ﬁnd that the predictive performance of CAUSAL-REP is stable across in-distribution and out-of-distribution test sets, suggesting that it learns non-spurious representations.
In contrast, logistic regression predicts well in the in-distribution test set but not in the out-of-distribution test set, suggesting that it picks up spurious features that only exist in the training set.
Table 3 presents the most informative words of the (positive or negative) ratings, suggested by the CAUSAL-REP representation and the logistic regression coefﬁcients.
Across three reviews corpora, logistic regression returns the spurious words “as”, “also”, “am”, “an” as the top words.
In contrast, CAUSAL-REP extracts words that are more relevant for the ratings.
The sentiment analysis study.
We next employ CAUSAL-REP for sentiment classiﬁcation on the IMDB-L, IMDB-S, and
Kindle datasets (Wang & Culotta, 2020; 2021).
We evaluate CAUSAL-REP on their raw observational and counterfactual test sets, without employing additional data augmentations as in Wang & Culotta (2020; 2021).
The observational test sets are in-distribution test sets, and the counterfactual test sets are out-of-distribution test sets.
Table 2 presents the predictive performance of CAUSAL-REP compared with logistic regression.
While logistic regression outperforms in in-distribution predictive accuracy, CAUSAL-REP outperforms in out-of-distribution prediction.
Moreover, the predictive performance of CAUSAL-REP is similar across in-distribution and out-of-distribution test sets, suggesting that CAUSAL-REP produces non-spurious representations.
[Table]
Finally, we study CAUSAL-REP in the unsupervised setting.
We focus on image datasets in the unsupervised setting because non-spurious features that distinguish different images are more readily deﬁned in the image domain than in the text domain.
We evaluate the non-spuriousness of the unsupervised CAUSAL-REP again by OOD prediction.
Given the unsupervised CAUSAL-REP representation, we ﬁt a prediction model to the target label and test its predictive performance on OOD test sets.
Competing methods.
We compare CAUSAL-REP with baseline representation learning algorithms that ﬁt a neural network to the subject ID label in Section 5.3.5.
We also compare with contrastive learning (Chen et al., 2020a) and the VAE representation.
The colored and shifted MNIST study.
We construct the colored and shifted MNIST dataset by coloring and shifting digits in a way that is highly correlated with the digit labels; see Appendix G.4 for details.
(Representation learning with the unsupervised CAUSAL-REP does not make use of the digit labels; these labels are only used in producing a prediction function from the representations to the labels.)
Figure 3b presents the OOD predictive accuracy of the unsupervised CAUSAL-REP on colored and shifted MNIST.
CAUSAL-REP outperforms baseline representation learning algorithms when the spurious correlation is high, and their predictive accuracy stays close to the theoretical maximum (the yellow dashed line).
Comparing CAUSAL-REP with contrastive learning with shift augmentation, we ﬁnd that the OOD predictive accuracy of contrastive learning degrades when the spurious correlations increase over 0.7.
It is because the shift augmentation can not rule out the spurious color feature; it can only avoid picking up the spurious shift feature.
This observation echoes the discussion in Section 5.3.5, illustrating how the unsupervised CAUSAL-REP relies on a different mechanism to produce non-spurious representations than contrastive learning and data augmentation.
Supplementary Materials A. Proof of Lemma
Proof.
The proof generalizes the proof of Theorem 9.2.10 in Pearl (2011).
We ﬁrst notice the following:
[Equation]
Next denote (cid:15) (cid:44) P ( Y ( Z = z
[Equation]
= y, Y ( Z (cid:54) =
z ) = y ) ≥ 0 .
Then we have
[Equation]
Substituting Equation (39) into Equation (37) implies that
[Equation]
which implies
[Equation]
( Y
[Equation]
do
[Equation]
The inequality becomes equality when (cid:15) =
under the monotonicity condition in Lemma 4.
B. The deﬁnition of functional interventions recovers backdoor adjustment
The deﬁnition of functional interventions (Deﬁnition 5) recovers the standard backdoor adjustment as special cases when the function f
( X ) returns X or its subset (assuming the causal graph Figure 1).
For example, when f ( X ) =
X , then
[Equation]
where the third inequality is due to no unobserved confounding between X and Y in Figure 1.
As another special case, suppose the function f ( X ) returns the subset of X
=
( X 1 , . . .
, X m ) except X 1 , i.e., f ( X ) =
( X 2 , . . .
, X m ) .
Then Equation (8) recovers backdoor adjustment:
[Equation] [Equation]
where the third inequality is due to no unobserved confounding between X and Y in Figure [Equation] and the ﬁfth inequality is due to the conditional independence of X 1 , . . .
, X m given C in Figure
[Equation]
C. Proof of Lemma
Proof.
We calculate the intervention distribution for functional interventions f ( X ) =
[Equation]
The ﬁrst equation is due to the deﬁnition of functional interventions on f ( X ) (Puli et al., 2020).
It is a soft intervention on
X with a stochastic policy conditional on the parents of X .
The stochastic policy is P ( X | f
( X ) , PA ( X )) where PA ( X ) denotes the parents of X .
The second equation is due to P ( Y | ( X j ) j ∈ S , C , f ( X ))
=
P ( Y | ( X j ) j ∈ S , C ) .
The third equation is due to the observability and positivity condition.
Observability and positivity guarantee that
P (( X j ) j ∈ S , C ) > 0 for all ( X j ) j ∈ S , C .
Thus we can calculate P ( Y | ( X j ) j ∈ S , C , f ( X ))
=
P ( Y | ( X j ) j ∈ S , C ) .
Moreover, the two conditions imply that P ( f ( X ) , C ) > 0 for all f ( X ) , C , and hence we can calculate P (( X j ) j ∈ S | C , f ( X )) .
The fourth equation is due to the pinpointability condition.
D. Pinpointing the unobserved common cause C
The CAUSAL-REP algorithm begins with a step of pinpointing the unobserved common cause C .
In this step, we infer
C from the observational data X , when C is low-dimensional and X is high-dimensional.
Operationally, as C renders
X =
( X 1 , . . .
, X m ) conditionally independent, we infer C by ﬁtting a probabilistic factor model to X ,
[Equation]
[Equation]
Speciﬁcally, we consider VAE , a ﬂexible probabilistic factor model (Kingma & Welling, 2014),
[Equation]
[Equation]
(50) where EF is an exponential family distribution, θ =
( f θ , λ θ ) are the parameters, and f θ : C → X is a ﬂexible neural network.
Next we infer p ( c i | x i ) using variational approximation p ( c i | x i )
≈ q φ ∗ ( c i | x i ) where q φ ∗ ( c | x ) maximizes the evidence lower bound ( ELBO ) objective of VAE (Blei et al., 2017),
[Equation]
, and q φ ( · | x ) parametrizes a ﬂexible family of distributions with parameters φ .
For example, we can have q φ ( · | x ) =
N ( Z 1 ,φ ( x ) , Z 2 ,φ ( x ) · I ) or even more ﬂexible non-Gaussian distributions via normalizing ﬂows.
Finally, we set
[Equation]
Though we use variational approximation for p ( c i | x i ) , Equation (51) can often give a good approximation of C i when dim( X ) (cid:29) dim( C ) , or more precisely when the pinpointability condition holds (Chen et al., 2020b; Wang & Blei, 2019b).
E. Calculating PNS lower bounds with linear models
We calculate the lower bound of the conditional efﬁciency and non-spuriousness
PNS n ( f j ( X ) , Y | f − j
( X )) with the linear model (Equation (19)):
[Equation]
[Equation]
[Equation]
57) where N ( · ) denotes the Gaussian density, (cid:15)
i =
y i − ( β
+ β (cid:62) f
( x i )+ γ (cid:62) c i ) is the residual of the regression in Equation (19).
Equations (53) and (56) make use of Taylor approximation exp( x ) ≈ 1+ x . Equation (57) makes use of (cid:80) ni
=1 (cid:15) i · ( f j ( x i ) −
E [ f j ( x i )])
≈ E [ [Equation] · ( f j ( X ) − E
[ f j ( X )])]
= 0 in the regression model.
Finally, in CAUSAL-REP Algorithms 2 and [Equation] we often impose an R-squared penalty to encourage the possitivity of f j ( X ) given C .
In these cases [Equation] we often have
[Equation]
Thus
[Equation]
we can further approximate the PNS by
[Equation]
and thus,
[Equation]
Similarly [Equation] we can obtain the lower bound of the (unconditional) efﬁciency and non-spuriousness, similar to Equation (57),
[Equation]
F. Details of the unsupervised CAUSAL-REP algorithm
We summarize the unsupervised CAUSAL-REP in Algorithm 3.
G. Details of the empirical studies for CAUSAL-REP and additional empirical results
G.1. Details of Section 5.3.
Figures 6 and 7 present additional results for Section 5.3.1.
As Z 1 and Z 2 become increasingly correlated, the (lower bounds of) unconditional POC of Z 2 for Y 1 also increase.
It is also consistent with the intuition: Z 2 is an increasingly better surrogate of Z 1 for Y 1 give higher correlations between Z 1 and Z 2 .
G.2. Details of the colored MNIST study
We study CAUSAL-REP on the colored MNIST dataset (Arjovsky et al., 2019).
The dataset builds on the original MNIST data but color the image in a way that is highly correlated with the digits label.
We focus on the digits ‘3’ and ‘8’ and colors ‘red’ and ‘green.’
To create a training set, we color the ‘3’ images in red with probability p and in green with probability (1 − p ) .
Next, we color the ‘8’ images in red with probability (1 − p ) and in green with probability p .
When p ∈ [0 , 1] is large, then the color of the image is highly correlated with the digit label in such a training set.
We further add noise to the ground truth digit label by randomly ﬂipping the labels with a probability of 0.25.
The best possible predictive accuracy is thus 0.75 (the yellow dashed line in Figure 4).
The color of the images is a spurious feature in the training set; it has a high correlation with the digit label but does not causally determine the label.
In contrast, the features of the digits themselves are non-spurious features; they are highly correlated with the digit label and can causally determine the label.
To create a test set, we color the images such that the color and images are correlated oppositely.
We color the ‘3’ images in red with probability (1 − p ) and the ‘8’ images in red with probability p .
As the color-image relationship is very different, a representation learning algorithm will predict poorly in the test set if it only captures color as a feature in the training set.
G.3. Details of the reviews corpora study
Table 3 presents the most informative words of the (positive or negative) ratings, suggested by the CAUSAL-REP representation and the logistic regression coefﬁcients.
Across three reviews corpora, logistic regression returns the spurious words “as”, “also”, “am”, “an” as the top words.
In contrast, CAUSAL-REP extracts words that are more relevant for the ratings.
G.4. Details of the colored and shifted MNIST study
The colored and shifted MNIST dataset is created similarly as in the colored MNIST.
We consider four shifts: ( dx, dy ) =
(0 , 1) , (1 , 0) , (0 , 1) , (1 , 1) —labeled 0,1,2,3—and shift the images such that the shift label is highly correlated with the digit label in the training set.
We evaluate the non-spuriousness of the representations using a downstream prediction task with domain shift.
Given a labeled training set where the digit features are no longer correlated with the spurious features, we learn a mapping from the representations to the digit label.
A representation can only predict the digit label well if it captured the non-spurious digit features in unsupervised representation learning.
[Figure]
Z
[Figure]
[Figure]
[Figure]
[Figure]
Corr( Z
[Figure]
Z
[Figure]
PS (
[Figure]
, Y
[Figure] Corr( Z 1 , Z 2 ) [Figure] [Figure]
[Figure]
P
[Figure]
( Z 1 ,
Y 1 )
[Figure]
Z
[Figure]
Z
[Figure]
[Figure]
[Figure]
[Figure]
[Figure]
Corr( Z
[Figure]
Z
[Figure]
[Figure]
[Figure]
[Figure]
[Figure]
[Figure]
[Figure]
[Figure]
( Z
[Figure]
Z
[Figure]
[Figure]
Z
[Figure]
Z
[Figure]
[Figure]
[Table]
[Table]
[Table]
[Table]
[Table]
P N (
[Table]
[Table]
[Table]
PS
[Table]
[Table]
[Table]
P
[Table]
[Table]
P N ( Z 1 & Z 2 , Y
[Table]
[Table]
[Table]
[Table]
[Table]
PS
[Table]
[Table]
[Table]
Corr(
[Table]
[Table]
[Figure]
Amazon
CAUSAL-REP
Logistic Regression love
_this _camera, recommend_this_camera, my_ﬁrst_digital, great, best
_camera
, camera_if_you, this_camera_and, camera_have, excellent_camera, camera_bought this am, an, also, as, love_my, the_tracfone, it_real, which_is, too, so_much, is_so_much, which_is_pretty, nokia, ear, home, is_must, for_your, faster, must_for, when_use this_
camera , camera, camera_is, pictures, picture, the_camera, digital, camera_
for
this_camera_is, digital_
camera;
really _nice hold_the , excellent_
it
, this_one_it, easy_it, is_superb, nice_if, returning
, too_ low, you_ need_more
with_this, aa, took , came, yet, pictures_of, camera_in, computer, pictures_in, for_those camera_
was expect , the_photos, by, camera_are, blurry, sony, have_an,
had_some, wife; Tripadvisor CAUSAL-REP
Logistic Regression
front_door, typical, lady, room_is, sized, yogurt, of_italian, in_we, was_at, front_desk_to, was_easy;
am, as, an, also, we_have, consideration, and_nice, real, stay_here_again, good
lobby, man, directions, door, open, tried, seemed, with_the, by_the, almost man_at, the_price, is_in, above_and_beyond, we_checked_out, in_central_rome, colliseum, great_for, covered, place_to_sit; the_front, front, front_desk, desk, the_front_desk, at_the_front, desk_staff, front_desk_staff, desk_was, front_of; the_people_at, the_people, stayed_nights, people_at, was_very_helpful, would_not_recommend, lovely_and, great_location, staff_at, of_my, pricey;
[Table]
but_if, looking, what_you, you_go, but_if_you, that_you, to_do, lot, youll, try, own, do_not;
an, as, am, also, japanese_food, because_its,sure_to_get, ive, ive_been, at_night, up_for_it
even_if, your_place, this_restaurant, for_you, you_should, thank_you, or_if, thank, lamb, fabulous, is_awesome; want_the, then_you, ahead, hollywood, dont_want, suggest, with, please, check_this_place, all_that; are, you_like, if_you_like, here_if, are_looking, here, are_in, is_the_place, you_need, are_looking_for; [Table] if_you, if, you, want, you_want, you_are, if_you_are, want_to, if_you_want, your, you_want_to, you_dont, dont;