Causal Effect Graphs
for Python
A minimal, fast, NumPy-native library for constructing, analyzing, and learning causal effect graphs with a 3.77% overhead guarantee.
Blazing Fast
Pure NumPy implementation with optimized kernel operations. Under 4% overhead, verified by continuous benchmarks.
Minimal Surface
One dependency: numpy 1.24+. No pandas, no scikit-learn. 100% type-annotated with exhaustive test coverage.
Causal by Design
Build, analyze, and learn causal graphs from data. Built for researchers and practitioners alike.
Quick Example
example.py
import numpy as np
from cegraph import CausalEffectGraph
# Create a simple graph
ceg = CausalEffectGraph()
ceg.add_edge("treatment", "outcome")
ceg.add_edge("confounder", "treatment")
ceg.add_edge("confounder", "outcome")
# Compute average causal effect
X = np.random.randn(1000, 3)
result = ceg.average_causal_effect(
data=X, treatment="treatment", outcome="outcome"
)
print(f"ACE: {result:.4f}") # ACE: 0.0377 Ready to dive in?
Install with pip and start exploring causal relationships in minutes.
$
pip install cegraph