28 #ifndef GUM_ESTIMATOR_H 29 #define GUM_ESTIMATOR_H 31 #include <agrum/BN/IBayesNet.h> 32 #include <agrum/BN/inference/loopyBeliefPropagation.h> 33 #include <agrum/tools/core/hashTable.h> 38 template <
typename GUM_SCALAR >
57 explicit Estimator(
const IBayesNet< GUM_SCALAR >* bn);
70 void setFromBN(
const IBayesNet< GUM_SCALAR >* bn,
const NodeSet& hardEvidence);
76 void setFromLBP(LoopyBeliefPropagation< GUM_SCALAR >* lbp,
77 const NodeSet& hardEvidence,
78 GUM_SCALAR virtualLBPSize);
95 void update(Instantiation I, GUM_SCALAR w);
140 GUM_SCALAR
EV(std::string name, Idx val);
152 GUM_SCALAR
variance(std::string name, Idx val);
160 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 161 extern template class Estimator<
double >;
166 #include <agrum/BN/inference/tools/estimator_tpl.h> void setFromBN(const IBayesNet< GUM_SCALAR > *bn, const NodeSet &hardEvidence)
estimator initializing
void clear()
refresh the estimator state as empty
const Potential< GUM_SCALAR > & posterior(const DiscreteVariable &var)
returns the posterior of a node
INLINE void emplace(Args &&... args)
void update(Instantiation I, GUM_SCALAR w)
updates the estimator with a given sample
HashTable< std::string, Potential< GUM_SCALAR > *> _target_posteriors_
the set of single posteriors computed during the last inference
GUM_SCALAR wtotal_
cumulated weights of all samples
GUM_SCALAR EV(std::string name, Idx val)
returns expected value of Bernouilli variable (called by it's name) of given parameter ...
void setFromLBP(LoopyBeliefPropagation< GUM_SCALAR > *lbp, const NodeSet &hardEvidence, GUM_SCALAR virtualLBPSize)
sets the estimatoor object with posteriors obtained by LoopyBeliefPropagation
Estimator(const IBayesNet< GUM_SCALAR > *bn)
Constructor with Bayesian network.
GUM_SCALAR variance(std::string name, Idx val)
returns variance of Bernouilli variable (called by it's name) of given parameter
Size ntotal_
number of generated samples
Estimator()
Default constructor.
const IBayesNet< GUM_SCALAR > * bn_
Bayesian network on which approximation is done.
GUM_SCALAR confidence()
computes the maximum length of confidence interval for each possible value of each variable ...