Skip to content

A lightweight graph class library relevant for causal inference.

License

Notifications You must be signed in to change notification settings

adam2392/causal-networkx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code style: black CircleCI Main Checked with mypy codecov

causal-networkx

Causal-Networkx is a Python graph library that extends networkx to implement causal graphical structures.

Causal-networkx does not directly subclass networkx graphs because they inherently do not support mixed edge graphs. Moreover, there are certain "graph algorithms" in networkx that would not work with mixed edge graphs. However, for the purposes of causal inference, only certain graph semantics are needed. Thus we have a lightweight library for causal graph representations that leverage the robustness and efficiency of networkx.

Why?

Representation of causal inference models in Python are severely lacking. Moreover, sampling from causal models is non-trivial. However, sampling from simulations is a requirement to benchmark different structural learning, causal ID, or other causal related algorithms.

This package aims at serving as a framework for representing causal models and sampling from causal models.

causal-networkx interfaces with other popular Python packages, such as networkx for graphical representations.

Documentation

See the development version documentation.

Or see stable version documentation

Installation

Installation is best done via pip or conda. For developers, they can also install from source using pip. See installation page for full details.

Dependencies

Minimally, causal-networkx requires:

* Python (>=3.8)
* NumPy
* SciPy
* Networkx
* Pandas

For extra functionality, see the extra-requirements.txt for additional packages that one might install.

User Installation

If you already have a working installation of numpy, scipy and networkx, the easiest way to install causal-networkx is using pip:

# doesn't work until we make an official release :p
pip install -U causal-networkx

To install the package from github, clone the repository and then cd into the directory:

pip install -e .

Current Limitations and Current Roadmap

Currently, selection bias representation is not implemented in the graphs and corresponding algorithms. However, I believe it is technically feasible based on the design of how we use networkx.

The roadmap currently is to integrate the next phases of causal ID, estimation, refutation and experimental design with the py-why organization and its package "dowhy".

About

A lightweight graph class library relevant for causal inference.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published