libDAI
|
Approximate inference algorithm "Tree Expectation Propagation" [MiQ04]. More...
#include <dai/treeep.h>
Classes | |
struct | Properties |
Parameters for TreeEP. More... | |
class | TreeEPSubTree |
Stores the data structures needed to efficiently update the approximation of an off-tree factor. More... | |
Public Member Functions | |
TreeEP () | |
Default constructor. | |
TreeEP (const TreeEP &x) | |
Copy constructor. | |
TreeEP & | operator= (const TreeEP &x) |
Assignment operator. | |
TreeEP (const FactorGraph &fg, const PropertySet &opts) | |
Construct from FactorGraph fg and PropertySet opts. | |
General InfAlg interface | |
virtual TreeEP * | clone () const |
Returns a pointer to a new, cloned copy of *this (i.e., virtual copy constructor) | |
virtual TreeEP * | 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). | |
virtual void | init () |
Initializes all data structures of the approximate inference algorithm. | |
virtual void | init (const VarSet &) |
Initializes all data structures corresponding to some set of variables. | |
virtual Real | run () |
Runs the approximate inference algorithm. | |
virtual Real | maxDiff () const |
Returns maximum difference between single variable beliefs in the last iteration. | |
virtual size_t | Iterations () const |
Returns number of iterations done (one iteration passes over the complete factorgraph). | |
virtual void | setMaxIter (size_t maxiter) |
Sets maximum number of iterations (one iteration passes over the complete factorgraph). | |
virtual void | setProperties (const PropertySet &opts) |
Set parameters of this inference algorithm. | |
virtual PropertySet | getProperties () const |
Returns parameters of this inference algorithm converted into a PropertySet. | |
virtual std::string | printProperties () const |
Returns parameters of this inference algorithm formatted as a string in the format "[key1=val1,key2=val2,...,keyn=valn]". | |
Public Attributes | |
struct dai::TreeEP::Properties | props |
Private Member Functions | |
void | construct (const FactorGraph &fg, const RootedTree &tree) |
Helper function for constructors. | |
bool | offtree (size_t I) const |
Returns true if factor I is not part of the tree. | |
Private Attributes | |
Real | _maxdiff |
Maximum difference encountered so far. | |
size_t | _iters |
Number of iterations needed. | |
std::map< size_t, TreeEPSubTree > | _Q |
Stores a TreeEPSubTree object for each off-tree factor. |
Approximate inference algorithm "Tree Expectation Propagation" [MiQ04].
dai::TreeEP::TreeEP | ( | ) | [inline] |
Default constructor.
dai::TreeEP::TreeEP | ( | const TreeEP & | x | ) | [inline] |
Copy constructor.
dai::TreeEP::TreeEP | ( | const FactorGraph & | fg, |
const PropertySet & | opts | ||
) |
Construct from FactorGraph fg and PropertySet opts.
fg | Factor graph. |
opts | Parameters |
virtual TreeEP* dai::TreeEP::clone | ( | ) | const [inline, virtual] |
Returns a pointer to a new, cloned copy of *this
(i.e., virtual copy constructor)
Reimplemented from dai::JTree.
virtual TreeEP* dai::TreeEP::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::JTree.
virtual std::string dai::TreeEP::name | ( | ) | const [inline, virtual] |
Returns the name of the algorithm.
Reimplemented from dai::JTree.
Real dai::TreeEP::logZ | ( | ) | const [virtual] |
Returns the logarithm of the (approximated) partition sum (normalizing constant of the factor graph).
NOT_IMPLEMENTED | if not implemented/supported |
Reimplemented from dai::JTree.
void dai::TreeEP::init | ( | ) | [virtual] |
Initializes all data structures of the approximate inference algorithm.
Reimplemented from dai::JTree.
virtual void dai::TreeEP::init | ( | const VarSet & | vs | ) | [inline, virtual] |
Initializes all data structures corresponding to some set of variables.
This method can be used to do a partial initialization after a part of the factor graph has changed. Instead of initializing all data structures, it only initializes those involving the variables in vs.
NOT_IMPLEMENTED | if not implemented/supported |
Reimplemented from dai::JTree.
Real dai::TreeEP::run | ( | ) | [virtual] |
Runs the approximate inference algorithm.
Reimplemented from dai::JTree.
virtual Real dai::TreeEP::maxDiff | ( | ) | const [inline, virtual] |
Returns maximum difference between single variable beliefs in the last iteration.
NOT_IMPLEMENTED | if not implemented/supported |
Reimplemented from dai::JTree.
virtual size_t dai::TreeEP::Iterations | ( | ) | const [inline, virtual] |
Returns number of iterations done (one iteration passes over the complete factorgraph).
NOT_IMPLEMENTED | if not implemented/supported |
Reimplemented from dai::JTree.
virtual void dai::TreeEP::setMaxIter | ( | size_t | ) | [inline, virtual] |
Sets maximum number of iterations (one iteration passes over the complete factorgraph).
NOT_IMPLEMENTED | if not implemented/supported |
Reimplemented from dai::InfAlg.
void dai::TreeEP::setProperties | ( | const PropertySet & | opts | ) | [virtual] |
Set parameters of this inference algorithm.
The parameters are set according to the PropertySet opts. The values can be stored either as std::string or as the type of the corresponding MF::props member.
Reimplemented from dai::JTree.
PropertySet dai::TreeEP::getProperties | ( | ) | const [virtual] |
Returns parameters of this inference algorithm converted into a PropertySet.
Reimplemented from dai::JTree.
string dai::TreeEP::printProperties | ( | ) | const [virtual] |
Returns parameters of this inference algorithm formatted as a string in the format "[key1=val1,key2=val2,...,keyn=valn]".
Reimplemented from dai::JTree.
void dai::TreeEP::construct | ( | const FactorGraph & | fg, |
const RootedTree & | tree | ||
) | [private] |
Helper function for constructors.
bool dai::TreeEP::offtree | ( | size_t | I | ) | const [inline, private] |
Returns true
if factor I is not part of the tree.
Real dai::TreeEP::_maxdiff [private] |
Maximum difference encountered so far.
size_t dai::TreeEP::_iters [private] |
Number of iterations needed.
std::map<size_t, TreeEPSubTree> dai::TreeEP::_Q [private] |
Stores a TreeEPSubTree object for each off-tree factor.