Bayesian predictive classification and structure learning in decomposable graphical models using particle Gibbs.
Project description
Bayesian inference in decomposable graphical models using sequential Monte Carlo methods
This library contains Bayesian inference in decomposable (triangulated) graphical models based on sequential Monte Carlo methods. Currently supported functionalities include:
-
Bayesian structure learning for discrete log-linear and Gaussian data.
-
Estimation of the number of decomopsable graphs with a given number of nodes.
-
Predictive classification using Bayesian model averaging (BMA).
-
Random generation of junction trees (the Christmas tree algorithm).
Installation
If graphviz is not installed, you can install it from brew / aptitude / pacman for example
$ brew install graphviz
On Ubuntu you might need to run
sudo apt-get install python-dev graphviz libgraphviz-dev pkg-config
Then run
$ pip install trilearn
It is also possible to pull trilearn as a docker image by
$ docker pull onceltuca/trilearn
Running the tests
$ make test
Usage
See the Jupyter notebooks for examples of usage.
Scripts
Continuous data
To approximate the underlying decomposable graph posterior given the dataset sample_data/data_ar1-5.csv run
$ pgibbs_ggm_sample -N 50 -M 1000 -f sample_data/data_ar1-5.csv -o results_ggm
this will produce a file containing the Markov chain generated by the particle Gibbs algorithm. In order to analyze the chain run
$ analyze_graph_tajectories -i results_ggm -o results_ggm/plots
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 particle Gibbs trajectory of decomposable graphs type
$ pgibbs_loglinear_sample -N 50 -M 300 -f sample_data/czech_autoworkers.csv -o results_loglin
and
$ analyze_graph_tajectories -i results_loglin -o results_loglin/plots
this will produce a number of files in the current directory.
Estimate the number of decomposable graphs
To estimate the number of decomposable graphs with up to 15 nodes run for example
$ count_chordal_graphs -p 15 -N 20000
Built With
Authors
- Felix L. Rios just send me an e-mail in case of any questions, felix.leopoldo.rios at gmail com
References
- J. Olsson, T. Pavlenko, and F. L. Rios. Bayesian learning of weakly structural Markov graph laws using sequential Monte Carlo methods. Electron. J. Statist., 13(2):2865–2897, 2019.
- J. Olsson, T. Pavlenko, F. L. Rios, Sequential sampling of junction trees for decomposable graphs, Statistics and Computing 32, 80, 2022
- T. Pavlenko, F. L. Rios, Graphical posterior predictive classifier: Bayesian model averaging with particle Gibbs, Theor. Probability and Math. Statist. 109: 81-99, 2023
License
This project is licensed under the Apache 2.0 License - see the LICENSE file for details
Acknowledgments
- Jim Holmstrom
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file trilearn-2.0.5-py3-none-any.whl
.
File metadata
- Download URL: trilearn-2.0.5-py3-none-any.whl
- Upload date:
- Size: 78.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb89445eb538fa8ddee5196e6468a4b5bd7569819170c2cf432b8681250fe213 |
|
MD5 | d807e5850c52bc3a8a2621aab956795d |
|
BLAKE2b-256 | fb3b29f4bf21821b0bc74a56856a1193e5201ef4ddb9e4602fcc09c56ed00dee |