py-scm

A Python library for exact associational, interventional, and counterfactual reasoning in Gaussian Bayesian Belief Networks (BBNs) and linear-Gaussian structural causal models.

py-scm works from:

  • a directed acyclic graph

  • per-variable means

  • a covariance matrix

The current reasoning surface is linear-Gaussian:

  • pquery() performs conditional multivariate-normal inference

  • iquery() computes exact post-intervention moments under do(...)

  • cquery() performs exact abduction-action-prediction when the factual world is fully observed

These methods return pandas objects by default. When pandas wrapping is not needed, set pandas=False to get raw NumPy-backed results with the same semantics.

These query types are regression-tested against closed-form linear-Gaussian oracles and benchmarked against R bnlearn on non-trivial Gaussian networks.

pyscm logo.

For a license, please send an email to info@rocketvector.io.

Indices and tables

Citation

@misc{rocketvector_pyscm_2024,
title={PySCM},
url={https://pyscm.rocketvector.io},
author={Vang, Jee},
year={2024},
month={Mar}}