D-K-E / graphical-models

Probabilistic Graphical Models from Scratch with support for LWF Chain Graphs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Graphical Models

Python package workflow

DOI

See doxygen generated documentation

The source code of this library aims to be accessible to all those interested in Probabilistic Graphical Models. The primary goal is to facilitate the understanding of models and basic inference strategies using well documented data structures based only on Python 3 standard library. Functions are annotated whenever possible.

Note that there are other alternatives on the subject:

We distinguish from these by the following traits:

  • Though not an entirely graph library like NetworkX, This library is more focused on Graph Theory than probabilistic structures. We implement several graph structures by the book. For example, Trees are implemented as a Graph, just like Paths.

  • Several graph analysis algorithms for:

    • Finding bridges

    • Finding articulation points

    • Finding connected components

    • Finding minimum and maximum spanning trees.

    • Finding shortest paths.

  • We are also one of the rare open sourced python libraries that support inference on LWF Chain Graphs also known as Mixed Graphs. As the overall library is not built for efficiency, we recommend not to use it in production. It should not be to difficult to transfer the concepts introduced in the source code though.

  • References are important for us. Whenever possible we add a reference to a published ressource to the doc string of the function/class. This also applies for tests.

Installation

The entire library depends only on Python standard library. It is tested for Python 3.6 through Github Actions at each push to the library. If you have Python 3.6+, you should be good to go for installation.

If you want to install without creating a virtual environment, just go to the main project directory that contains this readme file and call from terminal:

  • pip install .

If you prefer conda for managing your virtual environments, simply create a new environment:

  • conda create -n pygmodels python=3.6

Activate the environment:

  • conda activate pygmodels

Install the library:

  • pip install .

Lastly test your installation with following command:

  • python -m unittest

You should see something like the following on the terminal:

Ran 179 tests in 0.666s

OK

Usage Examples

See the example notebooks on how to use different PGM types. Please note that running the examples require installing jupyterlab along with PyGModels.

Guide for Contributors

See Contributing.md

Contributors

Citation

For citing in a paper for general usage, use the JOSS paper DOI: DOI

If you absolutely need to reference to a particular version of a source code, you can use the zenodo DOI:

DOI

About

Probabilistic Graphical Models from Scratch with support for LWF Chain Graphs

License:GNU General Public License v3.0


Languages

Language:Python 98.5%Language:TeX 1.5%