#include <dai/emalg.h>
Public Types | |
typedef ParameterEstimation *(* | ParamEstFactory )(const PropertySet &) |
Type of pointer to factory function. | |
Public Member Functions | |
virtual | ~ParameterEstimation () |
Virtual destructor for deleting pointers to derived classes. | |
virtual ParameterEstimation * | clone () const =0 |
Virtual copy constructor. | |
virtual Prob | estimate ()=0 |
Estimate the factor using the accumulated sufficient statistics and reset. | |
virtual void | addSufficientStatistics (const Prob &p)=0 |
Accumulate the sufficient statistics for p. | |
virtual size_t | probSize () const =0 |
Returns the size of the Prob that should be passed to addSufficientStatistics. | |
Static Public Member Functions | |
static ParameterEstimation * | construct (const std::string &method, const PropertySet &p) |
General factory method that constructs the desired ParameterEstimation subclass. | |
static void | registerMethod (const std::string &method, const ParamEstFactory &f) |
Register a subclass so that it can be used with construct(). | |
Static Private Member Functions | |
static void | loadDefaultRegistry () |
Registers default ParameterEstimation subclasses (currently, only CondProbEstimation). | |
Static Private Attributes | |
static std::map< std::string, ParamEstFactory > * | _registry = NULL |
A static registry containing all methods registered so far. |
This class defines the general interface of parameter estimation methods.
Implementations of this interface (see e.g. CondProbEstimation) should register a factory function (virtual constructor) via the static registerMethod() function. This factory function should return a pointer to a newly constructed object, whose type is a subclass of ParameterEstimation, and gets as input a PropertySet of parameters. After a subclass has been registered, instances of it can be constructed using the construct() method.
Implementations are responsible for collecting data from a probability vector passed to it from a SharedParameters container object.
The default registry only contains CondProbEstimation, named "CondProbEstimation".
typedef ParameterEstimation*(* dai::ParameterEstimation::ParamEstFactory)(const PropertySet &) |
Type of pointer to factory function.
virtual dai::ParameterEstimation::~ParameterEstimation | ( | ) | [inline, virtual] |
Virtual destructor for deleting pointers to derived classes.
virtual ParameterEstimation* dai::ParameterEstimation::clone | ( | ) | const [pure virtual] |
ParameterEstimation * dai::ParameterEstimation::construct | ( | const std::string & | method, | |
const PropertySet & | p | |||
) | [static] |
General factory method that constructs the desired ParameterEstimation subclass.
method | Name of the subclass that should be constructed; | |
p | Parameters passed to constructor of subclass. |
UNKNOWN_PARAMETER_ESTIMATION_METHOD | if the requested method is not registered. |
static void dai::ParameterEstimation::registerMethod | ( | const std::string & | method, | |
const ParamEstFactory & | f | |||
) | [inline, static] |
Register a subclass so that it can be used with construct().
virtual Prob dai::ParameterEstimation::estimate | ( | ) | [pure virtual] |
Estimate the factor using the accumulated sufficient statistics and reset.
Implemented in dai::CondProbEstimation.
virtual void dai::ParameterEstimation::addSufficientStatistics | ( | const Prob & | p | ) | [pure virtual] |
virtual size_t dai::ParameterEstimation::probSize | ( | ) | const [pure virtual] |
Returns the size of the Prob that should be passed to addSufficientStatistics.
Implemented in dai::CondProbEstimation.
void dai::ParameterEstimation::loadDefaultRegistry | ( | ) | [static, private] |
Registers default ParameterEstimation subclasses (currently, only CondProbEstimation).
std::map< std::string, ParameterEstimation::ParamEstFactory > * dai::ParameterEstimation::_registry = NULL [static, private] |
A static registry containing all methods registered so far.