![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
#include <estimator.h>
Public Member Functions | |
Estimator () | |
Default constructor. More... | |
Estimator (const IBayesNet< GUM_SCALAR > *bn) | |
Constructor with Bayesian network. More... | |
~Estimator () | |
GUM_SCALAR | confidence () |
computes the maximum length of confidence interval for each possible value of each variable More... | |
void | update (Instantiation I, GUM_SCALAR w) |
updates the estimator with a given sample More... | |
const Potential< GUM_SCALAR > & | posterior (const DiscreteVariable &var) |
returns the posterior of a node More... | |
void | clear () |
refresh the estimator state as empty More... | |
void | setFromBN (const IBayesNet< GUM_SCALAR > *bn, const NodeSet &hardEvidence) |
estimator initializing More... | |
void | setFromLBP (LoopyBeliefPropagation< GUM_SCALAR > *lbp, const NodeSet &hardEvidence, GUM_SCALAR virtualLBPSize) |
sets the estimatoor object with posteriors obtained by LoopyBeliefPropagation More... | |
Definition at line 39 of file estimator.h.
Estimator::Estimator | ( | ) |
Default constructor.
Definition at line 33 of file estimator_tpl.h.
|
explicit |
Constructor with Bayesian network.
Definition at line 42 of file estimator_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE Estimator::~Estimator | ( | ) |
Definition at line 54 of file estimator_tpl.h.
References gum::Set< Key, Alloc >::emplace().
void Estimator::clear | ( | ) |
refresh the estimator state as empty
this function remove all the statistics in order to restart the computations.
Definition at line 174 of file estimator_tpl.h.
References gum::Set< Key, Alloc >::emplace().
GUM_SCALAR Estimator::confidence | ( | ) |
computes the maximum length of confidence interval for each possible value of each variable
Definition at line 160 of file estimator_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
private |
returns expected value of Bernouilli variable (called by it's name) of given parameter
name | variable's name, considered as a Bernouilli variable |
val | the parameter of the Bernouilli variable |
computes the amount of cumulative weights for paramater val over the amount of total cumulative weights
Definition at line 142 of file estimator_tpl.h.
References gum::Set< Key, Alloc >::emplace().
const Potential< GUM_SCALAR > & Estimator::posterior | ( | const DiscreteVariable & | var | ) |
returns the posterior of a node
var | the variable node which we want posterior for |
returns the vector of cumulated weight bias for each value of the variable normalized as a CPT
NotFound | if variable node is not in estimator. |
Definition at line 119 of file estimator_tpl.h.
References gum::Set< Key, Alloc >::emplace().
void Estimator::setFromBN | ( | const IBayesNet< GUM_SCALAR > * | bn, |
const NodeSet & | hardEvidence | ||
) |
estimator initializing
sets the estimator object with 0-filled vectors corresponding to each non evidence node
Definition at line 64 of file estimator_tpl.h.
References gum::Set< Key, Alloc >::emplace().
void Estimator::setFromLBP | ( | LoopyBeliefPropagation< GUM_SCALAR > * | lbp, |
const NodeSet & | hardEvidence, | ||
GUM_SCALAR | virtualLBPSize | ||
) |
sets the estimatoor object with posteriors obtained by LoopyBeliefPropagation
Definition at line 84 of file estimator_tpl.h.
References gum::Set< Key, Alloc >::emplace().
void Estimator::update | ( | Instantiation | I, |
GUM_SCALAR | w | ||
) |
updates the estimator with a given sample
I | the sample used to update the estimators |
weight | bias for the given sample |
adds the sample weight to each node's given value in the estimator
Definition at line 107 of file estimator_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
private |
returns variance of Bernouilli variable (called by it's name) of given parameter
name | variable's name, considered as a Bernouilli variable |
val | the parameter of the Bernouilli variable |
computes variance for Bernouilli law using EV(name, val)
Definition at line 150 of file estimator_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
private |
the set of single posteriors computed during the last inference
the posteriors are owned by LazyPropagation.
Definition at line 157 of file estimator.h.
|
private |
Bayesian network on which approximation is done.
Definition at line 127 of file estimator.h.
|
private |
estimator represented by hashtable between each variable name and a vector of cumulative sample weights
Definition at line 118 of file estimator.h.
|
private |
number of generated samples
Definition at line 124 of file estimator.h.
|
private |
cumulated weights of all samples
Definition at line 121 of file estimator.h.