libDAI
|
Approximate inference algorithm "Fractional Belief Propagation" [WiH03]. More...
#include <dai/fbp.h>
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 FBP * | clone () const |
Returns a pointer to a new, cloned copy of *this (i.e., virtual copy constructor) | |
virtual FBP * | construct (const FactorGraph &fg, const PropertySet &opts) const |
Returns a pointer to a newly constructed inference algorithm. | |
virtual std::string | name () const |
Returns the name of the algorithm. | |
virtual Real | logZ () const |
Returns the logarithm of the (approximated) partition sum (normalizing constant of the factor graph). | |
Protected Attributes | |
std::vector< Real > | _weight |
Factor weights (indexed by factor ID) | |
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. |
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. (note that the Bethe free energy is typically derived from
). If each factor I has weight
, then FBP minimizes the alpha-divergence with
for that factor, which also corresponds to Power EP [Min05].
The messages are passed from factors
to variables
. The update equation is given by:
After convergence, the variable beliefs are calculated by:
and the factor beliefs are calculated by:
The logarithm of the partition sum is approximated by:
where the variable weights are defined as
dai::FBP::FBP | ( | ) | [inline] |
Default constructor.
dai::FBP::FBP | ( | const FactorGraph & | fg, |
const PropertySet & | opts | ||
) | [inline] |
Construct from FactorGraph fg and PropertySet opts.
fg | Factor graph. |
opts | Parameters |
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.
virtual FBP* dai::FBP::construct | ( | const FactorGraph & | fg, |
const PropertySet & | opts | ||
) | const [inline, virtual] |
Returns a pointer to a newly constructed inference algorithm.
fg | Factor graph on which to perform the inference algorithm; |
opts | Parameters passed to constructor of inference algorithm; |
Reimplemented from dai::BP.
virtual std::string dai::FBP::name | ( | ) | const [inline, virtual] |
Returns the name of the algorithm.
Reimplemented from dai::BP.
Real dai::FBP::logZ | ( | ) | const [virtual] |
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.
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
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.
std::vector<Real> dai::FBP::_weight [protected] |
Factor weights (indexed by factor ID)