57 template <
typename GUM_SCALAR >
64 template <
typename GUM_SCALAR >
70 template <
typename GUM_SCALAR >
76 template <
typename GUM_SCALAR >
79 bool wrong_value =
false;
83 for (
const auto nod: this->
BN().topologicalOrder()) {
86 && prev.
val(this->BN().variable(nod)) != this->hardEvidence()[nod]) {
91 }
while (wrong_value);
This file contains Monte Carlo sampling class definition.
virtual const IBayesNet< GUM_SCALAR > & BN() const final
Returns a constant reference over the IBayesNet referenced by this class.
const NodeSet & hardEvidenceNodes() const
returns the set of nodes with hard evidence
Class representing the minimal interface for Bayesian network with no numerical data.
Class for assigning/browsing values to tuples of discrete variables.
void clear()
Erase all variables from an Instantiation.
Idx val(Idx i) const
Returns the current value of the variable at position i.
Instantiation draw_(GUM_SCALAR *w, Instantiation prev) override
draws a sample according to classic Monte Carlo sampling
MonteCarloSampling(const IBayesNet< GUM_SCALAR > *bn)
Default constructor.
~MonteCarloSampling() override
Destructor.
Instantiation burnIn_() override
draws a defined number of samples without updating the estimators
virtual void addVarSample_(NodeId nod, Instantiation *I)
adds a node to current instantiation
SamplingInference(const IBayesNet< GUM_SCALAR > *bn)
default constructor
gum is the global namespace for all aGrUM entities