Skip to main content

causal-automata

A blazing-fast, JAX-accelerated Cellular Automaton engine for causal discovery.

Benchmark — N=100 on Tesla T4

Final figures (Colab Tesla T4, GOLEM num_iter=20000):

Algorithm Skeleton F1 Directed F1 Wall Time (s)
PC (gcastle) 0.968 0.813 528.631
GOLEM (gcastle) 0.577 0.403 251.182
Bayesian CA (JAX) 0.812 0.483 0.323

Bayesian CA is ~778× faster than GOLEM and ~1636× faster than PC, while beating GOLEM on both skeleton (0.812 vs 0.577) and directed (0.483 vs 0.403) F1.

Documentation

Full docs (theory, physics, API, CLI): https://causal-automata.readthedocs.io/en/latest/

Build locally from docs/:

pip install -e ".[docs,jax]"
cd docs && make html

How it works — CA physics + V-well

State is a binary DAG adjacency A, node elevations E ∈ [0,1], and a fixed empirical covariance Cov from continuous observations. Each tick is a local cellular update:

  1. Gravity — keep only downhill edges (E[parent] > E[child]), then drift elevations toward the midpoint of parent/child means.
  2. V-structure gravity well — absent undirected pairs that share neighbors and are marginally independent (|ρ| below the death threshold with empty conditioning set) mark shared neighbors as colliders. Those elevations are sunk (E -= 2·lr), so later birth prefers arrows into the collider — the classic V-structure i → k ← j.
  3. Death / birth — kill weak edges and birth strong ones using partial correlations conditioned on the top-k union neighbors ranked by |Cov|. Birth orients by elevation after the |ρ| gate.

The NumPy prototype (bayesian.step) and the pure functional JAX port (jax_core.step, @jax.jit) share this physics.

Install (Colab T4 / CUDA)

# Runtime → Change runtime type → T4 GPU
pip install -U "jax[cuda13]" gcastle torch networkx scikit-learn numpy
pip install -e .

CPU / portable (no CUDA wheel):

pip install -e ".[jax,gcastle]"
# or: uv sync --extra jax --extra gcastle

Full NVIDIA extra (mirrors the Colab stack in project metadata):

pip install -e ".[cuda]"

Run

# Synthetic DAG harness (NumPy default; use --backend jax for JIT)
python -m causal_automata.bayesian_synth --n 10
python -m causal_automata.bayesian_synth --n 50 --backend jax
python -m causal_automata.bayesian_synth --n 100

# Benchmark vs gCastle PC / GOLEM (default N=100)
python -m causal_automata.benchmark
python -m causal_automata.benchmark --n 100 --seed 0 --ticks 100
python -m causal_automata.benchmark --smoke   # device checks + GOLEM init only

Smoke the JAX compile:

python -c "from causal_automata import warmup; print(warmup())"

Documentation

Sphinx docs (Read the Docs) live under docs/. Build locally:

pip install -e ".[docs,jax]"
cd docs && make html

Configuration for hosted builds is in .readthedocs.yaml. Theory pages summarize the project manuscripts on causal / Bayesian automata; API pages are generated from module docstrings via autodoc.

Package layout

causal-automata/
├── causal_automata/
│   ├── __init__.py
│   ├── bayesian.py          # NumPy Bayesian CA step
│   ├── bayesian_synth.py    # Synthetic linear-DAG harness
│   ├── jax_core.py          # JAX @jit port of step
│   └── benchmark.py         # vs gCastle PC / GOLEM
├── docs/                    # Sphinx / Read the Docs
├── .readthedocs.yaml
├── pyproject.toml
├── README.md
└── NOTICE

License / notice

See NOTICE. Copyright 2026 Masakazu Yamagiwa.

Metadata

Release files for causal-automata 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for causal-automata 0.1.0
File Size Uploaded
causal_automata-0.1.0.tar.gz 20.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for causal-automata 0.1.0
File Interpreter ABI Platform
causal_automata-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 42.3 kB

Release files / causal_automata-0.1.0.tar.gz

Download URL causal_automata-0.1.0.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
02443d3032b4e1fde9d0717d694c11087a482ec2486c2ce33a81e26257ec333b
BLAKE2b-256 checksum
How to use checksums
fd51f1c6e2a33824ba36ef8e63102b8e1f097347d8aa791f47582fcf9a96a511
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / causal_automata-0.1.0-py3-none-any.whl

Download URL causal_automata-0.1.0-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68036cda08a0a0596777fc89a6a9572840592c87334d9cccb27c221ab03e76aa
BLAKE2b-256 checksum
How to use checksums
6efd010aad5c38ba9648a29eeaed8a162e26d971eb083e5edd445cbba32ddc6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.1.2

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page