48#ifndef GUM_ESTIMATOR_H
49#define GUM_ESTIMATOR_H
57 template <
typename GUM_SCALAR >
76 explicit Estimator(
const IBayesNet< GUM_SCALAR >* bn);
89 void setFromBN(
const IBayesNet< GUM_SCALAR >* bn,
const NodeSet& hardEvidence);
95 void setFromLBP(LoopyBeliefPropagation< GUM_SCALAR >* lbp,
97 GUM_SCALAR virtualLBPSize);
114 void update(Instantiation I, GUM_SCALAR w);
126 const Tensor< GUM_SCALAR >&
posterior(
const DiscreteVariable& var);
159 GUM_SCALAR
EV(std::string name,
Idx val);
179#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
GUM_SCALAR wtotal_
cumulated weights of all samples
HashTable< std::string, std::vector< GUM_SCALAR > > estimator_
estimator represented by hashtable between each variable name and a vector of cumulative sample weigh...
void setFromLBP(LoopyBeliefPropagation< GUM_SCALAR > *lbp, const NodeSet &hardEvidence, GUM_SCALAR virtualLBPSize)
sets the estimatoor object with posteriors obtained by LoopyBeliefPropagation
GUM_SCALAR EV(std::string name, Idx val)
returns expected value of Bernouilli variable (called by it's name) of given parameter
void setFromBN(const IBayesNet< GUM_SCALAR > *bn, const NodeSet &hardEvidence)
estimator initializing
const IBayesNet< GUM_SCALAR > * bn_
Bayesian network on which approximation is done.
const Tensor< GUM_SCALAR > & posterior(const DiscreteVariable &var)
returns the posterior of a node
Estimator()
Default constructor.
void clear()
refresh the estimator state as empty
Size ntotal_
number of generated samples
void update(Instantiation I, GUM_SCALAR w)
updates the estimator with a given sample
HashTable< std::string, Tensor< GUM_SCALAR > * > _target_posteriors_
the set of single posteriors computed during the last inference
GUM_SCALAR confidence()
computes the maximum length of confidence interval for each possible value of each variable
GUM_SCALAR variance(std::string name, Idx val)
returns variance of Bernouilli variable (called by it's name) of given parameter
The class for generic Hash Tables.
Class representing the minimal interface for Bayesian network with no numerical data.
Implementation of Estimator for approximate inference in bayesian networks.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size Idx
Type for indexes.
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
This file contains gibbs sampling (for BNs) class definitions.
gum is the global namespace for all aGrUM entities