Skip to content

Latest commit

 

History

History
107 lines (93 loc) · 4.33 KB

README.md

File metadata and controls

107 lines (93 loc) · 4.33 KB

baylib C++ library

c++ CI build GPU build License

Baylib is a parallel inference library for discrete Bayesian networks supporting approximate inference algorithms both in CPU and GPU.

Main features

Here's a list of the main requested features:

  • Copy-On-Write semantics for the graph data structure, including the conditional probability table (CPT) of each node
  • parallel implementation of the algorithms either using C++17 threads or GPU computing with boost compute
  • template-based classes for probability format
  • input compatibility with the XDSL format provided by the SMILE library
  • cmake-based deployment

Currently supported algorithms

  • Gibbs Sampling - C++11 threads
  • Likelihood Weighting - C++11 threads
  • Logic Sampling - GPGPU with boost compute
  • Rejection Sampling - C++11 threads
  • Adaptive importance sampling - C++11 threads, GPGPU with boost compute
algorithm evidence deterministic nodes multi-threading GPGPU
gibbs sampling *
likelihood weighting
logic sampling
rejection sampling
adaptive importance sampling

*It's a very well-known limitation of the Gibbs sampling approach

Dependencies

  • cmake >= 2.8
  • boost >= 1.65
  • libtbb
  • ocl-icd-opencl
  • mesa-opencl-icd

Under Linux, you can install the required dependencies using the provided script install_dependencies.sh as follows

 cd scripts/
 chmod u+x install_dependencies.sh
./install_dependencies.sh

Install baylib

Using the cmake FetchContent directives you can directly setup baylib as follows

include(FetchContent)

FetchContent_Declare(
        baylib
        GIT_REPOSITORY https://github.com/mspronesti/baylib.git
)

FetchContent_MakeAvailable(baylib)
# create your executable 
# and whatever you need for
# your project ...
target_link_libraries(<your_executable> baylib)

Alternatively under Linux or MacOS, you can run the provided script install.sh as follows

cd scripts/
chmod u+x install.sh
sudo ./install.sh

another option for the script is running the following commands (assuming you're in the root of the project):

mkdir build
cd build
cmake ..
make
sudo make install

You can now include baylib in your projects.

In the latter two cases, make sure your CMakeLists.txt looks like this

find_package(baylib)
# create your executable 
# and whatever you need for
# your project ...
target_link_libraries(<your_executable> baylib)

Usage

Baylib allows performing approximate inference on Bayesian Networks loaded from xdsl files or created by hand (either using named nodes or numeric identifiers).

Have a look at examples for more.

External references