• Stars
    star
    1,100
  • Rank 41,854 (Top 0.9 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 26 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Causal Discovery in Python. It also includes (conditional) independence tests and score functions.

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}
}

More Repositories

1

dowhy

DoWhy is a Python library for causal inference that supports explicit modeling and testing of causal assumptions. DoWhy is based on a unified language for causal inference, combining causal graphical models and potential outcomes frameworks.
Python
6,954
star
2

EconML

ALICE (Automated Learning and Intelligence for Causation and Economics) is a Microsoft Research project aimed at applying Artificial Intelligence concepts to economic decision making. One of its goals is to build a toolkit that combines state-of-the-art machine learning techniques with econometrics in order to bring automation to complex causal inference problems. To date, the ALICE Python SDK (econml) implements orthogonal machine learning algorithms such as the double machine learning work of Chernozhukov et al. This toolkit is designed to measure the causal effect of some treatment variable(s) t on an outcome variable y, controlling for a set of features x.
Jupyter Notebook
3,699
star
3

causaltune

AutoML for causal inference.
Jupyter Notebook
191
star
4

dodiscover

[Experimental] Global causal discovery algorithms
Python
76
star
5

pywhy-graphs

[Experimental] Causal graphs that are networkx-compliant for the py-why ecosystem.
Python
45
star
6

pywhy-stats

Python package for (conditional) independence testing and statistical functions related to causality.
Python
20
star
7

py-why.github.io

Contains the code for https://py-why.github.io/
HTML
8
star
8

pywhy-notes

Keep track of discussions and meeting minutes.
5
star
9

graphs

[Not used] Now, an open PR for mixed-edge graph support is open in networkx
Python
2
star
10

governance

This repository describes the governance model for the PyWhy org
1
star
11

dowhy-example-notebooks-deps-dockerfile

Dockerfile
1
star