Reference manual for libDAI - A free/open source C++ library for Discrete Approximate Inference methods
- Author:
- Joris Mooij (with contributions of Frederik Eaton)
- Version:
- 0.2.6
- Date:
- August 5, 2010
libDAI is a free/open source C++ library (licensed under GPL 2+) that provides implementations of various (approximate) inference methods for discrete graphical models. libDAI supports arbitrary factor graphs with discrete variables; this includes discrete Markov Random Fields and Bayesian Networks.
The library is targeted at researchers. To be able to use the library, a good understanding of graphical models is needed.
The best way to use libDAI is by writing C++ code that invokes the library; in addition, part of the functionality is accessibly by using the
- command line interface
- (limited) MatLab interface
- (experimental) python interface
- (experimental) octave interface.
libDAI can be used to implement novel (approximate) inference algorithms and to easily compare the accuracy and performance with existing algorithms that have been implemented already.
A solver using libDAI was amongst the three winners of the UAI 2010 Approximate Inference Challenge (see http://www.cs.huji.ac.il/project/UAI10/ for more information). The full source code is provided as part of the library.
Currently, libDAI supports the following (approximate) inference methods:
- Exact inference by brute force enumeration;
- Exact inference by junction-tree methods;
- Mean Field;
- Loopy Belief Propagation [KFL01];
- Fractional Belief Propagation [WiH03];
- Tree-Reweighted Belief Propagation [WJW03];
- Tree Expectation Propagation [MiQ04];
- Generalized Belief Propagation [YFW05];
- Double-loop GBP [HAK03];
- Various variants of Loop Corrected Belief Propagation [MoK07, MoR05];
- Gibbs sampler;
- Conditioned Belief Propagation [EaG09];
- Decimation algorithm.
These inference methods can be used to calculate partition sums, marginals over subsets of variables, and MAP states (the joint state of variables that has maximum probability).
In addition, libDAI supports parameter learning of conditional probability tables by Expectation Maximization.
libDAI is not intended to be a complete package for approximate inference. Instead, it should be considered as an "inference engine", providing various inference methods. In particular, it contains no GUI, currently only supports its own file format for input and output (although support for standard file formats may be added later), and provides very limited visualization functionalities. The only learning method supported currently is Expectation Maximization (or Maximum Likelihood if no data is missing) for learning factor parameters.
In my opinion, the lack of open source "reference" implementations hampers progress in research on approximate inference. Methods differ widely in terms of quality and performance characteristics, which also depend in different ways on various properties of the graphical models. Finding the best approximate inference method for a particular application therefore often requires empirical comparisons. However, implementing and debugging these methods takes a lot of time which could otherwise be spent on research. I hope that this code will aid researchers to be able to easily compare various (existing as well as new) approximate inference methods, in this way accelerating research and stimulating real-world applications of approximate inference.
Because libDAI is implemented in C++, it is very fast compared with implementations in MatLab (a factor 1000 faster is not uncommon). libDAI does provide a (limited) MatLab interface for easy integration with MatLab. It also provides a command line interface and experimental python and octave interfaces (thanks to Patrick Pletscher).
The code has been developed under Debian GNU/Linux with the GCC compiler suite. libDAI compiles successfully with g++ versions 3.4 up to 4.4.
libDAI has also been successfully compiled with MS Visual Studio 2008 under Windows (but not all build targets are supported yet) and with Cygwin under Windows.
Finally, libDAI has been compiled successfully on MacOS X.
The libDAI sources and documentation can be downloaded from the libDAI website:
http://www.libdai.org.
The Google group "libDAI" (
http://groups.google.com/group/libdai) can be used for getting support and discussing development issues.