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