bayesmix
is a C++ library for running MCMC simulations in Bayesian mixture models.
Current state of the software:
bayesmix
performs inference for mixture models of the kind
where P is either the Dirichlet process or the Pitman--Yor process
-
We currently support univariate and multivariate location-scale mixture of Gaussian densities
-
Inference is carried out using algorithms such as Algorithm 2 in Neal (2000)
-
Serialization of the MCMC chains is possible using Google's Protocol Buffers aka
protobuf
Warning: make sure you have a recent version of cmake
installed (at least 3.20.x) or install protobuf
beforehand (see the section for developers)!
To install and use bayesmix
, please cd
to the folder to which you wish to install it, and clone this repository with the following command-line instruction:
git clone --recurse-submodule git@github.com:bayesmix-dev/bayesmix.git
Then, by using cd bayesmix
, you will enter the newly downloaded folder.
To build the executable for the main file run_mcmc.cc
, please use the following list of commands:
mkdir build
cd build
cmake .. -DDISABLE_DOCS=on -DDISABLE_BENCHMARKS=on -DDISABLE_TESTS=on
make run
cd ..
The build/run_mcmc
executable can be used to perform all the necessary analysis, but it needs some command-line arguments to be passed.
To perform your first run of the library right out of the box, you can call the following script from the command line:
examples/tutorial/run.sh
This is an example script that runs said executable by passing appropriate arguments to it. In order to use your custom datasets, algorithm settings, and prior specifications, you can create a copy of the above script and change the arguments as appropriate. Please refer to the documentation for more information.
We heavily depend on the protobuf
library to move and store structured data.
The CMakeLists.txt
file is set up to install such library if it does not find it in the computer.
However any call to make clean
will uninstall it, causing a huge waste of time... so make sure to install it manually beforehand!
If you're using a Linux machine, you can do so as follows:
sudo apt-get install autoconf automake libtool curl make g++ unzip cmake
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protobuf-python-3.14.0.zip
unzip protobuf-python-3.14.0.zip
cd protobuf-3.14.0/
./configure --prefix=/usr
make check
sudo make install
sudo ldconfig
On Mac and Windows machines, please follow the steps from the official protobuf
installation guide.
Another very useful tool is ccache
that can significantly speed up the compilation process.
Finally, to compile unit tests, please use the following commands:
cd build
cmake ..
make test_bayesmix
cd ..
The corresponding executable is located at build/test/test_bayesmix
.
Documentation is available at https://bayesmix.readthedocs.io.
Please check out CONTRIBUTORS.md for details on how to collaborate with us.