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.

Possible Workflows in pgmpy for Directed Acyclic Graphs (DAGs) and Bayesian Networks (BNs).¶
Supported Data Types¶
Causal Discovery |
Parameter Estimation |
Causal Inference |
Probabilistic Inference |
Simulations |
|
---|---|---|---|---|---|
Categorical |
Yes |
Yes |
Yes |
Yes |
Yes |
Continuous |
Yes |
Yes |
Yes (partial) |
Yes |
Yes |
Mixed |
Yes |
No |
No |
No |
Yes |
Time Series |
No |
Yes |
Yes (ApproximateInference) |
Yes |
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}
}