#include <dai/exactinf.h>

Public Member Functions | |
Constructors/destructors | |
| ExactInf () | |
| Default constructor. | |
| ExactInf (const FactorGraph &fg, const PropertySet &opts) | |
| Construct from FactorGraph fg and PropertySet opts. | |
General InfAlg interface | |
| virtual ExactInf * | clone () 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 Factor | belief (const Var &v) const |
| Returns the (approximate) marginal probability distribution of a variable. | |
| virtual Factor | belief (const VarSet &vs) const |
| Returns the (approximate) marginal probability distribution of a set of variables. | |
| virtual Factor | beliefV (size_t i) const |
| Returns the (approximate) marginal probability distribution of the variable with index i. | |
| virtual Factor | beliefF (size_t I) const |
| Returns the (approximate) marginal probability distribution of the variables on which factor I depends. | |
| virtual std::vector< Factor > | beliefs () const |
| Returns all beliefs (approximate marginal probability distributions) calculated by the algorithm. | |
| virtual Real | logZ () const |
| Returns the logarithm of the (approximated) partition sum (normalizing constant of the factor graph). | |
| std::vector< std::size_t > | findMaximum () const |
| 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 | 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]". | |
Additional interface specific for ExactInf | |
| Factor | calcMarginal (const VarSet &vs) const |
| Calculates marginal probability distribution for variables vs. | |
Public Attributes | |
| struct dai::ExactInf::Properties | props |
Static Public Attributes | |
| static const char * | Name = "EXACT" |
| Name of this inference algorithm. | |
Private Member Functions | |
| void | construct () |
| Helper function for constructors. | |
Private Attributes | |
| std::vector< Factor > | _beliefsV |
| All single variable marginals. | |
| std::vector< Factor > | _beliefsF |
| All factor variable marginals. | |
| Real | _logZ |
| Logarithm of partition sum. | |
Classes | |
| struct | Properties |
| Parameters for ExactInf. More... | |
Inference is done simply by multiplying all factors together into one large factor, and then calculating marginals and partition sum from the product.
| dai::ExactInf::ExactInf | ( | ) | [inline] |
Default constructor.
| dai::ExactInf::ExactInf | ( | const FactorGraph & | fg, | |
| const PropertySet & | opts | |||
| ) | [inline] |
Construct from FactorGraph fg and PropertySet opts.
| fg | Factor graph. | |
| opts | Parameters |
| virtual ExactInf* dai::ExactInf::clone | ( | ) | const [inline, virtual] |
Returns a pointer to a new, cloned copy of *this (i.e., virtual copy constructor).
Implements dai::InfAlg.
| string dai::ExactInf::identify | ( | ) | const [virtual] |
Returns the (approximate) marginal probability distribution of a variable.
Reimplemented from dai::InfAlg.
Returns the (approximate) marginal probability distribution of a set of variables.
| NOT_IMPLEMENTED | if not implemented/supported. | |
| BELIEF_NOT_AVAILABLE | if the requested belief cannot be calculated with this algorithm. |
Implements dai::InfAlg.
| virtual Factor dai::ExactInf::beliefV | ( | size_t | i | ) | const [inline, virtual] |
Returns the (approximate) marginal probability distribution of the variable with index i.
For some approximate inference algorithms, using beliefV() is preferred to belief() for performance reasons.
Reimplemented from dai::InfAlg.
| virtual Factor dai::ExactInf::beliefF | ( | size_t | I | ) | const [inline, virtual] |
Returns the (approximate) marginal probability distribution of the variables on which factor I depends.
For some approximate inference algorithms, using beliefF() is preferred to belief() for performance reasons.
Reimplemented from dai::InfAlg.
| vector< Factor > dai::ExactInf::beliefs | ( | ) | const [virtual] |
Returns all beliefs (approximate marginal probability distributions) calculated by the algorithm.
Implements dai::InfAlg.
| virtual Real dai::ExactInf::logZ | ( | ) | const [inline, virtual] |
Returns the logarithm of the (approximated) partition sum (normalizing constant of the factor graph).
| NOT_IMPLEMENTED | if not implemented/supported |
Implements dai::InfAlg.
| std::vector< std::size_t > dai::ExactInf::findMaximum | ( | ) | const [virtual] |
Reimplemented from dai::InfAlg.
| void dai::ExactInf::init | ( | ) | [virtual] |
Initializes all data structures of the approximate inference algorithm.
Implements dai::InfAlg.
| virtual void dai::ExactInf::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 |
Implements dai::InfAlg.
| Real dai::ExactInf::run | ( | ) | [virtual] |
| virtual Real dai::ExactInf::maxDiff | ( | ) | const [inline, virtual] |
Returns maximum difference between single variable beliefs in the last iteration.
| NOT_IMPLEMENTED | if not implemented/supported |
Reimplemented from dai::InfAlg.
| virtual size_t dai::ExactInf::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::InfAlg.
| void dai::ExactInf::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.
Implements dai::InfAlg.
| PropertySet dai::ExactInf::getProperties | ( | ) | const [virtual] |
Returns parameters of this inference algorithm converted into a PropertySet.
Implements dai::InfAlg.
| string dai::ExactInf::printProperties | ( | ) | const [virtual] |
Returns parameters of this inference algorithm formatted as a string in the format "[key1=val1,key2=val2,...,keyn=valn]".
Implements dai::InfAlg.
Calculates marginal probability distribution for variables vs.
| void dai::ExactInf::construct | ( | ) | [private] |
Helper function for constructors.
const char * dai::ExactInf::Name = "EXACT" [static] |
Name of this inference algorithm.
std::vector<Factor> dai::ExactInf::_beliefsV [private] |
All single variable marginals.
std::vector<Factor> dai::ExactInf::_beliefsF [private] |
All factor variable marginals.
Real dai::ExactInf::_logZ [private] |
Logarithm of partition sum.
1.5.5