Skip to main content
causal-learn-logo

Causal-learn (documentation, paper) is an open-source platform for causal learning with both classical and state-of-the-art causal discovery algorithms. It aims to recover causal structure from observational data, without requiring interventional experiments, while offering provable correctness guarantees.

The package is actively being developed. Feedback (issues, suggestions, etc.) would be greatly appreciated.

News

Causal discovery is now available anytime, anywhere!

Check out our latest online agentic version of causal-learn: causallearn.com

Package Overview

Our causal-learn implements methods for causal discovery:

  • Constraint-based causal discovery methods.
  • Score-based causal discovery methods.
  • Causal discovery methods based on constrained functional causal models.
  • Hidden causal representation learning.
  • Permutation-based causal discovery methods.
  • Granger causality.
  • Multiple utilities for building your own method, such as independence tests, score functions, graph operations, and evaluations.

Install

Causal-learn needs the following packages to be installed beforehand:

  • python 3 (>=3.7)
  • numpy
  • networkx
  • pandas
  • scipy
  • scikit-learn
  • statsmodels
  • pydot

(For visualization)

  • matplotlib
  • graphviz

To use causal-learn, we could install it using pip:

pip install causal-learn

Documentation

Please kindly refer to causal-learn Doc for detailed tutorials and usages.

Running examples

For search methods in causal discovery, there are various running examples in the ‘tests’ directory, such as TestPC.py and TestGES.py.

For the implemented modules, such as (conditional) independent test methods, we provide unit tests for the convenience of developing your own methods.

Benchmarks

For the convenience of our community, CMU-CLeaR group maintains a list of benchmark datasets including real-world scenarios and various learning tasks. Please refer to the following links:

Please feel free to let us know if you have any recommendations regarding causal datasets with high-quality. We are grateful for any effort that benefits the development of the causality community.

Contribution

Please feel free to open an issue if you find anything unexpected. And please create pull requests, perhaps after passing unittests in 'tests/', if you would like to contribute to causal-learn. We are always targeting to make our community better!

Running Tetrad in Python

Although causal-learn provides Python implementations for many causal discovery algorithms, there are more in the classical Java-based Tetrad program. For users who would like to incorporate arbitrary Java code in Tetrad as part of a Python workflow, we strongly recommend considering py-tetrad. Here is a list of reusable examples of how to painlessly benefit from the most comprehensive Tetrad Java codebase.

Citation

Please cite as:

@article{zheng2024causal,
  title={Causal-learn: Causal discovery in python},
  author={Zheng, Yujia and Huang, Biwei and Chen, Wei and Ramsey, Joseph and Gong, Mingming and Cai, Ruichu and Shimizu, Shohei and Spirtes, Peter and Zhang, Kun},
  journal={Journal of Machine Learning Research},
  volume={25},
  number={60},
  pages={1--8},
  year={2024}
}

Metadata

Release files for causal-learn 0.1.4.8

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-learn 0.1.4.8
File Size Uploaded
causal_learn-0.1.4.8.tar.gz 201.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for causal-learn 0.1.4.8
File Interpreter ABI Platform
causal_learn-0.1.4.8-py3-none-any.whl Python 3 none any Details

Total release size: 447.8 kB

Release files / causal_learn-0.1.4.8.tar.gz

Download URL causal_learn-0.1.4.8.tar.gz
Size 201.9 kB
Tags Source
SHA-256 checksum
How to use checksums
03a2271e7b7c4835f04786c30bf190b8e24179eb71a42c32de9e4866ca37f397
BLAKE2b-256 checksum
How to use checksums
0581de8c9b92c55deecef1c1b5b36f4ab844f50fad16c13e1d1aa1c974983bea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.7

Release files / causal_learn-0.1.4.8-py3-none-any.whl

Download URL causal_learn-0.1.4.8-py3-none-any.whl
Size 245.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c8d408c0b2fecdf150584cbcd8271efeb590e692b8e7f6f67ed215339a094e6
BLAKE2b-256 checksum
How to use checksums
6b0d467f1fc5ba6693e4acaa5b5caa88438574c9ec83fe6688b8e601cc0b3841
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.7
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