![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
<agrum/BN/inference/samplingInference.h> More...
#include <samplingInference.h>
Public Types | |
| enum class | StateOfInference { OutdatedStructure , OutdatedTensors , ReadyForInference , Done } |
| current state of the inference More... | |
| enum class | ApproximationSchemeSTATE : char { Undefined , Continue , Epsilon , Rate , Limit , TimeLimit , Stopped } |
| The different state of an approximation scheme. More... | |
Public Member Functions | |
| virtual void | contextualize () |
| Simplifying the Bayesian network with relevance reasonning to lighten the computational charge. | |
| Tensor< GUM_SCALAR > | evidenceImpact (NodeId target, const NodeSet &evs) |
| Create a gum::Tensor for P(target|evs) (for all instanciation of target and evs). | |
| Tensor< GUM_SCALAR > | evidenceImpact (const std::string &target, const std::vector< std::string > &evs) |
| Create a gum::Tensor for P(target|evs) (for all instanciation of target and evs). | |
Constructors / Destructors | |
| SamplingInference (const IBayesNet< GUM_SCALAR > *bn) | |
| default constructor | |
| ~SamplingInference () override | |
| destructor | |
| const Tensor< GUM_SCALAR > & | currentPosterior (NodeId id) |
| Computes and returns the actual estimation of the posterior of a node. | |
| const Tensor< GUM_SCALAR > & | currentPosterior (const std::string &name) |
| Computes and returns the actual estimation of the posterior of a node by its name. | |
Probability computations | |
| const IBayesNet< GUM_SCALAR > & | samplingBN () |
| get the BayesNet which is used to really perform the sampling | |
| const Tensor< GUM_SCALAR > & | posterior_ (NodeId id) override |
| Computes and returns the posterior of a node. | |
Estimator objects initializing | |
| virtual void | setEstimatorFromBN_ () |
| Initializes the estimators object linked to the simulation. | |
| virtual void | setEstimatorFromLBP_ (LoopyBeliefPropagation< GUM_SCALAR > *lbp, GUM_SCALAR virtualLBPSize) |
| Initializes the estimators object linked to the simulation. | |
Probability computations | |
| virtual const Tensor< GUM_SCALAR > & | posterior (NodeId node) |
| Computes and returns the posterior of a node. | |
| virtual const Tensor< GUM_SCALAR > & | posterior (const std::string &nodeName) |
| Computes and returns the posterior of a node. | |
Targets | |
| virtual void | eraseAllTargets () |
| Clear all previously defined targets. | |
| virtual void | addAllTargets () final |
| adds all nodes as targets | |
| virtual void | addTarget (NodeId target) final |
| Add a marginal target to the list of targets. | |
| virtual void | addTarget (const std::string &nodeName) final |
| Add a marginal target to the list of targets. | |
| virtual void | eraseTarget (NodeId target) final |
| removes an existing (marginal) target | |
| virtual void | eraseTarget (const std::string &nodeName) final |
| removes an existing (marginal) target | |
| virtual bool | isTarget (NodeId node) const final |
| return true if variable is a (marginal) target | |
| virtual bool | isTarget (const std::string &nodeName) const final |
| return true if variable is a (marginal) target | |
| virtual Size | nbrTargets () const noexcept final |
| returns the number of marginal targets | |
| virtual const NodeSet & | targets () const noexcept final |
| returns the list of marginal targets | |
| virtual bool | isInTargetMode () const noexcept final |
| indicates whether the inference is in a target mode | |
Information Theory related functions | |
| virtual GUM_SCALAR | H (NodeId X) final |
| Entropy Compute Shanon's entropy of a node given the observation. | |
| virtual GUM_SCALAR | H (const std::string &nodeName) final |
| Entropy Compute Shanon's entropy of a node given the observation. | |
Accessors / Modifiers | |
| virtual void | setBN (const IBayesNet< GUM_SCALAR > *bn) |
| assigns a new BN to the inference engine | |
| virtual const IBayesNet< GUM_SCALAR > & | BN () const final |
| Returns a constant reference over the IBayesNet referenced by this class. | |
Accessors / Modifiers | |
| virtual const GraphicalModel & | model () const final |
| Returns a constant reference over the IBayesNet referenced by this class. | |
| virtual const NodeProperty< Size > & | domainSizes () const final |
| get the domain sizes of the random variables of the model | |
| virtual bool | isInferenceReady () const noexcept final |
| returns whether the inference object is in a ready state | |
| virtual bool | isInferenceOutdatedStructure () const noexcept final |
| returns whether the inference object is in a OutdatedStructure state | |
| virtual bool | isInferenceOutdatedTensors () const noexcept final |
| returns whether the inference object is in a OutdatedTensor state | |
| virtual bool | isInferenceDone () const noexcept final |
| returns whether the inference object is in a InferenceDone state | |
| virtual void | prepareInference () final |
| prepare the internal inference structures for the next inference | |
| virtual void | makeInference () final |
| perform the heavy computations needed to compute the targets' posteriors | |
| virtual void | clear () |
| clears all the data structures allocated for the last inference | |
| virtual StateOfInference | state () const noexcept final |
| returns the state of the inference engine | |
Evidence | |
| virtual void | addEvidence (NodeId id, const Idx val) final |
| adds a new hard evidence on node id | |
| virtual void | addEvidence (const std::string &nodeName, const Idx val) final |
| adds a new hard evidence on node named nodeName | |
| virtual void | addEvidence (NodeId id, const std::string &label) final |
| adds a new hard evidence on node id | |
| virtual void | addEvidence (const std::string &nodeName, const std::string &label) final |
| adds a new hard evidence on node named nodeName | |
| virtual void | addEvidence (NodeId id, const std::vector< GUM_SCALAR > &vals) final |
| adds a new evidence on node id (might be soft or hard) | |
| virtual void | addEvidence (const std::string &nodeName, const std::vector< GUM_SCALAR > &vals) final |
| adds a new evidence on node named nodeName (might be soft or hard) | |
| virtual void | addEvidence (const Tensor< GUM_SCALAR > &pot) final |
| adds a new evidence on node id (might be soft or hard) | |
| virtual void | addEvidence (Tensor< GUM_SCALAR > &&pot) final |
| adds a new evidence on node id (might be soft or hard) | |
| virtual void | addSetOfEvidence (const Set< const Tensor< GUM_SCALAR > * > &potset) final |
| adds a new set of evidence | |
| virtual void | addListOfEvidence (const List< const Tensor< GUM_SCALAR > * > &potlist) final |
| adds a new list of evidence | |
| virtual void | chgEvidence (NodeId id, const Idx val) final |
| change the value of an already existing hard evidence | |
| virtual void | chgEvidence (const std::string &nodeName, const Idx val) final |
| change the value of an already existing hard evidence | |
| virtual void | chgEvidence (NodeId id, const std::string &label) final |
| change the value of an already existing hard evidence | |
| virtual void | chgEvidence (const std::string &nodeName, const std::string &label) final |
| change the value of an already existing hard evidence | |
| virtual void | chgEvidence (NodeId id, const std::vector< GUM_SCALAR > &vals) final |
| change the value of an already existing evidence (might be soft or hard) | |
| virtual void | chgEvidence (const std::string &nodeName, const std::vector< GUM_SCALAR > &vals) final |
| change the value of an already existing evidence (might be soft or hard) | |
| virtual void | chgEvidence (const Tensor< GUM_SCALAR > &pot) final |
| change the value of an already existing evidence (might be soft or hard) | |
| virtual void | eraseAllEvidence () final |
| removes all the evidence entered into the network | |
| virtual void | eraseEvidence (NodeId id) final |
| removed the evidence, if any, corresponding to node id | |
| virtual void | eraseEvidence (const std::string &nodeName) final |
| removed the evidence, if any, corresponding to node of name nodeName | |
| virtual bool | hasEvidence () const final |
| indicates whether some node(s) have received evidence | |
| virtual bool | hasEvidence (NodeId id) const final |
| indicates whether node id has received an evidence | |
| virtual bool | hasEvidence (const std::string &nodeName) const final |
| indicates whether node id has received an evidence | |
| virtual bool | hasHardEvidence (NodeId id) const final |
| indicates whether node id has received a hard evidence | |
| virtual bool | hasHardEvidence (const std::string &nodeName) const final |
| indicates whether node id has received a hard evidence | |
| virtual bool | hasSoftEvidence (NodeId id) const final |
| indicates whether node id has received a soft evidence | |
| virtual bool | hasSoftEvidence (const std::string &nodeName) const final |
| indicates whether node id has received a soft evidence | |
| virtual Size | nbrEvidence () const final |
| returns the number of evidence entered into the Bayesian network | |
| virtual Size | nbrHardEvidence () const final |
| returns the number of hard evidence entered into the Bayesian network | |
| virtual Size | nbrSoftEvidence () const final |
| returns the number of soft evidence entered into the Bayesian network | |
| const NodeProperty< const Tensor< GUM_SCALAR > * > & | evidence () const |
| returns the set of evidence | |
| const NodeSet & | softEvidenceNodes () const |
| returns the set of nodes with soft evidence | |
| const NodeSet & | hardEvidenceNodes () const |
| returns the set of nodes with hard evidence | |
| const NodeProperty< Idx > & | hardEvidence () const |
| indicate for each node with hard evidence which value it took | |
Getters and setters | |
| void | setEpsilon (double eps) override |
| Given that we approximate f(t), stopping criterion on |f(t+1)-f(t)|. | |
| double | epsilon () const override |
| Returns the value of epsilon. | |
| void | disableEpsilon () override |
| Disable stopping criterion on epsilon. | |
| void | enableEpsilon () override |
| Enable stopping criterion on epsilon. | |
| bool | isEnabledEpsilon () const override |
| Returns true if stopping criterion on epsilon is enabled, false otherwise. | |
| void | setMinEpsilonRate (double rate) override |
| Given that we approximate f(t), stopping criterion on d/dt(|f(t+1)-f(t)|). | |
| double | minEpsilonRate () const override |
| Returns the value of the minimal epsilon rate. | |
| void | disableMinEpsilonRate () override |
| Disable stopping criterion on epsilon rate. | |
| void | enableMinEpsilonRate () override |
| Enable stopping criterion on epsilon rate. | |
| bool | isEnabledMinEpsilonRate () const override |
| Returns true if stopping criterion on epsilon rate is enabled, false otherwise. | |
| void | setMaxIter (Size max) override |
| Stopping criterion on number of iterations. | |
| Size | maxIter () const override |
| Returns the criterion on number of iterations. | |
| void | disableMaxIter () override |
| Disable stopping criterion on max iterations. | |
| void | enableMaxIter () override |
| Enable stopping criterion on max iterations. | |
| bool | isEnabledMaxIter () const override |
| Returns true if stopping criterion on max iterations is enabled, false otherwise. | |
| void | setMaxTime (double timeout) override |
| Stopping criterion on timeout. | |
| double | maxTime () const override |
| Returns the timeout (in seconds). | |
| double | currentTime () const override |
| Returns the current running time in second. | |
| void | disableMaxTime () override |
| Disable stopping criterion on timeout. | |
| void | enableMaxTime () override |
| Enable stopping criterion on timeout. | |
| bool | isEnabledMaxTime () const override |
| Returns true if stopping criterion on timeout is enabled, false otherwise. | |
| void | setPeriodSize (Size p) override |
| How many samples between two stopping is enable. | |
| Size | periodSize () const override |
| Returns the period size. | |
| void | setVerbosity (bool v) override |
| Set the verbosity on (true) or off (false). | |
| bool | verbosity () const override |
| Returns true if verbosity is enabled. | |
| ApproximationSchemeSTATE | stateApproximationScheme () const override |
| Returns the approximation scheme state. | |
| Size | nbrIterations () const override |
| Returns the number of iterations. | |
| const std::vector< double > & | history () const override |
| Returns the scheme history. | |
| void | initApproximationScheme () |
| Initialise the scheme. | |
| bool | startOfPeriod () const |
| Returns true if we are at the beginning of a period (compute error is mandatory). | |
| void | updateApproximationScheme (unsigned int incr=1) |
| Update the scheme w.r.t the new error and increment steps. | |
| Size | remainingBurnIn () const |
| Returns the remaining burn in. | |
| void | stopApproximationScheme () |
| Stop the approximation scheme. | |
| bool | continueApproximationScheme (double error) |
| Update the scheme w.r.t the new error. | |
Getters and setters | |
| std::string | messageApproximationScheme () const |
| Returns the approximation scheme message. | |
Public Attributes | |
| Signaler3< Size, double, double > | onProgress |
| Progression, error and time. | |
| Signaler1< const std::string & > | onStop |
| Criteria messageApproximationScheme. | |
Protected Member Functions | |
| virtual Instantiation | burnIn_ ()=0 |
| draws samples without updating the estimators | |
| virtual Instantiation | draw_ (GUM_SCALAR *w, Instantiation prev)=0 |
| draws a sample in the Bayesian network given a previous one | |
| void | makeInference_ () override |
| makes the inference by generating samples | |
| void | loopApproxInference_ () |
| virtual void | addVarSample_ (NodeId nod, Instantiation *I) |
| adds a node to current instantiation | |
| virtual void | onContextualize_ (BayesNetFragment< GUM_SCALAR > *bn) |
| fired when Bayesian network is contextualized | |
| void | onEvidenceAdded_ (const NodeId id, bool isHardEvidence) override |
| fired after a new evidence is inserted | |
| void | onEvidenceErased_ (const NodeId id, bool isHardEvidence) override |
| fired before an evidence is removed | |
| void | onAllEvidenceErased_ (bool contains_hard_evidence) override |
| fired before all the evidence are erased | |
| void | onEvidenceChanged_ (const NodeId id, bool hasChangedSoftHard) override |
| fired after an evidence is changed, in particular when its status (soft/hard) changes | |
| void | onModelChanged_ (const GraphicalModel *bn) override |
| fired after a new Bayes net has been assigned to the engine | |
| void | updateOutdatedStructure_ () override |
| prepares inference when the latter is in OutdatedStructure state | |
| void | updateOutdatedTensors_ () override |
| prepares inference when the latter is in OutdatedTensors state | |
| void | onMarginalTargetAdded_ (const NodeId id) override |
| fired after a new marginal target is inserted | |
| void | onMarginalTargetErased_ (const NodeId id) override |
| fired before a marginal target is removed | |
| void | onAllMarginalTargetsAdded_ () override |
| fired after all the nodes of the BN are added as marginal targets | |
| void | onAllMarginalTargetsErased_ () override |
| fired before a all marginal targets are removed | |
| void | onStateChanged_ () override |
| fired when the stage is changed | |
| void | setTargetedMode_ () |
| bool | isTargetedMode_ () const |
| void | setOutdatedStructureState_ () |
| put the inference into an outdated model structure state | |
| void | setOutdatedTensorsState_ () |
| puts the inference into an OutdatedTensors state if it is not already in an OutdatedStructure state | |
| virtual void | setState_ (const StateOfInference state) final |
| set the state of the inference engine and call the notification onStateChanged_ when necessary (i.e. when the state has effectively changed). | |
| void | setModel_ (const GraphicalModel *model) |
| void | setModelDuringConstruction_ (const GraphicalModel *model) |
| assigns a model during the inference engine construction | |
| bool | hasNoModel_ () const |
Protected Attributes | |
| Estimator< GUM_SCALAR > | _estimator_ |
| Estimator object designed to approximate target posteriors. | |
| bool | isSetEstimator = false |
| whether the Estimator object has been initialized | |
| bool | isContextualized = false |
| whether the referenced Bayesian network has been "contextualized" | |
| double | current_epsilon_ |
| Current epsilon. | |
| double | last_epsilon_ |
| Last epsilon value. | |
| double | current_rate_ |
| Current rate. | |
| Size | current_step_ |
| The current step. | |
| Timer | timer_ |
| The timer. | |
| ApproximationSchemeSTATE | current_state_ |
| The current state. | |
| std::vector< double > | history_ |
| The scheme history, used only if verbosity == true. | |
| double | eps_ |
| Threshold for convergence. | |
| bool | enabled_eps_ |
| If true, the threshold convergence is enabled. | |
| double | min_rate_eps_ |
| Threshold for the epsilon rate. | |
| bool | enabled_min_rate_eps_ |
| If true, the minimal threshold for epsilon rate is enabled. | |
| double | max_time_ |
| The timeout. | |
| bool | enabled_max_time_ |
| If true, the timeout is enabled. | |
| Size | max_iter_ |
| The maximum iterations. | |
| bool | enabled_max_iter_ |
| If true, the maximum iterations stopping criterion is enabled. | |
| Size | burn_in_ |
| Number of iterations before checking stopping criteria. | |
| Size | period_size_ |
| Checking criteria frequency. | |
| bool | verbosity_ |
| If true, verbosity is enabled. | |
Private Member Functions | |
| void | _setAllMarginalTargets_ () |
| sets all the nodes of the Bayes net as targets | |
| void | stopScheme_ (ApproximationSchemeSTATE new_state) |
| Stop the scheme given a new state. | |
Private Attributes | |
| BayesNetFragment< GUM_SCALAR > * | _samplingBN_ |
| bool | _targeted_mode_ |
| whether the actual targets are default | |
| NodeSet | _targets_ |
| the set of marginal targets | |
<agrum/BN/inference/samplingInference.h>
A generic class for making sampling inference in Bayesian networks adapted
The goal of this class is to define the genereal scheme used by all sampling inference algorithms, which are implemented as derived classes of ApproximateInference. This class inherits from MarginalTargetedInference for the handling of marginal targets and from ApproximationScheme.
Definition at line 75 of file samplingInference.h.
|
stronginherited |
The different state of an approximation scheme.
| Enumerator | |
|---|---|
| Undefined | |
| Continue | |
| Epsilon | |
| Rate | |
| Limit | |
| TimeLimit | |
| Stopped | |
Definition at line 86 of file IApproximationSchemeConfiguration.h.
|
stronginherited |
current state of the inference
graphicalModelInference can be in one of 4 different states:
| Enumerator | |
|---|---|
| OutdatedStructure | |
| OutdatedTensors | |
| ReadyForInference | |
| Done | |
Definition at line 127 of file graphicalModelInference.h.
|
explicit |
default constructor
Definition at line 67 of file samplingInference_tpl.h.
References gum::ApproximateInference< GUM_SCALAR >::ApproximateInference(), SamplingInference(), _estimator_, _samplingBN_, DEFAULT_EPSILON, DEFAULT_MAXITER, DEFAULT_MIN_EPSILON_RATE, DEFAULT_PERIOD_SIZE, DEFAULT_TIMEOUT, DEFAULT_VERBOSITY, gum::ApproximationScheme::setEpsilon(), gum::ApproximationScheme::setMaxIter(), gum::ApproximationScheme::setMaxTime(), gum::ApproximationScheme::setMinEpsilonRate(), gum::ApproximationScheme::setPeriodSize(), and gum::ApproximationScheme::setVerbosity().
Referenced by gum::GibbsSampling< GUM_SCALAR >::GibbsSampling(), gum::ImportanceSampling< GUM_SCALAR >::ImportanceSampling(), gum::MonteCarloSampling< GUM_SCALAR >::MonteCarloSampling(), SamplingInference(), gum::WeightedSampling< GUM_SCALAR >::WeightedSampling(), and ~SamplingInference().
|
override |
destructor
Definition at line 79 of file samplingInference_tpl.h.
References SamplingInference(), _samplingBN_, and isContextualized.
|
privateinherited |
sets all the nodes of the Bayes net as targets
Definition at line 229 of file marginalTargetedInference_tpl.h.
References _targets_, gum::BayesNetInference< GUM_SCALAR >::BN(), gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), and onAllMarginalTargetsAdded_().
Referenced by onModelChanged_().
|
finalvirtualinherited |
adds all nodes as targets
Definition at line 144 of file marginalTargetedInference_tpl.h.
References _targets_, gum::BayesNetInference< GUM_SCALAR >::BN(), GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), onMarginalTargetAdded_(), gum::GraphicalModelInference< GUM_SCALAR >::OutdatedStructure, gum::GraphicalModelInference< GUM_SCALAR >::setState_(), and setTargetedMode_().
|
finalvirtualinherited |
adds a new hard evidence on node named nodeName
| UndefinedElement | if nodeName does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if nodeName already has an evidence |
Definition at line 235 of file graphicalModelInference_tpl.h.
References addEvidence(), and model().
|
finalvirtualinherited |
adds a new hard evidence on node named nodeName
| UndefinedElement | if nodeName does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if nodeName already has an evidence |
Definition at line 249 of file graphicalModelInference_tpl.h.
References addEvidence(), and model().
|
finalvirtualinherited |
adds a new evidence on node named nodeName (might be soft or hard)
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if nodeName already has an evidence |
| FatalError | if vals=[0,0,...,0] |
| InvalidArgument | if the size of vals is different from the domain size of node nodeName |
Definition at line 281 of file graphicalModelInference_tpl.h.
References addEvidence(), and model().
|
finalvirtualinherited |
adds a new evidence on node id (might be soft or hard)
| UndefinedElement | if the tensor is defined over several nodes |
| UndefinedElement | if the node on which the tensor is defined does not belong to the Bayesian network |
| InvalidArgument | if the node of the tensor already has an evidence |
| FatalError | if pot=[0,0,...,0] |
Definition at line 323 of file graphicalModelInference_tpl.h.
References addEvidence().
|
finalvirtualinherited |
adds a new hard evidence on node id
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if id already has an evidence |
Definition at line 229 of file graphicalModelInference_tpl.h.
References _createHardEvidence_(), and addEvidence().
Referenced by addEvidence(), addEvidence(), addEvidence(), addEvidence(), addEvidence(), addEvidence(), addEvidence(), addListOfEvidence(), addSetOfEvidence(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedMRFInference< GUM_SCALAR >::evidenceJointImpact(), and gum::LoopySamplingInference< GUM_SCALAR, APPROX >::makeInference_().
|
finalvirtualinherited |
adds a new hard evidence on node id
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if id already has an evidence |
Definition at line 242 of file graphicalModelInference_tpl.h.
References addEvidence(), and model().
|
finalvirtualinherited |
adds a new evidence on node id (might be soft or hard)
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if id already has an evidence |
| FatalError | if vals=[0,0,...,0] |
| InvalidArgument | if the size of vals is different from the domain size of node id |
Definition at line 257 of file graphicalModelInference_tpl.h.
References _model_, addEvidence(), and GUM_ERROR.
|
finalvirtualinherited |
adds a new evidence on node id (might be soft or hard)
| UndefinedElement | if the tensor is defined over several nodes |
| UndefinedElement | if the node on which the tensor is defined does not belong to the Bayesian network |
| InvalidArgument | if the node of the tensor already has an evidence |
| FatalError | if pot=[0,0,...,0] |
Definition at line 288 of file graphicalModelInference_tpl.h.
References _evidence_, _hard_evidence_, _hard_evidence_nodes_, _isHardEvidence_(), _model_, _soft_evidence_nodes_, GUM_ERROR, hasEvidence(), onEvidenceAdded_(), OutdatedStructure, and setState_().
|
finalvirtualinherited |
adds a new list of evidence
| UndefinedElement | if some tensor is defined over several nodes |
| UndefinedElement | if the node on which some tensor is defined does not belong to the Bayesian network |
| InvalidArgument | if the node of some tensor already has an evidence |
| FatalError | if pot=[0,0,...,0] |
Definition at line 330 of file graphicalModelInference_tpl.h.
References addEvidence().
|
finalvirtualinherited |
adds a new set of evidence
| UndefinedElement | if some tensor is defined over several nodes |
| UndefinedElement | if the node on which some tensor is defined does not belong to the Bayesian network |
| InvalidArgument | if the node of some tensor already has an evidence |
| FatalError | if pot=[0,0,...,0] |
Definition at line 338 of file graphicalModelInference_tpl.h.
References addEvidence().
|
finalvirtualinherited |
Add a marginal target to the list of targets.
| UndefinedElement | if target is not a NodeId in the Bayes net |
Definition at line 164 of file marginalTargetedInference_tpl.h.
References addTarget(), gum::BayesNetInference< GUM_SCALAR >::BN(), GUM_ERROR, and gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_().
|
finalvirtualinherited |
Add a marginal target to the list of targets.
| UndefinedElement | if target is not a NodeId in the Bayes net |
Definition at line 122 of file marginalTargetedInference_tpl.h.
References _targets_, gum::BayesNetInference< GUM_SCALAR >::BN(), GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), onMarginalTargetAdded_(), gum::GraphicalModelInference< GUM_SCALAR >::OutdatedStructure, gum::GraphicalModelInference< GUM_SCALAR >::setState_(), and setTargetedMode_().
Referenced by addTarget(), and evidenceImpact().
|
protectedvirtual |
adds a node to current instantiation
| nod | the node to add to the sample |
| I | the current sample |
generates random value based on the BN's CPT's and adds the node to the Instantiation with that value
Definition at line 195 of file samplingInference_tpl.h.
References gum::Instantiation::add(), gum::Instantiation::chgVal(), and samplingBN().
Referenced by gum::ImportanceSampling< GUM_SCALAR >::draw_(), gum::MonteCarloSampling< GUM_SCALAR >::draw_(), and gum::WeightedSampling< GUM_SCALAR >::draw_().
|
finalvirtualinherited |
Returns a constant reference over the IBayesNet referenced by this class.
| UndefinedElement | is raised if no Bayes net has been assigned to the inference. |
Definition at line 75 of file BayesNetInference_tpl.h.
References gum::GraphicalModelInference< GUM_SCALAR >::model().
Referenced by gum::LazyPropagation< GUM_SCALAR >::LazyPropagation(), gum::ShaferShenoyInference< GUM_SCALAR >::ShaferShenoyInference(), gum::VariableElimination< GUM_SCALAR >::VariableElimination(), gum::MarginalTargetedInference< GUM_SCALAR >::_setAllMarginalTargets_(), gum::MarginalTargetedInference< GUM_SCALAR >::addAllTargets(), gum::JointTargetedInference< GUM_SCALAR >::addJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), gum::SamplingInference< GUM_SCALAR >::contextualize(), gum::SamplingInference< GUM_SCALAR >::currentPosterior(), gum::SamplingInference< GUM_SCALAR >::currentPosterior(), gum::ImportanceSampling< GUM_SCALAR >::draw_(), gum::MonteCarloSampling< GUM_SCALAR >::draw_(), gum::WeightedSampling< GUM_SCALAR >::draw_(), gum::JointTargetedInference< GUM_SCALAR >::eraseJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::MarginalTargetedInference< GUM_SCALAR >::H(), gum::JointTargetedInference< GUM_SCALAR >::isJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::isTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::isTarget(), gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation(), gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation(), gum::JointTargetedInference< GUM_SCALAR >::posterior(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), gum::SamplingInference< GUM_SCALAR >::posterior_(), gum::SamplingInference< GUM_SCALAR >::samplingBN(), and gum::Estimator< GUM_SCALAR >::setFromLBP().
|
protectedpure virtual |
draws samples without updating the estimators
Implemented in gum::GibbsSampling< GUM_SCALAR >, gum::ImportanceSampling< GUM_SCALAR >, gum::MonteCarloSampling< GUM_SCALAR >, and gum::WeightedSampling< GUM_SCALAR >.
Referenced by loopApproxInference_().
|
finalvirtualinherited |
change the value of an already existing hard evidence
| UndefinedElement | if nodeName does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if id does not already have an evidence |
Definition at line 397 of file graphicalModelInference_tpl.h.
References chgEvidence(), and model().
|
finalvirtualinherited |
change the value of an already existing hard evidence
| UndefinedElement | if nodeName does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if id does not already have an evidence |
Definition at line 411 of file graphicalModelInference_tpl.h.
References chgEvidence(), and model().
|
finalvirtualinherited |
change the value of an already existing evidence (might be soft or hard)
| UndefinedElement | if nodeName does not belong to the Bayesian network |
| InvalidArgument | if the node does not already have an evidence |
| FatalError | if vals=[0,0,...,0] |
| InvalidArgument | if the size of vals is different from the domain size of node id |
Definition at line 445 of file graphicalModelInference_tpl.h.
References chgEvidence(), and model().
|
finalvirtualinherited |
change the value of an already existing evidence (might be soft or hard)
| UndefinedElement | if the tensor is defined over several nodes |
| UndefinedElement | if the node on which the tensor is defined does not belong to the Bayesian network |
| InvalidArgument | if the node of the tensor does not already have an evidence |
| FatalError | if pot=[0,0,...,0] |
Definition at line 452 of file graphicalModelInference_tpl.h.
References _evidence_, _hard_evidence_, _hard_evidence_nodes_, _isHardEvidence_(), _model_, _soft_evidence_nodes_, gum::Instantiation::end(), GUM_ERROR, hasEvidence(), hasHardEvidence(), gum::Instantiation::inc(), isInferenceOutdatedStructure(), onEvidenceChanged_(), OutdatedStructure, OutdatedTensors, gum::Instantiation::setFirst(), and setState_().
|
finalvirtualinherited |
change the value of an already existing hard evidence
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if id does not already have an evidence |
Definition at line 391 of file graphicalModelInference_tpl.h.
References _createHardEvidence_(), and chgEvidence().
Referenced by chgEvidence(), chgEvidence(), chgEvidence(), chgEvidence(), chgEvidence(), chgEvidence(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), and gum::JointTargetedMRFInference< GUM_SCALAR >::evidenceJointImpact().
|
finalvirtualinherited |
change the value of an already existing hard evidence
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if id does not already have an evidence |
Definition at line 404 of file graphicalModelInference_tpl.h.
References chgEvidence(), and model().
|
finalvirtualinherited |
change the value of an already existing evidence (might be soft or hard)
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if the node does not already have an evidence |
| FatalError | if vals=[0,0,...,0] |
| InvalidArgument | if the size of vals is different from the domain size of node id |
Definition at line 420 of file graphicalModelInference_tpl.h.
References _model_, chgEvidence(), and GUM_ERROR.
|
virtualinherited |
clears all the data structures allocated for the last inference
Reimplemented in gum::ShaferShenoyLIMIDInference< GUM_SCALAR >.
Definition at line 155 of file graphicalModelInference_tpl.h.
References eraseAllEvidence(), OutdatedStructure, and setState_().
Referenced by setModel_().
|
virtual |
Simplifying the Bayesian network with relevance reasonning to lighten the computational charge.
Sets the reference Bayesian network as a BayesNetFragment after having eliminated nodes that are idle for simulation and computation, such as barren or d-separated nodes. Eliminates the arcs from evidence nodes to it's children, after setting new CPT's for them.
Definition at line 126 of file samplingInference_tpl.h.
References _samplingBN_, gum::Instantiation::add(), gum::BarrenNodesFinder::barrenNodes(), gum::BayesNetInference< GUM_SCALAR >::BN(), gum::Instantiation::chgVal(), gum::GraphicalModelInference< GUM_SCALAR >::hardEvidence(), gum::GraphicalModelInference< GUM_SCALAR >::hardEvidenceNodes(), isContextualized, onContextualize_(), gum::dSeparationAlgorithm::requisiteNodes(), gum::BarrenNodesFinder::setEvidence(), gum::BarrenNodesFinder::setTargets(), gum::GraphicalModelInference< GUM_SCALAR >::softEvidenceNodes(), and gum::MarginalTargetedInference< GUM_SCALAR >::targets().
Referenced by loopApproxInference_().
Update the scheme w.r.t the new error.
Test the stopping criterion that are enabled.
| error | The new error value. |
| OperationNotAllowed | Raised if state != ApproximationSchemeSTATE::Continue. |
Definition at line 229 of file approximationScheme_inl.h.
References enabled_max_time_, and timer_.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), gum::learning::GreedyHillClimbing::learnStructure(), gum::learning::LocalSearchWithTabuList::learnStructure(), gum::SamplingInference< GUM_SCALAR >::loopApproxInference_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceByOrderedArcs_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceByRandomOrder_(), and gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceNodeToNeighbours_().
| const Tensor< GUM_SCALAR > & gum::SamplingInference< GUM_SCALAR >::currentPosterior | ( | const std::string & | name | ) |
Computes and returns the actual estimation of the posterior of a node by its name.
| name | the name of the node for which we need a posterior probability |
| UndefinedElement | if node corresponding to name is not in the set of targets. |
| NotFound | if node corresponding to name is not in the BN. |
Definition at line 116 of file samplingInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and currentPosterior().
| const Tensor< GUM_SCALAR > & gum::SamplingInference< GUM_SCALAR >::currentPosterior | ( | NodeId | id | ) |
Computes and returns the actual estimation of the posterior of a node.
| id | the node for which we need a posterior probability |
| UndefinedElement | if node is not in the set of targets. |
| NotFound | if node is not in the BN. |
Definition at line 110 of file samplingInference_tpl.h.
References _estimator_, and gum::BayesNetInference< GUM_SCALAR >::BN().
Referenced by currentPosterior().
|
overridevirtualinherited |
Returns the current running time in second.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 136 of file approximationScheme_inl.h.
References timer_.
|
overridevirtualinherited |
Disable stopping criterion on epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 74 of file approximationScheme_inl.h.
References enabled_eps_.
Referenced by gum::learning::EMApproximationScheme::EMApproximationScheme(), and gum::learning::EMApproximationScheme::setMinEpsilonRate().
|
overridevirtualinherited |
Disable stopping criterion on max iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 115 of file approximationScheme_inl.h.
References enabled_max_iter_.
Referenced by gum::learning::GreedyHillClimbing::GreedyHillClimbing().
|
overridevirtualinherited |
Disable stopping criterion on timeout.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 139 of file approximationScheme_inl.h.
References enabled_max_time_.
Referenced by gum::learning::GreedyHillClimbing::GreedyHillClimbing().
|
overridevirtualinherited |
Disable stopping criterion on epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 95 of file approximationScheme_inl.h.
References enabled_min_rate_eps_.
Referenced by gum::learning::GreedyHillClimbing::GreedyHillClimbing(), gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), and gum::learning::EMApproximationScheme::setEpsilon().
|
finalvirtualinherited |
get the domain sizes of the random variables of the model
Definition at line 173 of file graphicalModelInference_tpl.h.
References _domain_sizes_.
|
protectedpure virtual |
draws a sample in the Bayesian network given a previous one
| w | the weight of sample being generated |
| prev | the previous sample generated |
Implemented in gum::GibbsSampling< GUM_SCALAR >, gum::ImportanceSampling< GUM_SCALAR >, gum::MonteCarloSampling< GUM_SCALAR >, and gum::WeightedSampling< GUM_SCALAR >.
Referenced by loopApproxInference_().
|
overridevirtualinherited |
Enable stopping criterion on epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 77 of file approximationScheme_inl.h.
References enabled_eps_.
|
overridevirtualinherited |
Enable stopping criterion on max iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 118 of file approximationScheme_inl.h.
References enabled_max_iter_.
|
overridevirtualinherited |
Enable stopping criterion on timeout.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 142 of file approximationScheme_inl.h.
References enabled_max_time_.
|
overridevirtualinherited |
Enable stopping criterion on epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 98 of file approximationScheme_inl.h.
References enabled_min_rate_eps_.
Referenced by gum::learning::EMApproximationScheme::EMApproximationScheme(), and gum::GibbsBNdistance< GUM_SCALAR >::computeKL_().
|
overridevirtualinherited |
Returns the value of epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 71 of file approximationScheme_inl.h.
References eps_.
Referenced by gum::ImportanceSampling< GUM_SCALAR >::onContextualize_(), and gum::ImportanceSampling< GUM_SCALAR >::unsharpenBN_().
|
finalvirtualinherited |
removes all the evidence entered into the network
Definition at line 540 of file graphicalModelInference_tpl.h.
References _evidence_, _hard_evidence_, _hard_evidence_nodes_, _soft_evidence_nodes_, isInferenceOutdatedStructure(), onAllEvidenceErased_(), OutdatedStructure, OutdatedTensors, and setState_().
Referenced by clear(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedMRFInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation(), and gum::JointTargetedMRFInference< GUM_SCALAR >::jointMutualInformation().
|
virtualinherited |
Clear all previously defined targets.
Reimplemented in gum::JointTargetedInference< GUM_SCALAR >.
Definition at line 111 of file marginalTargetedInference_tpl.h.
References _targets_, onAllMarginalTargetsErased_(), gum::GraphicalModelInference< GUM_SCALAR >::OutdatedStructure, gum::GraphicalModelInference< GUM_SCALAR >::setState_(), and setTargetedMode_().
Referenced by gum::JointTargetedInference< GUM_SCALAR >::eraseAllMarginalTargets(), and evidenceImpact().
|
finalvirtualinherited |
removed the evidence, if any, corresponding to node of name nodeName
Definition at line 534 of file graphicalModelInference_tpl.h.
References eraseEvidence(), and model().
|
finalvirtualinherited |
removed the evidence, if any, corresponding to node id
Definition at line 514 of file graphicalModelInference_tpl.h.
References _evidence_, _hard_evidence_, _hard_evidence_nodes_, _soft_evidence_nodes_, hasEvidence(), hasHardEvidence(), isInferenceOutdatedStructure(), onEvidenceErased_(), OutdatedStructure, OutdatedTensors, and setState_().
Referenced by eraseEvidence().
|
finalvirtualinherited |
removes an existing (marginal) target
Definition at line 199 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), eraseTarget(), GUM_ERROR, and gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_().
|
finalvirtualinherited |
removes an existing (marginal) target
Definition at line 176 of file marginalTargetedInference_tpl.h.
References _targeted_mode_, _targets_, gum::BayesNetInference< GUM_SCALAR >::BN(), GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), onMarginalTargetErased_(), gum::GraphicalModelInference< GUM_SCALAR >::OutdatedStructure, and gum::GraphicalModelInference< GUM_SCALAR >::setState_().
Referenced by eraseTarget().
|
inherited |
returns the set of evidence
Definition at line 587 of file graphicalModelInference_tpl.h.
References _evidence_.
Referenced by gum::ImportanceSampling< GUM_SCALAR >::onContextualize_(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), and gum::MarginalTargetedMRFInference< GUM_SCALAR >::posterior().
|
inherited |
Create a gum::Tensor for P(target|evs) (for all instanciation of target and evs).
| target | the nodeId of the target variable |
| evs | the nodeId of the observed variable |
Definition at line 319 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and evidenceImpact().
|
inherited |
Create a gum::Tensor for P(target|evs) (for all instanciation of target and evs).
| bn | the BayesNet |
| target | the nodeId of the targetted variable |
| evs | the vector of nodeId of the observed variables |
Definition at line 280 of file marginalTargetedInference_tpl.h.
References gum::GraphicalModelInference< GUM_SCALAR >::addEvidence(), addTarget(), gum::BayesNetInference< GUM_SCALAR >::BN(), gum::GraphicalModelInference< GUM_SCALAR >::chgEvidence(), gum::Set< Key >::contains(), gum::Instantiation::end(), gum::GraphicalModelInference< GUM_SCALAR >::eraseAllEvidence(), eraseAllTargets(), GUM_ERROR, gum::Instantiation::incNotVar(), gum::Instantiation::incVar(), gum::GraphicalModelInference< GUM_SCALAR >::makeInference(), posterior(), gum::Instantiation::setFirst(), gum::Instantiation::setFirstVar(), and gum::Instantiation::val().
Referenced by evidenceImpact().
|
finalvirtualinherited |
Entropy Compute Shanon's entropy of a node given the observation.
Definition at line 275 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and H().
|
finalvirtualinherited |
Entropy Compute Shanon's entropy of a node given the observation.
Definition at line 267 of file marginalTargetedInference_tpl.h.
References posterior().
Referenced by H().
|
inherited |
indicate for each node with hard evidence which value it took
Definition at line 580 of file graphicalModelInference_tpl.h.
References _hard_evidence_.
Referenced by gum::GibbsSampling< GUM_SCALAR >::GibbsSampling(), gum::SamplingInference< GUM_SCALAR >::contextualize(), gum::ImportanceSampling< GUM_SCALAR >::draw_(), and gum::WeightedSampling< GUM_SCALAR >::draw_().
|
inherited |
returns the set of nodes with hard evidence
the set of nodes that received hard evidence
Definition at line 599 of file graphicalModelInference_tpl.h.
References _hard_evidence_nodes_.
Referenced by gum::SamplingInference< GUM_SCALAR >::contextualize(), gum::ImportanceSampling< GUM_SCALAR >::draw_(), gum::MonteCarloSampling< GUM_SCALAR >::draw_(), gum::WeightedSampling< GUM_SCALAR >::draw_(), gum::ImportanceSampling< GUM_SCALAR >::onContextualize_(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::posterior(), gum::SamplingInference< GUM_SCALAR >::setEstimatorFromBN_(), and gum::SamplingInference< GUM_SCALAR >::setEstimatorFromLBP_().
|
finalvirtualinherited |
indicates whether some node(s) have received evidence
Definition at line 346 of file graphicalModelInference_tpl.h.
References _evidence_.
Referenced by addEvidence(), chgEvidence(), eraseEvidence(), and hasEvidence().
|
finalvirtualinherited |
indicates whether node id has received an evidence
Definition at line 371 of file graphicalModelInference_tpl.h.
References hasEvidence(), and model().
|
finalvirtualinherited |
indicates whether node id has received an evidence
Definition at line 352 of file graphicalModelInference_tpl.h.
References _evidence_.
|
finalvirtualinherited |
indicates whether node id has received a hard evidence
Definition at line 378 of file graphicalModelInference_tpl.h.
References hasHardEvidence(), and model().
|
finalvirtualinherited |
indicates whether node id has received a hard evidence
Definition at line 358 of file graphicalModelInference_tpl.h.
References _hard_evidence_nodes_.
Referenced by chgEvidence(), gum::ImportanceSampling< GUM_SCALAR >::draw_(), eraseEvidence(), hasHardEvidence(), and gum::JointTargetedMRFInference< GUM_SCALAR >::jointPosterior().
|
inlineprotectedinherited |
Definition at line 542 of file graphicalModelInference.h.
References _model_.
Referenced by gum::EvidenceInference< GUM_SCALAR >::EvidenceInference(), gum::EvidenceMRFInference< GUM_SCALAR >::EvidenceMRFInference(), gum::JointTargetedInference< GUM_SCALAR >::JointTargetedInference(), gum::JointTargetedMRFInference< GUM_SCALAR >::JointTargetedMRFInference(), gum::MarginalTargetedInference< GUM_SCALAR >::MarginalTargetedInference(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::MarginalTargetedMRFInference(), _computeDomainSizes_(), gum::MarginalTargetedInference< GUM_SCALAR >::_setAllMarginalTargets_(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::_setAllMarginalTargets_(), gum::MarginalTargetedInference< GUM_SCALAR >::addAllTargets(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addAllTargets(), gum::JointTargetedInference< GUM_SCALAR >::addJointTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::addJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addTarget(), gum::JointTargetedInference< GUM_SCALAR >::eraseJointTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::eraseJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::eraseTarget(), gum::JointTargetedInference< GUM_SCALAR >::isJointTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::isJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::isTarget(), and gum::MarginalTargetedMRFInference< GUM_SCALAR >::isTarget().
|
finalvirtualinherited |
indicates whether node id has received a soft evidence
Definition at line 385 of file graphicalModelInference_tpl.h.
References hasSoftEvidence(), and model().
|
finalvirtualinherited |
indicates whether node id has received a soft evidence
Definition at line 364 of file graphicalModelInference_tpl.h.
References _soft_evidence_nodes_.
Referenced by hasSoftEvidence().
|
overridevirtualinherited |
Returns the scheme history.
| OperationNotAllowed | Raised if the scheme did not performed or if verbosity is set to false. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 178 of file approximationScheme_inl.h.
References GUM_ERROR, stateApproximationScheme(), and gum::IApproximationSchemeConfiguration::Undefined.
|
inherited |
Initialise the scheme.
Definition at line 189 of file approximationScheme_inl.h.
References ApproximationScheme(), gum::IApproximationSchemeConfiguration::Continue, current_epsilon_, current_rate_, current_state_, current_step_, and initApproximationScheme().
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), initApproximationScheme(), gum::learning::GreedyHillClimbing::learnStructure(), gum::learning::LocalSearchWithTabuList::learnStructure(), gum::SamplingInference< GUM_SCALAR >::loopApproxInference_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInference(), and gum::SamplingInference< GUM_SCALAR >::onStateChanged_().
|
overridevirtualinherited |
Returns true if stopping criterion on epsilon is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 81 of file approximationScheme_inl.h.
References enabled_eps_.
|
overridevirtualinherited |
Returns true if stopping criterion on max iterations is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 122 of file approximationScheme_inl.h.
References enabled_max_iter_.
|
overridevirtualinherited |
Returns true if stopping criterion on timeout is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 146 of file approximationScheme_inl.h.
References enabled_max_time_.
|
overridevirtualinherited |
Returns true if stopping criterion on epsilon rate is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 102 of file approximationScheme_inl.h.
References enabled_min_rate_eps_.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::computeKL_().
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a InferenceDone state
The inference object is in a done state when the posteriors can be retrieved without performing a new inference, i.e., all the heavy computations have already been performed. Typically, in a junction tree algorithm, this corresponds to a situation in which all the messages needed in the JT have been computed and sent.
Definition at line 104 of file graphicalModelInference_tpl.h.
Referenced by gum::JointTargetedInference< GUM_SCALAR >::jointPosterior(), gum::JointTargetedMRFInference< GUM_SCALAR >::jointPosterior(), makeInference(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::posterior(), and prepareInference().
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a OutdatedStructure state
Definition at line 92 of file graphicalModelInference_tpl.h.
References _state_, and OutdatedStructure.
Referenced by chgEvidence(), eraseAllEvidence(), and eraseEvidence().
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a OutdatedTensor state
Definition at line 98 of file graphicalModelInference_tpl.h.
References _state_, and OutdatedTensors.
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a ready state
Definition at line 86 of file graphicalModelInference_tpl.h.
References _state_, and ReadyForInference.
Referenced by makeInference(), gum::SamplingInference< GUM_SCALAR >::onStateChanged_(), and prepareInference().
|
finalvirtualnoexceptinherited |
indicates whether the inference is in a target mode
Definition at line 223 of file marginalTargetedInference_tpl.h.
References _targeted_mode_.
|
finalvirtualinherited |
return true if variable is a (marginal) target
Definition at line 105 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and isTarget().
|
finalvirtualinherited |
return true if variable is a (marginal) target
Definition at line 90 of file marginalTargetedInference_tpl.h.
References _targets_, gum::BayesNetInference< GUM_SCALAR >::BN(), GUM_ERROR, and gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_().
Referenced by isTarget(), gum::JointTargetedInference< GUM_SCALAR >::posterior(), and posterior().
|
protectedinherited |
Definition at line 327 of file marginalTargetedInference_tpl.h.
References _targeted_mode_.
|
protected |
Definition at line 175 of file samplingInference_tpl.h.
References _estimator_, burnIn_(), contextualize(), gum::ApproximationScheme::continueApproximationScheme(), draw_(), gum::ApproximationScheme::initApproximationScheme(), isContextualized, isSetEstimator, and gum::ApproximationScheme::updateApproximationScheme().
Referenced by makeInference_().
|
finalvirtualinherited |
perform the heavy computations needed to compute the targets' posteriors
In a Junction tree propagation scheme, for instance, the heavy computations are those of the messages sent in the JT. This is precisely what makeInference should compute. Later, the computations of the posteriors can be done "lightly" by multiplying and projecting those messages.
Definition at line 638 of file graphicalModelInference_tpl.h.
References Done, isInferenceDone(), isInferenceReady(), makeInference_(), prepareInference(), and setState_().
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedMRFInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation(), gum::JointTargetedMRFInference< GUM_SCALAR >::jointMutualInformation(), gum::JointTargetedInference< GUM_SCALAR >::jointPosterior(), gum::JointTargetedMRFInference< GUM_SCALAR >::jointPosterior(), gum::LoopySamplingInference< GUM_SCALAR, APPROX >::makeInference_(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), and gum::MarginalTargetedMRFInference< GUM_SCALAR >::posterior().
|
overrideprotectedvirtual |
makes the inference by generating samples
Implements gum::GraphicalModelInference< GUM_SCALAR >.
Definition at line 169 of file samplingInference_tpl.h.
References isSetEstimator, loopApproxInference_(), and setEstimatorFromBN_().
|
overridevirtualinherited |
Returns the criterion on number of iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 112 of file approximationScheme_inl.h.
References max_iter_.
|
overridevirtualinherited |
Returns the timeout (in seconds).
Implements gum::IApproximationSchemeConfiguration.
Definition at line 133 of file approximationScheme_inl.h.
References max_time_.
|
inherited |
Returns the approximation scheme message.
Definition at line 59 of file IApproximationSchemeConfiguration_inl.h.
References Continue, Epsilon, epsilon(), Limit, maxIter(), maxTime(), minEpsilonRate(), Rate, stateApproximationScheme(), Stopped, TimeLimit, and Undefined.
Referenced by gum::credal::InferenceEngine< GUM_SCALAR >::getApproximationSchemeMsg(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, LazyPropagation< GUM_SCALAR > >::stateApproximationScheme().
|
overridevirtualinherited |
Returns the value of the minimal epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 92 of file approximationScheme_inl.h.
References min_rate_eps_.
|
finalvirtualinherited |
Returns a constant reference over the IBayesNet referenced by this class.
| UndefinedElement | is raised if no Bayes net has been assigned to the inference. |
Definition at line 126 of file graphicalModelInference_tpl.h.
References _model_, and GUM_ERROR.
Referenced by GraphicalModelInference(), addEvidence(), addEvidence(), addEvidence(), addEvidence(), gum::BayesNetInference< GUM_SCALAR >::BN(), chgEvidence(), chgEvidence(), chgEvidence(), chgEvidence(), eraseEvidence(), hasEvidence(), hasHardEvidence(), hasSoftEvidence(), gum::MRFInference< GUM_SCALAR >::MRF(), onModelChanged_(), gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::onModelChanged_(), setModel_(), and setModelDuringConstruction_().
|
finalvirtualinherited |
returns the number of evidence entered into the Bayesian network
Definition at line 562 of file graphicalModelInference_tpl.h.
References _evidence_.
|
finalvirtualinherited |
returns the number of hard evidence entered into the Bayesian network
Definition at line 568 of file graphicalModelInference_tpl.h.
References _hard_evidence_nodes_.
|
overridevirtualinherited |
Returns the number of iterations.
| OperationNotAllowed | Raised if the scheme did not perform. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 169 of file approximationScheme_inl.h.
References current_step_, GUM_ERROR, stateApproximationScheme(), and gum::IApproximationSchemeConfiguration::Undefined.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::computeKL_().
|
finalvirtualinherited |
returns the number of soft evidence entered into the Bayesian network
Definition at line 574 of file graphicalModelInference_tpl.h.
References _soft_evidence_nodes_.
|
finalvirtualnoexceptinherited |
returns the number of marginal targets
Definition at line 217 of file marginalTargetedInference_tpl.h.
References _targets_.
|
overrideprotectedvirtual |
fired before all the evidence are erased
Implements gum::GraphicalModelInference< GUM_SCALAR >.
Definition at line 216 of file samplingInference_tpl.h.
|
overrideprotectedvirtual |
fired after all the nodes of the BN are added as marginal targets
Implements gum::MarginalTargetedInference< GUM_SCALAR >.
Definition at line 242 of file samplingInference_tpl.h.
|
overrideprotectedvirtual |
fired before a all marginal targets are removed
Implements gum::MarginalTargetedInference< GUM_SCALAR >.
Definition at line 245 of file samplingInference_tpl.h.
|
protectedvirtual |
fired when Bayesian network is contextualized
| bn | the contextualized BayesNetFragment |
| targets | inference target variables |
| hardEvNodes | hard evidence nodes |
| hardEv | hard evidences values |
Reimplemented in gum::ImportanceSampling< GUM_SCALAR >.
Definition at line 203 of file samplingInference_tpl.h.
Referenced by contextualize().
|
overrideprotectedvirtual |
fired after a new evidence is inserted
Implements gum::GraphicalModelInference< GUM_SCALAR >.
Definition at line 206 of file samplingInference_tpl.h.
References GUM_ERROR.
|
overrideprotectedvirtual |
fired after an evidence is changed, in particular when its status (soft/hard) changes
| nodeId | the node of the changed evidence |
| hasChangedSoftHard | true if the evidence has changed from Soft to Hard or from Hard to Soft |
Implements gum::GraphicalModelInference< GUM_SCALAR >.
Definition at line 219 of file samplingInference_tpl.h.
References GUM_ERROR.
|
overrideprotectedvirtual |
fired before an evidence is removed
Implements gum::GraphicalModelInference< GUM_SCALAR >.
Definition at line 213 of file samplingInference_tpl.h.
|
overrideprotectedvirtual |
fired after a new marginal target is inserted
| id | The target variable's id. |
Implements gum::MarginalTargetedInference< GUM_SCALAR >.
Definition at line 236 of file samplingInference_tpl.h.
|
overrideprotectedvirtual |
fired before a marginal target is removed
| id | The target variable's id. |
Implements gum::MarginalTargetedInference< GUM_SCALAR >.
Definition at line 239 of file samplingInference_tpl.h.
|
overrideprotectedvirtual |
fired after a new Bayes net has been assigned to the engine
Reimplemented from gum::MarginalTargetedInference< GUM_SCALAR >.
Definition at line 227 of file samplingInference_tpl.h.
|
overrideprotectedvirtual |
fired when the stage is changed
Implements gum::GraphicalModelInference< GUM_SCALAR >.
Definition at line 248 of file samplingInference_tpl.h.
References _estimator_, gum::ApproximationScheme::initApproximationScheme(), and gum::GraphicalModelInference< GUM_SCALAR >::isInferenceReady().
|
overridevirtualinherited |
Returns the period size.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 155 of file approximationScheme_inl.h.
References period_size_.
|
virtualinherited |
Computes and returns the posterior of a node.
| nodeName | the anme of the node for which we need a posterior probability |
| UndefinedElement | if node is not in the set of targets |
Reimplemented in gum::JointTargetedInference< GUM_SCALAR >.
Definition at line 259 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and posterior().
|
virtualinherited |
Computes and returns the posterior of a node.
| node | the node for which we need a posterior probability |
| UndefinedElement | if node is not in the set of targets |
Reimplemented in gum::JointTargetedInference< GUM_SCALAR >.
Definition at line 243 of file marginalTargetedInference_tpl.h.
References gum::GraphicalModelInference< GUM_SCALAR >::evidence(), GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hardEvidenceNodes(), gum::GraphicalModelInference< GUM_SCALAR >::isInferenceDone(), isTarget(), gum::GraphicalModelInference< GUM_SCALAR >::makeInference(), and posterior_().
Referenced by evidenceImpact(), H(), gum::JointTargetedInference< GUM_SCALAR >::posterior(), posterior(), and gum::Estimator< GUM_SCALAR >::setFromLBP().
|
overridevirtual |
Computes and returns the posterior of a node.
| id | the node for which we need a posterior probability |
| UndefinedElement | if node is not in the set of targets. |
| NotFound | if node is not in the BN. |
Implements gum::MarginalTargetedInference< GUM_SCALAR >.
Definition at line 121 of file samplingInference_tpl.h.
References _estimator_, and gum::BayesNetInference< GUM_SCALAR >::BN().
|
finalvirtualinherited |
prepare the internal inference structures for the next inference
Definition at line 622 of file graphicalModelInference_tpl.h.
References _model_, _state_, GUM_ERROR, isInferenceDone(), isInferenceReady(), OutdatedStructure, ReadyForInference, setState_(), updateOutdatedStructure_(), and updateOutdatedTensors_().
Referenced by makeInference(), and gum::SamplingInference< GUM_SCALAR >::samplingBN().
|
inherited |
Returns the remaining burn in.
Definition at line 212 of file approximationScheme_inl.h.
References burn_in_, and current_step_.
| INLINE const IBayesNet< GUM_SCALAR > & gum::SamplingInference< GUM_SCALAR >::samplingBN | ( | ) |
get the BayesNet which is used to really perform the sampling
Definition at line 89 of file samplingInference_tpl.h.
References _samplingBN_, gum::BayesNetInference< GUM_SCALAR >::BN(), and gum::GraphicalModelInference< GUM_SCALAR >::prepareInference().
Referenced by addVarSample_(), gum::ImportanceSampling< GUM_SCALAR >::draw_(), and setEstimatorFromBN_().
|
virtualinherited |
assigns a new BN to the inference engine
Assigns a new BN to the BayesNetInference engine and sends messages to the descendants of BayesNetInference to inform them that the BN has changed.
Definition at line 81 of file BayesNetInference_tpl.h.
References gum::GraphicalModelInference< GUM_SCALAR >::setModel_().
|
overridevirtualinherited |
Given that we approximate f(t), stopping criterion on |f(t+1)-f(t)|.
If the criterion was disabled it will be enabled.
| eps | The new epsilon value. |
| OutOfBounds | Raised if eps < 0. |
Implements gum::IApproximationSchemeConfiguration.
Reimplemented in gum::learning::EMApproximationScheme.
Definition at line 63 of file approximationScheme_inl.h.
References enabled_eps_, eps_, and GUM_ERROR.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsSampling< GUM_SCALAR >::GibbsSampling(), gum::learning::GreedyHillClimbing::GreedyHillClimbing(), gum::SamplingInference< GUM_SCALAR >::SamplingInference(), and gum::learning::EMApproximationScheme::setEpsilon().
|
virtual |
Initializes the estimators object linked to the simulation.
Initializes the estimator object by creating a hashtable between non evidence nodes and a 0-filled tensor which will approximate the node's posterior
Definition at line 96 of file samplingInference_tpl.h.
References _estimator_, gum::GraphicalModelInference< GUM_SCALAR >::hardEvidenceNodes(), isSetEstimator, and samplingBN().
Referenced by makeInference_().
|
virtual |
Initializes the estimators object linked to the simulation.
| lbp | a LoopyBeliefPropagation object |
| virtualLBPSize | the size of the equivalent sampling by LBP |
Initializes the estimator object by creating a hashtable between non evidence nodes and the current approximation of the node's posterior obtained by running LoopyBeliefPropagation algorithm
Definition at line 102 of file samplingInference_tpl.h.
References _estimator_, gum::GraphicalModelInference< GUM_SCALAR >::hardEvidenceNodes(), and isSetEstimator.
|
overridevirtualinherited |
Stopping criterion on number of iterations.
If the criterion was disabled it will be enabled.
| max | The maximum number of iterations. |
| OutOfBounds | Raised if max <= 1. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 105 of file approximationScheme_inl.h.
References enabled_max_iter_, GUM_ERROR, and max_iter_.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), and gum::SamplingInference< GUM_SCALAR >::SamplingInference().
|
overridevirtualinherited |
Stopping criterion on timeout.
If the criterion was disabled it will be enabled.
| timeout | The timeout value in seconds. |
| OutOfBounds | Raised if timeout <= 0.0. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 126 of file approximationScheme_inl.h.
References enabled_max_time_, GUM_ERROR, and max_time_.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), and gum::SamplingInference< GUM_SCALAR >::SamplingInference().
|
overridevirtualinherited |
Given that we approximate f(t), stopping criterion on d/dt(|f(t+1)-f(t)|).
If the criterion was disabled it will be enabled
| rate | The minimal epsilon rate. |
| OutOfBounds | if rate<0 |
Implements gum::IApproximationSchemeConfiguration.
Reimplemented in gum::learning::EMApproximationScheme.
Definition at line 84 of file approximationScheme_inl.h.
References enabled_min_rate_eps_, GUM_ERROR, and min_rate_eps_.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsSampling< GUM_SCALAR >::GibbsSampling(), gum::SamplingInference< GUM_SCALAR >::SamplingInference(), and gum::learning::EMApproximationScheme::setMinEpsilonRate().
|
protectedinherited |
Definition at line 136 of file graphicalModelInference_tpl.h.
References _computeDomainSizes_(), _model_, clear(), model(), onModelChanged_(), OutdatedStructure, and setState_().
Referenced by gum::BayesNetInference< GUM_SCALAR >::setBN(), and gum::MRFInference< GUM_SCALAR >::setMRF().
|
protectedinherited |
assigns a model during the inference engine construction
Definition at line 146 of file graphicalModelInference_tpl.h.
References _computeDomainSizes_(), _model_, model(), OutdatedStructure, and setState_().
Referenced by gum::BayesNetInference< GUM_SCALAR >::_setBayesNetDuringConstruction_(), and gum::MRFInference< GUM_SCALAR >::_setMRFDuringConstruction_().
|
protectedinherited |
put the inference into an outdated model structure state
OutdatedStructure: in this state, the inference is fully unprepared to be applied because some events changed the "logical" structure of the model: for instance a node received a hard evidence, which implies that its outgoing arcs can be removed from the model, hence involving a structural change in the model. As a consequence, the (incremental) inference (probably) needs a significant amount of preparation to be ready for the next inference. In a Lazy propagation, for instance, this step amounts to compute a new join tree, hence a new structure in which inference will be applied. Note that classes that inherit from graphicalModelInference may be smarter than graphicalModelInference and may, in some situations, find out that their data structures are still ok for inference and, therefore, only resort to perform the actions related to the OutdatedTensors state. As an example, consider a LazyPropagation inference in Bayes Net A->B->C->D->E in which C has received hard evidence e_C and E is the only target. In this case, A and B are not needed for inference, the only tensors that matter are P(D|e_C) and P(E|D). So the smallest join tree needed for inference contains only one clique DE. Now, adding new evidence e_A on A has no impact on E given hard evidence e_C. In this case, LazyPropagation can be smart and not update its join tree.
Definition at line 609 of file graphicalModelInference_tpl.h.
References OutdatedStructure, and setState_().
Referenced by makeInference_().
|
protectedinherited |
puts the inference into an OutdatedTensors state if it is not already in an OutdatedStructure state
OutdatedTensors: in this state, the structure of the model remains unchanged, only some tensors stored in it have changed. Therefore, the inference probably just needs to invalidate some already computed tensors to be ready. Only a light amount of preparation is needed to be able to perform inference.
Definition at line 616 of file graphicalModelInference_tpl.h.
References OutdatedTensors, and setState_().
Referenced by makeInference_().
|
overridevirtualinherited |
How many samples between two stopping is enable.
| p | The new period value. |
| OutOfBounds | Raised if p < 1. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 149 of file approximationScheme_inl.h.
References GUM_ERROR, and period_size_.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), and gum::SamplingInference< GUM_SCALAR >::SamplingInference().
|
finalprotectedvirtualinherited |
set the state of the inference engine and call the notification onStateChanged_ when necessary (i.e. when the state has effectively changed).
Definition at line 117 of file graphicalModelInference_tpl.h.
References _state_, onStateChanged_(), and state().
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::addAllTargets(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addAllTargets(), addEvidence(), gum::JointTargetedInference< GUM_SCALAR >::addJointTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::addJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addTarget(), chgEvidence(), clear(), eraseAllEvidence(), gum::JointTargetedInference< GUM_SCALAR >::eraseAllJointTargets(), gum::JointTargetedMRFInference< GUM_SCALAR >::eraseAllJointTargets(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseAllTargets(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::eraseAllTargets(), eraseEvidence(), gum::JointTargetedInference< GUM_SCALAR >::eraseJointTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::eraseJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::eraseTarget(), makeInference(), prepareInference(), setModel_(), setModelDuringConstruction_(), setOutdatedStructureState_(), and setOutdatedTensorsState_().
|
protectedinherited |
Definition at line 332 of file marginalTargetedInference_tpl.h.
References _targeted_mode_, and _targets_.
Referenced by addAllTargets(), gum::JointTargetedInference< GUM_SCALAR >::addJointTarget(), addTarget(), and eraseAllTargets().
|
overridevirtualinherited |
Set the verbosity on (true) or off (false).
| v | If true, then verbosity is turned on. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 158 of file approximationScheme_inl.h.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), and gum::SamplingInference< GUM_SCALAR >::SamplingInference().
|
inherited |
returns the set of nodes with soft evidence
the set of nodes that received soft evidence
Definition at line 593 of file graphicalModelInference_tpl.h.
References _soft_evidence_nodes_.
Referenced by gum::SamplingInference< GUM_SCALAR >::contextualize().
|
inherited |
Returns true if we are at the beginning of a period (compute error is mandatory).
Definition at line 199 of file approximationScheme_inl.h.
References burn_in_, and current_step_.
|
finalvirtualnoexceptinherited |
returns the state of the inference engine
Definition at line 111 of file graphicalModelInference_tpl.h.
References _state_.
Referenced by setState_().
|
overridevirtualinherited |
Returns the approximation scheme state.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 164 of file approximationScheme_inl.h.
References current_state_.
Referenced by history(), and nbrIterations().
|
inherited |
Stop the approximation scheme.
Definition at line 221 of file approximationScheme_inl.h.
Referenced by gum::learning::GreedyHillClimbing::learnStructure(), gum::learning::LocalSearchWithTabuList::learnStructure(), and gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceNodeToNeighbours_().
|
privateinherited |
Stop the scheme given a new state.
| new_state | The scheme new state. |
Definition at line 301 of file approximationScheme_inl.h.
References gum::IApproximationSchemeConfiguration::Continue, current_state_, and gum::IApproximationSchemeConfiguration::Undefined.
Referenced by gum::credal::MultipleInferenceEngine< GUM_SCALAR, LazyPropagation< GUM_SCALAR > >::disableMaxIter(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, LazyPropagation< GUM_SCALAR > >::disableMaxTime(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, LazyPropagation< GUM_SCALAR > >::isEnabledMaxIter(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, LazyPropagation< GUM_SCALAR > >::maxTime(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, LazyPropagation< GUM_SCALAR > >::setPeriodSize().
|
finalvirtualnoexceptinherited |
returns the list of marginal targets
Definition at line 211 of file marginalTargetedInference_tpl.h.
References _targets_.
Referenced by gum::VariableElimination< GUM_SCALAR >::_createNewJT_(), gum::VariableElimination< GUM_SCALAR >::_unnormalizedJointPosterior_(), gum::VariableElimination< GUM_SCALAR >::_unnormalizedJointPosterior_(), gum::SamplingInference< GUM_SCALAR >::contextualize(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation(), gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation(), and gum::JointTargetedInference< GUM_SCALAR >::VI().
|
inherited |
Update the scheme w.r.t the new error and increment steps.
| incr | The new increment steps. |
Definition at line 208 of file approximationScheme_inl.h.
References current_step_.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), gum::learning::GreedyHillClimbing::learnStructure(), gum::learning::LocalSearchWithTabuList::learnStructure(), gum::SamplingInference< GUM_SCALAR >::loopApproxInference_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceByOrderedArcs_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceByRandomOrder_(), and gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceNodeToNeighbours_().
|
overrideprotectedvirtual |
prepares inference when the latter is in OutdatedStructure state
Note that the values of evidence are not necessarily known and can be changed between updateOutdatedStructure_ and makeInference_.
Implements gum::GraphicalModelInference< GUM_SCALAR >.
Definition at line 230 of file samplingInference_tpl.h.
|
overrideprotectedvirtual |
prepares inference when the latter is in OutdatedTensors state
Note that the values of evidence are not necessarily known and can be changed between updateOutdatedTensors_ and makeInference_.
Implements gum::GraphicalModelInference< GUM_SCALAR >.
Definition at line 233 of file samplingInference_tpl.h.
|
overridevirtualinherited |
Returns true if verbosity is enabled.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 160 of file approximationScheme_inl.h.
References verbosity_.
Referenced by ApproximationScheme(), and gum::learning::EMApproximationScheme::EMApproximationScheme().
|
protected |
Estimator object designed to approximate target posteriors.
Definition at line 194 of file samplingInference.h.
Referenced by SamplingInference(), currentPosterior(), loopApproxInference_(), onStateChanged_(), posterior_(), setEstimatorFromBN_(), and setEstimatorFromLBP_().
|
private |
Definition at line 263 of file samplingInference.h.
Referenced by SamplingInference(), ~SamplingInference(), contextualize(), and samplingBN().
|
privateinherited |
whether the actual targets are default
Definition at line 260 of file marginalTargetedInference.h.
Referenced by MarginalTargetedInference(), eraseTarget(), isInTargetMode(), isTargetedMode_(), onModelChanged_(), and setTargetedMode_().
|
privateinherited |
the set of marginal targets
Definition at line 263 of file marginalTargetedInference.h.
Referenced by MarginalTargetedInference(), _setAllMarginalTargets_(), addAllTargets(), addTarget(), eraseAllTargets(), eraseTarget(), isTarget(), nbrTargets(), setTargetedMode_(), and targets().
|
protectedinherited |
Number of iterations before checking stopping criteria.
Definition at line 423 of file approximationScheme.h.
Referenced by ApproximationScheme(), gum::GibbsBNdistance< GUM_SCALAR >::burnIn(), gum::GibbsSampling< GUM_SCALAR >::burnIn(), remainingBurnIn(), gum::GibbsBNdistance< GUM_SCALAR >::setBurnIn(), gum::GibbsSampling< GUM_SCALAR >::setBurnIn(), and startOfPeriod().
|
protectedinherited |
Current epsilon.
Definition at line 378 of file approximationScheme.h.
Referenced by initApproximationScheme().
|
protectedinherited |
Current rate.
Definition at line 384 of file approximationScheme.h.
Referenced by initApproximationScheme().
|
protectedinherited |
The current state.
Definition at line 393 of file approximationScheme.h.
Referenced by ApproximationScheme(), initApproximationScheme(), stateApproximationScheme(), and stopScheme_().
|
protectedinherited |
The current step.
Definition at line 387 of file approximationScheme.h.
Referenced by initApproximationScheme(), gum::learning::Miic::initiation_(), gum::learning::SimpleMiic::initiation_(), gum::learning::Miic::iteration_(), gum::learning::SimpleMiic::iteration_(), gum::learning::Miic::learnMixedStructure(), gum::learning::SimpleMiic::learnMixedStructure(), gum::learning::Miic::learnSkeleton(), nbrIterations(), gum::learning::SimpleMiic::orientationLatents_(), gum::learning::Miic::orientationMiic_(), gum::learning::SimpleMiic::orientationMiic_(), remainingBurnIn(), startOfPeriod(), and updateApproximationScheme().
|
protectedinherited |
If true, the threshold convergence is enabled.
Definition at line 402 of file approximationScheme.h.
Referenced by ApproximationScheme(), disableEpsilon(), enableEpsilon(), isEnabledEpsilon(), and setEpsilon().
|
protectedinherited |
If true, the maximum iterations stopping criterion is enabled.
Definition at line 420 of file approximationScheme.h.
Referenced by ApproximationScheme(), disableMaxIter(), enableMaxIter(), isEnabledMaxIter(), and setMaxIter().
|
protectedinherited |
If true, the timeout is enabled.
Definition at line 414 of file approximationScheme.h.
Referenced by ApproximationScheme(), continueApproximationScheme(), disableMaxTime(), enableMaxTime(), isEnabledMaxTime(), and setMaxTime().
|
protectedinherited |
If true, the minimal threshold for epsilon rate is enabled.
Definition at line 408 of file approximationScheme.h.
Referenced by ApproximationScheme(), disableMinEpsilonRate(), enableMinEpsilonRate(), isEnabledMinEpsilonRate(), and setMinEpsilonRate().
|
protectedinherited |
Threshold for convergence.
Definition at line 399 of file approximationScheme.h.
Referenced by ApproximationScheme(), epsilon(), and setEpsilon().
|
protectedinherited |
The scheme history, used only if verbosity == true.
Definition at line 396 of file approximationScheme.h.
|
protected |
whether the referenced Bayesian network has been "contextualized"
Definition at line 200 of file samplingInference.h.
Referenced by ~SamplingInference(), contextualize(), and loopApproxInference_().
|
protected |
whether the Estimator object has been initialized
Definition at line 197 of file samplingInference.h.
Referenced by loopApproxInference_(), makeInference_(), setEstimatorFromBN_(), and setEstimatorFromLBP_().
|
protectedinherited |
Last epsilon value.
Definition at line 381 of file approximationScheme.h.
|
protectedinherited |
The maximum iterations.
Definition at line 417 of file approximationScheme.h.
Referenced by ApproximationScheme(), maxIter(), and setMaxIter().
|
protectedinherited |
The timeout.
Definition at line 411 of file approximationScheme.h.
Referenced by ApproximationScheme(), maxTime(), and setMaxTime().
|
protectedinherited |
Threshold for the epsilon rate.
Definition at line 405 of file approximationScheme.h.
Referenced by ApproximationScheme(), minEpsilonRate(), and setMinEpsilonRate().
Progression, error and time.
Definition at line 80 of file IApproximationSchemeConfiguration.h.
Referenced by gum::learning::IBNLearner::distributeProgress(), gum::learning::Miic::initiation_(), gum::learning::SimpleMiic::initiation_(), gum::learning::Miic::iteration_(), gum::learning::SimpleMiic::iteration_(), gum::learning::SimpleMiic::orientationLatents_(), gum::learning::Miic::orientationMiic_(), and gum::learning::SimpleMiic::orientationMiic_().
|
inherited |
Criteria messageApproximationScheme.
Definition at line 83 of file IApproximationSchemeConfiguration.h.
Referenced by gum::learning::IBNLearner::distributeStop().
|
protectedinherited |
Checking criteria frequency.
Definition at line 426 of file approximationScheme.h.
Referenced by ApproximationScheme(), periodSize(), and setPeriodSize().
|
protectedinherited |
The timer.
Definition at line 390 of file approximationScheme.h.
Referenced by continueApproximationScheme(), currentTime(), gum::learning::Miic::initiation_(), gum::learning::SimpleMiic::initiation_(), gum::learning::Miic::iteration_(), gum::learning::SimpleMiic::iteration_(), gum::learning::Miic::learnMixedStructure(), gum::learning::SimpleMiic::learnMixedStructure(), gum::learning::Miic::learnSkeleton(), gum::learning::SimpleMiic::orientationLatents_(), gum::learning::Miic::orientationMiic_(), and gum::learning::SimpleMiic::orientationMiic_().
|
protectedinherited |
If true, verbosity is enabled.
Definition at line 429 of file approximationScheme.h.
Referenced by ApproximationScheme(), and verbosity().