pywhy-graphs

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

https://github.com/py-why/pywhy-graphs

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.6%) to scientific vocabulary

Keywords

causality graphs networkx python

Keywords from Contributors

mesh pipeline-testing datacleaner data-profilers exoplanet energy-system hydrology neuroimaging frequentist-statistics hep
Last synced: 6 months ago · JSON representation ·

Repository

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

Basic Info
Statistics
  • Stars: 56
  • Watchers: 2
  • Forks: 8
  • Open Issues: 24
  • Releases: 1
Topics
causality graphs networkx python
Created over 3 years ago · Last pushed 7 months ago
Metadata Files
Readme Contributing License Citation Governance

README.md

Code style: black CircleCI unit-tests Checked with mypy codecov PyPI Download count Latest PyPI release

PyWhy-Graphs

pywhy-graphs is a Python graph library that extends networkx with the notion of a MixedEdgeGraph to implement a light-weight API for causal graphical structures that contain mixed-edges and contain causal graph traversal algorithms.

Why?

Representation of causal graphical models in Python are severely lacking.

PyWhy-Graphs implements a graphical API layer for representing commmon graphs in causal inference: ADMG, CPDAG and PAG. For causal DAGs, we recommend using the networkx.DiGraph class and ensuring acylicity via networkx.is_directed_acyclic_graph function.

Existing packages that aim to represent causal graphs either break from the networkX API, or only implement a subset of the relevant causal graphs. By keeping in-line with the robust NetworkX API, we aim to ensure a consistent user experience and a gentle introduction to causal graphical models. A MixedEdgeGraph instance is a composition of networkx graphs and has a similar API, with the additional notion of an "edge type", which specifies what edge type subgraph any function should operate over. For example:

```Python

adds a directed edge from x to y

G.addedge('x', 'y', edgetype='directed')

adds a bidirected edge from x to y

G.addedge('x', 'y', edgetype='bidirected') ```

Moreover, sampling from causal models is non-trivial, but a requirement for benchmarking many causal algorithms in discovery, ID, estimation and more. We aim to provide simulation modules that are easily connected with causal graphs to provide a simple robust API for modeling causal graphs and then simulating data.

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

We aim to provide a very light-weight dependency structure. Minimally, pywhy-graphs requires:

* Python (>=3.8)
* numpy
* scipy
* networkx

Additional functionality may be required when running unit-tests and documentation.

User Installation

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

pip install pywhy-graphs

or you can add it via poetry

poetry add pywhy-graphs

To install the package from github, clone the repository and then cd into the directory. You can then use poetry to install:

poetry install

# for vizualizing graph functionality
poetry install --extras viz

# if you would like an editable install of dodiscover for dev purposes
pip install -e .

pip install https://api.github.com/repos/py-why/pywhy-graphs/zipball/main

Contributing

Pywhy-Graphs is always looking for new contributors to help make the package better, whether it is algorithms, documentation, examples of graph usage, and more! Contributing to Pywhy-Graphs will be rewarding because you will contribute to a much needed package for causal inference.

See our contributing guide for more details.

Citing

Please refer to the Github Citation to cite the repository.

Owner

  • Name: PyWhy
  • Login: py-why
  • Kind: organization

Citation (CITATION.cff)

# YAML 1.2
---
# Metadata for citation of this software according to the CFF format (https://citation-file-format.github.io/)
cff-version: 1.2.0
title: 'Pywhy-Graphs:  Causal graphs that are networkx-compliant for the py-why ecosystem.'
abstract: 'Pywhy-Graphs is a Python library to represent causal graphs and its related algorithms using a networkx-like API in Python.'
authors:
    - given-names: Adam
      family-names: Li
      affiliation: 'Department of Computer Science, Columbia University, New York, NY, USA'
      orcid: 'https://orcid.org/0000-0001-8421-365X'
    - given-names: Jaron
      family-names: Lee
      affiliation: 'Johns Hopkins University'
      email: 'jaron2005@gmail.com'
    - given-names: Aryan
      family-names: Roy
      affiliation: 'Manipal Institute of Technology'
      email: 'aryanroy5678@gmail.com'
type: software
repository-code: 'https://github.com/py-why/pywhy-graphs'
license: MIT
keywords:
  - causality
  - pywhy
  - graphs
  - networkx
...

GitHub Events

Total
  • Watch event: 9
  • Delete event: 1
  • Push event: 223
  • Pull request review comment event: 1
  • Pull request event: 3
  • Pull request review event: 2
  • Create event: 2
Last Year
  • Watch event: 9
  • Delete event: 1
  • Push event: 223
  • Pull request review comment event: 1
  • Pull request event: 3
  • Pull request review event: 2
  • Create event: 2

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 100
  • Total Committers: 8
  • Avg Commits per committer: 12.5
  • Development Distribution Score (DDS): 0.34
Past Year
  • Commits: 9
  • Committers: 4
  • Avg Commits per committer: 2.25
  • Development Distribution Score (DDS): 0.667
Top Committers
Name Email Commits
Adam Li a****2@g****m 66
dependabot[bot] 4****] 12
Aryan Roy 5****y 9
Jaron Lee j****5@g****m 6
pre-commit-ci[bot] 6****] 3
Peter Götz p****z@g****m 2
Julien Siebert 8****n 1
Amit Sharma a****r@m****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 45
  • Total pull requests: 80
  • Average time to close issues: 2 months
  • Average time to close pull requests: 25 days
  • Total issue authors: 4
  • Total pull request authors: 7
  • Average comments per issue: 2.33
  • Average comments per pull request: 4.74
  • Merged pull requests: 65
  • Bot issues: 0
  • Bot pull requests: 18
Past Year
  • Issues: 3
  • Pull requests: 7
  • Average time to close issues: N/A
  • Average time to close pull requests: 24 days
  • Issue authors: 2
  • Pull request authors: 4
  • Average comments per issue: 1.0
  • Average comments per pull request: 0.86
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 5
Top Authors
Issue Authors
  • adam2392 (22)
  • aryan26roy (9)
  • robertness (8)
  • jaron-lee (5)
Pull Request Authors
  • adam2392 (37)
  • dependabot[bot] (20)
  • aryan26roy (17)
  • pre-commit-ci[bot] (8)
  • jaron-lee (8)
  • petergtz (2)
  • siebert-julien (1)
Top Labels
Issue Labels
Algorithms (5) bug (5) good first issue (4) enhancement (2) help wanted (2)
Pull Request Labels
dependencies (20) No Changelog Needed (11)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 163 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 1
  • Total maintainers: 1
pypi.org: pywhy-graphs

Causal Graphs for Python

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 163 Last month
Rankings
Dependent packages count: 10.0%
Stargazers count: 11.4%
Forks count: 12.5%
Average: 20.0%
Dependent repos count: 21.7%
Downloads: 44.1%
Maintainers (1)
Last synced: 6 months ago

Dependencies

pyproject.toml pypi
  • importlib-resources *
  • networkx ^2.8.8
  • numpy ^1.21.0
  • pygraphviz *
  • python >=3.8,<3.11
  • scipy ^1.8.0
.github/workflows/circle_artifacts.yml actions
  • larsoner/circleci-artifacts-redirector-action master composite
.github/workflows/main.yml actions
  • abatilo/actions-poetry v2.2.0 composite
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • codecov/codecov-action v3 composite
  • softprops/action-gh-release v1 composite
.github/workflows/pr_checks.yml actions
  • actions/checkout v3 composite
poetry.lock pypi
  • 160 dependencies