L EARNING N EURAL C AUSAL M ODELS FROM U NKNOWN I NTERVENTIONS
Anonymous authors
Paper under double-blind review
A BSTRACT
Meta-learning over a set of distributions can be interpreted as learning different types of parameters corresponding to short-term vs long-term aspects of the mechanisms underlying the generation of data.
These are respectively captured by quickly-changing parameters and slowly-changing meta-parameters .
We present a new framework for meta-learning causal models where the relationship between each variable and its parents is modeled by a neural network, modulated by structural meta-parameters which capture the overall topology of a directed graphical model.
Our approach avoids a discrete search over models in favour of a continuous optimization procedure.
We study a setting where interventional distributions are induced as a result of a random intervention on a single unknown variable of an unknown ground truth causal model and the observations arising after such an intervention constitute one meta-example.
To disentangle the slow-changing aspects of each conditional from the fast-changing adaptations to each intervention, we parametrize the neural network into fast parameters and slow meta-parameters.
We introduce a meta-learning objective that favours solutions robust to frequent but sparse interventional distribution change and which generalize well to previously unseen interventions.
Optimizing this objective is shown experimentally to recover the structure of the causal graph.
Finally, we ﬁnd that when the learner is unaware of the intervention variable, it is able to infer that information, improving results further and focusing the parameter and meta-parameter updates where needed
I NTRODUCTION
A major challenge of contemporary deep learning is to generalize well outside the assumptions of independent and identically distributed data, when we care about generalization or fast adaptation to distributions other than the main training distribution.
For this purpose, we propose an approach that starts by distinguishing between: (a) an underlying causal model, (b) observational distributions derived from it, an (c) interventional distributions arising from interventions upon its variables, whether they be known or unknown.
Fortunately, these distinctions can be addressed by the paradigm of Structural Causal Models (SCMs) (Pearl, 1995; Peters et al., 2017) and a wide body of associated literature.
Unlike other frameworks using SCMs we also account for interventions performed by agents other than an experimenter.
By treating the interventions of other agents as unknown interventions that lead to changes in the underlying data distribution, the present work is a contribution towards the use of a meta-learning for causal model induction.
Estimating the underlying causal structure from data is an open and challenging problem (Pearl, 2009;
Imbens & Rubin, 2015).
A lot of prior work has examined learning causal structure based on observational data (Chickering, 2002;
Tsamardinos et al., 2006; Goudet et al., 2017; Hauser &
Bühlmann, 2012; Spirtes et al., 2000; Sun et al., 2007; Zhang et al., 2012; Shimizu et al., 2006;
Hoyer et al., 2009; Daniusis et al., 2012; Budhathoki & Vreeken, 2017; Kalainathan et al., 2018).
However, many real-world datasets have an inherent distributional heterogeneity due to different interventions to the variables composing the model.
In these situations interventional approaches are needed (e.g. Heckerman et al., 1995; Cooper & Yoo, 1999; Hauser & Bühlmann, 2012; Peters et al., 2016;
Rothenhäusler et al., 2015; Ghassami et al., 2017).
Established approaches for causal inference are often either relying on restrictive assumptions or on conditional independence testing, which is hard (Shah & Peters, 2018).
Furthermore, most of these approaches either assume full knowledge of the intervention or make strong assumptions about its form (Heinze-Deml et al., 2018).
However, in the real world, interventions are also not always performed by an experimenter.
They can be performed by other agents, or by environmental changes in ways that are unknown, or by a naive learner (like a robot) which does not know precisely yet how its low-level actions change high-level causal variables.
In this paper, we look at the setting where interventions are unknown, and our goal is to discover causal graphs given unknown-intervention samples.
The challenging aspect of this setting is to not only learn the causal graph structure, but also predict the intervention accurately.
In this setting, we need to make sure to: (1) avoid an exponential search over all possible DAGs, (2) handle unknown interventions, (3) model the effect of interventions, and (4) model the underlying causal structure.
One possibility for learning a causal structure (through SCM modelling) is to perform many experiments in which one executes interventions.
Thus, such interventions modify the effect of the intervened upon variable from its parents in the corresponding DAG, which the model has to quickly adapt to.
We can make parallel connections to meta-learning, where the inner loop can be considered as fast adaptation to the distribution change, and outer loop can be considered as learning the stationary meta-parameters of the model.
For causal induction, one can consider each distribution which arises as a result of an intervention as a meta-example, and use a meta-learning objective for fast adaptation in response to an intervention.
One can think of model parameters as being composed of slow- and fast-changing parameters.
The slow parameters are analogous to the meta-parameters in meta-learning and are used for (1) intervention prediction in order to handle the unknown intervention and for (2) modeling the underlying causal structure.
On the other hand, the fast parameters are used to model the effect of interventions.
An explicit search over the exponentially-growing space of all possible DAGs is avoided by modeling the conditionals of the structural causal model using function approximators, with one neural network per variable.
The belief over whether one node i is a direct causal parent of another node j corresponds to a dropout probability for the i -th input of network j (which predicts variable j given its parents).
This cheaply represents all 2 M 2 possible model graphs, with the graph search implicitly achieved by learning these dropout probabilities.
We thus propose a new method for fast adaptation and learning of neural causal models by framing the problem in a meta-learning setting, similar to (Dasgupta et al., 2019; Bengio et al., 2019).
Our contributions Our key contributions can be summarized as follows:
• Handle causal induction to the case where the variable on which a soft intervention took place is not known by the learner, and show that better results can be obtained when the learner attempts to infer that information and uses it to appropriately change parameters and meta-parameters.
• We bypass the issue of having to optimize over and represent an exponentially large set of discrete causal graphs by learning an efﬁciently parametrized ensemble of SCMs, • Show that our algorithm correctly identiﬁes the causal graph and use the learned graph for generalization to an unseen environment.
P RELIMINARIES
A Structural Causal Model (SCM) (Peters et al., 2017) over a ﬁnite number M of random variables
X i is a set of structural assignments
[Equation]
where N i is jointly-independent noise and pa ( i, C ) is the set of parents (direct causes) of variable i under conﬁguration C of the SCM directed acyclic graph, i.e., C ∈ { 0 , 1 } M × M , with c ij = 1 if node i has node j as a parent (equivalently, X j ∈ X pa ( i,C ) ; i.e. X j is a direct cause of X i ).
The n -th power of an adjacency matrix, C n , counts the number of length- n walks from node i to node j of the graph in element c ij .
The trace of the n -th power of an adjacency matrix, Tr( C n ) , counts the number of length- n cycles in the graph.
Causal structure learning is the recovery of the ground-truth C from observational and interventional studies.
Functional and structural meta-parameters Let us consider the simplest SCMs, those with
M = 2 random variables (lets say random variables A and B ).
Only three DAGs exist relating them; they are A → B , B
→ A or A ⊥ B .
These can be represented as the following.
If A causes
B , then the SCM between A and B can be represented as B = f θ B ( c BA · A, (cid:15) B ) , where c BA = 1 , (cid:15) B ∼ N B is a sample of an independent noise factor.
If B causes A , then the SCM can be presented as A = f θ A ( c AB · B, (cid:15) A ) , where c AB = 1 , (cid:15)
A ∼ N A is a sample of an independent noise factor.
If
A and B are independent, then we have the same equations but we set c AB = 0 and c BA = 0 .
We may now think of learning the structural causal model as learning the two probabilities of c AB or c BA being 1 (versus 0 ), representing our belief in the causal relationship between A and
B .
We can parametrize these probabilities differentiably using P ( c AB = 1)
=
σ ( γ AB ) and
P ( c BA = 1) =
σ ( γ BA ) , with γ real numbers and σ ( x ) = 1 1+ e − x .
We can also parametrize the structural equations f θ A and f θ B in a differentiable manner, using conditional probability tables (CPTs) or neural networks.
Hence, the problem becomes simultaneously learning the structural meta-parameters γ and the functional meta-parameters θ .
Functional meta-parameters θ may be easily learned by maximum likelihood or a proxy, and using backpropagation.
However, the γ are more difﬁcult to infer.
Bengio et al.
(2019) propose to learn them by using observations of how the distribution changes sparsely, with the transfer generalization (the adaptation rate after the sparse change) being the training objective for γ .
Simultaneously inferring both θ and γ is still more difﬁcult.
An M -variable SCM over random variables
X i , i ∈ { 0 , . . .
, M − 1 } can induce a super-exponential number of adjacency matrices C .
The super-exponential explosion in the number of potential graph connectivity patterns and the super-exponentially growing storage requirements of their deﬁning conditional probability tables make CPT-based parametrizations of the structural assignments
f i increasingly unwieldy as M scales.
As shown below, neural networks with c ij -masked inputs can provide a more manageable parametrization.
For more background about different kinds of intervention we ask the reader to refer
Appendix A.3.
P ROPOSED F RAMEWORK : M ETA L EARNING FOR C AUSAL I NDUCTION
Our framework disentangles the slow-changing meta-parameters, which reﬂect the stationary properties discovered by the learner, and the fast-changing parameters, which adapt in response to interventional changes in distribution.
We consider two kinds of meta-parameters: the causal graph structure γ and the model’s slow weights θ slow , along with the meta-learning objective for both of them.
We also consider one kind of parameter: the model’s fast weights, θ fast .
We will call θ = θ slow + θ fast the sum of the slow, stationary meta-parameters and the fast, adaptational parameters.
3. T ASK D ESCRIPTION
Our task setup deviates from most common deep learning modeling setups.
For the purposes of this work, we restrict ourselves to inference of randomly-generated or manually-provided ground-truth
SCMs of M categorical random variables causally related via a DAG.
The model is permitted to see (1) data from the original ground-truth model, and (2) data from a modiﬁed ground-truth model with a random intervention applied.
In our experiments, at most one intervention is concurrently performed.
When an intervention is performed, a single node is randomly and uniformly chosen among all M nodes, and its ground-truth distribution soft-intervened upon.
The learner model is aware of the samples having come from an intervention distribution, but is not aware of the identity of the intervention node, and so must predict it.
Each run of sampling steps under a given intervention is referred to as an episode .
The learner, over a large number of episodes, will experience all nodes being intervened upon, and should be able to infer the SCM from these interventions.
3. C AUSAL I NDUCTION AS AN O PTIMIZATION P ROBLEM
We ﬁrst explain how we mitigate the problem of searching in the super-exponential set of graph structures.
If there are M such variables, the strategy of considering all the possible structural graphs as separate hypotheses is not feasible because it would require maintaining O (2 M 2 ) models of the data.
We note that we can cheaply choose any of the 2 M 2 possible DAGs through suitable independent Bernoulli choices c ij associated with each edge i
→ j of the causal graph, i.e., sampling all the c ij ’s independently.
Then we only need to learn the M 2 coefﬁcients γ ij , and we implicitly maintain a distribution over the 2 M 2 models corresponding to all the possible draws of c ij .
Note that a slight dependency between the c ij is induced if we require the causal graph to be acyclic (which allows one to sample the X using ancestral sampling).
To enforce that constraint it is not sufﬁcient to require c ij c ji =
(both cannot be 1).
We deal with this problem with a regularizer acting on the γ ’s in order to favour acyclic solutions (Zheng et al., 2018).
In our approach, each random variable’s structural assignment is modeled via X i :
= f θ i
( c i 0 ×
X 0 , c i 1 ×
X 1 , ..., c im × X m , (cid:15) i ) , where f θ i (˙) is a neural network (MLP) with parameters θ i , and c ij ∼ Bin(sigmoid( γ ij )) .
Through this construction we can frame the causal induction problem as an optimization problem, with θ optimized to maximize the likelihood of data under the model but γ optimized with respect to a meta-learning objective arising from changes in distribution because of interventions.
There are a few beneﬁts for learning a parametrized ensemble of SCMs.
Such an ensemble is analogous to an ensemble of neural nets differing by their binary input dropout masks, which select what variables are used as predictors of another variable.
3. F AST A DAPTATION BY M ETA -L EARNING
Fast and slow weights To disentangle an environment’s stable, unchanging properties (the causal structure) from unstable, changing properties (the effects of an intervention), we proposed in §3 to distinguish between the model’s functional meta-parameters θ slow and parameters θ fast .
The sum of these weights, θ = θ slow + θ fast , parametrizes the MLPs computing the conditionals P i ( X i | X pa ( i ) ; θ i ) .
The fast weights and the slow weights terminology is drawn from Hinton & Plaut (1987).
The construction of θ as a sum of initial, slow weights plus zeroed, fast weight that are then allowed to quickly adapt during a transfer episode is due to MAML (Finn et al., 2017).
The ability to generalize out-of-distribution by adapting to a transfer distribution can then be measured by the likelihood after adapting the fast weights on transfer data.
Since an intervention is generally not persistent from one transfer distribution to another, the model’s functional parameters ( θ fast ) are reset after each episode of transfer distribution adaptation.
The meta-parameters ( θ slow , γ ) are preserved, then updated after each episode.
Inspired by Bengio et al.
(2019), the meta-objective for each meta-example over some intervention distribution D int is the following 1 "meta-transfer" loss:
[Equation]
where X is an example sampled from the intervention distribution D int , C is an adjacency matrix drawn from our belief distribution (parametrized by γ ) about graph structure conﬁgurations and
[Equation]
is the likelihood of the i -th variable X i of the sample X , when predicting it under the conﬁguration
C from the set of its putative parents, X pa ( i,C ) .
Structural Parameter Gradient Estimator Because a discrete Bernoulli random sampling process is used to produce the conﬁgurations under which the log-likelihood of data samples is obtained, we require a gradient estimator to propagate gradient through to the γ structural meta-parameters.
We adopt for this purpose the gradient estimate of Bengio et al.
(but see footnote 1) :
[Equation]
where the ( k ) superscript indicates the values obtained for the k -th draw of C .
This gradient is estimated solely with θ slow because estimates employing θ have much greater variance.
Acyclic Constraint We add a regularization term to the loss term that discourages the model from having length-2 cycles in the learned adjacency matrix.
The regularizer term is
[Equation]
and is derived from Zheng et al.
The details of the derivation are in the Appendix.
3. I NTERVENTION PREDICTION
Predicting interventions After an intervention on X i , the gradients into γ i and the slow weights for the i -th conditional are false, because they do not bear the blame for X i ’s outcome (which lies with the intervener).
We ﬁnd that ignoring this issue considerably hurts or slows down meta-learning, suggesting that we should try to infer on which variable the intervention took place.
For this purpose, we take advantage of the fact that the conditional likelihood of the intervened variable tends to have a poorer relative likelihood under D int , so we pick the variable with the greatest deterioration in likelihood as our guess.
3. M ODEL D ESCRIPTION
Learner Model We model the M structural assignments
X i :=
f i ( X pa ( i,C ) , N i ) (Eq. 1) of the
SCM as a set of M multi-layer perceptrons (MLPs), as in Bengio et al.
The MLPs are identical in shape but do not share any parameters, since they are modeling independent causal mechanisms .
Each possesses an input layer of M × N neurons (for M one-hot vectors of length N each), a single hidden layer chosen arbitrarily to have max(4 M, 4 N ) neurons with a LeakyReLU activation of slope 0 .
1 , and an output layer of N neurons representing the unnormalized log-probabilities of each category.
To force f i to rely exclusively on the direct ancestor set pa ( i, C ) under adjacency matrix C
(See Eqn. 2), the one-hot input vector X j for variable
X
i ’s MLP is masked by the Boolean element c ij .
The functional parameters of the MLP are the set θ = { W0 ihjn , B0 ih , W1 inh , B1 in } .
An example of the multi-MLP architecture with M = 3 categorical variables of N = 2 categories is shown in Figure 1.
Ground-Truth Model
In our experiments, ground-truth SCM models are parametrized as a set of
MLPs of the same size as the learner models, thus avoid having to manually deﬁne the Conditional
Probability Tables (CPTs).
Ground-truth models exist in two variants that differ mainly in initialization: synthetic , where the θ are randomly initialized and the γ are either randomly-initialized or pre-speciﬁed; and real-world , where the θ and γ are both initialized so as to closely replicate
the
CPTs of given Bayesian networks.
3. T RAINING ALGORITHM
The structural meta-parameters σ ( γ ij ) represent the belief in the hypothesis that node i has node j as a direct causal parent.
We may sample from this belief, obtaining different conﬁgurations (causal structures) of the causal graph.
We hypothesize that the correct conﬁguration enables better adaptation to a slight change in distribution, e.g. resulting from a soft intervention.
Hence, we evaluate different conﬁgurations under the transfer distribution; those giving a higher transfer likelihood under θ slow get a higher reward and their probability is increased.
The functional (meta-)parameters are trained as usual by gradient ascent on the log-likelihood.
The details of the training algorithm is in Section A. in the Appendix.
Synthetic datasets use either a speciﬁed edge structure for γ , or randomly initialize γ ij such that it is Boolean, strictly lower-triangular, and each row has an expected sum of 1-5 (and therefore each node expects 1-5 direct ancestors).
Real-world datasets, speciﬁed as CPTs, must ﬁrst be converted or approximated by a near-ground-truth MLP.
We use the graph’s proper edge structure to initialize γ , and learn θ by training individually each MLP in the set to replicate the correct pre-softmax logits.
In practice, excellent reproductions of the CPT can be achieved.
Stability of training Our model requires simultaneous training of both the structural and the functional meta-parameters, but these are not independent and do inﬂuence each other, which leads to instability in training.
For example, if σ ( γ ij ) ≈ 0 incorrectly, the i -th MLP does not learn to use input X j , and vice-versa, if the i -th MLP has not learned to properly use input X j , this will favour pushing σ ( γ ij ) towards 0.
To overcome this instability, we pretrain the model under observational data (from the distribution of the data before interventions) using dropout on the inputs.
This ensures that the functional meta-parameters θ slow are not too biased towards certain conﬁgurations of the meta-parameters γ .
R ELATED W ORK
The recovery of the underlying structural causal graph from observational and interventional data is a fundamental problem (Pearl, 1995; 2009).
Different approaches have been studied, score-based, constraint-based and asymmetry-based methods.
Score-based methods search through the space of all possible directed acyclic graphs (DAGs) representing the causal structure based on some form of scoring function for network structures (Chickering, 2002;
Tsamardinos et al., 2006; Goudet et al., 2017; Hauser & Bühlmann, 2012; Heckerman et al., 1995; Cooper & Yoo, 1999; Hauser & Bühlmann, 2012).
Constraint-based methods (Spirtes et al., 2000; Sun et al., 2007;
Zhang et al., 2012) infer the
DAG by analyzing the conditional independence of data.
Eaton & Murphy (2007b) use dynamic programming techniques to accelerate Markov Chain Monte Carlo (MCMC) sampling in a Bayesian approach to structure learning for discrete variable DAGs.
Asymmetry-based methods (Shimizu et al., 2006;
Hoyer et al., 2009; Daniusis et al., 2012; Budhathoki & Vreeken, 2017; Mitrovic et al., 2018) assume asymmetry between cause and effect in the data and try to use this information to estimate the causal structure.
Recently Peters et al.
; Ghassami et al.
(2017) proposed to exploit invariance across different environments to infer causal structure, but are difﬁcult to scale to large graphs due to the necessary iteration over the super-exponential set of possible graphs.
For interventional data, it is often assumed that the models have access to full intervention information, which is rare in the real world.
Rothenhäusler et al.
(2015) have investigated the case of additive shift interventions, while Eaton & Murphy (2007a) have examined the situation where the targets of experimental interventions are imperfect or uncertain.
This is different from our setting where the intervention is unknown to start with and is assumed to arise from other agents and the environment.
Learning based methods have been proposed (Guyon, a;b; Lopez-Paz et al., 2015) and there also exist recent approaches using the generalization ability of neural networks to learn causal signals from purely observational data (Kalainathan et al., 2018; Goudet et al., 2018). Some methods even use a masked-neural network approach, such as Ivanov et al. ; Li et al. ; Yoon et al.
; Douglas et al.
Dasgupta et al.
(2019) uses meta-learning to learn to make predictions under interventions.
However, their approach does not induce a causal graph, neither explicitly nor via decoding.
Thus, it cannot be used for general causal discovery, but only to make predictions of variable values.
Most similar to our work, Bengio et al.
(2019) proposes a metalearning framework for learning causal models from interventional data.
However, the proposed method (Bengio et al., 2019) explicitly models every possible set of parents for every child variable and attempts to distinguish the best among them.
Because there are combinatorially-many such parent sets, the method cannot scale beyond trivial graphs.
In our work, we bypass this restriction by modeling the edge between any 2 variables as a dropout probability and hence our model only scales quadratically as the size of the graph grows.
E XPERIMENTAL SETUP AND RESULTS
Our experiments aim to evaluate the proposed method to recover the correct causal structure and which elements of the method matter.
We ﬁrst evaluate our model on a synthetic dataset where we have control over the number of variables and causal edges in the ground-truth SCM.
This allows us to verify after learning with what accuracy we recover the individual decisions about c ij and understand the performance of our algorithm under various conditions.
We then evaluate our method on real world datasets collected from the BnLearn dataset repository, and show that the proposed approach recovers the true causal structure.
We then show that the trained models can correctly predict the consequences of previously unseen interventions on the rest of the graph.
We also perform ablations showing how important is each component of the model.
5. S YNTHETIC D ATASETS
We ﬁrst evaluate the model’s performance on several randomly-initialized SCMs with speciﬁc, representative graph structures.
For M = 3 -variable DAGs, we consider every possible connected graph: chain3 , fork3 , collider3 and confounder3 (See Fig.
7 in appendix).
They exhibit every graph sub-structure that can exist in larger graphs, and must be mastered before tackling larger graphs.
Since the number of possible DAGs grows super-exponentially with the number of variables, for M > 3 up to 8 a selection of representative and edge-case graphs are chosen.
The chainM and fullM graphs ( M = 3-8) are the minimally and maximally connected M -variable graphs, while the remaining graphs are randomly generated with a varying sparsity level (1-4 expected number of parents per node).
The details of the setup can be found in Appendix A.5.
Results The model can successfully recover the correct edge structure for all synthetic graphs considered.
The learning curves plotting the average cross-entropy (CE) loss for the learned edges against the ground-truth model for M = 3 are shown in Figure 7.
The fully-connected confounder graph is particularly easy to learn, but all 3-variable graphs are learned perfectly.
Plots of the same process on 4 - through 8 -variable graphs were similarly encouraging, with all models converging to a negligible loss.
The results are, however, sensitive to some hyperparameters, notably the DAG penalty and the sparsity penalty. [Equation] EAL [Figure]
[Equation]
[Figure]
The Bayesian Network Repository is a collection of commonlyused causal Bayesian networks from the literature, suitable for
Bayesian and causal learning benchmarks.
We evaluate our model on the Earthquake (Korb & Nicholson, 2010), Cancer (Korb & Nicholson, 2010) and Asia (Lauritzen & Spiegelhalter, 1988) datasets ( M = 5, 5 and 8-variables respectively, maximum 2 parents per node) in the BnLearn dataset repository.
The ground-truth SCM is given for each dataset, and the functional parameters are represented as conditional probability tables (CPTs).
We learn a near-ground-truth MLP from the dataset
’s CPT and use it as the ground-truth data generator.
We also insert a (greater than 1) temperature factor in order to increase the likelihood of sampling some very rare events in the CPTs.
Details of the setup can be found in Appendix A.5.1.
Results The model can successfully recover the correct edge structure for all BnLearn graphs considered up to and including 8-variable Asia.
Figures 3 and 4 illustrate what the model has learned at several stages of learning.
In these ﬁgures, the σ ( γ ij ) and c ij adjacency matrix elements are plotted as colored squares and dots.
Off-diagonal terms are unknown, and appear yellow.
The color of the squares indicates belief in the presence or absence of an edge ( σ ( γ ij ) ), while the color of the dot indicates the ground truth c ij .
Red indicates (belief in) an edge; Blue indicates (belief in) the absence of an edge.
Yellow indicates maximum uncertainty At the beginning of training, the main diagonal is a priori known to be clear of edges, and therefore is solid blue.
As training progresses, the beliefs approach the ground truth, which visually appears as the squares converging towards the color of the dot within them.
When they coincide, the dot vanishes.
An [Figure] [Figure] erroneous belief stands out as a red dot on blue square or, vice-versa, a blue dot on red square.
Because we pre-sort the nodes in BnLearn datasets so that they are in topological order, the model must learn a lower triangle.
This corresponds to a completely blue uppper triangle.
Anti-causal violations are easily recognizable as non-blue squares in the upper triangle.
Baseline comparisons We compared our method to ICP (Peters et al., 2016) and Eaton & Murphy (2007a).
Eaton & Murphy (2007a) handles uncertain interventions and Peters et al.
(2016) handles unknown interventions.
However, neither attempt to predict the intervention.
Our method (Eaton & Murphy, 2007a) (Peters et al., 2016) (Zheng et al., 2018)
[Table]
Importance of Dropout To perform initial pretraining for an observational distribution, sampling adjacency matrices is required.
One may be tempted to make these “fully-connected” (all-ones except for a zero diagonal), to give the MLP maximum freedom to learn any potential causal relations itself.
We demonstrate that pretraining cannot be carried out this way, and that it is necessary to “drop out” each edge (with probability 0.5 in our experiments) during pre-training of the conditional distributions of the SCM.
We attempt to recover the previously-recoverable graphs chain3 , fork and confounder3 without dropout, but fail to do so, as shown in Figure 5.
[Table]
Generalization to Previously Unseen Interventions It is often argued that learning approaches based on prediction do not necessarily yield models that generalize to unseen experiments, since they do not explicitly model changes through interventions - in contrast causal models use the concept of interventions to explicitly model changing environments and hold thus the promise to work even under distributional shifts (Pearl, 2009; Schölkopf et al., 2012; Peters et al., 2017).
To test the robustness of causal modelling to previously unseen interventions (new values for an intervened variable), we evaluate a well-trained causal model against a non-causal variant model where all c ij = 1 , i (cid:54) =
j .
In both cases, an intervention is performed, and the models, with knowledge of the intervention, are asked to predict the rest.
For this purpose, a batch of samples X are drawn from D int and their average log-likelihoods are computed and contrasted.
The intervention variable’s contribution to the log-likelihood is ignored.
For all 3-variable graphs ( chain3 , fork3 , collider3 , confounder3 ), the causal model attributes higher log-likelihood to the intervention distribution’s samples than the non-causal variant, thereby demonstrating causal models’ superior generalization ability in transfer tasks.
Table 2 collects these results.
[Table]
Importance of Inference After the intervention has been performed, the learner draws data samples from the intervention distribution and computes the per-variable average log-probability under sampled adjacency matrices.
The variable consistently producing the least-likely outputs is predicted to be the intervention node.
Experiments over all 3-variable DAGs show that this prediction mechanism functions well in practice, yielding far above-random accuracy in correctly predicting the intervention node (Table 3), the model performance dropped signiﬁcantly without the predication (Figure 6 Left) and is comparable to having the ground-truth intervention (Figure 6 Right).
Effect of DAG Regularizer:
To promote the acyclicity of C , we include a DAG regularizer .
This signiﬁcantly improves cross-entropy of the solution (wrt. ground truth DAG) on all 3-variable graphs, as illustrated in Figure 6, and was therefore included in all experiments with M > 3 variables.
C ONCLUSION
In this work, we introduced a framework for fast adaptation and slow learning of neural causal models.
We demonstrate through experiments that the principle of optimizing an out-of-distribution meta-learning objective enables the learner to recover the causal graph structure for graphs with more than two variables.
To achieve this we introduce an efﬁcient parametrization of the belief regarding the underlying graph structure, implemented as an adaptive form of dropout on the inputs of MLPs computing the conditionals of the model.
This relies on pre-training the conditionals using agnostic beliefs and by approximately inferring on which variable the intervention took place.
We believe that our approach of treating seemingly observational data as being derived from an environment with agents executing interventions could represent an important change in modelling perspective with deeper implications.
A A PPENDIX A. DAG P ENALTY D ERIVATION
Recall, from Zheng et al.
Theorem 1.
A matrix W ∈ R d × d is a DAG
if and only if
[Equation]
For the two-variable ( d = 2 ) graph with adjacency matrix
[Equation]
we have
[Equation]
There can only be even- or odd-length paths in a graph.
Because, in a two-variable graph with no self-edges, all even-length paths are cycles and none of the odd-length paths are, we have
[Equation]
A pairwise generalization to multinode graphs over all i (cid:54) =
j is:
[Equation]
A. T RAINING A LGORITHM
In this section, we describe the training algorithm in detail.
Algorithm
1: procedure T RAINING (Categorical Distribution D ,
M nodes and N categories) 2:
Let i an integer from 0 to M −3:4: for k pretrain steps do (cid:46)
Pretraining Loop 5: x ∼ D (cid:46)
Sample data from D 6: c ∼ Ber( σ ( γ ))
(cid:46)
Sample conﬁg from structure distribution 7:
L = − log P ( x | c ) (cid:46) Compute log-probability of data given conﬁg 8: θ slow ← Adam( θ slow , ∇ θ L ) (cid:46) Update θ slow 9: for k intervention steps do (cid:46) Interventions Loop 10:
I_N ← randint( 0 , M − 1 ) 11:
D int := D with intervention on node I_N 12: if predicting intervention then 13:
L i ← 0 ∀
i 14: for k predict steps do (cid:46) Prediction Loop 15: x ∼ D int (cid:46)
Draw batch of data from D 16: c ∼ Ber( σ ( γ ))
(cid:46)
Draw conﬁg from structure distribution 17:
L
i ← L i + − log P
i ( x | c i ; θ slow ) ∀ i (cid:46) Accumulate NLL for every node i separately 18:
I_N ← argmax ( L i ) 19: gammagrads, logregrets =
[], [] 20: for k episode steps do (cid:46) Transfer Episode Adaptation Loop 21: x ∼ D int 22: gammagrad, logregret = 0,23: for k cfg steps do (cid:46) Conﬁgurations Loop 24: c ∼ Ber( σ ( γ )) 25:
L i = − log P
i ( x | c i ; θ slow ) ∀ i 26: gammagrad += σ ( γ ) − c (cid:46) Accumulate
[Table]
A. P RELIMINARIES
Interventions In a purely-observational setting, it is known that causal graphs can be distinguished only up to a Markov equivalence class.
In order to identify the true causal graph intervention data is needed (Eberhardt et al., 2012).
Several types of common interventions may be available (Eaton &
Murphy, 2007a).
These are: No intervention: only observational data is obtained from the ground truth causal model.
Hard/perfect: the value of a single or several variables is ﬁxed and then ancestral sampling is performed on the other variables.
Soft/imperfect: the conditional distribution of the variable on which the intervention is performed is changed.
Uncertain: the learner is not sure of which variable exactly the intervention affected directly.
Here we make use of soft interventions for several reasons: First, they include hard interventions as a limiting case and hence are more general.
Second, in many real-world scenarios, it is more difﬁcult to perform a hard intervention compared to a soft one.
We also deal with a special case of uncertain interventions, where the variable selected for intervention is random and unknown.
We call these unidentiﬁed or unknown interventions.
Causal sufﬁciency
The inability to distinguish which causal graph, within a Markov equivalence class, is the correct one in the purely-observational setting is called the identiﬁability problem .
In our setting, all variables are observed (there are no latent confounders) and all interventions are random and independent.
Hence, within our setting the true causal graph is always identiﬁable in principle (Eberhardt et al., 2012; Heinze-Deml et al., 2018).
We consider here situations where a single variable is randomly selected and intervened upon with a soft or imprecise intervention, its identity is unknown and must be inferred.
A. E XPERIMENTAL SETUP
For all datasets, the weight parameters for the learned model is initialized randomly.
In order to not bias the structural parameters, all γ is initialized to 0 .
5 in the beginning of training.
A. S YNTHETIC DATA
SCM with n variables is modeled by n feedforward neural networks (MLPs) as described in section 3.1.
For simplicity, we assume use an acyclic causal graph such that we could easily sample from it.
Hence, given any pair of random variables A and B , either A −→ B , B −→ A or A and B are independent.
The MLP representing the ground-truth SCM has its weights θ initialized use orthogonal initialization with gain 2 .
and the biases are initialized using a uniform initialization between − 1 . 1 and 1 . 1 , which was empirically found to yield "interesting" yet learnable random SCMs.
[Figure]
A.5. B N L EARN DATA REPOSITORY
The repo contains many datasets with various sizes and structures modeling different variables.
We evaluate our model on 3 of the datasets in the repo, namely the Earthquake (Korb & Nicholson, 2010), Cancer (Korb & Nicholson, 2010) and Asia (Lauritzen & Spiegelhalter, 1988) datasets.
The ground-truth model structure for the Cancer (Korb & Nicholson, 2010) and Earthquake (Korb &
Nicholson, 2010) datasets are shown in Figure 8.
Note that even though the structure for the 2 datasets seems to be the same, the conditional probability tables (CPTs) for these 2 datasets are very different and hence results in different structured causal models (SCMs) for the 2 datasets.
A.5. T RAINING GROUND - TRUTH DATA GENERATOR
Because a CPT is capable of representing any distribution, and MLPs are strictly less powerful in this respect, it may not be possible to learn perfectly the distribution with our MLP learner model.
We therefore train a near-ground-truth MLP to replicate as closely as possible the CPT’s probability table, and then use this trained MLP are the ground-truth SCM data generator.
Training is by 1000 iterations of full-batch gradient descent with learning rate 0 .
001 and momentum 0 .
9 , with all possible parent values masked with the ground-truth vector γ i .
The objective is to minimize mean squared error between the MLP’s logits and the log-probability as drawn from the
CPT.
If the CPT contains a zero, it is approximated by a logit of − 100 .
Given that some of the CPTs contain very unlikely events, we have found it necessary to add a temperature parameter in order to make them more frequent.
The near-ground-truth MLP model’s logit outputs are divided by the temperature before being used for sampling.
Temperatures above 1 result in more uniform distributions for all causal variables; Temperatures below 1 result in less uniform, sharper distributions that peak around the most likely value.
We ﬁnd empirically that a temperature of about 2 is required for our BnLearn benchmarks.
A. E FFECT OF S PARSITY
We use a L 1 regularizer on the structure parameters γ to encourage a sparse representation of edges in the causal graph.
In order to better understand the effect of the L 1 regularizer, we conducted ablation studies on the L 1 regularizer.
It seems that the regularizer has an small effect on rate of converges and that the model converges faster with the regularizer.
This is shown in Figure
A. E FFECT OF T EMPERATURE
As noted in section A.5.1, we have introduced a temperature hyperparameter in order to encourage the groundtruth model to generate some very rare events in the conditional probability tables (CPTs) more frequently.
We run ablation studies to understand the importance of the temperature term.
A temperature of 1 corresponds to no changes to the underlying CPTs.
As shown in Figure 10, for the
Cancer (Korb & Nicholson, 2010) dataset, a temperature of 2 improves the accuracy of causal graph recovery.