SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Siyuan Guo $^{12*}$  Viktor Tóth $^{1*}$  Bernhard Schölkopf $^{2}$  Ferenc Huszár $^{1}$ $^{1}$ University of Cambridge  $^{2}$ Max Planck Institute for Intelligent Systems {syg26,fh277}@cam.ac.uk toth.viktor7400@gmail.com bs@tuebingen.mpg.de
Constraint-based causal discovery methods leverage conditional independence tests to infer causal relationships in a wide variety of applications. Just as the majority of machine learning methods, existing work focuses on studying independent and identically distributed data. However, it is known that even with infinite i.i.d. data, constraint-based methods can only identify causal structures up to broad Markov equivalence classes, posing a fundamental limitation for causal discovery. In this work, we observe that exchangeable data contains richer conditional independence structure than i.i.d. data, and show how the richer structure can be leveraged for causal discovery. We first present causal de Finetti theorems, which state that exchangeable distributions with certain non-trivial conditional independences can always be represented as independent causal mechanism (ICM) generative processes. We then present our main identifiability theorem, which shows that given data from an ICM generative process, its unique causal structure can be identified through performing conditional independence tests. We finally develop a causal discovery algorithm and demonstrate its applicability to inferring causal relationships from multi-environment data. Our code and models are publicly available at: https://github.com/syguo96/Causal-de-Finetti
Learning causal structure from observational data is a key step towards causally robust predictions in machine learning. Most existing causal discovery theory (Pearl, 2009) focuses on the study of independent and identically distributed (i. i.d.) data. Indeed, a majority of practical methods (Chickering, 2002; Spirtes et al., 2000a,b) based on i.i.d. data only allows us to determine causal structure up to broad equivalence classes, and going beyond that is known to be impossible without further constraints (Pearl, 2009). For example, the basic task of identifying a bivariate cause-effect relationship (i.e.  $X$  causes  $Y$  or  $Y$  causes  $X$ ) on i.i.d. data is known to be impossible. Current methods impose additional restrictions, e.g., linearity assumptions (Hoyer et al., 2012; Shimizu et al., 2006, 2011) or assumptions about the additive nature of noise (Hoyer et al., 2008a; Peters et al., 2014; Zhang and Hyvarinen, 2009) to ensure identification.
A more recent line of work relaxes the i.i.d. assumption and considers inferring causal structure from grouped or multi-environment data (Arjovsky et al., 2019; Heinze-Deml et al., 2018; Huang et al., 2020; Peters and Meinshausen, 2016; Rojas-Carulla et al., 2018; Tian and Pearl, 2001). Our key observation is that studying grouped data is akin to relaxing the assumption on the data generating process from i.i.d. to exchangeable. In this work, we study causal structure learning in exchangeable data and show unique causal structure identification is enabled by the richer conditional independence structure of exchangeable processes.
Figure 1: (a) is an illustration showing how i.i.d. data and certain exchangeable data differ in identifying the correct causal structure for a bivariate model. Each quadrant represents a causal structure,  $X \perp Y$ ,  $X \rightarrow Y$ ,  $X \leftarrow Y$ . The inner circle represents i.i.d. regime and the outer circle represents certain exchangeable regime. Under i.i.d. data, one can only identify  $X \perp Y$ , whereas certain exchangeable data (i.e., ICM-generated processes) enables one to identify unique causal structures. (b) illustrates a differentiating factor between de Finetti and causal de Finetti's representation on exchangeable data. Causal de Finetti disentangles the latents and substantiates causal mechanisms are independent in the sense that parameters governing each mechanism are statistically independent.
Several works in multi-environment data implicitly leverage the independent causal mechanism (ICM) assumption (Aldrich, 1989; Janzing and Scholkopf, 2010; Pearl, 2009), which postulates that causal mechanisms of the true underlying generating process do not inform or influence one another. Despite having been widely applied (Brehmer et al., 2022; Goyal et al., 2019; Madan et al., 2021; Parascandolo et al., 2018), the ICM assumption is rarely stated any more formally than above, and thus lacks a statistical formalization. It is also unknown what the fundamental limitations of inferring causal structure under the ICM assumptions are. Our work makes three contributions to clarify these questions:
- Causal de Finetti theorems (§ 3) provide a mathematical justification for the independent causal mechanism (ICM) assumption in data generating processes. It states that any exchangeable process satisfying a certain set of conditional independence properties can be represented as a generative process in which factors in a Markov factorization are statistically independent. We show how causal de Finetti substantiates the ICM principle and call such models ICM-generative processes.
- Our main identifiability theorem (§ 4), informally stated, shows that if data is sampled from an ICM generative process, the causal graph is uniquely identifiable by testing conditional independence relationships.
- Causal discovery in multi-environment data: Section 5 connects the identifiability theorem for ICM generative models to the analysis of multi-environment data. This section establishes that multi-environment data can be viewed as observing finite marginals of i.i.d. copies of an exchangeable process. This then allows us to develop an algorithm for recovering causal structure from data coming from a sufficient number of environments.
Our work thus provides strong probabilistic justification for approaches based on the independent causal mechanisms assumption and algorithms that require non-i.i.d. grouped data. We review the use of exchangeability in causality and approaches for causal structure learning in grouped data in Section 7. In Section 6, we present experiments that validate our approach to inferring causal structure from multi-environment data using conditional independence testing. Fig. 1 summarizes the main contributions of the paper and Fig. 2 illustrates differences between data generated by causal graph under i.i.d. process and ICM-generative process.
2.1 The Causal Framework
A joint distribution  $P(X_{1},\ldots ,X_{N})$  over a set of variables  $X_{1},\ldots ,X_{N}$  can be decomposed into simpler components in multiple ways. For example, by the chain rule of probability, one can factorize
(a): i.i.d. process
(b): exchangeable process
(c)
Figure 2: An illustration demonstrates different conditional independence relationships contained in i.i.d. process and ICM-generative process. (a): A causal graph generated under an i.i.d. process; (b): A causal graph generated under ICM-generative process; Unrolling the inner plate notation from (b), we visualize the process with two samples. Causal graphs  $X \to Y$  and  $Y \to X$  generated under an i.i.d. process share the same conditional independences  $\{\emptyset\}$  and are thus observationally equivalent. (c) and (d) show the corresponding graphs under ICM-generative processes. (c) has  $X_1 \perp Y_2 \mid X_2$  which does not hold in (d) and (d) has  $X_1 \perp Y_2 \mid Y_1$  which does not hold in (c). One can thus differentiate the bivariate causal direction in ICM-generative processes.
the joint as  $P(X_{1},\ldots ,X_{N}) = \prod_{i = 1}^{N}P(X_{i}\mid X_{1},\ldots ,X_{i - 1})$ . We say the joint distribution satisfies the Markov factorization property with respect to a directed acyclic graph  $\mathcal{G}$  if
$$
P \left(X _ {1}, \dots , X _ {N}\right) = \prod_ {i = 1} ^ {N} P \left(X _ {i} \mid \mathbf {P A} _ {i}\right), \tag {1}
$$
where  $\mathbf{PA}_i$  are the direct parents of node  $X_i$  in  $\mathcal{G}$ . While many factorisations can represent the same joint  $P$ , a specific one is called the causal Markov factorization: in it, the factors  $P(X_i \mid \mathbf{PA}_i)$  represent the causal mechanisms of the true underlying data generating process. One can use the causal factorization to predict effects of interventions, which we model mathematically by replacing the corresponding factor (Pearl, 2009).
Causal discovery aims at recovering the causal graph  $\mathcal{G}$  and the corresponding causal Markov factorization from the joint distribution  $P$ . This can be done by matching the conditional independence structure implied by the graph  $\mathcal{G}$  to those observable in the joint distribution  $P$ . To facilitate this matching, an elaborate graphical terminology has been developed, as detailed in Appendix A. Unfortunately, under the assumption that data is sampled i.i.d. from  $P$ , the true underlying  $\mathcal{G}$  cannot be uniquely determined, only up to broad equivalence classes. The conditional independence structure of i.i.d. processes is not rich enough to facilitate identifiability of the causal structure  $\mathcal{G}$ .
Independence of Causal Mechanisms, Causal and Anti-Causal Machine Learning In addition to the study of Markov factorization, recent work (Janzing and Schölkopf, 2010) studies the behaviour of causal mechanisms and postulates the Independent Causal Mechanism (ICM) principle, which states:
Causal mechanisms are independent of each other in the sense that a change in one mechanism  $P(X_{i} \mid \mathbf{PA}_{i})$  does not inform or influence any of the other mechanisms  $P(X_{j} \mid \mathbf{PA}_{j})$ , for  $i \neq j$ .
The notion of invariant, independent and autonomous mechanisms have a long history in causality research: Haavelmo (1944) and Aldrich (1989) discuss the historical development of autonomous mechanisms in economics and Pearl (2009) also argues that causal mechanisms are modular in nature. Schölkopf et al. (2012) pointed out the implications of this principle when using machine learning techniques in causal or anti-causal learning settings, i.e., when the task is to predict an effect from a cause or a cause from an effect, respectively. The ICM principle implies that semi-supervised learning is only successful in the anti-causal direction, while the predictor can be robustly applied to new domains if learning is in the causal direction. While these observations seem intuitively true, it is difficult to ground their meaning in the language of probability or information. As we will see, these difficulties can be resolved once we consider non-i.i.d. data generating processes.
2.2 Exchangeability
As we have seen, i.i.d. processes have a limitation that their conditional independence structure is not rich enough to support identifiability of the full causal graph. We thus turn our attention to a richer class of processes, exchangeable sequences.
Definition 1 (Exchangeable sequence). A finite sequence of random variables  $X_{1}, X_{2}, \ldots, X_{N}$  is exchangeable, if for any permutation  $\pi$  of its indices  $\{1, \ldots, N\}$ :
$$
P \left(X _ {\pi (1)}, \dots , X _ {\pi (N)}\right) = P \left(X _ {1}, \dots , X _ {N}\right) \tag {2}
$$
An infinite exchangeable sequence is a sequence where for any  $N \in \mathbb{N}$ , its finite sequence of length  $N$  is exchangeable.
Exchangeability is a notion of symmetry. Definition 1 informally states the order of observations does not matter. Recall a finite sequence of random variables is independent and identically distributed if its joint distribution satisfies  $P(X_{1},\ldots ,X_{N}) = \prod_{i = 1}^{N}P(X_{i})$ . Of course, such an i.i.d. sequence is automatically exchangeable but not all exchangeable sequences are i.i.d. To clarify the connection between exchangeable and i.i.d. sequences, recall the de Finetti theorem:
Theorem 1 (De Finetti's representation theorem (de Finetti, 1931)). Let  $(X_{n})_{n\in \mathbb{N}}$  be an infinite sequence of binary* random variables. The sequence is exchangeable if and only if there exists a random variable  $\theta \in [0,1]$  such that  $X_{1},X_{2},\ldots$  are conditionally independent and identically distributed given  $\theta$ , with a probability measure  $\mu$  on  $\theta$ . Mathematically speaking, given any sequence  $(\mathbf{x}_1,\dots,\mathbf{x}_N)\in \{0,1\}^N$ :
$$
P \left(\mathbf {x} _ {1}, \dots , \mathbf {x} _ {N}\right) = \int \prod_ {i = 1} ^ {N} p \left(\mathbf {x} _ {i} \mid \theta\right) d \mu (\theta) \tag {3}
$$
Informally, the theorem states that an exchangeable sequence can always be represented as a mixture of i.i.d. sequences. De Finetti's representation theorem has important consequences for Bayesian inference. Bayesian statistics, unlike frequentist, takes the view that the parameter is a latent variable, instead of an unknown point estimate. Bayes' theorem estimates the parameter via calculating posterior density  $p(\theta | \mathbf{x}_1, \dots, \mathbf{x}_N)$ . De Finetti's representation theorem demonstrates (O'Neill, 2009) that rather than metaphysical belief about the true model, it is due to our judgement that the observations are exchangeable that underlies our standard use of Bayesian modelling involving observations are i.i.d. conditioned on some unknown latent variable.
3 Causal de Finetti Theorems
Just as de Finetti justifies Bayesian modelling, we will introduce causal de Finetti theorems that justify causal modelling via probability theory. We first motivate our study of exchangeable sequences by noting that they have a richer conditional dependence structure than i.i.d. sequences. We illustrate what this means concretely in the simplest possible case of a pair of variables.
Let  $X$  denote a random variable and  $x$  denote a random variable's particular realization. Let  $[n]$  denotes the set of positive integers that are less than or equal to  $n$ , i.e.  $[n] = \{1, \ldots, n\}$ .
Definition 2 (Exchangeable pairs). An infinite sequence of random variable pairs  $(X_{n},Y_{n})_{n\in \mathbb{N}}$  is exchangeable if for any permutation  $\pi$  and for any finite number  $N$ , it satisfies
$$
P \left(X _ {\pi (1)}, Y _ {\pi (1)}, \dots , X _ {\pi (N)}, Y _ {\pi (N)}\right) = P \left(X _ {1}, Y _ {1}, \dots , X _ {N}, Y _ {N}\right) \tag {4}
$$
In an i.i.d. sequence over pairs, the only non-trivial independence is  $X_{i} \perp Y_{i}$ . Since the distribution is identical, it either holds for all  $i$  or does not hold for all  $i$ . In an exchangeable sequence of pairs, one can consider other non-trivial independence, for example,  $Y_{i} \perp X_{j} \mid X_{i}$ . This conditional independence relationship trivially holds in i.i.d. sequences, but it may or may not hold in exchangeable sequences. Therefore, one can hope its absence or presence carries some useful information about some underlying causal structure. Here, we present the causal de Finetti theorems, which illustrate the type of causal structure this conditional independence relationship implies.
*De Finetti's representation theorem has been extended to categorical and continuous variables (Klenke, 2008).
Theorem 2 (Causal de Finetti - bivariate). Let  $\{(X_n, Y_n)\}_{n \in \mathbb{N}}$  be an infinite sequence of binary random variable pairs. The sequence is:
1. infinitely exchangeable, and satisfies
2.  $\forall n\in \mathbb{N}\colon Y_{[n]}\perp X_{n + 1}\mid X_{[n]}$
if and only if there exist two random variables  $\theta \in [0,1]$  and  $\psi \in [0,1]^2$  with probability measures  $\mu, \nu$  such that the joint probability can be represented as
$$
P \left(x _ {1}, y _ {1}, \dots , x _ {N}, y _ {N}\right) = \int \prod_ {n = 1} ^ {N} p \left(y _ {n} \mid x _ {n}, \psi\right) p \left(x _ {n} \mid \theta\right) d \mu (\theta) d \nu (\psi) \tag {5}
$$
Informally, the theorem states that an exchangeable sequence of random variable pairs satisfying an additional set of conditional independence properties, can always be represented as a mixture of i.i.d. sequences which all share the same underlying Markov factorization structure, and thus, an invariant causal structure. In fact, such exchangeable data can be interpreted as data generated under the ICM assumption. Recall the independent causal mechanism is loosely denoted as " \( P_{\text{effect|cause}} \perp P_{\text{cause}} \)". \) ICM assumption can be modelled by Eq. 5 in the sense that causal mechanisms are characterized by latent variables: mechanisms do not influence each other if one can separately manipulate each latent variable controlling different mechanisms; further, latent variables governing each mechanism are statistically independent with each other, supporting mechanisms do not inform one another. We thus call the generative process in Eq. 5 as ICM-generative process. Causal de Finetti, just as how de Finetti substantiates Bayesian modelling, demonstrates that rather than metaphysical belief about independent causal mechanisms, it is due to our judgement that observations are exchangeable and the sufficiency to predict the target variable \( Y \) with the corresponding \( X \) values irrespective of other \( X \) observations underlie our standard use of causal modelling. We thus substantiate ICM by detailing the statistical assumptions one implicitly make when assuming ICM.
As an example, consider the causal graph on the right. Imagine in a hospital there are two patients. A patient's symptom is the cause of a doctor's diagnosis. Suppose we are interested to predict a patient's diagnosis given her symptom. The conditional independence says knowing another patient's symptom will not help us to predict the diagnosis of this patient if we know this patient's symptoms already. The conditional independence thus formulated the intuition behind causal and anti-causal problem in the language of probability: the distribution of the cause, other patients' symptoms in this case, will not help prediction about the effect given cause, i.e., one patient's diagnosis given his or
Causal de Finetti vs. de Finetti To see the difference between causal de Finetti and de Finetti's representation theorem, we observe that a direct application of de Finetti theorem on exchangeable data that may or may not contain causal information results in a factorization as:
$$
P \left(x _ {1}, y _ {1}, \dots , x _ {N}, y _ {N}\right) = \int \prod_ {n = 1} ^ {N} p \left(y _ {n}, x _ {n} \mid \theta\right) d \mu (\theta) \tag {6}
$$
As observations are conditionally i.i.d. given latent variable  $\theta$ , learning  $\theta$  is thus sufficient to achieve maximum prediction power. This finding corroborates empirical results in the machine learning community, where training often produces an entangled representation that achieves strong prediction accuracy. However, with the fast development of powerful machine learning applications (Brown et al., 2020), both deep learning and causal communities advocate the need for disentangled representations (Bengio et al., 2013; Locatello et al., 2019; Scholkopf et al., 2021), which offer greater control, interpretability, and generalization capabilities. Causal de Finetti shows that, in fact, given exchangeable data satisfying the causal and anti-causal learning phenomenon formulated in conditional independences, there are statistically independent latent variables controlling each causal mechanism. It shows one can achieve both maximum prediction power and disentangled representations. Fig. 1b illustrates a visualization of the differences between de Finetti and causal de Finetti theorems.
We next illustrate causal de Finetti in the general multivariate form (see Appendix B for proof):
Definition 3 (Exchangeable arrays). An array of size  $d$  contains variables  $(X_{1:n},\ldots ,X_{d:n})$  where  $X_{d:n}$  denotes the  $d$ -th random variable in  $n$ -th array. Such an array is denoted as  $\mathbf{X}_{;n}$ . A finite sequence of size  $d$  arrays is exchangeable, if
$$
P \left(\mathbf {X} _ {:; \pi (1)}, \dots , \mathbf {X} _ {:; \pi (N)}\right) = P \left(\mathbf {X} _ {:; 1}, \dots , \mathbf {X} _ {:; N}\right) \tag {7}
$$
Theorem 3 (Causal de Finetti - multivariate). Let  $\{(X_{1:n}, X_{2:n}, \ldots, X_{d:n})\}_{n \in \mathbb{N}}$  be an infinite sequence of  $d$ -tuple binary random variables. The sequence is
1. infinitely exchangeable, and
2. if there exists a DAG  $\mathcal{G}$  such that  $\forall i\in [d],\forall n\in \mathbb{N}$
$$
X _ {i; [ n ]} \perp \bar {\mathbf {N D}} _ {i; [ n ]}, \mathbf {N D} _ {i; n + 1} | \mathbf {P A} _ {i; [ n ]}
$$
where  $\mathbf{PA}_i$  selects parents of node  $i$  and  $\mathbf{ND}_i$  selects non-descendants of node  $i$  in  $\mathcal{G}$ .  $\overline{\mathbf{ND}}_i$  denotes the set of non-descendants of node  $i$  excluding its own parents.
if and only if there exist  $d$  random variables where  $\pmb{\theta}_i\in [0,1]^{2^{|PA_i|}}$  with suitable probability measures  $\{\nu_{i}\}$  such that the joint probability can be written as
$$
P \left(\mathbf {x} _ {:, 1: N}\right) = \int \int \prod_ {n = 1} ^ {N} \prod_ {i = 1} ^ {d} p \left(x _ {i; n} \mid \boldsymbol {p} \boldsymbol {a} _ {i; n}, \boldsymbol {\theta} _ {i}\right) d \nu_ {1} \left(\boldsymbol {\theta} _ {1}\right) \dots d \nu_ {d} \left(\boldsymbol {\theta} _ {d}\right), \tag {8}
$$
where  $\mathbf{x}_{:,1:N} \coloneqq \{(x_{1:n},\ldots ,x_{d:n})\}_{n = 1}^{N}$ .
Theorem 2 is a special case of Theorem 3 when  $d = 2$ . Informally, it states that an exchangeable sequence of size  $d$  random arrays satisfying an additional set of conditional independence properties with respect to a DAG, can always be represented as a mixture of i.i.d. sequences which all share the same underlying Markov factorization structure as the corresponding DAG. The set of conditional independence properties in condition 2 can be interpreted via its decomposition:
$$
X _ {i; [ n ]} \perp \overline {{\mathbf {N D}}} _ {i; [ n ]} \mid \mathbf {P A} _ {i; [ n ]}
$$
This shows that the direct parents of one node form a Markov blanket for its other non-descendant nodes. In other words, to infer about the variable of interest, it is sufficient to know the variable's direct parents irrespective of other non-descendants.
$$
X _ {i; [ n ]} \perp \mathbf {\Omega} \mathbf {N D} _ {i; n + 1} \mid \mathbf {P A} _ {i; [ n ]}
$$
This conditional independence is another example that exchangeable data has richer conditional independence structure. It trivially holds in i.i.d. sequences but may or may not hold in exchangeable data. Informally, it states that to infer the variable of interest, it is sufficient to know its corresponding parents irrespective of non-descendants in other observations. This formulated the intuition behind the causal and anti-causal problem in the language of probability: the distribution of the variables in the causal direction, in this case, non-descendants in other observations will not help prediction if covariates contain a complete set of the corresponding direct causal parents.
To illustrate how Theorem 3 also justifies the ICM in action, consider the causal graph to the right. Imagine high schools host campaigns to advertise university opportunities and encourage students to apply. Students' decision to apply is the cause of their university admission outcomes. Suppose we are interested in understanding how influential school campaigns are on students' decision to apply, i.e., the mechanism of "Apply | Campaign". We expect that knowing a particular student's decision to apply after attending a school campaign
will not be influenced by the other school campaigns the student did not attend; instead, knowing other students' decisions to apply after their attendance in campaigns will help the prediction of this particular student's decision to apply. Similarly, knowing other students' university admission outcomes will also be helpful. This is because more students decide to apply implies the effectiveness of school campaigns, and more university admission acceptance implies more students decide to apply. Causal de Finetti says given such assumptions and exchangeable data, it naturally holds that there exist latent variables, represented by high school, student and university, and they are independent.