954f794f0f13752293e5c4804281667595886e19
[libdai.git] / README
1 libDAI - A free/open source C++ library for Discrete Approximate Inference methods
2 ==================================================================================
3
4 v 0.2.2 - May 26, 2008
5
6
7 Copyright (C) 2006-2008 Joris Mooij [joris dot mooij at tuebingen dot mpg dot de]
8 Radboud University Nijmegen, The Netherlands /
9 Max Planck Institute for Biological Cybernetics, Germany
10
11
12 ----------------------------------------------------------------------------------
13 This file is part of libDAI.
14
15 libDAI is free software; you can redistribute it and/or modify
16 it under the terms of the GNU General Public License as published by
17 the Free Software Foundation; either version 2 of the License, or
18 (at your option) any later version.
19
20 libDAI is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with libDAI; if not, write to the Free Software
27 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 ----------------------------------------------------------------------------------
29
30
31 SCIENTISTS: please be aware that the fact that this program is released as Free
32 Software does not excuse you from scientific propriety, which obligates you to
33 give appropriate credit! If you write a scientific paper describing research
34 that made substantive use of this program, it is your moral obligation as a
35 scientist to (a) mention the fashion in which this software was used, including
36 the version number, with a citation to the literature, to allow replication;
37 (b) mention this software in the Acknowledgements section. The appropriate
38 citation is: J. M. Mooij (2008) libDAI: A free/open source C++ library for
39 Discrete Approximate Inference methods, http://mloss.org/software/view/77/.
40 Moreover, as a personal note, I would appreciate it if you would email me with
41 citations of papers referencing this work so I can mention them to my funding
42 agent and tenure committee.
43
44 What is libDAI?
45 ---------------
46 libDAI is a free/open source C++ library (licensed under GPL, see the file
47 COPYING for more details) that provides implementations of various
48 (deterministic) approximate inference methods for discrete graphical models.
49 libDAI supports arbitrary factor graphs with discrete variables (this includes
50 discrete Markov Random Fields and Bayesian Networks).
51
52 libDAI is not intended to be a complete package for approximate inference.
53 Instead, it should be considered as an "inference engine", providing various
54 inference methods. In particular, it contains no GUI, currently only supports
55 its own file format for input and output (although support for standard file
56 formats may be added), and provides no visualization.
57
58 Because libDAI is implemented in C++, it is very fast compared with e.g. MatLab
59 implementations. libDAI does provide a MatLab interface for easy integration
60 with MatLab. Currently, libDAI supports the following deterministic approximate
61 inference methods:
62
63 * Mean Field
64 * (Loopy) Belief Propagation
65 * Tree Expectation Propagation
66 * Generalized Belief Propagation
67 * Double-loop GBP
68 * Loop Corrected Approximate Inference
69
70 Exact inference by JunctionTree is also provided.
71
72 Many of these algorithms are not yet available in similar open source software,
73 to the best of the author's knowledge (open source packages supporting both
74 directed and undirected graphical models are Murphy's BNT, Intel's PNL and gR).
75
76 The library is targeted at researchers; to be able to use the library, a good
77 understanding of graphical models is needed. However, the code will hopefully
78 find its way into real-world applications as well.
79
80
81 Rationale
82 ---------
83 In my opinion, the lack of open source reference implementations hampers
84 progress in research on approximate inference. Methods differ widely in terms
85 of quality and performance characteristics, which also depend in different ways
86 on various properties of the graphical models. Finding the best approximate
87 inference method for a particular application therefore often requires
88 empirical comparisons. However, implementing and debugging these methods takes
89 a lot of time which could otherwise be spent on research. I hope that this code
90 will aid researchers to be able to easily compare various (existing as well as
91 new) approximate inference methods, in this way accelerating research and
92 stimulating real-world applications of approximate inference.
93
94
95 Releases
96 --------
97 Releases can be obtained from http://www.mbfys.ru.nl/~jorism/libDAI.
98 License: GNU Public License v2 (or higher).
99
100 libDAI-0.2 December 1, 2006
101 libDAI-0.2.1 May 26, 2008
102
103
104 Acknowledgments
105 ---------------
106 The development reported here is part of the Interactive Collaborative
107 Information Systems (ICIS) project, supported by the Dutch Ministry of Economic
108 Affairs, grant BSIK03024. I would like to thank Martijn Leisink for providing
109 the basis on which libDAI has been built.
110
111
112 Known issues
113 ------------
114 Due to a bug in GCC 3.3.x and earlier (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20358)
115 it doesn't compile with these versions (it does compile with GCC version 3.4 and higher).
116 Workaround: replace the two NAN's in factor.h causing the error messages by -1.
117
118
119 Documentation
120 -------------
121 Almost nonexistant. But I'm working on it. In the meantime, I'll provide limited support
122 by email. The following gives an overview of different methods and their properties
123 (can be slightly obsolete):
124
125 BP
126 updates UpdateType SEQFIX,SEQRND,SEQMAX,PARALL
127 tol double
128 maxiter size_t
129 verbose size_t
130 MF
131 tol double
132 maxiter size_t
133 verbose size_t
134 HAK
135 clusters MIN,DELTA,LOOP
136 loopdepth
137 doubleloop bool
138 tol double
139 maxiter size_t
140 verbose size_t
141 JTREE
142 updates UpdateType HUGIN,SHSH
143 verbose size_t
144 MR
145 updates UpdateType FULL,LINEAR
146 inits InitType RESPPROP,CLAMPING,EXACT
147 verbose size_t
148 TREEEP
149 type TypeType ORG,ALT
150 tol double
151 maxiter size_t
152 verbose size_t
153 LC
154 cavity CavityType FULL,PAIR,PAIR2,UNIFORM
155 updates UpdateType SEQFIX,SEQRND(,NONE)
156 reinit bool
157 cavainame string
158 cavaiopts Properties
159 tol double
160 maxiter size_t
161 verbose size_t
162
163
164
165 Quick start
166 -----------
167 You need:
168 - a recent version of gcc (version 3.4 at least)
169 - the Boost C++ libraries (under Debian/Ubuntu you can install them using
170 "apt-get install libboost-dev libboost-program-options-dev")
171 - GNU make
172
173 To build the source, edit the Makefile and then run
174
175 make
176
177 If the build was successful, you can test the example program:
178
179 ./example tests/alarm.fg
180
181 or the more elaborate test program:
182
183 tests/test --aliases tests/aliases.conf --filename tests/alarm.fg --methods JTREE_HUGIN BP_SEQMAX
184
185 A description of the factor graph (.fg) file format can be found in the file FILEFORMAT.