The Python implementation of the paper On the Identifiability of Poisson Branching Structural Causal Model Under Latent Confounding (ICML 2026).
The running example of LC-PB-SCM is given below.
import numpy as np
from eq_search import eq_search_v2, mag2graph
from pgf_confounder_partial import pgf_confounder_partial
from util import pbscm, graph2pgf
from PGF import PGF
case_graph =(
3,
[.02, .03, .04, .05],
[
[0, 0, 0.3, 0],
[0, 0, 0.4, 0],
[0, 0, 0, 0],
[0.5, 0.6, 0, 0],
]
)
n = case_graph[0]
mu = case_graph[1]
graph = case_graph[2]
print(np.array(graph))
pgf = PGF(graph)
expr = pgf.compute(mu, s=[pgf.s[k] if k < n else 1 for k in range(len(mu))])
print("True PGF expression:")
print(expr.as_expr())
data = pbscm(graph=graph, mu=mu, sample=10000)
data = data[:, :n]
terms, mag = pgf_confounder_partial(data, bootstrap_round=200, p_value=.05, verbose=True)
print("Learned PPADMG:")
print(mag2graph(mag))The requirements are given in requirements.txt. You can install them using the following command:
pip install -r requirements.txt