30 #ifndef GUM_SAMPLING_INFERENCE_H 31 #define GUM_SAMPLING_INFERENCE_H 33 #include <agrum/BN/BayesNetFragment.h> 34 #include <agrum/BN/IBayesNet.h> 35 #include <agrum/BN/inference/tools/estimator.h> 36 #include <agrum/BN/inference/tools/gibbsOperator.h> 37 #include <agrum/BN/inference/tools/marginalTargetedInference.h> 38 #include <agrum/tools/core/approximations/approximationScheme.h> 39 #include <agrum/tools/multidim/instantiation.h> 58 template <
typename GUM_SCALAR >
173 GUM_SCALAR virtualLBPSize);
251 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 257 #include <agrum/BN/inference/tools/samplingInference_tpl.h> virtual void contextualize()
Simplifying the Bayesian network with relevance reasonning to lighten the computational charge...
virtual Instantiation draw_(GUM_SCALAR *w, Instantiation prev)=0
draws a sample in the Bayesian network given a previous one
SamplingInference(const IBayesNet< GUM_SCALAR > *bn)
default constructor
void onMarginalTargetErased_(const NodeId id) override
fired before a marginal target is removed
INLINE void emplace(Args &&... args)
void onStateChanged_() override
fired when the stage is changed
const Potential< GUM_SCALAR > & posterior_(NodeId id) override
Computes and returns the posterior of a node.
void makeInference_() override
makes the inference by generating samples
void onModelChanged_(const GraphicalModel *bn) override
fired after a new Bayes net has been assigned to the engine
~SamplingInference() override
destructor
void onAllMarginalTargetsErased_() override
fired before a all marginal targets are removed
void onAllEvidenceErased_(bool contains_hard_evidence) override
fired before all the evidence are erased
BayesNetFragment< GUM_SCALAR > * _samplingBN_
<agrum/BN/inference/samplingInference.h>
Estimator< GUM_SCALAR > _estimator_
Estimator object designed to approximate target posteriors.
void onEvidenceAdded_(const NodeId id, bool isHardEvidence) override
fired after a new evidence is inserted
const Potential< GUM_SCALAR > & currentPosterior(NodeId id)
Computes and returns the actual estimation of the posterior of a node.
void onEvidenceErased_(const NodeId id, bool isHardEvidence) override
fired before an evidence is removed
void onMarginalTargetAdded_(const NodeId id) override
fired after a new marginal target is inserted
virtual void setEstimatorFromLBP_(LoopyBeliefPropagation< GUM_SCALAR > *lbp, GUM_SCALAR virtualLBPSize)
Initializes the estimators object linked to the simulation.
void updateOutdatedPotentials_() override
prepares inference when the latter is in OutdatedPotentials state
virtual Instantiation burnIn_()=0
draws samples without updating the estimators
bool isContextualized
whether the referenced Bayesian network has been "contextualized"
virtual void addVarSample_(NodeId nod, Instantiation *I)
adds a node to current instantiation
bool isSetEstimator
whether the Estimator object has been initialized
const Potential< GUM_SCALAR > & currentPosterior(const std::string &name)
Computes and returns the actual estimation of the posterior of a node by its name.
void loopApproxInference_()
const IBayesNet< GUM_SCALAR > & samplingBN()
get the BayesNet which is used to really perform the sampling
virtual void onContextualize_(BayesNetFragment< GUM_SCALAR > *bn)
fired when Bayesian network is contextualized
void onEvidenceChanged_(const NodeId id, bool hasChangedSoftHard) override
fired after an evidence is changed, in particular when its status (soft/hard) changes ...
void updateOutdatedStructure_() override
prepares inference when the latter is in OutdatedStructure state
virtual void setEstimatorFromBN_()
Initializes the estimators object linked to the simulation.
void onAllMarginalTargetsAdded_() override
fired after all the nodes of the BN are added as marginal targets