SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Sarah Mameche
CISPA Helmholtz Center for Information Security arah.mameche@cispa.d
David Kaltenpoth
CISPA Helmholtz Center for Information Security david.kaltenpoth@cispa.de
Jilles Vreeken
CISPA Helmholtz Center for Information Security jv@cispa.de
In many scientific applications, we observe a system in different conditions in which its components may change, rather than in isolation. In our work, we are interested in explaining the generating process of such a multi-context system using a finite mixture of causal mechanisms. Recent work shows that this causal model is identifiable from data, but is limited to settings where the sparse mechanism shift hypothesis [1] holds and only a subset of the causal conditionals change. As this assumption is not easily verifiable in practice, we study the more general principle that mechanism shifts are independent, which we formalize using the algorithmic notion of independence. We introduce an approach for causal discovery beyond partially directed graphs using Gaussian process models and give conditions under which we provably identify the correct causal model. In our experiments, we show that our method performs well in a range of synthetic settings, on realistic gene expression simulations, as well as on real-world cell signaling data.
Most of statistical learning theory rests on the assumption that all data is i.i.d. and comes from a single distribution. In reality, this assumption rarely holds: observations often stem from heterogeneous environments, different time domains, or interventional experiments. This results in non-i.i.d. data which may contain spurious correlations, such that naive analysis could be subject to serious learning bias [2]. Recent research tackles this problem via causal discovery, where given different context distributions, we want to discover robust, causal relationships that transfer to novel conditions [3]. Existing approaches however commonly discover only an equivalence class of the true model [4-9]. Here, we investigate under which conditions we can identify causal directions.
To determine causal orientations, Scholkopf et al. [1] proposed the Sparse Mechanism Shift (SMS) hypothesis, which asserts that distribution shifts are a consequence of a small number of causal mechanism changes. It relies on the idea that causal functions exhibit robustness over different contexts, whereas spurious correlations typically fail to generalize to modified conditions [3, 10, 11]. While the SMS assumption permits causal identification via counting of distribution shifts [12, 13], this approach is limited to settings where only a subset of the causal conditionals change, does not apply in the i.i.d. case, and needs conditional independence tests in practice, which suffer from a multiple testing problem and, depending on the use case, limited power [14, 15]. To address these issues, we propose a functional modeling approach based on algorithmic independence and give identifiability guarantees under general assumptions. Instead of counting mechanism changes, our approach identifies the model that achieves the most succinct lossless description of the data.
To illustrate this idea, we consider three variables in five environments (Fig. 1). The environments correspond to different conditions that we observe our system in, such as interventional experiments in genomics [16, 17]. In our example, there exists some mechanism responsible for generating  $Y$  from its cause  $X$  which we call  $f$ . It remains the same in Contexts 1-4, even when the underlying causal mechanisms and hence distributions of the covariates  $X, Z$  differ  $(f_1)$ , and only changes in
(a) Causal model for non-i.i.d. data.
Figure 1: Given non-i.i.d. data from different contexts, we are interested in the mechanism  $f$  that generates a variable  $Y$  and that may change in one or more contexts (a). We consider a varying number of causal functions  $f$ , modeled through a Gaussian process, in the causal (green) and anticausal (red) direction as potential models and measure how succinctly the models encode the data ( $L$ ). Here, we find that  $Y$  has cause  $X$  and a small number  $|f|$  of different mechanisms (green star). As the causal mechanism of  $Y$  changes independently of the mechanisms generating  $X$  and  $Z$ , this holds regardless of whether  $X, Z$  undergo distribution shifts in one context (b) or in all contexts (c).
(b) Covariate shift in one context.
(c) Covariate shift in all contexts.
Context 5 as a result of a direct intervention on  $Y(f_{2})$ . Intuitively, to most concisely describe the data, we will need two functions in the causal direction, fewer would underfit, and more overfit. To capture this, we propose a score that quantifies how succinctly a model can describe the observed distributions. We show in Fig. 1(b) that it identifies the ground truth (indicated by a star symbol).
To explain why an anti-causal model from  $Z$  to  $Y$  (red) fits the data less effectively than the causal one (green), we compare two cases. Fig. 1(b) depicts the case where we change the generating process of covariates  $X$  and  $Z$  in only one context, while in Fig. 1(c) we do so in all five contexts. Changing these processes does not directly affect how  $Y$  is generated, and hence the true causal model permits equally succinct descriptions for both cases (green curve). In the anti-causal direction, however, such an invariant does not exist; in fact, by changing the distribution of  $X$  and  $Z$  in all five contexts we created a situation where five different functions are needed to describe  $Y$  from  $Z$ , and none of these can as cleanly separate signal from noise as in the causal direction. As a result, we see much worse description lengths for the anti-causal direction (red curve). We conclude that the causal mechanism for  $Y$  offers a succinct explanation because it is independent of the mechanisms for  $X$  and  $Z$ . This connection between the independence of mechanisms and succinct descriptions will be the focus of our analysis.
Our contributions are as follows. We show how the algorithmic model of causation can precisely specify which kinds of causal models are permissible for a set of variables observed over multiple contexts. Based on this framework, we propose a scoring criterion under Gaussian process models [18]. We show that our score is theoretically sound by giving general conditions under which it identifies causal models beyond partially directed graphs. Based on our theory, we introduce the LINC approach for Learning causal models under INdependent Changes. In empirical evaluations, we confirm that LINC works in practice, and show that in contrast to competitors, it is robust in various settings including semi-synthetic gene expression data [19] as well as real-world protein-signaling data [20]. We include all proofs, code, and data in the supplementary material.
2 Causal Model and Assumptions
We begin by stating our assumptions and causal model. Throughout this work, we consider a set of continuous variables  $X \in \mathbb{R}^d$ . We observe these in multiple contexts  $c \in \mathcal{C}$ . For a given set of contexts  $\mathcal{C}$ , we can represent the assignment of samples to contexts using a categorical variable  $C$ . We write  $X^{(c)}$  for a dataset in one context. Whereas the data points  $x \in X^{(c)}$  are i.i.d. samples from a distribution  $P(X \mid c)$ , the overall data is not necessarily identically distributed. We aim to understand this data through a causal model, as we describe next.
2.1 Problem Setting and Problem Statement
We assume that we can describe the true causal structure over the observed variables by a directed acyclic graph (DAG)  $G = (X, \mathcal{E})$  with node set  $X$  and edges  $(X_i, X_j) \in \mathcal{E}$  whenever  $X_i$  causes  $X_j$ . As is standard in causal discovery [10], we assume that the relationship between  $X_i$  and its parents is given by a function  $f$ ,
$$
X _ {i} ^ {(c)} = f _ {i} ^ {(c)} \left(\mathrm {p a} _ {i} ^ {G}, N _ {i}\right) \text {w h e r e} N _ {i} \perp \left(\mathrm {p a} _ {i} ^ {G}, C\right)
$$
for each context  $c$ . We hereby assume causal sufficiency, i.e. that no unobserved variables exist. Whereas the structural equations depend on the context, the causal structure  $G$  is shared in all contexts. Previous work shows that we can discover  $G$  up to an equivalence class by integrating a context variable  $C$  into conventional causal discovery methods. In particular, the  $\psi$ -Markov Equivalence class  $(\psi$ -MEC) of  $G$ , a variant of MECs to encompass interventions, is identifiable [6].
While graphical models are essential, we place emphasis on understanding the generating process of each variable. For a given variable  $X_{i}$ , we consider a mixture of  $m$  different causal mechanisms  $f$ . Importantly, each may apply to one context or remain invariant over multiple contexts. To model this situation, let  $\Pi_{i} = \{\pi_{1},\dots,\pi_{m}\}$  be a partition of  $C$  into disjoint, nonempty sets  $\pi$  such that
$$
f _ {i} ^ {(c)} = f _ {i} ^ {(c ^ {\prime})} \mathrm {f o r} \Pi_ {i} (c) = \Pi_ {i} (c ^ {\prime}),
$$
where  $\Pi_i(c)$  is the unique set  $\pi \in \Pi_i$  containing  $c$ . We thus write  $f_i^{(\pi)}$  for the invariant function  $f_i^{(c)}$  when  $c \in \pi$ , and similarly  $X^{(\pi)}$  for the pooled data from all contexts  $c \in \pi$ . To ease notation, we write its distribution as  $P(X \mid \pi) \coloneqq P(X \mid C \in \pi)$ . This results in a set of functions
$$
f _ {i} ^ {(\Pi_ {i})} = \left\{f _ {i} ^ {(\pi_ {1})}, \dots f _ {i} ^ {(\pi_ {m})} \right\}.
$$
We obtain such a partition of the contexts for each variable and denote the set over those partitions by  $\Pi = \{\Pi_i : X_i \in X\}$ . Our structural equations can thus be written as
$$
X _ {i} ^ {(c)} = f _ {i} ^ {(\pi)} \left(\mathrm {p a} _ {i} ^ {G}, N _ {i}\right) \text {f o r} c \in \pi \tag {1}
$$
for each  $\pi \in \Pi_i$ , with independent noise  $N_{i} \perp (\mathrm{pa}_{i}^{G}, C)$ . We remark that by assuming the noise  $N_{i}$  to be independent of the environment, we follow how related work characterizes environments [7, 9, 13] as differing in distribution due to changes in the conditionals  $P(X_{i} \mid \mathrm{pa}_{i}^{G})$ , independently of the exogenous noise variables  $N_{i}$ , for example, due to a soft intervention on  $X_{i}$ .
With the above, we can now informally state the problem that we want to solve.
Problem Statement (Informal). Given data  $X$  over environments  $\mathcal{C}$  we want to find
- a (sparse) graph  $G$
- a set  $\Pi$  of partitions  $\Pi_i$  of  $\mathcal{C}$  into (few) disjoint sets
- a set of (simple) functions  $f_{i}^{\pi}$
describing the causal mechanism generating our data  $X$ .
To formalize this problem, we next explain the principle of independence of causal mechanisms.
2.2 Algorithmic Independence of Causal Mechanisms
We base our approach on the principle of Independence of Causal Mechanisms (ICM, [10]). Different types of independence have been proposed in the literature. Most previous work considers statistical independence [4-9, 21], but the conditional independence constraints present in observational data only permit the identification of DAGs up to a MEC unless we make restrictive assumptions [3, 13, 22]. This has sparked interest in algorithmic independence as an alternative formulation [23-27]. We introduce this concept here and extend it to multi-context distributions.
With the idea that causal mechanisms offer simple explanations of complex phenomena, Janzing and Schölkopf [23] postulate that they correspond to simple programs computing each variable  $X_{i}$  from its causes  $\mathrm{pa}_{i}^{G}$ , where programs generating different variables  $X_{i}, X_{j}$  do not share information.
To make this precise, we revisit several concepts. Kolmogorov complexity  $K(x)$  defines the length of the shortest program  $p$  that computes a string  $x \in \{0,1\}^*$  on a universal Turing machine  $\mathcal{U}$  and halts [28]. For a distribution  $P$ , Kolmogorov complexity is the length of the shortest program able to uniformly approximate  $P$  arbitrarily well,
$$
K(P) = \min_{p\in \{0,1\}^{*}}\left\{|p|:\forall y  |\mathcal{U}(p,y,q) - P(y)|\leq \frac{1}{q}\right\} .
$$
Using  $K$  and towards defining algorithmic independence, we define algorithmic mutual information [23]. For two binary strings  $x, y$ , the algorithmic mutual information between  $x, y$  is given by  $I_A(x; y) = K(x) + K(y) - K(x, y)$ . For distributions  $P, Q$ , we can state it as follows.
Definition 2.1 (Algorithmic Mutual Information [28]). The algorithmic mutual information between two distributions  $P$  and  $Q$  is given by
$$
I _ {A} (P; Q) := K (P) - K (Q \mid P ^ {*})
$$
where  $P^{*}$  is the shortest algorithmic description of  $P$ .
Two strings  $x, y$  are algorithmically independent if  $I_A(x; y) \stackrel{+}{=} 0$  holds (up to an additive constant that is independent of  $x, y$ ), where we write  $I_A(x_1; \ldots; x_n)$  if the corresponding strings are pairwise independent. Analogously, a set of distributions  $P_i$  are jointly independent when
$$
I _ {A} (P _ {1}; \ldots ; P _ {n}) \stackrel {{\pm}} {{=}} 0.
$$
When the mutual information  $I_{A}$  between different causal conditionals vanishes, we can characterize them as independent. The algorithmic causal Markov Condition [23] states precisely this.
Postulate 2.2 (Algorithmic Markov Condition for Changing Mechanisms). Let  $(G,\Pi)$  be a causal model with DAG  $G$ , partitions  $\Pi$ , and structural equations as in Eq. 1. Then  $(G,\Pi)$  is a valid causal hypothesis only if the following equivalent conditions hold,
1. All causal mechanisms  $f$  in the model are jointly algorithmically independent. That is,
$$
I _ {A} \left(\left\{P \left(X _ {i} \mid p a _ {i} ^ {G}, \pi\right): i \in \{1, \dots , n \}, \pi \in \Pi_ {i} \right\}\right) \stackrel {\pm} {=} 0. \tag {2}
$$
2. The causal mechanisms  $f$  in the model describe the observed distribution most concisely. That is, the shortest description of  $P(X)$  across all contexts  $c \in \mathcal{C}$  is given by writing each  $X_{i}$  as a function of  $p a_{i}^{G}$  in each group  $\pi \in \Pi_{i}$ ,
$$
K (P (X)) \stackrel {\pm} {=} \sum_ {X _ {i}} \sum_ {\pi \in \Pi_ {i}} K \left(P \left(X _ {i} \mid p a _ {i} ^ {G}, \pi\right)\right) \tag {3}
$$
where  $\pm$  denotes equality up to an additive constant.
The inner term in Eq. (2) ranges over the conditionals  $P(X_{i} \mid \mathrm{pa}_{i}^{G}, \pi)$  for each variable  $X_{i}$  in each group of contexts  $\pi \in \Pi_{i}$ , where we omit indices of  $\pi$  for ease of notation. Overall, Postulate 2.2 states that the causal mechanisms correspond to programs that do not share any information (Eq. (2)) and that describe the observed distributions most concisely (Eq. (3)).
We will use the formulation in Eq. (3) which directly uses Kolmogorov complexity of conditionals. Due to the halting problem, we cannot compute Kolmogorov complexity for arbitrary programs [28], but by restricting the class to be tractable, we can approximate it from above. A statistically well-founded manner of doing so is Minimum Description Length (MDL) [29]. For a fixed class  $\mathcal{H}$  of models, MDL defines a description length  $L$  of encoding a dataset  $X$  together with its optimal model,
$$
L (X \mid \mathcal {H}) = \min  _ {h \in \mathcal {H}} \left(- \log P (X \mid h) + L (h)\right).
$$
Regarding the choice of  $\mathcal{H}$ , we are interested in functions  $f$  that are both expressive but also allow us to measure their description length. Gaussian processes naturally fulfill these requirements [18, 29], making them a fitting choice for our approach. We briefly introduce them next.
2.3 Gaussian Process Functional Model
A Gaussian process (GP) is a collection of random variables  $\mathcal{X}$ , any finite number of which have a joint multivariate Gaussian distribution [18]. Each variable represents the value of a function  $f$  at a single location  $x$ . We write functions drawn from a GP as
$$
f \sim \mathcal {G P} (m (x), \kappa (x, x ^ {\prime}))
$$
for a mean function  $m(x) = \mathbb{E}[f(x)]$  and covariance kernel  $\kappa (x,x^{\prime}) = \mathbb{E}[(f(x) - m(x))(f(x^{\prime}) - m(x^{\prime}))]$ . Viewed differently, a GP can also be expressed as a linear regression  $f = \sum \alpha_{i}\phi_{i}$  with potentially infinitely many basis functions  $\phi_i$ . Given finitely many data points  $(x_{i},y_{i})$ , we can write predictions as a linear combination of a finite number of kernel functions  $\kappa (x_{i},\cdot)$  centered on the observed points  $x_{i}$  [18],
$$
f (x) = \sum_ {i = 1} ^ {n} \alpha_ {i} \kappa \left(x _ {i}, x\right), \tag {4}
$$
with  $\alpha = (K + \sigma^2 I)^{-1}y$ , where  $K$  is the Gram matrix of  $\kappa$  with  $K_{ij} = \kappa (x_i,x_j)$ , and  $\sigma^2$  a parameter. This formulation will be useful when we consider the description length of GPs later.
Regarding the richness of the function class, given a kernel  $\kappa$ , one can construct a reproducing Hilbert space  $\mathcal{H}_{\kappa}$ , which is the smallest Hilbert space containing all finite expansions of the form in Eq. (4). For some kernels, such as the radial basis function (RBF) kernel  $\kappa(x_i, x_j) = \lambda \exp \left(-\frac{1}{2l} \|x_i - x_j\|_2^2\right)$ ,  $\lambda > 0$  which we consider here, it is known that  $\mathcal{H}_{\kappa}$  is dense in the space of continuous functions [18]. That is, we can approximate these functions up to arbitrary precision using a GP [30]. Using GPs, we now state our functional model as follows.
Assumption 1 (Functional Model with Changing Mechanisms). Given a DAG  $G$  and partitions  $\Pi$ , we assume the functional model
$$
X _ {i} ^ {(c)} = f _ {i} ^ {(\pi)} \left(\mathrm {p a} _ {i} ^ {G}\right) + N _ {i} \text {f o r} c \in \pi , \tag {5}
$$
where  $\pi \in \Pi_i$  is a group,  $f_{i}^{(\pi)}\in \mathcal{H}_{\kappa}$  is a GP, and  $N_{i}$  is independent noise  $N_{i}\perp \perp (\mathrm{pa}_{i}^{G},C)$ .
We point out that the above makes an additive noise assumption as is standard in GP modeling. Having stated the ICM assumption and our functional model, we are ready to introduce our approach.
3 Learning Independent Changes with LINC
We now introduce a score to instantiate Eq. (3) for GPs and give an analysis of its properties.
3.1 Measuring the Complexity of GP Models
To define the ability of our model to succinctly describe a given dataset, we need to address the complexity of a GP  $f$ . Despite the richness of  $\mathcal{H}_{\kappa}$ , the complexity of any  $f \in \mathcal{H}_{\kappa}$  can be readily measured by its squared norm  $\| f \|_{\kappa}^{2}$ . For functions inferred from finite amounts of data, as in Eq. (4), we can compute this norm  $\| f \|_{\kappa}^{2}$  from the quantities  $K$  and  $\alpha$  as [29]
$$
\left\| f \right\| _ {\kappa} ^ {2} = \alpha^ {\top} K \alpha .
$$
Consider now the model class  $\mathcal{H}_{\kappa}$  of GPs and a target variable  $X_{i}$ . For a given subset  $X_{S} \subseteq X$  of predictors, we can fit a GP regression  $f: X_{S} \mapsto X_{i}$ . Kakade et al. [31] show that the Bayesian MDL score for this GP model is given by
$$
L \left(X _ {S}, X _ {i} \mid \mathcal {H} _ {\kappa}\right) = \min  _ {f \in \mathcal {H} _ {\kappa}} \left(- \log P \left(X _ {i} \mid X _ {S}\right) + \| f \| _ {\kappa} ^ {2}\right) + R \left(X _ {S}\right). \tag {6}
$$
The score balances the data fit of the GP regression model  $f$  with its complexity,  $\| f\|_{\kappa}^{2} = \alpha^{\top}K\alpha$ . The remaining penalty  $R(X_S)$  is independent of the minimization over  $f$ ,
$$
R (X _ {S}) = \frac {1}{2} \log \det (\sigma^ {- 2} K _ {S} + I),
$$
where  $K_{S}$  is the Gram matrix when  $\kappa$  is applied to  $X_{S}$ . We write  $L(f) = L(X_{S}, X_{i} \mid \mathcal{H}_{\kappa})$  when the context is clear, and  $L(G, \Pi)$  as the summed description length for a given causal model. By Eq. (3), we choose the model with the smallest description length as our causal hypothesis.
Problem Statement (Formal). Given data  $X$  over environments  $\mathcal{C}$  we want to find the graph  $\widehat{G}$ , partitions  $\widehat{\Pi}$  and mechanisms  $f_{i}^{(\pi)}$  minimizing the score  $L$ ,
$$
\widehat {G}, \widehat {\Pi} = \underset {G, \Pi} {\arg \min } L (G, \Pi). \tag {7}
$$
To show that we recover the correct causal structure with this objective, we give identifiability results.
3.2 Identifiability Results
Here, we give conditions under which we can identify the true causal model using our score function. We begin by showing that we can discover the causal DAG in the correct Markov Equivalence class (MEC) under the following general assumptions.
Assumption 2 (Sufficient Capacity). For each  $i$  there exist functions  $f_{i}^{(\pi)} \in \mathcal{H}_{\kappa}$  s.t. Eq. (5) holds.
This recalls the assumption that our functional model is well-specified.
Assumption 3 (Causal Minimality). For all  $\pi \in \Pi_i$ ,  $f_i^{(\pi)}$  is not constant in any of its inputs.
The above is a toned-down version of the faithfulness condition, ensuring that every parent of  $X_{i}$  has an influence on  $X_{i}$ . Without this, it would be impossible to identify the complete set of parents.
Assumption 4 (II-Faithfulness). If  $\pi' \neq \pi \in \Pi_i$  then  $f_i^{(\pi)} \neq f_i^{(\pi')}$ .
This assumption guarantees the uniqueness of each partition. Without it, interventions would not necessarily lead to changes in causal mechanisms, and make identification thereof impossible.
With this, we can state our first identifiability result as follows.
Theorem 3.1 (Identification of MECs). Let Assumptions 1-4 hold and let  $\lambda$  be sufficiently small. Then the estimates  $\widehat{G},\widehat{\Pi}$  that minimize our score  $L$
$$
\widehat {G}, \widehat {\Pi} = \underset {G, \Pi} {\arg \min} L (G, \Pi),
$$
recover a DAG  $\widehat{G} \sim G^{*}$  in the Markov Equivalence class of the true DAG  $G^{*}$ , as well as the true partitions  $\Pi_{i}^{*}$  for each node  $i$  with probability 1
$$
P (\widehat {G} \sim G ^ {*}, \widehat {\Pi} = \Pi^ {*}) = 1
$$
Next, we show that under independent mechanism shifts, we can also identify the fully directed  $G^{*}$ . To correctly identify the direction of all edges in the discovered network, we need the following assumption that the causal mechanisms are independent of each other and change independently.
Assumption 5 (Independent Mechanism Shift). For all  $i \neq j: \Pi_i(C) \perp \Pi_j(C)$ .
We can now show that as we observe more contexts,  $|\mathcal{C}| \to \infty$ , our score identifies the correct DAG.
Theorem 3.2 (Identifiability from independent changes). Let Assumptions 1-5 hold. Then for  $\lambda$  sufficiently small, where  $\lambda$  is a hyperparameter bounding the score differences of  $\widehat{G}, G^{*}$ , we can identify the causes  $pa_{i}^{G}$  and partition  $\Pi_{i}$  of each  $X_{i}$  in the causal model  $(G^{*}, \Pi^{*})$  with probability 1,
$$
\lim  _ {| \mathcal {C} | \rightarrow \infty} P (\widehat {G} = G ^ {*}, \widehat {\Pi} = \Pi^ {*}) = 1
$$
In particular, the fully directed network  $G^{*}$  is identifiable.
The requirement  $|\mathcal{C}| \to \infty$  is necessary to turn the assumed independence of causal conditionals across different contexts into an empirically testable statistical criterion. That is, to guarantee that the model is indeed identifiable, we need either the distribution assigning contexts to partitions, or a guaranteed representative sample from the distribution, which we only obtain in the limit. Essentially, this is a frequentist approach, allowing us not to require the distributions for the partitions themselves.