Official implementation for paper: Summarizing Bayesian Nonparametric Mixture Posterior - Sliced Optimal Transport Metrics for Gaussian Mixtures
The code can also be found at https://github.com/khainb/sbnpm-sot.
Details of the model architecture and experimental results can be found in our papers.
@article{nguyen2024summarizing,
title={Summarizing Bayesian Nonparametric Mixture Posterior--Sliced Optimal Transport Metrics for Gaussian Mixtures},
author={Nguyen, Khai and Mueller, Peter},
journal={arXiv preprint arXiv:2411.14674},
year={2024}
}
Please CITE our paper whenever this repository is used to help produce published results or incorporated into other software.
This implementation is made by Khai Nguyen.
Python 3.11.4 (with pip) and R 4.3.1 with RStudio were used to produce results, however, they are not strictly required for running the code.
These packages were used to produce results, however, their mentioned specific version are not strictly required for running the code.
pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124
pip install -r requirements.txt
If the above versions of packages are not available for your system, use:
pip install torch torchvision torchaudio
pip install -r requirements_general.txt
Install package salso.
- Implementation of Mixed Sliced Wasserstein (Mix-SW) distance, Sliced Mixture Wasserstein (SMix-W) distance, and posterior summarization framework for Dirichlet Process mixture model.
- Code for simulation
- Code for analysis on Faithful dataset
- Code for testing Monte Carlo approximation
Please check out sot_gms.py.
Code is in the folder simulation.
- run_truncated_dpgmm.py: This file runs posterior inference for truncated Dirichlet process Gaussian mixture model.
- summarizing_with_sw.py: This file runs mixing measure summarization, partition summarization, and density summarization with vectorized SW.
- summarizing_with_mixsw.py: This file runs mixing measure summarization, partition summarization, and density summarization with Mix-SW.
- summarizing_with_smixw.py: This file runs mixing measure summarization, partition summarization, and density summarization with SMix-W.
- summarizing_partition_with_salso.R: This file runs partition summarization with Binder, VI, and omARI, and also evaluate them.
- density_from_partition.py: This file runs density summarization from the given partition summarization with Binder, VI, and omARI.
- evaluate_partition_with_salso.R: This file evaluates partition summarization from SW, Mix-SW, and SMix-W.
- evaluate_density.py: This file evaluates the density summarization from all methods.
- evaluate_mixing_measures.py: This file evaluates the mixing measure summarization from SW, Mix-SW, and SMix-W.
- plotting_density.py: This file plots the density summarization and partition summarization figures.
Please update directory path at line 3 in summarizing_partition_with_salso.R and evaluate_partition_with_salso.R.
cd simulation
python evaluate_density.py
python plotting_density.py
python evaluate_mixing_measures.py
Rscript summarizing_partition_with_salso.R
Rscript evaluate_partition_with_salso.R
For running from scratch:
cd simulation
python run_truncated_dpgmm.py
python summarizing_with_sw.py
python summarizing_with_mixsw.py
python summarizing_with_smixw.py
Rscript summarizing_partition_with_salso.R
python density_from_partition.py
python evaluate_density.py
python plotting_density.py
python evaluate_mixing_measures.py
Rscript evaluate_partition_with_salso.R
Code is in the folder faithful.
- run_truncated_dpgmm.py: This file runs posterior inference for truncated Dirichlet process Gaussian mixture model.
- summarizing_with_sw.py: This file runs mixing measure summarization, partition summarization, and density summarization with vectorized SW.
- summarizing_with_mixsw.py: This file runs mixing measure summarization, partition summarization, and density summarization with Mix-SW.
- summarizing_with_smixw.py: This file runs mixing measure summarization, partition summarization, and density summarization with SMix-W.
- summarizing_partition_with_salso.R: This file runs partition summarization with Binder, VI, and omARI, and also evaluate them.
- density_from_partition.py: This file runs density summarization from the given partition summarization with Binder, VI, and omARI.
- evaluate_partition_with_salso.R: This file evaluates partition summarization from SW, Mix-SW, and SMix-W.
- evaluate_density.py: This file evaluates the density summarization from all methods.
- plotting_density.py: This file plots the density summarization and partition summarization figures.
Please update directory path at line 3 in summarizing_partition_with_salso.R and evaluate_partition_with_salso.R.
cd faithful
python evaluate_density.py
python plotting_density.py
python evaluate_mixing_measures.py
Rscript summarizing_partition_with_salso.R
Rscript evaluate_partition_with_salso.R
For running from scratch:
cd faithful
python run_truncated_dpgmm.py
python summarizing_with_sw.py
python summarizing_with_mixsw.py
python summarizing_with_smixw.py
Rscript summarizing_partition_with_salso.R
python density_from_partition.py
python evaluate_density.py
python plotting_density.py
python evaluate_mixing_measures.py
Rscript evaluate_partition_with_salso.R
Code is in the folder MonteCarlo
cd MonteCarlo
python main.py