Skip to main content

ergodic

Causal AI in one Python package. ergodic learns causal graphs from data, tells you whether a question can be answered from them, and estimates the effect with an interval. It also covers quasi-experiments on panels, process mining on event logs, structural causal models, and Bayesian forecasting with drivers. ergodic runs locally; the optional [welt] extra calls the hosted Welt service. ergodic is pre-1.0, so the API can change between minor versions.

Documentation: docs.ergodic.dev

Install

pip install "ergodic"
# or
uv add "ergodic"

Requires Python 3.11 or later. The extras "ergodic[scm]", "ergodic[forecast]" and "ergodic[latent]" add PyMC for structural causal models, forecasting and hidden regimes. "ergodic[welt]" connects to Welt, which runs hosted models on your data.

Your first causal effect

from ergodic import discover, estimate_effect, identify_effect
from ergodic.datasets import load_earthquake

alarm = load_earthquake(n=10_000, seed=0)  # the burglar-alarm network (Pearl, 1988)
graph = discover(alarm.data, method="pc").graph  # learn the graph from data alone
for edge in sorted(edge.glyph() for edge in graph.edges):
    print(edge)

print(identify_effect(graph, "Burglary", "JohnCalls"))  # can the data answer it?
print(estimate_effect(graph, alarm.data, "Burglary", "JohnCalls", treated="True"))
Alarm --> JohnCalls
Alarm --> MaryCalls
Alarm <-- Burglary
Alarm <-- Earthquake
Identification(adjustment: P(JohnCalls | do(Burglary)) = sum_z P(JohnCalls | Burglary, z) P(z), with z = {Earthquake})
EffectEstimate(aipw, analytic: ate=0.7982, se=0.0333, 95% CI [0.733, 0.863], n=10000)

The true effect, from the network's own tables, is 0.793: inside the interval. The documentation starts from this program and goes step by step.

Licence

Apache-2.0. See LICENSE and NOTICE. Made by Ergodic.

Metadata

Release files for ergodic 0.2.1

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

Source distribution (sdist)

Source distribution for ergodic 0.2.1
File Size Uploaded
ergodic-0.2.1.tar.gz 2.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for ergodic 0.2.1
File Interpreter ABI Platform
ergodic-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 3.2 MB

Release files / ergodic-0.2.1.tar.gz

Download URL ergodic-0.2.1.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
b3ec3f84e76284c3d1ca5a97c31d5b5eaba4a64ef21447f87679a1375c24fac0
BLAKE2b-256 checksum
How to use checksums
b8d84de727af24e16253a2d7fbbceec13e0cba5da395ce4d03435e8abc57ab9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / ergodic-0.2.1-py3-none-any.whl

Download URL ergodic-0.2.1-py3-none-any.whl
Size 792.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da06d8139b87108ba431109071f6dc9c631b0e362b013539275f79277f10c72e
BLAKE2b-256 checksum
How to use checksums
17bfe84ead2c00c7edbb912fb5a5e767b47608e3458e2060fca6cf38e633eed0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

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