/parallelDG

Parallel Bayesian inference for decomposable graphical models.

Primary LanguagePythonApache License 2.0Apache-2.0

GitHub

Bayesian inference for decomposable graphical models using Parallel Metropolis-Hastings MC

A library that implements parallel sampling of decomposable (chordal) graphical models. Currently supported functionalities include:

  • Bayesian structure learning for discrete log-linear and Gaussian data.

Installation

This package currently requires Python 2.7. If graphviz is not installed, you can install it from brew / aptitude / pacman for example

$ brew install graphviz

On Linux system (i.e. Ubuntu/Debian) you might need to run

$ apt install python-dev graphviz libgraphviz-dev pkg-config

Then run

$ pip install parallelDG

It is also possible to pull parallelDG as a docker image by

$ docker pull hallawalla/paralleldg

Usage

See the Jupyter notebooks (and .py's) in examples/.

Scripts

Continuous data

To approximate the underlying decomposable graph posterior given the dataset sample_data/data_ar1-5.csv run

$ parallelDG_ggm_sample -M 10000 -R 100 -f sample_data/data_ar1-5.csv

this will produce a file containing the Markov chain generated by the sample model In order to analyze the chain run

$ analyze_graph_tajectories

this will produce a bunch of files in the current directory to be analyzed.

Discrete data

The data set examples/data/czech_autoworkers.csv contains six binary variables. To generate a MCMC trajectories of decomposable graphs type

$ parallelDG_loglinear_sample -M 10000 -R 100 -f sample_data/czech_autoworkers.csv

and

$ analyze_graph_tajectories

this will produce a number of files in the current directory.

Built With

Authors

  • ** Mohamad Elmasri**. For any questions email me at {first}.{last} at utoronto dot ca.

References

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details

Acknowledgments

  • Felix L. Rios