https://github.com/pgmpy/pgmpy/actions/workflows/ci.yml/badge.svg?branch=dev https://img.shields.io/pypi/dm/pgmpy.svg https://img.shields.io/pypi/v/pgmpy?color=blue https://img.shields.io/pypi/pyversions/pgmpy.svg?color=blue https://img.shields.io/github/license/pgmpy/pgmpy http://img.shields.io/badge/benchmarked%20by-asv-blue.svg?style=flat https://img.shields.io/badge/Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white

pgmpy is a Python package for causal inference and probabilistic inference using Directed Acyclic Graphs (DAGs) and Bayesian Networks with a focus on modularity and extensibility. Implementations of various algorithms for Causal Discovery (a.k.a, Structure Learning), Parameter Estimation, Approximate (Sampling Based) and Exact inference, and Causal Inference are available.


_images/pgmpy_workflow.png

Possible Workflows in pgmpy for Directed Acyclic Graphs (DAGs) and Bayesian Networks (BNs).


Supported Data Types

Casual Discovery

Parameter Estimation

Causal Inference

Probabilistic Inference

Categorical

Yes

Yes

Yes

Yes

Continuous

Yes

Yes

Yes (partial)

Yes

Mixed

Yes

No

No

No

Time Series

No

Yes

Yes (ApproximateInference)

Yes


Algorithms

Causal Discovery / Structure Learning

Parameter Estimation

Probabilistic Inference

Causal Inference

PC with variants

Maximum Likelihood

Variable Elimination

do-operation

Greedy Equivalence Search(GES)

Bayesian Estimator

Belief Propagation

adjustment sets

Hill-Climb Search

Expectation Maximization (EM)

MPLP

Expert In The Loop

Sampling methods

Tree Search

Max-Min Hill-Climb

Exhaustive Search


Examples

Example notebooks: https://pgmpy.org/examples.html

Tutorial notebooks: https://pgmpy.org/tutorial.html


Citation

If you use pgmpy in your scientific work, please consider citing us:

Ankur Ankan, & Johannes Textor (2024). pgmpy: A Python Toolkit for Bayesian Networks. Journal of Machine Learning Research, 25(265), 1–8.

Bibtex:

@article{Ankan2024,
  author  = {Ankur Ankan and Johannes Textor},
  title   = {pgmpy: A Python Toolkit for Bayesian Networks},
  journal = {Journal of Machine Learning Research},
  year    = {2024},
  volume  = {25},
  number  = {265},
  pages   = {1--8},
  url     = {http://jmlr.org/papers/v25/23-0487.html}
}

Indices and tables