{"id":13473650,"url":"https://github.com/py-why/causal-learn","last_synced_at":"2025-12-28T01:35:52.896Z","repository":{"id":37034954,"uuid":"303161792","full_name":"py-why/causal-learn","owner":"py-why","description":"Causal Discovery in Python. It also includes (conditional) independence tests and score functions.","archived":false,"fork":false,"pushed_at":"2025-04-10T02:30:01.000Z","size":28339,"stargazers_count":1334,"open_issues_count":54,"forks_count":213,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-04-27T20:04:04.284Z","etag":null,"topics":["causal","causal-discovery","causal-inference","causal-representation-learning","causality","confounder","graph","hidden-causal","independence-tests","python","statistics","structure","tetrad","time-series"],"latest_commit_sha":null,"homepage":"https://causal-learn.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/py-why.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-11T16:18:35.000Z","updated_at":"2025-04-27T16:03:25.000Z","dependencies_parsed_at":"2025-01-15T20:13:06.321Z","dependency_job_id":"e3f2276a-6eec-4782-a06b-95ace70c9ec8","html_url":"https://github.com/py-why/causal-learn","commit_stats":{"total_commits":466,"total_committers":42,"mean_commits":"11.095238095238095","dds":0.6416309012875536,"last_synced_commit":"8c72b52d0ca5d2ef86016898b2f10ecab5804db2"},"previous_names":["cmu-phil/causal-learn","cmu-phil/pytrad"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py-why%2Fcausal-learn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py-why%2Fcausal-learn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py-why%2Fcausal-learn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py-why%2Fcausal-learn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/py-why","download_url":"https://codeload.github.com/py-why/causal-learn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254010821,"owners_count":21999002,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["causal","causal-discovery","causal-inference","causal-representation-learning","causality","confounder","graph","hidden-causal","independence-tests","python","statistics","structure","tetrad","time-series"],"created_at":"2024-07-31T16:01:05.671Z","updated_at":"2025-12-28T01:35:52.831Z","avatar_url":"https://github.com/py-why.png","language":"Python","readme":"# causal-learn: Causal Discovery in Python\n\nCausal-learn ([documentation](https://causal-learn.readthedocs.io/en/latest/), [paper](https://jmlr.org/papers/volume25/23-0970/23-0970.pdf)) 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](https://github.com/cmu-phil/tetrad).\n\nThe package is actively being developed. Feedbacks (issues, suggestions, etc.) are highly encouraged.\n\n# Package Overview\n\nOur causal-learn implements methods for causal discovery:\n\n* Constraint-based causal discovery methods.\n* Score-based causal discovery methods.\n* Causal discovery methods based on constrained functional causal models.\n* Hidden causal representation learning.\n* Permutation-based causal discovery methods.\n* Granger causality.\n* Multiple utilities for building your own method, such as independence tests, score functions, graph operations, and evaluations.\n\n# Install\n\nCausal-learn needs the following packages to be installed beforehand:\n\n* python 3 (\u003e=3.7)\n* numpy\n* networkx\n* pandas\n* scipy\n* scikit-learn\n* statsmodels\n* pydot\n\n(For visualization)\n\n* matplotlib\n* graphviz\n\nTo use causal-learn, we could install it using [pip](https://pypi.org/project/causal-learn/):\n\n```\npip install causal-learn\n```\n\n\n# Documentation\n\nPlease kindly refer to [causal-learn Doc](https://causal-learn.readthedocs.io/en/latest/) for detailed tutorials and usages.\n\n# Running examples\n\nFor search methods in causal discovery, there are various running examples in the **‘tests’** directory, such as TestPC.py and TestGES.py.\n\nFor the implemented modules, such as (conditional) independent test methods, we provide unit tests for the convenience of developing your own methods.\n\n# Benchmarks\n\nFor the convenience of our community, [CMU-CLeaR](https://www.cmu.edu/dietrich/causality) group maintains a list of benchmark datasets including real-world scenarios and various learning tasks. Please refer to the following links:\n\n* [https://github.com/cmu-phil/example-causal-datasets](https://github.com/cmu-phil/example-causal-datasets) (maintained by Joseph Ramsey)\n* [https://www.cmu.edu/dietrich/causality/projects/causal_learn_benchmarks](https://www.cmu.edu/dietrich/causality/projects/causal_learn_benchmarks)\n\nPlease 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.\n\n\n# Contribution\n\nPlease feel free to open an issue if you find anything unexpected.\nAnd please create pull requests, perhaps after passing unittests in 'tests/', if you would like to contribute to causal-learn.\nWe are always targeting to make our community better!\n\n# Running Tetrad in Python\n\nAlthough causal-learn provides python implementations for some causal discovery algorithms, there are currently a lot more in the classical Java-based [Tetrad](https://github.com/cmu-phil/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](https://github.com/cmu-phil/py-tetrad). Here is a list of [reusable examples](https://github.com/cmu-phil/py-tetrad/tree/main/pytetrad) of how to painlessly benefit from the most comprehensive Tetrad Java codebase.\n\n# Citation\n\nPlease cite as:\n\n```\n@article{zheng2024causal,\n  title={Causal-learn: Causal discovery in python},\n  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},\n  journal={Journal of Machine Learning Research},\n  volume={25},\n  number={60},\n  pages={1--8},\n  year={2024}\n}\n```","funding_links":[],"categories":["Python","Causal Inference and Econometrics"],"sub_categories":["Core Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpy-why%2Fcausal-learn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpy-why%2Fcausal-learn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpy-why%2Fcausal-learn/lists"}