← all repositories
py-why/causal-learn

Causal graphs from raw data, no A/B test required

A Python toolkit that tries to tease out cause-and-effect relationships from plain observational data using a broad menu of discovery algorithms.

1.6k stars Python Other AI
causal-learn
Velocity · 7d
+0.8
★ / day
Trend
steady
star history

What it does

Causal-learn is a Python implementation of causal discovery algorithms: statistical methods that attempt to reconstruct cause-and-effect structures (directed graphs) from observational data alone, without controlled experiments. It bundles constraint-based methods (like PC), score-based methods, permutation-based approaches, Granger causality, and utilities for independence tests and graph operations.

The interesting bit

The project doesn’t pretend to solve causality with one magic algorithm. Instead it collects multiple classical and newer approaches under one roof, letting you compare how different assumptions lead to different inferred graphs. It also explicitly acknowledges its limits by pointing users to py-tetrad when they need the deeper Java-based Tetrad codebase.

Key highlights

  • Implements constraint-based, score-based, and functional-model-based discovery methods
  • Includes hidden causal representation learning and Granger causality
  • Provides modular utilities: independence tests, score functions, graph operations, evaluations
  • Published in JMLR (volume 25, 2024) with active maintenance
  • Maintains links to CMU benchmark datasets for validation

Caveats

  • The README notes the package is “actively being developed,” which suggests APIs may shift
  • Running examples live in the tests/ directory rather than dedicated documentation
  • Visualization requires extra dependencies (matplotlib, graphviz) beyond the core install

Verdict

Worth a look if you’re doing observational causal inference in Python and want to compare multiple algorithmic approaches without writing them from scratch. Skip it if you need production-hardened pipelines or deep Bayesian causal modeling; this is a research toolkit, not a finished product.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.