dai::FBP Class Reference

Approximate inference algorithm "Fractional Belief Propagation" [WiH03]. More...

#include <dai/fbp.h>

Inheritance diagram for dai::FBP:

dai::BP dai::DAIAlg< GRM > dai::InfAlg

List of all members.

FBP accessors/mutators for weights

Real Weight (size_t I) const
 Returns weight of the I 'th factor.
const std::vector< Real > & Weights () const
 Returns constant reference to vector of all factor weights.
void setWeight (size_t I, Real c)
 Sets the weight of the I 'th factor to c.
void setWeights (const std::vector< Real > &c)
 Sets the weights of all factors simultaenously.
virtual Prob calcIncomingMessageProduct (size_t I, bool without_i, size_t i) const
 Calculate the product of factor I and the incoming messages.
virtual void calcNewMessage (size_t i, size_t _I)
 Calculate the updated message from the _I 'th neighbor of variable i to variable i.
virtual void calcBeliefF (size_t I, Prob &p) const
 Calculates unnormalized belief of factor I.
virtual void construct ()
 Helper function for constructors.

Public Member Functions

Constructors/destructors
 FBP ()
 Default constructor.
 FBP (const FactorGraph &fg, const PropertySet &opts)
 Construct from FactorGraph fg and PropertySet opts.
General InfAlg interface
virtual FBPclone () const
 Returns a pointer to a new, cloned copy of *this (i.e., virtual copy constructor).
virtual std::string identify () const
 Identifies itself for logging purposes.
virtual Real logZ () const
 Returns the logarithm of the (approximated) partition sum (normalizing constant of the factor graph).

Static Public Attributes

static const char * Name = "FBP"
 Name of this inference algorithm.

Protected Attributes

std::vector< Real_weight
 Factor weights (indexed by factor ID).


Detailed Description

Approximate inference algorithm "Fractional Belief Propagation" [WiH03].

The Fractional Belief Propagation algorithm is like Belief Propagation, but associates each factor with a weight (scale parameter) which controls the divergence measure being minimized. Standard Belief Propagation corresponds to the case of FBP where each weight is 1. When cast as an EP algorithm, BP (and EP) minimize the inclusive KL-divergence, i.e. $\min_q KL(p||q)$ (note that the Bethe free energy is typically derived from $ KL(q||p) $). If each factor I has weight $ c_I $, then FBP minimizes the alpha-divergence with $ \alpha=1/c_I $ for that factor, which also corresponds to Power EP [Min05].

The messages $m_{I\to i}(x_i)$ are passed from factors $I$ to variables $i$. The update equation is given by:

\[ m_{I\to i}(x_i) \propto \left( \sum_{x_{N_I\setminus\{i\}}} f_I(x_I)^{1/c_I} \prod_{j\in N_I\setminus\{i\}} m_{I\to j}^{1-1/c_I} \prod_{J\in N_j\setminus\{I\}} m_{J\to j} \right)^{c_I} \]

After convergence, the variable beliefs are calculated by:

\[ b_i(x_i) \propto \prod_{I\in N_i} m_{I\to i} \]

and the factor beliefs are calculated by:

\[ b_I(x_I) \propto f_I(x_I)^{1/c_I} \prod_{j \in N_I} m_{I\to j}^{1-1/c_I} \prod_{J\in N_j\setminus\{I\}} m_{J\to j} \]

The logarithm of the partition sum is approximated by:

\[ \log Z = \sum_{I} \sum_{x_I} b_I(x_I) \big( \log f_I(x_I) - c_I \log b_I(x_I) \big) + \sum_{i} (c_i - 1) \sum_{x_i} b_i(x_i) \log b_i(x_i) \]

where the variable weights are defined as

\[ c_i := \sum_{I \in N_i} c_I \]

Todo:
Add nice way to set weights
Author:
Frederik Eaton

Constructor & Destructor Documentation

dai::FBP::FBP (  )  [inline]

Default constructor.

dai::FBP::FBP ( const FactorGraph fg,
const PropertySet opts 
) [inline]

Construct from FactorGraph fg and PropertySet opts.

Parameters:
fg Factor graph.
opts Parameters
See also:
BP::Properties


Member Function Documentation

virtual FBP* dai::FBP::clone (  )  const [inline, virtual]

Returns a pointer to a new, cloned copy of *this (i.e., virtual copy constructor).

Reimplemented from dai::BP.

string dai::FBP::identify (  )  const [virtual]

Identifies itself for logging purposes.

Reimplemented from dai::BP.

Real dai::FBP::logZ (  )  const [virtual]

Returns the logarithm of the (approximated) partition sum (normalizing constant of the factor graph).

Note:
Before this method is called, run() should have been called.
Exceptions:
NOT_IMPLEMENTED if not implemented/supported

Reimplemented from dai::BP.

Real dai::FBP::Weight ( size_t  I  )  const [inline]

Returns weight of the I 'th factor.

const std::vector<Real>& dai::FBP::Weights (  )  const [inline]

Returns constant reference to vector of all factor weights.

void dai::FBP::setWeight ( size_t  I,
Real  c 
) [inline]

Sets the weight of the I 'th factor to c.

void dai::FBP::setWeights ( const std::vector< Real > &  c  )  [inline]

Sets the weights of all factors simultaenously.

Note:
Faster than calling setWeight(size_t,Real) for each factor

Prob dai::FBP::calcIncomingMessageProduct ( size_t  I,
bool  without_i,
size_t  i 
) const [protected, virtual]

Calculate the product of factor I and the incoming messages.

If without_i == true, the message coming from variable i is omitted from the product

Note:
This function is used by calcNewMessage() and calcBeliefF()

Reimplemented from dai::BP.

void dai::FBP::calcNewMessage ( size_t  i,
size_t  _I 
) [protected, virtual]

Calculate the updated message from the _I 'th neighbor of variable i to variable i.

Reimplemented from dai::BP.

virtual void dai::FBP::calcBeliefF ( size_t  I,
Prob p 
) const [inline, protected, virtual]

Calculates unnormalized belief of factor I.

Reimplemented from dai::BP.

void dai::FBP::construct (  )  [protected, virtual]

Helper function for constructors.

Reimplemented from dai::BP.


Member Data Documentation

std::vector<Real> dai::FBP::_weight [protected]

Factor weights (indexed by factor ID).

const char * dai::FBP::Name = "FBP" [static]

Name of this inference algorithm.

Reimplemented from dai::BP.


The documentation for this class was generated from the following files:

Generated on Thu Aug 5 19:04:06 2010 for libDAI by  doxygen 1.5.5