Bayesian Causal Discovery - BGe Score, Interventions and Sachs Data

Summary

Concept note (no raw source). For continuous data, Bayesian DAG learning uses the BGe score (Normal-Wishart marginal likelihood; score-equivalent, so Markov-equivalent DAGs tie). Observational data identify only a Markov equivalence class; interventional data (Sachs et al. 2005: 7,466 cells over 9 conditions) break ties by removing the intervened node’s local factor. Posterior averaging over DAGs uses order-based sums (see Friedman 2000 - Closed Form for a Known Ordering) or dynamic programming over orders. Used in PyMC example E20.

Overview

Example list: https://redam94.github.io/pymc-challenges/examples.html, E20 (linear-Gaussian SEMs, Markov equivalence through LOO and pm.do, NOTEARS acyclicity as pm.Potential and why it is multimodal and scale-dependent, fixed-order horseshoe DAGs, exact BGe + dynamic-programming averaging over all orders). E19 is the undirected sibling (Bayesian Gaussian Graphical Models - G-Wishart and Neighbourhood Selection).

Main Content

Linear-Gaussian structural equation model on a DAG

, independent; is the weighted adjacency matrix with acyclic support. Observational distribution ; different DAGs in one Markov equivalence class give the same distribution (e.g. and ).

BGe score (Geiger & Heckerman 1994, 2002)

With a Normal-Wishart prior (, ) over variables, the marginal likelihood of complete observations of a subset of variables is

, , . Local score ; , as in Friedman 2000 - Bayesian Structure Learning Framework. BGe is score equivalent: Markov-equivalent DAGs have equal scores.

Interventional data (Cooper & Yoo 1999; Sachs et al. 2005)

For samples where node is experimentally set (perfect intervention), is not generated by its parents, so that sample is excluded from node ‘s local score (its parent mechanism is not observed), while its value still acts as a parent for children. In PyMC, pm.do / per-sample masks implement the same idea: the likelihood term for in intervened rows is dropped. Interventions make edge directions identifiable beyond the Markov class.

Sachs et al. (2005): flow cytometry on 11 phosphoproteins/phospholipids in primary T cells under multiple perturbations; the commonly used benchmark has a 20-edge consensus network and (per the example list) 7,466 cells in 9 intervention conditions.

Computation: (a) order-MCMC / exact sums over DAGs given an order (Friedman & Koller); (b) exact averaging over all orders by dynamic programming over subsets (Koivisto & Sood 2004; cost about local-score lookups with an in-degree bound), practical to roughly -20; (c) continuous relaxations: NOTEARS (NOTEARS - Overview), which in a Bayesian model becomes pm.Potential(-rho*h(W)): soft, scale-dependent and multimodal.

Examples

Score equivalence check ( vs )

, , . Both orientations get BGe log-score (identical), the empty graph : data support an edge but not its direction.

import numpy as np
from scipy.special import gammaln
def logc(k, a): return -(a*k/2*np.log(2) + k*(k-1)/4*np.log(np.pi) + sum(gammaln((a+1-i)/2) for i in range(1, k+1)))
def bge_node(D, i, pa, am=1.0):
    n, m = D.shape; aw_full = m + am + 1
    def lm(cols):
        X = D[:, cols]; k = len(cols); aw = aw_full - m + k
        T = (am*(aw-k-1)/(am+1))*np.eye(k); xb = X.mean(0); Sn = (X-xb).T @ (X-xb)
        R = T + Sn + (am*n/(am+n))*np.outer(xb, xb)
        return (-n*k/2*np.log(2*np.pi) + k/2*np.log(am/(am+n)) + logc(k, aw) - logc(k, aw+n)
                + aw/2*np.linalg.slogdet(T)[1] - (aw+n)/2*np.linalg.slogdet(R)[1])
    return lm([i] + list(pa)) - (lm(list(pa)) if pa else 0.0)
rng = np.random.default_rng(0); x = rng.normal(size=200); y = 0.8*x + rng.normal(size=200); D = np.c_[x, y]
print(bge_node(D,0,[]) + bge_node(D,1,[0]), bge_node(D,1,[]) + bge_node(D,0,[1]))

(Prior: , , , , standard defaults.)

Marketing relevance: causal structure among marketing variables (spend, brand search, awareness, sales) is only partially identifiable from observational time series; experiments (geo holdouts, lift tests) play the role of interventions, and a posterior over edges communicates that honestly. Treat as an analogy; time-series dependence is not handled by the iid BGe model.

Connections

Causal Discovery - Overview, PC Algorithm and Constraint-Based Discovery, GES and Score-Based Discovery, Markov and Faithfulness Assumptions, Functional Causal Models (LiNGAM, ANM), Joint Priors and Covariance Matrices.

See Also

Friedman 2000 - Being Bayesian about Network Structure