Skip to content
akatiefPublic
forked from mspronesti/baylib

About

Parallel library for approximate inference on discrete Bayesian networks

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

168 Commits

Folders and files

Repository files navigation

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

About

Parallel library for approximate inference on discrete Bayesian networks

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages