libDAI
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
dai::CondProbEstimation Class Reference

Estimates the parameters of a conditional probability table, using pseudocounts. More...

#include <dai/emalg.h>

Inheritance diagram for dai::CondProbEstimation:
dai::ParameterEstimation

Public Member Functions

 CondProbEstimation (size_t target_dimension, const Prob &pseudocounts)
 Constructor.
virtual ParameterEstimationclone () const
 Virtual copy constructor.
virtual ~CondProbEstimation ()
 Virtual destructor.
virtual Prob estimate ()
 Returns an estimate of the conditional probability distribution.
virtual void addSufficientStatistics (const Prob &p)
 Accumulate sufficient statistics from the expectations in p.
virtual size_t probSize () const
 Returns the required size for arguments to addSufficientStatistics().

Static Public Member Functions

static ParameterEstimationfactory (const PropertySet &p)
 Virtual constructor, using a PropertySet.

Private Attributes

size_t _target_dim
 Number of states of the variable of interest.
Prob _stats
 Current pseudocounts.
Prob _initial_stats
 Initial pseudocounts.

Additional Inherited Members

- Private Types inherited from dai::ParameterEstimation
typedef ParameterEstimation *(* ParamEstFactory )(const PropertySet &)
 Type of pointer to factory function.
- Private Member Functions inherited from dai::ParameterEstimation
virtual ~ParameterEstimation ()
 Virtual destructor for deleting pointers to derived classes.
virtual ParameterEstimationclone () 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 Private Member Functions inherited from dai::ParameterEstimation
static ParameterEstimationconstruct (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().

Detailed Description

Estimates the parameters of a conditional probability table, using pseudocounts.

Author
Charles Vaske

Constructor & Destructor Documentation

dai::CondProbEstimation::CondProbEstimation ( size_t  target_dimension,
const Prob pseudocounts 
)

Constructor.

For a conditional probability $ P( X | Y ) $,

Parameters
target_dimensionshould equal $ | X | $
pseudocountsare the initial pseudocounts, of length $ |X| \cdot |Y| $
virtual dai::CondProbEstimation::~CondProbEstimation ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

ParameterEstimation * dai::CondProbEstimation::factory ( const PropertySet p)
static

Virtual constructor, using a PropertySet.

Some keys in the PropertySet are required. For a conditional probability $ P( X | Y ) $,

  • target_dimension should be equal to $ | X | $
  • total_dimension should be equal to $ |X| \cdot |Y| $

An optional key is:

  • pseudo_count which specifies the initial counts (defaults to 1)
virtual ParameterEstimation* dai::CondProbEstimation::clone ( ) const
inlinevirtual

Virtual copy constructor.

Prob dai::CondProbEstimation::estimate ( )
virtual

Returns an estimate of the conditional probability distribution.

The format of the resulting Prob keeps all the values for $ P(X | Y=y) $ in sequential order in the array.

void dai::CondProbEstimation::addSufficientStatistics ( const Prob p)
virtual

Accumulate sufficient statistics from the expectations in p.

virtual size_t dai::CondProbEstimation::probSize ( ) const
inlinevirtual

Returns the required size for arguments to addSufficientStatistics().

Member Data Documentation

size_t dai::CondProbEstimation::_target_dim
private

Number of states of the variable of interest.

Prob dai::CondProbEstimation::_stats
private

Current pseudocounts.

Prob dai::CondProbEstimation::_initial_stats
private

Initial pseudocounts.


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