A Swiss Army knife for guessing which variable caused what
Python toolbox that wraps dozens of causal inference algorithms so you don't have to install R, PyTorch, and hope for the best.

What it does
The Causal Discovery Toolbox (cdt) is a Python package for inferring causal relationships from observational data. It covers two main jobs: recovering the structure of directed graphs (which variable influences which) and pairwise causal inference (does X cause Y or vice versa?). The package bundles classical methods like PC, GES, and LiNGAM alongside newer neural approaches such as CGNN and NCC.
The interesting bit
The real labor here isn’t the algorithms—it’s the plumbing. The toolbox wraps R packages (bnlearn, pcalg, kpcalg) behind a Python API, auto-detects your GPU/CPU setup at import time, and provides Docker images with all dependencies pre-installed. Someone did the messy integration work so you don’t have to maintain an R installation just to run one paper’s baseline.
Key highlights
- Implements 20+ algorithms across graph and pairwise causal discovery
- Auto-configures hardware settings (GPUs, CPUs, optional packages) on import via
cdt.SETTINGS - Docker images available for both CPU and GPU (nvidia-docker) environments
- Built on NetworkX graphs, with PyTorch for neural methods and R for classical ones
- Includes benchmark data generators and evaluation metrics (SHD, SID, precision-recall)
Caveats
- Full functionality requires installing R and numerous R packages; the README includes a 30-line bash script for Ubuntu that pulls specific archived package versions
- Some algorithms warn about missing dependencies even after a standard
pip install - Last version badge shows 0.6.0; Travis CI badges suggest maintenance status is unclear
Verdict Grab this if you need to benchmark causal discovery methods or run established algorithms without rewriting R bindings. Skip it if you want a lightweight, pure-Python solution—this is fundamentally an integration layer, and the weight shows.