aGrUM  0.16.0
estimator.h
Go to the documentation of this file.
1 
29 #ifndef GUM_ESTIMATOR_H
30 #define GUM_ESTIMATOR_H
31 
32 #include <agrum/BN/IBayesNet.h>
34 #include <agrum/core/hashTable.h>
35 #include <vector>
36 
37 namespace gum {
38 
39  template < typename GUM_SCALAR >
40  class Estimator {
41  public:
53  Estimator();
54 
58  explicit Estimator(const IBayesNet< GUM_SCALAR >* bn);
59 
60  /* Destructor */
61  ~Estimator();
62 
71  void setFromBN(const IBayesNet< GUM_SCALAR >* bn, const NodeSet& hardEvidence);
72 
78  const NodeSet& hardEvidence,
79  GUM_SCALAR virtualLBPSize);
82 
87  GUM_SCALAR confidence();
88 
90 
96  void update(Instantiation I, GUM_SCALAR w);
97 
99 
109 
111 
114  void clear();
115 
116  private:
120 
122  GUM_SCALAR _wtotal;
123 
126 
129 
132 
141  GUM_SCALAR EV(std::string name, Idx val);
142 
145 
153  GUM_SCALAR variance(std::string name, Idx val); // variance corrigĂ©e
154 
155  private:
157 
159  };
160 
161 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
162  extern template class Estimator< double >;
163 #endif
164 
165 } // namespace gum
166 
168 #endif
aGrUM&#39;s Potential is a multi-dimensional array with tensor operators.
Definition: potential.h:60
void setFromBN(const IBayesNet< GUM_SCALAR > *bn, const NodeSet &hardEvidence)
estimator initializing
Definition: estimator_tpl.h:69
void clear()
refresh the estimator state as empty
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
const Potential< GUM_SCALAR > & posterior(const DiscreteVariable &var)
returns the posterior of a node
HashTable< std::string, std::vector< GUM_SCALAR > > _estimator
estimator represented by hashtable between each variable name and a vector of cumulative sample weigh...
Definition: estimator.h:119
GUM_SCALAR _wtotal
cumulated weights of all samples
Definition: estimator.h:122
Size _ntotal
number of generated samples
Definition: estimator.h:125
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void update(Instantiation I, GUM_SCALAR w)
updates the estimator with a given sample
Base class for discrete random variable.
Class representing the minimal interface for Bayesian Network.
Definition: IBayesNet.h:62
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
The class for generic Hash Tables.
Definition: hashTable.h:679
GUM_SCALAR EV(std::string name, Idx val)
returns expected value of Bernouilli variable (called by it&#39;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
Definition: estimator_tpl.h:92
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
const IBayesNet< GUM_SCALAR > * _bn
bayesian network on which approximation is done
Definition: estimator.h:128
<agrum/BN/inference/loopyBeliefPropagation.h>
Class for assigning/browsing values to tuples of discrete variables.
Definition: instantiation.h:83
GUM_SCALAR variance(std::string name, Idx val)
returns variance of Bernouilli variable (called by it&#39;s name) of given parameter
Size Idx
Type for indexes.
Definition: types.h:53
Estimator()
Default constructor.
Definition: estimator_tpl.h:34
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
HashTable< std::string, Potential< GUM_SCALAR > *> __target_posteriors
the set of single posteriors computed during the last inference
Definition: estimator.h:158
GUM_SCALAR confidence()
computes the maximum length of confidence interval for each possible value of each variable ...