━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
-Version: git commit 76cf77837c617f54202590125c7a566ae443d0ab
-Date: Thu Nov 12 10:52:51 2009 +0100
+Version: git commit 7982eafde7cecc6ee4105461337667980203e4d2
+Date: Thu Nov 12 16:36:54 2009 +0100
See also: http://www.libdai.org
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
To do for the next release (0.2.3):
-Improve documentation of all .props structs.
-
Write a concept/notations page for the documentation,
explaining the concepts of "state" (index into a
multi-dimensional array, e.g., one corresponding
BP_dual _bp_dual;
/// Pointer to the factor graph
const FactorGraph *_fg;
- /// Pointer to the approximate inference algorithm
+ /// Pointer to the approximate inference algorithm (currently, only BP objects are supported)
const InfAlg *_ia;
//@}
/// \name Constructors/destructors
//@{
/// Construct BBP object from a InfAlg \a ia and a PropertySet \a opts
+ /** \param ia should be a BP object or something compatible
+ * \param opts Parameters @see Properties
+ */
BBP( const InfAlg *ia, const PropertySet &opts ) : _bp_dual(ia), _fg(&(ia->fg())), _ia(ia) {
props.set(opts);
}
//@}
public:
- /// Parameters of this algorithm
+ /// Parameters for BBP
/* PROPERTIES(props,BBP) {
- /// Enumeration of possible update schedules
+ /// \brief Enumeration of possible update schedules
+ /// - SEQ_FIX fixed sequential updates
+ /// - SEQ_MAX maximum residual updates (inspired by [\ref EMK06])
+ /// - SEQ_BP_REV schedule used by BP, but reversed
+ /// - SEQ_BP_FWD schedule used by BP
+ /// - PAR parallel updates
DAI_ENUM(UpdateType,SEQ_FIX,SEQ_MAX,SEQ_BP_REV,SEQ_BP_FWD,PAR);
- /// Verbosity
+ /// Verbosity (amount of output sent to stderr)
size_t verbose;
/// Maximum number of iterations
size_t maxiter;
- /// Tolerance (not used for updates = SEQ_BP_REV, SEQ_BP_FWD)
+ /// Tolerance for convergence test
+ /// \note Not used for updates = SEQ_BP_REV, SEQ_BP_FWD
Real tol;
/// Damping constant (0 for none); damping = 1 - lambda where lambda is the damping constant used in [\ref EaG09]
*/
struct Properties {
/// Enumeration of possible update schedules
+ /** The following update schedules are defined:
+ * - SEQ_FIX fixed sequential updates
+ * - SEQ_MAX maximum residual updates (inspired by [\ref EMK06])
+ * - SEQ_BP_REV schedule used by BP, but reversed
+ * - SEQ_BP_FWD schedule used by BP
+ * - PAR parallel updates
+ */
DAI_ENUM(UpdateType,SEQ_FIX,SEQ_MAX,SEQ_BP_REV,SEQ_BP_FWD,PAR);
- /// Verbosity
+ /// Verbosity (amount of output sent to stderr)
size_t verbose;
/// Maximum number of iterations
size_t maxiter;
- /// Tolerance (not used for updates = SEQ_BP_REV, SEQ_BP_FWD)
+ /// Tolerance for convergence test
+ /** \note Not used for updates = SEQ_BP_REV, SEQ_BP_FWD
+ */
Real tol;
/// Damping constant (0 for none); damping = 1 - lambda where lambda is the damping constant used in [\ref EaG09]
Real damping;
* The logarithm of the partition sum is calculated by:
* \f[ \log Z = \sum_i (1 - |N_i|) \sum_{x_i} b_i(x_i) \log b_i(x_i) - \sum_I \sum_{x_I} b_I(x_I) \log \frac{b_I(x_I)}{f_I(x_I)} \f]
*
- * There are several predefined update schedules:
- * - PARALL parallel updates
- * - SEQFIX sequential updates using a fixed sequence
- * - SEQRND sequential updates using a random sequence
- * - SEQMAX maximum-residual updates [\ref EMK06]
- *
* For the max-product algorithm, a heuristic way of finding the MAP state (the
* joint configuration of all variables which has maximum probability) is provided
* by the findMaximum() method, which can be called after convergence.
std::vector<std::pair<std::size_t, std::size_t> > _sentMessages;
public:
- /// Parameters of this inference algorithm
+ /// Parameters for BP
struct Properties {
/// Enumeration of possible update schedules
+ /** The following update schedules have been defined:
+ * - PARALL parallel updates
+ * - SEQFIX sequential updates using a fixed sequence
+ * - SEQRND sequential updates using a random sequence
+ * - SEQMAX maximum-residual updates [\ref EMK06]
+ */
DAI_ENUM(UpdateType,SEQFIX,SEQRND,SEQMAX,PARALL);
/// Enumeration of inference variants
+ /** There are two inference variants:
+ * - SUMPROD Sum-Product
+ * - MAXPROD Max-Product (equivalent to Min-Sum)
+ */
DAI_ENUM(InfType,SUMPROD,MAXPROD);
- /// Verbosity
+ /// Verbosity (amount of output sent to stderr)
size_t verbose;
/// Maximum number of iterations
/// Message update schedule
UpdateType updates;
- /// Type of inference: sum-product or max-product?
+ /// Inference variant
InfType inference;
} props;
BP() : DAIAlgFG(), _edges(), _edge2lut(), _lut(), _maxdiff(0.0), _iters(0U), _sentMessages(), props(), recordSentMessages(false) {}
/// Construct from FactorGraph \a fg and PropertySet \a opts
+ /** \param opts Parameters @see Properties
+ */
BP( const FactorGraph & fg, const PropertySet &opts ) : DAIAlgFG(fg), _edges(), _maxdiff(0.0), _iters(0U), _sentMessages(), props(), recordSentMessages(false) {
setProperties( opts );
construct();
public:
/// Construct CBP object from FactorGraph \a fg and PropertySet \a opts
+ /** \param opts Parameters @see Properties
+ */
CBP( const FactorGraph &fg, const PropertySet &opts ) : DAIAlgFG(fg) {
props.set( opts );
construct();
//----------------------------------------------------------------
- /// Parameters of this inference algorithm
+ /// Parameters for CBP
/* PROPERTIES(props,CBP) {
/// Enumeration of possible update schedules
typedef BP::Properties::UpdateType UpdateType;
/// Enumeration of possible clampings: variables or factors
DAI_ENUM(ClampType,CLAMP_VAR,CLAMP_FACTOR);
- /// Verbosity
+ /// Verbosity (amount of output sent to stderr)
size_t verbose = 0;
- /// Tolerance to use in BP
+ /// Tolerance for BP convergence test
Real tol;
/// Update style for BP
UpdateType updates;
/// Maximum number of iterations for BP
size_t maxiter;
- /// Tolerance to use for controlling recursion depth (\a recurse is REC_LOGZ or REC_BDIFF)
+ /// Tolerance used for controlling recursion depth (\a recurse is REC_LOGZ or REC_BDIFF)
Real rec_tol;
/// Maximum number of levels of recursion (\a recurse is REC_FIXED)
size_t max_levels = 10;
DAI_ENUM(ChooseMethodType,CHOOSE_RANDOM,CHOOSE_MAXENT,CHOOSE_BBP,CHOOSE_BP_L1,CHOOSE_BP_CFN);
/// Enumeration of possible clampings: variables or factors
DAI_ENUM(ClampType,CLAMP_VAR,CLAMP_FACTOR);
- /// Verbosity
+ /// Verbosity (amount of output sent to stderr)
size_t verbose;
- /// Tolerance to use in BP
+ /// Tolerance for BP convergence test
Real tol;
/// Update style for BP
UpdateType updates;
/// Maximum number of iterations for BP
size_t maxiter;
- /// Tolerance to use for controlling recursion depth (\a recurse is REC_LOGZ or REC_BDIFF)
+ /// Tolerance used for controlling recursion depth (\a recurse is REC_LOGZ or REC_BDIFF)
Real rec_tol;
/// Maximum number of levels of recursion (\a recurse is REC_FIXED)
size_t max_levels;
*/
class ExactInf : public DAIAlgFG {
public:
- /// Parameters of this inference algorithm
+ /// Parameters for ExactInf
struct Properties {
- /// Verbosity
+ /// Verbosity (amount of output sent to stderr)
size_t verbose;
} props;
ExactInf() : DAIAlgFG(), props(), _beliefsV(), _beliefsF(), _logZ(0) {}
/// Construct from FactorGraph \a fg and PropertySet \a opts
+ /** \param opts Parameters @see Properties
+ */
ExactInf( const FactorGraph &fg, const PropertySet &opts ) : DAIAlgFG(fg), props(), _beliefsV(), _beliefsF(), _logZ() {
setProperties( opts );
construct();
_state_t _state;
public:
- /// Parameters of this inference algorithm
+ /// Parameters for Gibbs
struct Properties {
/// Total number of iterations
size_t iters;
/// Number of "burn-in" iterations
size_t burnin;
- /// Verbosity
+ /// Verbosity (amount of output sent to stderr)
size_t verbose;
} props;
Gibbs() : DAIAlgFG(), _sample_count(0), _var_counts(), _factor_counts(), _state() {}
/// Construct from FactorGraph \a fg and PropertySet \a opts
+ /** \param opts Parameters @see Properties
+ */
Gibbs( const FactorGraph &fg, const PropertySet &opts ) : DAIAlgFG(fg), _sample_count(0), _var_counts(), _factor_counts(), _state() {
setProperties( opts );
construct();
size_t _iters;
public:
- /// Parameters of this inference algorithm
+ /// Parameters for HAK
struct Properties {
/// Enumeration of possible cluster choices
+ /** The following cluster choices are defined:
+ * - MIN minimal clusters, i.e., one outer region for each maximal factor
+ * - DELTA one outer region for each variable and its Markov blanket
+ * - LOOP one cluster for each loop of length at most \a Properties::loopdepth, and in addition one cluster for each maximal factor
+ */
DAI_ENUM(ClustersType,MIN,DELTA,LOOP);
/// Enumeration of possible message initializations
DAI_ENUM(InitType,UNIFORM,RANDOM);
- /// Verbosity
+ /// Verbosity (amount of output sent to stderr)
size_t verbose;
/// Maximum number of iterations
size_t maxiter;
- /// Tolerance
+ /// Tolerance for convergence test
Real tol;
- /// Damping constant
+ /// Damping constant (0.0 means no damping, 1.0 is maximum damping)
Real damping;
/// How to choose the outer regions
HAK() : DAIAlgRG(), _Qa(), _Qb(), _muab(), _muba(), _maxdiff(0.0), _iters(0U), props() {}
/// Construct from FactorGraph \a fg and PropertySet \a opts
- /** The clusters are chosen according to \a opts["clusters"]:
- * - MIN minimal clusters, i.e., one outer region for each maximal factor
- * - DELTA one outer region for each variable and its Markov blanket
- * - LOOP one cluster for each loop of length at most \a opts["loopdepth"], and in addition one cluster for each maximal factor of \a fg
+ /** \param opts Parameters @see Properties
*/
HAK( const FactorGraph &fg, const PropertySet &opts );
/// Inner region beliefs
std::vector<Factor> Qb;
- /// Parameters of this inference algorithm
+ /// Parameters for JTree
struct Properties {
/// Enumeration of possible JTree updates
+ /** There are two types of updates:
+ * - HUGIN similar to those in HUGIN
+ * - SHSH Shafer-Shenoy type
+ */
DAI_ENUM(UpdateType,HUGIN,SHSH);
/// Enumeration of inference variants
+ /** There are two inference variants:
+ * - SUMPROD Sum-Product
+ * - MAXPROD Max-Product (equivalent to Min-Sum)
+ */
DAI_ENUM(InfType,SUMPROD,MAXPROD);
- /// Verbosity
+ /// Verbosity (amount of output sent to stderr)
size_t verbose;
- /// Type of updates: HUGIN or Shafer-Shenoy
+ /// Type of updates
UpdateType updates;
- /// Type of inference: sum-product or max-product
+ /// Type of inference
InfType inference;
} props;
/// Construct from FactorGraph \a fg and PropertySet \a opts
/** \param fg factor graph (which has to be connected);
- * \param opts parameters;
+ ** \param opts Parameters @see Properties
* \param automatic if \c true, construct the junction tree automatically, using the MinFill heuristic.
* \throw FACTORGRAPH_NOT_CONNECTED if \a fg is not connected
*/
size_t _iters;
public:
- /// Parameters of this inference algorithm
+ /// Parameters for LC
struct Properties {
/// Enumeration of possible ways to initialize the cavities
/** The following initialization methods are defined:
*/
DAI_ENUM(UpdateType,SEQFIX,SEQRND);
- /// Verbosity
+ /// Verbosity (amount of output sent to stderr)
size_t verbose;
/// Maximum number of iterations
size_t maxiter;
- /// Tolerance
+ /// Tolerance for convergence test
Real tol;
/// Complete or partial reinitialization of cavity graphs?
bool reinit;
- /// Damping constant
+ /// Damping constant (0.0 means no damping, 1.0 is maximum damping)
Real damping;
/// How to initialize the cavities
LC() : DAIAlgFG(), _pancakes(), _cavitydists(), _phis(), _beliefs(), _maxdiff(), _iters(), props() {}
/// Construct from FactorGraph \a fg and PropertySet \a opts
- /** \see Properties
+ /** \param opts Parameters @see Properties
*/
LC( const FactorGraph &fg, const PropertySet &opts );
size_t _iters;
public:
- /// Parameters of this inference algorithm
+ /// Parameters for MF
struct Properties {
- /// Verbosity
+ /// Verbosity (amount of output sent to stderr)
size_t verbose;
/// Maximum number of iterations
size_t maxiter;
- /// Tolerance
+ /// Tolerance for convergence test
Real tol;
- /// Damping constant
+ /// Damping constant (0.0 means no damping, 1.0 is maximum damping)
Real damping;
} props;
MF() : DAIAlgFG(), _beliefs(), _maxdiff(0.0), _iters(0U), props() {}
/// Construct from FactorGraph \a fg and PropertySet \a opts
+ /** \param opts Parameters @see Properties
+ */
MF( const FactorGraph &fg, const PropertySet &opts ) : DAIAlgFG(fg), _beliefs(), _maxdiff(0.0), _iters(0U), props() {
setProperties( opts );
construct();
size_t _iters;
public:
- /// Parameters of this inference algorithm
+ /// Parameters for MR
struct Properties {
/// Enumeration of different types of update equations
/** The possible update equations are:
*/
DAI_ENUM(InitType,RESPPROP,CLAMPING,EXACT);
- /// Verbosity
+ /// Verbosity (amount of output sent to stderr)
size_t verbose;
- /// Tolerance
+ /// Tolerance for convergence test
Real tol;
/// Update equations
MR() : DAIAlgFG(), supported(), con(), nb(), tJ(), theta(), M(), kindex(), cors(), N(), Mag(), _maxdiff(), _iters(), props() {}
/// Construct from FactorGraph \a fg and PropertySet \a opts
- /** \note This implementation only deals with binary variables and pairwise interactions.
+ /** \param opts Parameters @see Properties
+ * \note This implementation only deals with binary variables and pairwise interactions.
* \throw NOT_IMPLEMENTED if \a fg has factors depending on three or more variables or has variables with more than two possible states.
*/
MR( const FactorGraph &fg, const PropertySet &opts );
size_t _iters;
public:
- /// Parameters of this inference algorithm
+ /// Parameters for TreeEP
struct Properties {
/// Enumeration of possible choices for the tree
/** The two possibilities are:
*/
DAI_ENUM(TypeType,ORG,ALT);
- /// Verbosity
+ /// Verbosity (amount of output sent to stderr)
size_t verbose;
/// Maximum number of iterations
size_t maxiter;
- /// Tolerance
+ /// Tolerance for convergence test
Real tol;
/// How to choose the tree
}
/// Construct from FactorGraph \a fg and PropertySet \a opts
- /** \note The factor graph has to be connected.
+ /** \param opts Parameters @see Properties
+ * \note The factor graph has to be connected.
* \throw FACTORGRAPH_NOT_CONNECTED if \a fg is not connected
*/
TreeEP( const FactorGraph &fg, const PropertySet &opts );