Skip to content

Latest commit

 

History

History
68 lines (55 loc) · 2.39 KB

README.md

File metadata and controls

68 lines (55 loc) · 2.39 KB

PyPI version

This package is nearing a V1 release, with potential (minor) breaking changes. After the release, future breaking changes will occur less frequently and with more notice. Please raise issues as needed.

causaldag is common wrapper for the following packages:

Installing and importing causaldag should be sufficient for most use cases.

CausalDAG is a Python package for the creation, manipulation, and learning of Causal DAGs. CausalDAG requires Python 3.5+

Install

Install the latest version of CausalDAG:

$ pip3 install causaldag

Cite

You may use the following bibtex for citing causaldag:

@manual{squires2018causaldag,
  title={{\texttt{causaldag}: creation, manipulation, and learning of causal models}},
  author={{Chandler Squires}},
  year={2018},
  url={https://github.com/uhlerlab/causaldag},
}

Or the following text:

Chandler Squires. causaldag: creation, manipulation, and learning of causal models, 2018. URL https://github.com/uhlerlab/causaldag

Documentation

Documentation for each subpackage is available at:

Examples for specific algorithms can be found at https://uhlerlab.github.io/causaldag/

Simple Example

Find the CPDAG (complete partially directed acyclic graph, AKA the essential graph) corresponding to a DAG:

>>> from causaldag import rand, partial_correlation_suffstat, partial_correlation_test, MemoizedCI_Tester, gsp
>>> import numpy as np
>>> np.random.seed(12312)
>>> nnodes = 5
>>> nodes = set(range(nnodes))
>>> dag = rand.directed_erdos(nnodes, .5)
>>> gdag = rand.rand_weights(dag)
>>> samples = gdag.sample(100)
>>> suffstat = partial_correlation_suffstat(samples)
>>> ci_tester = MemoizedCI_Tester(partial_correlation_test, suffstat, alpha=1e-3)
>>> est_dag = gsp(nodes, ci_tester)
>>> dag.shd_skeleton(est_dag)

License

Released under the 3-Clause BSD license (see LICENSE.txt):

Copyright (C) 2018
Chandler Squires <csquires@mit.edu>