Skip to main content

A library for Probabilistic Graphical Models

Project description


Build codecov Codacy Badge Downloads Join the chat at asv

pgmpy is a python library for working with Probabilistic Graphical Models.

Documentation and list of algorithms supported is at our official site
Examples on using pgmpy:
Basic tutorial on Probabilistic Graphical models using pgmpy:

Our mailing list is at!forum/pgmpy .

We have our community chat at gitter.


pgmpy has the following non-optional dependencies:

  • python 3.6 or higher
  • networkX
  • scipy
  • numpy
  • pytorch

Some of the functionality would also require:

  • tqdm
  • pandas
  • pyparsing
  • statsmodels
  • joblib


pgmpy is available both on pypi and anaconda. For installing through anaconda use:

$ conda install -c ankurankan pgmpy

For installing through pip:

$ pip install -r requirements.txt  # only if you want to run unittests
$ pip install pgmpy

To install pgmpy from the source code:

$ git clone 
$ cd pgmpy/
$ pip install -r requirements.txt
$ python install

If you face any problems during installation let us know, via issues, mail or at our gitter channel.



Our latest codebase is available on the dev branch of the repository.


Issues can be reported at our issues section.

Before opening a pull request, please have a look at our contributing guide

Contributing guide contains some points that will make our life's easier in reviewing and merging your PR.

If you face any problems in pull request, feel free to ask them on the mailing list or gitter.

If you want to implement any new features, please have a discussion about it on the issue tracker or the mailing list before starting to work on it.


After installation, you can launch the test form pgmpy source directory (you will need to have the pytest package installed):

$ pytest -v

to see the coverage of existing code use following command

$ pytest --cov-report html --cov=pgmpy

Documentation and usage

The documentation is hosted at:

We use sphinx to build the documentation. To build the documentation on your local system use:

$ cd /path/to/pgmpy/docs
$ make html

The generated docs will be in _build/html


We have a few example jupyter notebooks here: For more detailed jupyter notebooks and basic tutorials on Graphical Models check:


Please use the following bibtex for citing pgmpy in your research:

  title={pgmpy: Probabilistic graphical models using python},
  author={Ankan, Ankur and Panda, Abinash},
  booktitle={Proceedings of the 14th Python in Science Conference (SCIPY 2015)},


pgmpy is released under MIT License. You can read about our license at here

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pgmpy-0.1.24.tar.gz (1.9 MB view hashes)

Uploaded source

Built Distribution

pgmpy-0.1.24-py3-none-any.whl (2.0 MB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page