Skip to main content

causal-learn Python Package

Project description

causal-learn: Causal Discovery in Python

Causal-learn is a python package for causal discovery that implements both classical and state-of-the-art causal discovery algorithms, which is a Python translation and extension of Tetrad.

The package is actively being developed. Feedbacks (issues, suggestions, etc.) are highly encouraged.

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 recommendation regarding causal datasets with high-quality. We are grateful for any effort that benefits the development of 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 some causal discovery algorithms, there are currently a lot 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{causallearn,
  title={Causal-learn: Causal Discovery in Python},
  author={Yujia Zheng and Biwei Huang and Wei Chen and Joseph Ramsey and Mingming Gong and Ruichu Cai and Shohei Shimizu and Peter Spirtes and Kun Zhang},
  journal={arXiv preprint arXiv:2307.16405},
  year={2023}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

causal-learn-0.1.3.4.tar.gz (137.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

causal_learn-0.1.3.4-py3-none-any.whl (173.5 kB view details)

Uploaded Python 3

File details

Details for the file causal-learn-0.1.3.4.tar.gz.

File metadata

  • Download URL: causal-learn-0.1.3.4.tar.gz
  • Upload date:
  • Size: 137.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.12

File hashes

Hashes for causal-learn-0.1.3.4.tar.gz
Algorithm Hash digest
SHA256 77149e6d310d06b1dd8570dfc3fbddec49e7975f6854a8c39d68a7b95b8ed63e
MD5 56b92a0e6ea7a1772962486f50f4585a
BLAKE2b-256 4294f81c0646dc13525f541391943eea0d2fcd1014aaad611186485604671508

See more details on using hashes here.

File details

Details for the file causal_learn-0.1.3.4-py3-none-any.whl.

File metadata

  • Download URL: causal_learn-0.1.3.4-py3-none-any.whl
  • Upload date:
  • Size: 173.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.12

File hashes

Hashes for causal_learn-0.1.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cccccfa689f2a7f8fb47d6b6553547ce2ef2a8f44ac7c043ba22aff0c24679eb
MD5 da05936c6ebc6ec490fd9f1b06334e6f
BLAKE2b-256 6ee9028769d228852e678cf65d40e09c6e55a14cc64fb2436c15c3f2826e6e09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page