Improved factor.h/cpp code and finished corresponding unit tests
[libdai.git] / ChangeLog
1 git HEAD
2 --------
3
4 TODO:
5 * Write unit tests for newly added functions
6
7 * Fixed some bugs in the MatLab interface build system
8 * Fixed a bug in utils/fginfo.cpp
9 * Improved factor.h/cpp:
10 - Fixed bug in min( const TFactor<T> &, const TFactor<T> & )
11 - Fixed bug in max( const TFactor<T> &, const TFactor<T> & )
12 - Added TFactor<T>::takeAbs()
13 - Added TFactor<T>::takeExp()
14 - Added TFactor<T>::takeLog( bool )
15 - Added TFactor<T>::operator-() const
16 - Added TFactor<T>::sumAbs() const
17 - Added TFactor<T>::operator=( const TFactor<T> &y )
18 - Renamed TFactor<T>::states() into TFactor<T>::nrStates()
19 - Added get(size_t) and set(size_t,T) operators; get() is
20 equivalent to "operator[](size_t) const" and set() should
21 be used instead of the non-const operator[], which has been deprecated
22 * Improved prob.h/cpp:
23 - Added TProb<T>::operator==( const TProb<T> &q )
24 - TProb<T>::accumulate() now also applies op2 to init
25 - Fixed bug by renaming TProb<T>::operator<=() to TProb<T>::operator<()
26 - TProb<T>& operator/= (T x) now yields 0 when dividing by 0
27 - Changed format of TProb<T> when streamed to an ostream
28 - Added get(size_t) and set(size_t,T) operators; get() is
29 equivalent to "operator[](size_t) const" and set() should
30 be used instead of the non-const operator[], which has been deprecated
31 - Added TProb<T>::resize(size_t, T)
32 * Improved index.h/cpp:
33 - Added multifor::reset()
34 * Improved properties.h/cpp:
35 - Renamed PropertySet::Set() -> PropertySet::set()
36 - Renamed PropertySet::Get() -> PropertySet::get()
37 - Renamed PropertySet::GetAs<T>() -> PropertySet::getAs<T>()
38 - Renamed PropertySet::ConvertTo<T>() -> PropertySet::convertTo<T>()
39 - Added PropertySet::size()
40 - Added PropertySet::clear()
41 - Added PropertySet::erase()
42 - Fixed bug in PropertySet::setAsString<T>()
43 * Improved util.h/cpp:
44 - Fixed a bug in rnd_seed()
45 - Removed Real max( const std::vector<Real> &v )
46 * Improved weightedgraph.h/cpp:
47 - Renamed MaxSpanningTreePrims into MaxSpanningTree
48 - Renamed MinSpanningTreePrims into MinSpanningTree
49 - Added option to MaxSpanningTree and MinSpanningTree for
50 choosing between Prim's algorithm and Kruskal's algorithm
51 - More error checking in RootedTree constructor
52 - The vertices in DEdge and UEdge are now named "first" and "second"
53 for compatibility with a std::pair<size_t,size_t>
54 - Added GraphEL( const GraphAL& G ) constructor
55 * Improved bipgraph.h/cpp:
56 - Fixed bug in BipartiteGraph::eraseNode1()
57 - Fixed bug in BipartiteGraph::eraseNode2()
58 - Fixed bug in BipartiteGraph::isTree()
59 - Added BipartiteGraph::hasEdge()
60 - Added BipartiteGraph::findNb1()
61 - Added BipartiteGraph::findNb2()
62 - BipartiteGraph::delta1() and BipartiteGraph::delta2() now
63 return a SmallSet<size_t> instead of a vector<size_t>
64 * Improved graph.h/cpp:
65 - Fixed bug in GraphAL::nrEdges()
66 - Fixed bug in GraphAL::addEdge()
67 - Fixed bug in GraphAL::isTree()
68 - Fixed bug in GraphAL::eraseNode()
69 - Fixed bug in GraphAL::printDot()
70 - Fixed bug in createGraphGrid3D()
71 - Fixed bug in createGraphRegular()
72 - Added GraphAL::hasEdge(size_t,size_t)
73 * Improved smallset.h/cpp:
74 - The sizeHint argument of the iterator constructor
75 SmallSet::SmallSet( TIterator begin, TIterator end, size_t sizeHint=0 )
76 no longer has a default value in order to avoid confusion with the
77 SmallSet::SmallSet( const T &t1, const T &t2 )
78 constructor.
79 * Removed RandomDRegularGraph(), please use createGraphRegular() instead
80 * Compressed Makefile
81 * Added unit tests for var, smallset, varset, graph, bipgraph,
82 weightedgraph, enum, util, properties, index, prob, factor
83 * Added unit testing framework
84 * Added initialization of TRWBP weights by sampling spanning trees
85 * Cleaned up MR code:
86 - rewrote response propagation implementation with help of BBP
87 - now uses GraphAL to represent the Markov graph
88 - miscellaneous smaller cleanups
89 * Fixed bug in BBPCostFunction::operator=() which prevented the desired
90 assignment from happening
91 * [Stefano Pellegrini] Fixed bug in BP[logdomain=1,inference=MAXPROD]
92 * Removed deprecated functionality
93 * Updated ChangeLog for libDAI-0.2.4 (forgot a few entries)
94
95
96 libDAI-0.2.4 (2010-02-11)
97 -------------------------
98
99 New features:
100 * Implemented Tree-Reweighted BP
101 * [Frederik Eaton] Implemented Fractional Belief Propagation
102
103 Miscellaneous improvements:
104 * Improved documentation
105 * [Frederik Eaton] Added constructors for BBPCostFunction
106 * [Frederik Eaton] Added accessor/mutator for the elements of a SmallSet<>
107 * [Frederik Eaton] Added unary minus to TProb<>
108 * [Frederik Eaton] Added Hellinger distance to TProb<>::DistType
109 * [Frederik Eaton] Two small patches for src/jtree.cpp and utils/createfg.cpp
110 * tests/testdai option "marginals" now has three possible values: NONE
111 outputs no marginals, VAR only variable marginals, and ALL outputs all
112 marginals calculated by the algorithm.
113 * Strengthened convergence criteria of various algorithms
114 * Added GraphAL, an adjacency list implementation for graphs,
115 similar to (but simpler than) BipartiteGraph
116 * Added some functionality to create various standard factors
117 (the functions whose names start with "createFactor")
118 * Added examples example_sprinkler_gibbs and example_sprinkler_em
119 * Implemented various heuristics for choosing a variable elimination sequence
120 in JTree
121 * Added BETHE method for GBP/HAK cluster choice
122 * Made alias support official part of the library
123
124 Build system:
125 * Moved platform independent build options into Makefile.ALL
126 * Windows platform now needs Boost 1.37 or higher
127
128 Code cleanup:
129 * Cleaned up utils/createfg and tests/testdai
130 * Cleanup of some duplicate code in BP, FBP, TRWBP
131
132 Interface changes (the old interface is marked obsolete and will be removed in the next release):
133 * Removed obsolete/deprecated stuff
134 * Renamed Graph into GraphEL (for Graph, implemented as Edge List)
135 * Renamed some functions of BipartiteGraph:
136 add1() -> addNode1()
137 erase1() -> eraseNode1()
138 nr1() -> nrNodes1()
139 add2() -> addNode2()
140 erase2() -> eraseNode2()
141 nr2() -> nrNodes2()
142 * Renamed some functions in ClusterGraph:
143 ClusterGraph::eliminationCost() -> ::eliminationCost_MinFill()
144 ClusterGraph::VarElim() -> ClusterGraph::VarElim( sequentialVariableElimination( ElimSeq ) )
145 ClusterGraph::VarElim_MinFill() -> ClusterGraph::VarElim( greedyVariableElimination( eliminationCost_MinFill ) )
146 * Changed interface of one RegionGraph constructor
147 * Renamed "Clamped BP" into "Conditioned BP"
148
149 Bug fixes:
150 * Fixed regression in scripts/regenerate-properties (now all errors are
151 gathered before throwing the exception, as used to be the case)
152 * Fixed FTBFS errors on MACOSX (thanks to Sebastian Riedel for reporting this bug)
153 * [Alexander Schwing] Fixed error in BP that occured with damping
154 and using log-domain updates
155 * Fixed bug in HAK for trivial region graphs (with only one outer region
156 and no inner regions), reported by Alejandro Lage.
157 * Fixed long-standing bug in TreeEP (now, within-loop propagation optimization works)
158
159
160 libDAI-0.2.3 (2009-11-16)
161 -------------------------
162
163 New features:
164 * Complete doxygen documentation (although more detailed documentation still
165 has to be written)
166 * [Charles Vaske] Added parameter learning for conditional probabilities by
167 Expectation Maximization
168 * [Patrick Pletscher] Added SWIG wrapper code for experimental python and
169 octave interfaces
170 * Added Max-Product functionality to JTree
171 * [Frederik Eaton] Added Back-Belief-Propagation
172 * [Frederik Eaton] Added approximate inference method "Clamped Belief Propagation"
173 * [Frederik Eaton] Added approximate inference method "Gibbs sampling"
174
175 Code cleanup:
176 * Updated copyright headers
177 * Cleaned up error handling by introducing the DAI_THROWE macro
178 * Introduced DAI_DEBASSERT macro to abbreviate a common pattern
179 * Replaced the standard assert() macro by DAI_ASSERT, which throws a
180 dai::Exception and is even active if NDEBUG is defined
181 * Removed all the virtual default constructors *::create(), as they are not used
182 * [Frederik Eaton] Removed unnecessary copy constructors and assignment operators
183 * [Frederik Eaton] Change cout to cerr in warnings and error messages
184
185 Miscellaneous improvements:
186 * BipartiteGraph:
187 - Added eraseEdge( size_t n1, size_t n2 )
188 - [Frederik Eaton] Improved documentation of Neighbor
189 * TProb<T>:
190 - Added divided_by(const TProb<T>&) const
191 - Added constructor TProb<T>( const std::vector<S> &v )
192 - Added size_t draw(), which draws a random index
193 - [Frederik Eaton] Added setUniform()
194 - [Frederik Eaton] Added sumAbs()
195 - [Frederik Eaton] Added argmax()
196 - [Giuseppe Passino] Added begin(), end()
197 * TFactor<T>:
198 - [Giuseppe Passino] Added begin(), end()
199 - [Charles Vaske] Added TFactor( const std::vector<Var> &vars, const std::vector<T> &p ),
200 which reorders variables to canonical ordering before storing the table
201 - Added constructor TFactor<T>( const VarSet &vars, const std::vector<S> &v )
202 - Extended functionality of TFactor<T>::operators +,-,+=,-= to handle different VarSets
203 - Added TFactor<T>::maxMarginal (similar to marginal but with max instead of sum)
204 * State:
205 - [Giuseppe Passino] Added prefix ++ operator
206 * Permute:
207 - [Charles Vaske] Added constructor in Permute for canonical variable ordering
208 * FactorGraph:
209 - [Frederik Eaton] Added clampVar()
210 - [Frederik Eaton] Added clampFactor()
211 - [Giuseppe Passino] Added begin(), end()
212 * PropertySet:
213 - Added keys(), for getting all keys
214 - [Frederik Eaton] Added default constructor
215 - [Frederik Eaton] Added constructor from string
216 * InfAlg:
217 - Added setProperties(), getProperties() and printProperties()
218 - [Frederik Eaton] Added beliefV(), beliefF()
219 * ExactInf:
220 - Added calcMarginal(const VarSet &)
221 * HAK:
222 - Added "init" parameter to allow for random initialization
223 * BP:
224 - [Giuseppe Passino] Added findMaximum(), which can be used after running
225 max-product BP to construct a global state with maximum probability
226 * JTree:
227 - Added findMaximum(), which can be used after running
228 max-product JTree to construct a global state with maximum probability
229 * MatLab interface:
230 - MEX file dai now also returns variable and factor beliefs
231 - [Sebastian Nowozin] MEX file dai now also optionally returns the MAP state
232 (only for BP and JTree)
233 * README is now created automatically from doxygen documentation
234 * [Frederik Eaton] Added script for automatically generating properties code (used by CBP and BBP)
235 * [Frederik Eaton] Added newInfAlgFromString to alldai.h/cpp
236 * [Frederik Eaton] Added some utility macros (DAI_PV, DAI_DMSG, DAI_IFVERB)
237 and functions (concat(),rnd()) to util.h
238 * Changed output stream operator<< for Var and VarSet
239 * [Frederik Eaton] Improved parsing code in tests/testdai to allow recursive
240 alias substitutions
241 * [Frederik Eaton] Added useful aliases to aliases.conf
242 * [Giuseppe Passino] Optimised maximum-residual BP by using a reversed ordered
243 set instead of the linear search (which can yield enormous speedups - a
244 factor 500 has been measured on a binary Ising grid with 128x128 variables!)
245 * Added debug assertions to Var which check for inconsistent dimensions of
246 variables with the same labels
247 * toc() now returns POSIX system time with maximum accuracy of microseconds
248 * Exception objects now remember their error code
249 * Examples:
250 - Moved example.cpp to examples/
251 - Added examples/example_bipgraph.cpp
252 - Added examples/example_varset.cpp
253 - Added examples/example_sprinkler.cpp
254 - Added examples/example_permute.cpp
255 - Added python and octave ports for examples/example_sprinkler.cpp
256
257 Build system:
258 * Improved Makefile:
259 - Merged Makefile.win and Makefile.shared into Makefile
260 - Macros DAI_VERSION and DAI_DATE have been introduced,
261 in order to store this information in a central place
262 - Introduced CCNODEBUGFLAGS in Makefile
263 - Switched Makefile.win to GNU Make syntax
264 - [Frederik Eaton] Added TAGS, lib targets to Makefile
265 * Compatibility:
266 - [Peter Gober] libDAI can now be built on Cygwin
267 - [Dan Preston] libDAI can now be built on Mac OS X
268 - Changed regression test so that it also works under Windows
269
270 Interface changes (the old interface is marked obsolete and will be removed in the next release):
271 * Var:
272 - Variable labels are now nonnegative (of type size_t)
273 * VarSet:
274 - Replaced calcState() by non-member calcLinearState()
275 - Replaced calcStates() by non-member calcState()
276 * Permute:
277 - Renamed convert_linear_index into convertLinearIndex
278 * TProb<>:
279 - Replaced log0() by log(true)
280 - Replaced takeLog0() by takeLog(true)
281 - Removed hasNonPositives()
282 - Renamed minVal() to min()
283 - Renamed maxVal() to max()
284 - Renamed totalSum() to sum()
285 * TFactor<>:
286 - Replaced log0() by TFactor<T>::log(true)
287 - Removed divided_by, use operator/ instead
288 - Removed divide, use operator/= instead
289 - Removed partSum(const VarSet&), use marginal(const VarSet&,false) instead
290 - Renamed minVal() to min()
291 - Renamed maxVal() to max()
292 - Renamed totalSum() to sum()
293 * FactorGraph:
294 - Changed clamp and clamp interfaces (the variable to be
295 clamped is now indicated by its index, not as a Var)
296 * RegionGraph:
297 - Renamed Check_Counting_Numbers into checkCountingNumbers
298 - Renamed Calc_Counting_Numbers into calcCountingNumbers
299 * Miscellaneous:
300 - Renamed Treewidth(const FactorGraph &) into boundTreewidth(const FactorGraph &)
301 - Replaced UEdgeVec by Graph
302 - Replaced DEdgeVec by new RootedTree class
303 - Moved functionality of GrowRootedTree() into constructor of RootedTree
304 - Merged calcPairBeliefsNew() into calcPairBeliefs()
305 - Removed calcMarginal2ndO()
306 - Renamed smallSet<T> to SmallSet<T>
307 - Removed class Diffs
308 - [Frederik Eaton] Added backwards compatibility layer for edge interface to
309 BipartiteGraph and FactorGraph (which will be obsoleted soon)
310
311 Bug fixes:
312 * Fixed reversal of min and max in
313 TFactor<T> min( const TFactor<T> &, const TFactor<T> & )
314 TFactor<T> max( const TFactor<T> &, const TFactor<T> & )
315 * [Sebastian Nowozin] Fixed memory leak in MEX file dai
316 * [Frederik Eaton] In PropertySet::getStringAs(), check for typeid(ValueType)
317 before typeid(std::string) (this fixes a strange bug for empty string property)
318 * Added work-around for bug in Boost Graph Library
319 * Fixed bug in MaxSpanningTree (it wrongly assumed that the tree was not empty).
320 * Fixed bug in calcMarginal and calcPairBeliefs where states with zero probability
321 mass were clamped, leading to NaNs or assertion errors (thanks to Dan Preston
322 for reporting this)
323
324
325 libDAI-0.2.2 (2008-09-30)
326 -------------------------
327
328 New features:
329 * Approximate inference methods now report the number of iterations needed.
330 * Added damping to various algorithms to improve convergence properties.
331 * Added more features to utils/createfg for creating factor graphs.
332 * Added ExactInf class for brute force exact inference.
333 * [Giuseppe Pasino] Added "logdomain" property to BP, a boolean that controls
334 whether calculations are done in the log-domain or in the linear domain;
335 doing calculations in the log-domain may help if the numerical range
336 of a double is too small.
337 * [Claudio Lima] Added Max-Product functionality to BP.
338 * Improved documentation.
339
340 Improved architecture:
341 * Added Exceptions framework.
342 * Pervasive change of BipartiteGraph implementation (based on an idea by
343 Giuseppe Passino). BipartiteGraph no longer stores the node properties
344 (former _V1 and _V2), nor does it store a dense adjacency matrix anymore,
345 nor an edge list. Instead, it stores the graph structure as lists of
346 neighboring nodes. This yields a significant memory/speed improvement for
347 large factor graphs, and is more elegant as well. Iterating over neighbors is
348 made easy by using boost::foreach.
349 * Added conditional compilation of inference methods.
350 * VarSet is now implemented using a std::vector<Var> instead of a
351 std::set<Var>, which yields a significant speed improvement. Furthermore,
352 the implementation has been generalized, resulting in the small_set<T> class
353 which can be used to represent sets of small cardinality; VarSet is the
354 specialization with T = Var.
355 * Improved ClusterGraph implementation, yielding significant speedups
356 for the JunctionTree algorithm on large factorgraphs.
357
358 Code cleanup:
359 * Moved everything into namespace "dai".
360 * Renamed DEBUG to DAI_DEBUG to avoid conflicts.
361 * Replaced ENUM2,ENUM3,ENUM4,ENUM5,ENUM6 by single DAI_ENUM macro.
362 * Removed utils/remove_short_loops and matlab/remove_short_loops.
363 * Replaced sub_nb class in mr.h by boost::dynamic_bitset.
364 * Improved index.h:
365 - Renamed Index -> IndexFor
366 - Added some .reserve()'s to IndexFor methods which yields a
367 25% speedup of testregression
368 - Replaced multind by Permute
369 - Added MultiFor
370 - Added State
371 * New funcstionality of factor.h.
372 * Moved Properties and MaxDiff frameworks from InfAlg to each individual
373 inference algorithm, because the Properties framework was not as
374 convenient as I hoped, and not every inference algorithm needs a maxdiff
375 variable. Also, replaced some FactorGraph functionality in InfAlg by a
376 function that returns the FactorGraph. The result is cleaner (less
377 entangled) code.
378 * Removed x2x.
379 * Replaced Complex with real numbers (negative potentials are just too rare
380 to warrant the additional "complexity" :)).
381
382 Miscellaneous improvements:
383 * Now compiles also with MS Visual C++ (thanks to Jiuxiang Hu) and with
384 GCC under cygwin.
385 * Contributions by Peter Gober:
386 - Renamed variable _N in mr.* for compatibility with g++ under cygwin.
387 * Misc contributions by Giuseppe Passino:
388 - removed "using namespace std;" from header files - bad practice;
389 - moved header files in include/dai and sources in src;
390 - changed #ifndefs to GNU style;
391 - added extra warning checks (-W -Wextra) and fixed resulting warnings;
392 - dai::TProb:
393 o removed copy constructor and assignment operators (redundant);
394 o implementation of some methods via STL algorithms;
395 o added methods takeExp, takeLog, takeLog0 for transformation in-place;
396 o explicit constructor (prevents implicit conversion from size_t to TProb);
397 o added operator+,+=,-,-=, with argument T (for calculations in log-scale);
398 * Misc contributions by Christian Wojek:
399 - New FactorGraph constructor that constructs from given ranges of factors
400 and variables;
401 - Optimization of FactorGraph constructors using tr1::unordered_map.
402 * FactorGraph constructors no longer check for short loops (huge speed
403 increase for large factor graphs), nor for negative entries. Also, the
404 normtype is now Prob::NORMPROB by default.
405 * Improved MaxSpanningTreePrims algorithm (uses boost::graph).
406
407 Interface changes:
408 * VarSet::
409 - VarSet::stateSpace() -> nrStates(const VarSet &)
410 - VarSet( const std::set<Var> ) -> VarSet( begin, end, sizeHint=0 )
411 - VarSet( const std::vector<Var> ) -> VarSet( begin, end, sizeHint=0 )
412 - removed bool operator||
413 - operator&&(const VarSet&) -> intersects(const VarSet&)
414 - operator&&(const Var&) -> contains(const Var&)
415 * FactorGraph::
416 - delta(const Var &) -> delta(size_t)
417 - Delta(const Var &) -> Delta(size_t)
418 - makeCavity(const Var &) -> makeCavity(size_t)
419 - vars() -> vars
420 - factors() -> factors
421 - removed MakeFactorCavity(size_t)
422 - removed ExactMarginal(const VarSet &)
423 - removed ExactlogZ()
424 - removed updatedFactor(size_t)
425 - removed _normtype and NormType()
426 - removed hasShortLoops(...) and removeShortLoops(...)
427 - WriteToDotFile(const char *filename) -> printDot( std::ostream& os )
428 - undoProb(size_t) -> restoreFactor(size_t)
429 - saveProb(size_t) -> backupFactor(size_t)
430 - undoProbs(const VarSet &) -> restoreFactors(const VarSet &)
431 - saveProbs(const VarSet &) -> backupFactors(const VarSet &)
432 - ReadFromFile(const char*) returns void (throws on error)
433 - WriteToFile(const char*) returns void (throws on error)
434 - removed hasNegatives()
435 * RegionGraph::
436 - nr_ORs() -> nrORs()
437 - nr_IRs() -> nrIRs()
438 - ORs() -> ORs
439 - IRs() -> IRs
440 * *::Regenerate() -> *::construct()
441 * Renamed Index -> IndexFor
442 * Diffs:
443 - max() -> maxDiff()
444 - max_size() -> maxSize()
445 * Prob::max() -> Prob::maxVal()
446 * Factor::
447 - max() -> maxVal()
448 - part_sum() -> partSum()
449 * toc() in util.h now returns seconds as a double
450 * VarSet::operator&&
451 * Properties -> PropertySet
452
453
454 libDAI-0.2.1 (2008-05-26)
455 -------------------------
456
457 Bugfix release.
458 * added missing cstdio header in util.h
459 * fixed Properties in MR_CLAMPING_* and MR_EXACT_*
460 * added description of the factor graph fileformat
461 * improved Makefile
462
463
464 libDAI-0.2.0 (2006-11-30)
465 -------------------------
466
467 First public release.
468
469
470 0.1.5 (2006-11-30)
471 ------------------
472
473 Regressions
474
475 - tests/testlcbp and tests/testlcbp are broken.
476 - EXACT method does not work anymore.
477 - The Properties framework gives a speed penalty because of the lookup
478 costs involved; inner loops should be optimized.
479
480 General framework
481
482 - DAIAlg is now a template class; typedefs for DAIAlg<FactorGraph> and for
483 DAIAlg<RegionGraph> are provided. In this way, we do not have to write "wrapper"
484 functions to forward functionality from either FactorGraph or RegionGraph
485 to DAIAlg. Functionality like clamping can be implemented in FactorGraph
486 and in RegionGraph and no explicit interface is needed in descendants.
487 - New abstract base class InfAlg added, representing an inference algorithm,
488 from which DAIAlg<T> inherits. This solves the incompatibility problems of
489 DAIAlg<T> for different T (e.g. DAIAlg<FactorGraph> was incompatible with
490 DAIAlg<RegionGraph>). More work is required to reduce code duplication
491 (make FactorGraph part of InfAlg).
492 - Added generic interface (nrVars(), Vars(), nrFactors(), factor(size_t),
493 beliefs(), belief(VarSet &), ...) to InfAlg and descendants.
494 - Added a saveProbs/undoProbs interface to InfAlg and descendants that enables
495 one to save a few factors, modify them (e.g. clamp them), and then restore them
496 to their old values. Undo should also init the corresponding messages / beliefs.
497 This can be used if a given factor graph repeatedly needs to be clamped in
498 different ways and an approximation method is run for each clamping; using the
499 saveProbs/undoProbs can give a significant speed increase.
500 - Switched to a general Properties framework that handles the parameters of
501 all inference methods in a uniform manner. The Properties class is a map of
502 several properties in boost::any objects, indexed by their names (strings).
503 It can read from a stream and write to a stream. It is recursive, in the sense
504 that a Properties object can hold a variable of type Properties as well.
505 - Added a generic way of constructing inference algorithms from a factor graph,
506 name and properties object. Added the newInfAlg function which constructs
507 the requested object. This is used by LCBP, the Matlab interface and the
508 command line (test) interface.
509 - Added a generic enum framework for enum parameters. Although implemented as a
510 hack, it is quite useful in that it drastically simplifies and reduces the
511 amount of code for handling enum parameters.
512 - Provided generic functions for calculating marginals in different ways that
513 work for all approximate inference methods.
514
515 Bugfixes
516
517 - Fixed GBP free energy.
518 - Fixed bug in junctiontree (it didn't init the _vars variable).
519 - Corrected two bugs in operator&& and operator|| in VarSet (they returned
520 the logical NOT of what they should return).
521 - Fixed bug in RegionGraph::RecomputeOR(s).
522 - Fixed bug in utils/create_dreg_fg:
523 graph structure was not random for given parameters (forgot to call srand()).
524 - TreeEP bug workaround: use the complete junction tree instead of a subtree.
525 - Fixed bug in JTree::HUGIN() and JTree:ShaferShenoy() in case of junction tree
526 that consists of one outer region only.
527 - Fixed INIT bug in LCBP2::UpdatePancake().
528 - Fixed MaxDiffs flow (except for MR).
529
530 New functionality
531
532 - HAK supports several default cluster choices:
533 minimal (only factors)
534 delta (Markov blankets)
535 loop (all loops consisting of loops consisting of <loopdepth> or less variables)
536 Only the maximal clusters are used as outer clusters.
537 - Implemented TreeEP. It generalizes the heuristic method described in the
538 Minka & Qi paper for obtaining a tree with the most relevant interactions to
539 higher order interactions. Almost all optimizations described in the Minka & Qi
540 paper are used, except that evidence is passed over the whole tree instead of
541 relevant subsets (the latter is almost implemented but buggy). Also added
542 alternative (worst-case) algorithm that uses a maximum spanning tree on the
543 weighted graph where the weight between neighbours i and j is given by
544 N(psi,i,j), where psi is the product of all the factors involving both i and j
545 (which is an upper bound on the effective interaction between i and j).
546 - Implemented MR (MontanariRizzo) based on Bastian's code, but extended it
547 to be able to handle connectivities larger than 3 (in principle, up to 32).
548 It supports different initialization methods (the original RESPPROP,
549 the CLAMPING method and EXACT which uses JTree) and different update methods
550 (FULL and LINEAR).
551 - Implemented LCBP2, an analogon of LCBP which represents pancakes as little
552 networks and uses some approximate inference method on them for calculating
553 marginals.
554 - Now there are several LCBP variants (LCBP, LCBPI, LCBPJ, LCBPK, LCBPL);
555 LCBPJ works only for pairwise, LCBPK is LCBP improved for higher order
556 interactions and LCBPL is LCBPI improved for higher-order interactions.
557 - Wrote one single program utils/createfg for creating various types of
558 random factor graphs.
559 - Wrote utility to visualize factor graphs using graphviz.
560 (it uses the BOOST Program Options library)
561 - Added fginfo utility that displays some info about a .fg file.
562 - Implemented Factor::strength function that calculates the potential strength
563 N(psi,i,j) between variables i and j as described in cs.IT:0504030
564 - Wrote a general MatLab interface matlab/dai (similar to tests/test);
565 this unified the matlab functions dai, dai_bp, dai_mf, dai_jt, dai_tep, dai_cvm.
566 - Added MATLAB routine that returns contraction matrix A for BP convergence analysis.
567 - Implemented a MATLAB interface ai_potstrength for Factor::strength
568 - Added Martijn's x2x
569
570 Improvements of existing code
571
572 - Reimplemented RegionGraph and descendants: a RegionGraph ISA FactorGraph
573 and also a BipartiteGraph<FRegion,Region>. It now also keeps a map that
574 associates outer region indices to factor indices (no powers yet, this
575 is deemed superfluous) and provides functions to recompute (some of) the
576 outer regions from the factors.
577 - InfAlg descendants run() methods now stop immediately and return NAN in case
578 they detect NANs. Only BP does not do NAN checking for performance reasons.
579 - LCBP now works with factors containing zeroes (by defining x/0 = 0).
580 - HAK, GBP and DoubleLoop now conform to the standards for verbose reporting,
581 timing and convergence criteria.
582 - Implemented logZ() for JTree. It does the calculation during message-passing.
583 - Marginal2ndO now optionally divides by the single node beliefs (to the power n-2);
584 hopefully this will give more accurate approximations.
585 - Marginal and Marginal2ndO (optionally) use the new saveProbs/undoProbs functionality
586 for a faster way of calculating marginals, which does not require a call to init()
587 nor cloning the whole object for each clamping. This leads to a significant speedup.
588 - LCBP (and LCBP2) now have complete flexibility in the specification of the
589 inner method, i.e. the method used to generate the initial cavity approximations.
590 One can pass two strings, a name and a properties string, and LCBP simply invokes
591 newInfAlg to construct the corresponding inference algorithm and uses the generic
592 marginal functions to approximate cavity marginals.
593 - Replaced the global "method" variable by local properties and removed ai.h
594 - Added some methods to Factor (operators *, *=, /, /= with doubles as
595 second argument, operators -, +=, -= with other Factors as second
596 arguments, randomize(), RemoveFirstOrderInteractions) and similar
597 operations to Prob
598 - Moving towards boost::program_options for handling command line arguments
599 (tests/test is done).
600 - Renamed some FactorGraph methods:
601 nr_vars -> nrVars
602 nr_factors -> nrFactors
603 varind -> findVar
604 factorind -> findFactor
605 makeFacCavity -> makeFactorCavity
606 - LCBP_SEQMAXRES has been removed because it did strange things.
607 - Implemented RandomDRegularGraph
608 - Implemented JTree::calcMarginal for marginals that are not confined
609 within one cluster (using cut-set conditioning).
610 - Added isConnected() method to FactorGraph (some methods do not work with
611 disconnected factor graphs).
612 - Pair beliefs are now calculated in a symmetrical way by calcPairBeliefs
613 - Removed single node interaction "correction" code from clamping methods
614 - Removed calcCavityDist and calcCavityDist2ndO
615 - No longer depends on GSL.
616 - Increased portability by combining platform dependant utility functions
617 in util.{h,cpp}.
618 - Wrote *.m files providing help
619
620 Testing framework
621
622 - Made a new and significantly improved testing framework that provides most
623 functionality from the command line.
624 - The basis is provided by tests/test, which uses the newInfAlg functionality
625 and enables the user to easily compare from the command line different
626 inference methods on a given factorgraph. All parameters can be specified.
627 Output consists of CPU time, average and maximum single variable marginal
628 errors, relative logZ error and MaxDiff().
629 - tests/aliases.conf contains aliases for standard combinations of methods
630 and their options (which can be used in tests/test).
631 - tests/large contains several bash/python scripts that create random factor
632 graphs, compare several approximate inference algorithms (using tests/test) and
633 allow for easy visualization of the results using PyX.
634 - Added several .fg files for test purposes to /tests (e.g. two ALARM versions
635 alarm.fg and alarm_bnt.fg; testfast.fg, a 4x4 periodic Ising grid for
636 regression testing).
637 - Added a regression test to the Makefile which is included in the standard
638 target. It compares all inference methods on tests/testfast.fg with the
639 results stored in tests/testfast.out
640
641 Miscellaneous
642
643 - Expanded all tabs to spaces (":set tabstop 4\n:set expandtab\n:retab" in vim)
644 - Experimental MATLAB code added for StarEP approximation on cavity
645 - Renamed project to libDAI and changed directory name accordingly.
646 - Renamed JunctionTree to JTree.
647 - Fixed licensing (now it's officially GPL).
648 - Improved README
649
650
651 revision 252
652 ------------
653
654 Functionality
655 - Added RegionGraph, GBP, CVM and HAK (double-loop).
656 - Added JunctionTree (with two update algorithms, HUGIN and Shafer-Shenoy), which is a
657 RegionGraph.
658 - NormType is now chosen automatically (in case of negative factors, Prob::NORMLINF is used,
659 otherwise the default Prob::NORMPROB is used). Also, in case of negative factors, the
660 RegionGraph constructors assign each Factor to a unique outer region instead of dividing
661 it over all subsuming outer regions. See README for when negative factors are known to work
662 and when not.
663 - FactorGraph::FactorGraph(const vector<Factor>) only gives a warning in case of short loops,
664 it does not automatically merge factors anymore.
665 - Removed BP_SEQMAXRESNOCLEAR (all cavity initialization methods now are implicitly NOCLEAR)
666 - Added MATLAB interface functions ai_readfg, ai_removeshortloops and ai_bp
667 - Added LCBP-III type that should be equivalent to LCBP-II, but can handle zeroes
668 in potentials. Note that it is significantly slower than LCBP-II (and has to be reimplemented
669 such that it does not store the complete pancakes, but represents them as little factor graphs).
670
671 Implementation / code
672 - Made a seperate type WeightedGraph, which until now only implements Prim's
673 maximal spanning tree algorithm and is only used by the junction tree code. It might
674 be good to make it a class somewhere in the future and extend it's interface.
675 - Made a seperate class ClusterGraph, which is only used by the junction tree
676 code. It's main purpose is a graph-theoretical variable elimination algorithm.
677 - Implemented the heuristic "minimum-new-edges-in-clique-graph" for variable elimination.
678 - Massive code cleanup, moving towards "generic" programming style, using
679 multiple inheritance and polymorphism.
680 o BP, LCBP, MF, HAK and JunctionTree now inherit from a common DAIAlg class
681 o Made generic functions Marginal, Marginal2ndO, calcCavityDist, calcCavityDist2ndO, clamp
682 that can be used by FactorGraph-based DAIAlgs.
683 o Created TProb<T> class, which stores a probability vector (without the accompanying indexing
684 and VarSet) and provides functionality for it (which is used by TFactor<T>).
685 o Rewrote the VarSet class. It now caches its statespace(). It now privately inherits from set<Var>.
686 I had to overload the insert methods of set<Var> so that they calculate the new statespace.
687 o Rewrote the TFactor class. The TFactor class now HAS a TProb and HAS a VarSet.
688 - Rewrote BP to use the new TProb<T> interface. Performance of BP improved up to a factor 6 by:
689 o using Prob's instead of Factor's;
690 o splitting the multiplication of the messages into two parts (thanks to Vicenc!);
691 o optimizing the calculation of the beliefs (only the message calculations were optimized till now).
692 o replacing FactorGraph::_nb1 and _nb2 (which were set<size_t>) by vector<size_t>
693 - LCBP now seperately stores cavitydists and pancakes. Added InitPancakes() method
694 that takes the cavitydists and multiplies them with the relevant factors. This
695 resulted in an API change in AI which now accepts and returns initial cavitydists
696 instead of initial pancakes.
697
698 Minor changes
699 - Started writing DoxyGen documentation
700 - Renamed lcptab2fg.m matlab/ai_writefg.m
701 - Moved all matlab stuff to matlab/
702 - More detailed reporting (also reports clocks used).
703 - Marginal and Marginal2ndO now use *differences* in logZ to avoid NaNs.
704 - Improved testing suite.
705 - Removed logreal support.
706 - FactorGraph now also supports input streams and ignores comment lines in .fg files.
707 - Added tests/create_full_fg.cpp and tests/create_ising_fg.cpp which create
708 full and periodic 2D Ising networks according to some command line parameters.
709 - Now logZ really returns logZ instead of -logZ.
710 - Added FactorGraph::WriteToDotFile
711
712
713 0.1.4 (2006-04-13)
714 ------------------
715 - Added file IO routines to read and write factorgraphs.
716 - Added L-infinity normalization for use with (partially) negative factors.
717 - Renamed BetheF, MFF to logZ, which now use complex numbers to be able to
718 handle (partially) negative factors.
719 - Added test suite.
720 - All probabilities are now represented using double instead of LogReal<double>.
721 - Combined Alg and Alg3 into LCBP. Several update schemes possible.
722 - Combined several variants of BP into doBP. Several update schemes possible.
723 Now uses precalculated indices for optimization.
724 - Renamed Node -> Var and Potential -> Factor.
725 - Extensive code cleanup. More use of OO techniques. Changed API.
726 - MaxIter now means maximum number of passes (corresponding to number of
727 _parallel_ updates).
728 - MaxDiff now means the maximum L-infinity distance between the updated and
729 original single variable beliefs, for all AI methods.
730 - Implemented RBP which converges faster than BP for difficult problems.
731 - Now uses method parameter which is a bitmask combining outmethod and inmethod
732 (see ai.h).
733
734
735 0.1.3 (2006-03-22)
736 --------------------
737 - All AI methods now return maxdiff
738 - ai.cpp:
739 o Now returns maxdiffinner and maxdiffouter
740 o New BP2ndO innermethod (estimate only 2nd order cavity interactions)
741 o New InitCav outermethod (only create initial cavity distributions)
742 - bp.cpp:
743 o New CavityDist2ndO which estimates 2nd order cavity interactions
744 - Makefile:
745 o Bugfix: removed dependencies on algwim.*
746
747
748 0.1.2 (2006-02-28)
749 --------------------
750 - Cleaned up alg.cpp (removed Alg2 and its corresponding data structures).
751 - Added the possibility to provide initial cavity distributions as an input
752 argument to ai (not much error checking is done, so be careful).
753 - Potentials2mx now correctly sets the dimensions of the P field (i.e. for
754 the output arguments Q, Q0 of ai).
755 - Removed algwim.* since it does not work.
756
757
758 0.1.1 (2006-02-28)
759 --------------------
760 - The constructors of (Log)FactorGraph and LogFactorGraph from a
761 vector<(Log)Potential> now merge potentials to prevent short loops (of length
762 4) in the factor graph. These are used in ai to construct the factor graphs
763 from the psi argument. If compiled with DEBUG defined, the method calc_nb()
764 of BipGraph checks for the existence of short loops.
765 - Changed calling syntax of ai (now the actual syntax *does* correspond to its
766 description in the help).
767 - ai does not hook cout anymore (which caused weird segfaults).
768 - Fixed a bug in an assert statement in the matlab interface code in ai.cpp.
769 - Removed network.* since it is not useful.
770
771
772 0.1.0 (2006-02-28)
773 --------------------
774 First version worthy of a version number.