![]() |
aGrUM
0.16.0
|
#include <approximateInference.h>
Public Attributes | |
Signaler3< Size, double, double > | onProgress |
Progression, error and time. More... | |
Signaler1< std::string > | onStop |
Criteria messageApproximationScheme. More... | |
Public Member Functions | |
ApproximateInference (const IBayesNet< GUM_SCALAR > *bn) | |
Potential< GUM_SCALAR > | evidenceImpact (NodeId target, const NodeSet &evs) |
Create a gum::Potential for P(target|evs) (for all instanciation of target and evs) More... | |
Potential< GUM_SCALAR > | evidenceImpact (const std::string &target, const std::vector< std::string > &evs) |
Create a gum::Potential for P(target|evs) (for all instanciation of target and evs) More... | |
Probability computations | |
virtual const Potential< GUM_SCALAR > & | posterior (NodeId node) |
Computes and returns the posterior of a node. More... | |
virtual const Potential< GUM_SCALAR > & | posterior (const std::string &nodeName) |
Computes and returns the posterior of a node. More... | |
Targets | |
virtual void | eraseAllTargets () |
Clear all previously defined targets. More... | |
virtual void | addAllTargets () final |
adds all nodes as targets More... | |
virtual void | addTarget (NodeId target) final |
Add a marginal target to the list of targets. More... | |
virtual void | addTarget (const std::string &nodeName) final |
Add a marginal target to the list of targets. More... | |
virtual void | eraseTarget (NodeId target) final |
removes an existing (marginal) target More... | |
virtual void | eraseTarget (const std::string &nodeName) final |
removes an existing (marginal) target More... | |
virtual bool | isTarget (NodeId node) const final |
return true if variable is a (marginal) target More... | |
virtual bool | isTarget (const std::string &nodeName) const final |
return true if variable is a (marginal) target More... | |
virtual const Size | nbrTargets () const noexcept final |
returns the number of marginal targets More... | |
virtual const NodeSet & | targets () const noexcept final |
returns the list of marginal targets More... | |
Information Theory related functions | |
virtual GUM_SCALAR | H (NodeId X) final |
Entropy Compute Shanon's entropy of a node given the observation. More... | |
virtual GUM_SCALAR | H (const std::string &nodeName) final |
Entropy Compute Shanon's entropy of a node given the observation. More... | |
Accessors / Modifiers | |
virtual void | setBN (const IBayesNet< GUM_SCALAR > *bn) |
assigns a new BN to the inference engine More... | |
virtual const IBayesNet< GUM_SCALAR > & | BN () const final |
Returns a constant reference over the IBayesNet referenced by this class. More... | |
virtual const NodeProperty< Size > & | domainSizes () const final |
get the domain sizes of the random variables of the BN More... | |
virtual bool | isInferenceReady () const noexcept final |
returns whether the inference object is in a ready state More... | |
virtual bool | isInferenceOutdatedBNStructure () const noexcept final |
returns whether the inference object is in a OutdatedBNStructure state More... | |
virtual bool | isInferenceOutdatedBNPotentials () const noexcept final |
returns whether the inference object is in a OutdatedBNPotential state More... | |
virtual bool | isInferenceDone () const noexcept final |
returns whether the inference object is in a InferenceDone state More... | |
virtual bool | isDone () const noexcept final |
returns whether the inference object is in a done state More... | |
virtual void | prepareInference () final |
prepare the internal inference structures for the next inference More... | |
virtual void | makeInference () final |
perform the heavy computations needed to compute the targets' posteriors More... | |
virtual void | clear () |
clears all the data structures allocated for the last inference More... | |
virtual StateOfInference | state () const noexcept final |
returns the state of the inference engine More... | |
Evidence | |
virtual void | addEvidence (NodeId id, const Idx val) final |
adds a new hard evidence on node id More... | |
virtual void | addEvidence (const std::string &nodeName, const Idx val) final |
adds a new hard evidence on node named nodeName More... | |
virtual void | addEvidence (NodeId id, const std::string &label) final |
adds a new hard evidence on node id More... | |
virtual void | addEvidence (const std::string &nodeName, const std::string &label) final |
adds a new hard evidence on node named nodeName More... | |
virtual void | addEvidence (NodeId id, const std::vector< GUM_SCALAR > &vals) final |
adds a new evidence on node id (might be soft or hard) More... | |
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) More... | |
virtual void | addEvidence (const Potential< GUM_SCALAR > &pot) final |
adds a new evidence on node id (might be soft or hard) More... | |
virtual void | addEvidence (Potential< GUM_SCALAR > &&pot) final |
adds a new evidence on node id (might be soft or hard) More... | |
virtual void | addSetOfEvidence (const Set< const Potential< GUM_SCALAR > * > &potset) final |
adds a new set of evidence More... | |
virtual void | addListOfEvidence (const List< const Potential< GUM_SCALAR > * > &potlist) final |
adds a new list of evidence More... | |
virtual void | chgEvidence (NodeId id, const Idx val) final |
change the value of an already existing hard evidence More... | |
virtual void | chgEvidence (const std::string &nodeName, const Idx val) final |
change the value of an already existing hard evidence More... | |
virtual void | chgEvidence (NodeId id, const std::string &label) final |
change the value of an already existing hard evidence More... | |
virtual void | chgEvidence (const std::string &nodeName, const std::string &label) final |
change the value of an already existing hard evidence More... | |
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) More... | |
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) More... | |
virtual void | chgEvidence (const Potential< GUM_SCALAR > &pot) final |
change the value of an already existing evidence (might be soft or hard) More... | |
virtual void | eraseAllEvidence () final |
removes all the evidence entered into the network More... | |
virtual void | eraseEvidence (NodeId id) final |
removed the evidence, if any, corresponding to node id More... | |
virtual void | eraseEvidence (const std::string &nodeName) final |
removed the evidence, if any, corresponding to node of name nodeName More... | |
virtual bool | hasEvidence () const final |
indicates whether some node(s) have received evidence More... | |
virtual bool | hasEvidence (NodeId id) const final |
indicates whether node id has received an evidence More... | |
virtual bool | hasEvidence (const std::string &nodeName) const final |
indicates whether node id has received an evidence More... | |
virtual bool | hasHardEvidence (NodeId id) const final |
indicates whether node id has received a hard evidence More... | |
virtual bool | hasHardEvidence (const std::string &nodeName) const final |
indicates whether node id has received a hard evidence More... | |
virtual bool | hasSoftEvidence (NodeId id) const final |
indicates whether node id has received a soft evidence More... | |
virtual bool | hasSoftEvidence (const std::string &nodeName) const final |
indicates whether node id has received a soft evidence More... | |
virtual Size | nbrEvidence () const final |
returns the number of evidence entered into the Bayesian network More... | |
virtual Size | nbrHardEvidence () const final |
returns the number of hard evidence entered into the Bayesian network More... | |
virtual Size | nbrSoftEvidence () const final |
returns the number of soft evidence entered into the Bayesian network More... | |
const NodeProperty< const Potential< GUM_SCALAR > *> & | evidence () const |
returns the set of evidence More... | |
const NodeSet & | softEvidenceNodes () const |
returns the set of nodes with soft evidence More... | |
const NodeSet & | hardEvidenceNodes () const |
returns the set of nodes with hard evidence More... | |
const NodeProperty< Idx > & | hardEvidence () const |
indicate for each node with hard evidence which value it took More... | |
Getters and setters | |
void | setEpsilon (double eps) |
Given that we approximate f(t), stopping criterion on |f(t+1)-f(t)|. More... | |
double | epsilon () const |
Returns the value of epsilon. More... | |
void | disableEpsilon () |
Disable stopping criterion on epsilon. More... | |
void | enableEpsilon () |
Enable stopping criterion on epsilon. More... | |
bool | isEnabledEpsilon () const |
Returns true if stopping criterion on epsilon is enabled, false otherwise. More... | |
void | setMinEpsilonRate (double rate) |
Given that we approximate f(t), stopping criterion on d/dt(|f(t+1)-f(t)|). More... | |
double | minEpsilonRate () const |
Returns the value of the minimal epsilon rate. More... | |
void | disableMinEpsilonRate () |
Disable stopping criterion on epsilon rate. More... | |
void | enableMinEpsilonRate () |
Enable stopping criterion on epsilon rate. More... | |
bool | isEnabledMinEpsilonRate () const |
Returns true if stopping criterion on epsilon rate is enabled, false otherwise. More... | |
void | setMaxIter (Size max) |
Stopping criterion on number of iterations. More... | |
Size | maxIter () const |
Returns the criterion on number of iterations. More... | |
void | disableMaxIter () |
Disable stopping criterion on max iterations. More... | |
void | enableMaxIter () |
Enable stopping criterion on max iterations. More... | |
bool | isEnabledMaxIter () const |
Returns true if stopping criterion on max iterations is enabled, false otherwise. More... | |
void | setMaxTime (double timeout) |
Stopping criterion on timeout. More... | |
double | maxTime () const |
Returns the timeout (in seconds). More... | |
double | currentTime () const |
Returns the current running time in second. More... | |
void | disableMaxTime () |
Disable stopping criterion on timeout. More... | |
void | enableMaxTime () |
Enable stopping criterion on timeout. More... | |
bool | isEnabledMaxTime () const |
Returns true if stopping criterion on timeout is enabled, false otherwise. More... | |
void | setPeriodSize (Size p) |
How many samples between two stopping is enable. More... | |
Size | periodSize () const |
Returns the period size. More... | |
void | setVerbosity (bool v) |
Set the verbosity on (true) or off (false). More... | |
bool | verbosity () const |
Returns true if verbosity is enabled. More... | |
ApproximationSchemeSTATE | stateApproximationScheme () const |
Returns the approximation scheme state. More... | |
Size | nbrIterations () const |
Returns the number of iterations. More... | |
const std::vector< double > & | history () const |
Returns the scheme history. More... | |
void | initApproximationScheme () |
Initialise the scheme. More... | |
bool | startOfPeriod () |
Returns true if we are at the beginning of a period (compute error is mandatory). More... | |
void | updateApproximationScheme (unsigned int incr=1) |
Update the scheme w.r.t the new error and increment steps. More... | |
Size | remainingBurnIn () |
Returns the remaining burn in. More... | |
void | stopApproximationScheme () |
Stop the approximation scheme. More... | |
bool | continueApproximationScheme (double error) |
Update the scheme w.r.t the new error. More... | |
Getters and setters | |
std::string | messageApproximationScheme () const |
Returns the approximation scheme message. More... | |
Public Types | |
enum | StateOfInference { StateOfInference::OutdatedBNStructure, StateOfInference::OutdatedBNPotentials, StateOfInference::ReadyForInference, StateOfInference::Done } |
current state of the inference More... | |
enum | ApproximationSchemeSTATE : char { ApproximationSchemeSTATE::Undefined, ApproximationSchemeSTATE::Continue, ApproximationSchemeSTATE::Epsilon, ApproximationSchemeSTATE::Rate, ApproximationSchemeSTATE::Limit, ApproximationSchemeSTATE::TimeLimit, ApproximationSchemeSTATE::Stopped } |
The different state of an approximation scheme. More... | |
Protected Attributes | |
double | _current_epsilon |
Current epsilon. More... | |
double | _last_epsilon |
Last epsilon value. More... | |
double | _current_rate |
Current rate. More... | |
Size | _current_step |
The current step. More... | |
Timer | _timer |
The timer. More... | |
ApproximationSchemeSTATE | _current_state |
The current state. More... | |
std::vector< double > | _history |
The scheme history, used only if verbosity == true. More... | |
double | _eps |
Threshold for convergence. More... | |
bool | _enabled_eps |
If true, the threshold convergence is enabled. More... | |
double | _min_rate_eps |
Threshold for the epsilon rate. More... | |
bool | _enabled_min_rate_eps |
If true, the minimal threshold for epsilon rate is enabled. More... | |
double | _max_time |
The timeout. More... | |
bool | _enabled_max_time |
If true, the timeout is enabled. More... | |
Size | _max_iter |
The maximum iterations. More... | |
bool | _enabled_max_iter |
If true, the maximum iterations stopping criterion is enabled. More... | |
Size | _burn_in |
Number of iterations before checking stopping criteria. More... | |
Size | _period_size |
Checking criteria frequency. More... | |
bool | _verbosity |
If true, verbosity is enabled. More... | |
Protected Member Functions | |
virtual void | _onMarginalTargetAdded (const NodeId id)=0 |
fired after a new marginal target is inserted More... | |
virtual void | _onMarginalTargetErased (const NodeId id)=0 |
fired before a marginal target is removed More... | |
virtual void | _onAllMarginalTargetsAdded ()=0 |
fired after all the nodes of the BN are added as marginal targets More... | |
virtual void | _onAllMarginalTargetsErased ()=0 |
fired before a all marginal targets are removed More... | |
virtual void | _onBayesNetChanged (const IBayesNet< GUM_SCALAR > *bn) |
fired after a new Bayes net has been assigned to the engine More... | |
virtual const Potential< GUM_SCALAR > & | _posterior (NodeId id)=0 |
asks derived classes for the posterior of a given variable More... | |
void | _setTargetedMode () |
bool | _isTargetedMode () const |
virtual void | _onStateChanged ()=0 |
fired when the stage is changed More... | |
virtual void | _onEvidenceAdded (const NodeId id, bool isHardEvidence)=0 |
fired after a new evidence is inserted More... | |
virtual void | _onEvidenceErased (const NodeId id, bool isHardEvidence)=0 |
fired before an evidence is removed More... | |
virtual void | _onAllEvidenceErased (bool contains_hard_evidence)=0 |
fired before all the evidence are erased More... | |
virtual void | _onEvidenceChanged (const NodeId id, bool hasChangedSoftHard)=0 |
fired after an evidence is changed, in particular when its status (soft/hard) changes More... | |
virtual void | _updateOutdatedBNStructure ()=0 |
prepares inference when the latter is in OutdatedBNStructure state More... | |
virtual void | _updateOutdatedBNPotentials ()=0 |
prepares inference when the latter is in OutdatedBNPotentials state More... | |
virtual void | _makeInference ()=0 |
called when the inference has to be performed effectively More... | |
void | _setOutdatedBNStructureState () |
put the inference into an outdated BN structure state More... | |
void | _setOutdatedBNPotentialsState () |
puts the inference into an OutdatedBNPotentials state if it is not already in an OutdatedBNStructure state More... | |
Definition at line 40 of file approximateInference.h.
|
stronginherited |
The different state of an approximation scheme.
Enumerator | |
---|---|
Undefined | |
Continue | |
Epsilon | |
Rate | |
Limit | |
TimeLimit | |
Stopped |
Definition at line 65 of file IApproximationSchemeConfiguration.h.
|
stronginherited |
current state of the inference
BayesNetInference can be in one of 4 different states:
Enumerator | |
---|---|
OutdatedBNStructure | |
OutdatedBNPotentials | |
ReadyForInference | |
Done |
Definition at line 183 of file BayesNetInference.h.
|
inlineexplicit |
Definition at line 44 of file approximateInference.h.
|
protectedinherited |
Definition at line 338 of file marginalTargetedInference_tpl.h.
References gum::MarginalTargetedInference< GUM_SCALAR >::__targeted_mode.
|
protectedpure virtualinherited |
called when the inference has to be performed effectively
Once the inference is done, _fillPosterior can be called.
Implemented in gum::LazyPropagation< GUM_SCALAR >, gum::SamplingInference< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
Referenced by gum::BayesNetInference< GUM_SCALAR >::makeInference().
|
protectedpure virtualinherited |
fired before all the evidence are erased
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
Referenced by gum::BayesNetInference< GUM_SCALAR >::eraseAllEvidence().
|
protectedpure virtualinherited |
fired after all the nodes of the BN are added as marginal targets
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::__setAllMarginalTargets().
|
protectedpure virtualinherited |
fired before a all marginal targets are removed
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::eraseAllTargets().
|
protectedvirtualinherited |
fired after a new Bayes net has been assigned to the engine
Implements gum::BayesNetInference< GUM_SCALAR >.
Reimplemented in gum::JointTargetedInference< GUM_SCALAR >, gum::SamplingInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
Definition at line 62 of file marginalTargetedInference_tpl.h.
References gum::MarginalTargetedInference< GUM_SCALAR >::__setAllMarginalTargets(), and gum::MarginalTargetedInference< GUM_SCALAR >::__targeted_mode.
Referenced by gum::JointTargetedInference< GUM_SCALAR >::_onBayesNetChanged().
|
protectedpure virtualinherited |
fired after a new evidence is inserted
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
Referenced by gum::BayesNetInference< GUM_SCALAR >::addEvidence().
|
protectedpure virtualinherited |
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 |
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
Referenced by gum::BayesNetInference< GUM_SCALAR >::chgEvidence().
|
protectedpure virtualinherited |
fired before an evidence is removed
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
Referenced by gum::BayesNetInference< GUM_SCALAR >::eraseEvidence().
|
protectedpure virtualinherited |
fired after a new marginal target is inserted
id | The target variable's id. |
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::addAllTargets(), and gum::MarginalTargetedInference< GUM_SCALAR >::addTarget().
|
protectedpure virtualinherited |
fired before a marginal target is removed
id | The target variable's id. |
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::eraseTarget().
|
protectedpure virtualinherited |
fired when the stage is changed
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
Referenced by gum::BayesNetInference< GUM_SCALAR >::__setState().
|
protectedpure virtualinherited |
asks derived classes for the posterior of a given variable
id | The variable's id. |
Implemented in gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, gum::SamplingInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::posterior().
|
protectedinherited |
puts the inference into an OutdatedBNPotentials state if it is not already in an OutdatedBNStructure state
OutdatedBNPotentials: in this state, the structure of the BN remains unchanged, only some potentials stored in it have changed. Therefore, the inference probably just needs to invalidate some already computed potentials to be ready. Only a light amount of preparation is needed to be able to perform inference.
Definition at line 685 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__setState(), and gum::BayesNetInference< GUM_SCALAR >::OutdatedBNPotentials.
|
protectedinherited |
put the inference into an outdated BN structure state
OutdatedBNStructure: in this state, the inference is fully unprepared to be applied because some events changed the "logical" structure of the BN: for instance a node received a hard evidence, which implies that its outgoing arcs can be removed from the BN, hence involving a structural change in the BN. 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 BayesNetInference may be smarter than BayesNetInference 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 OutdatedBNPotentials 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 potentials 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 677 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__setState(), and gum::BayesNetInference< GUM_SCALAR >::OutdatedBNStructure.
|
protectedinherited |
Definition at line 342 of file marginalTargetedInference_tpl.h.
References gum::MarginalTargetedInference< GUM_SCALAR >::__targeted_mode, gum::MarginalTargetedInference< GUM_SCALAR >::__targets, and gum::Set< Key, Alloc >::clear().
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::addAllTargets(), gum::JointTargetedInference< GUM_SCALAR >::addJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), and gum::MarginalTargetedInference< GUM_SCALAR >::eraseAllTargets().
|
protectedpure virtualinherited |
prepares inference when the latter is in OutdatedBNPotentials state
Note that the values of evidence are not necessarily known and can be changed between _updateOutdatedBNPotentials and _makeInference.
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
Referenced by gum::BayesNetInference< GUM_SCALAR >::prepareInference().
|
protectedpure virtualinherited |
prepares inference when the latter is in OutdatedBNStructure state
Note that the values of evidence are not necessarily known and can be changed between _updateOutdatedBNStructure and _makeInference.
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
Referenced by gum::BayesNetInference< GUM_SCALAR >::prepareInference().
|
finalvirtualinherited |
adds all nodes as targets
Definition at line 136 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, gum::BayesNetInference< GUM_SCALAR >::__setState(), gum::MarginalTargetedInference< GUM_SCALAR >::__targets, gum::MarginalTargetedInference< GUM_SCALAR >::_onMarginalTargetAdded(), gum::MarginalTargetedInference< GUM_SCALAR >::_setTargetedMode(), gum::Set< Key, Alloc >::contains(), GUM_ERROR, and gum::Set< Key, Alloc >::insert().
|
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 247 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__createHardEvidence().
Referenced by gum::LoopySamplingInference< GUM_SCALAR, APPROX >::_makeInference(), gum::BayesNetInference< GUM_SCALAR >::addEvidence(), gum::BayesNetInference< GUM_SCALAR >::addListOfEvidence(), gum::BayesNetInference< GUM_SCALAR >::addSetOfEvidence(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), and gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact().
|
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 255 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::addEvidence(), and gum::BayesNetInference< GUM_SCALAR >::BN().
|
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 263 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::addEvidence(), and gum::BayesNetInference< GUM_SCALAR >::BN().
|
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 271 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::addEvidence(), and gum::BayesNetInference< GUM_SCALAR >::BN().
|
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 279 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, gum::MultiDimDecorator< GUM_SCALAR >::add(), gum::BayesNetInference< GUM_SCALAR >::addEvidence(), and GUM_ERROR.
|
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 305 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::addEvidence(), and gum::BayesNetInference< GUM_SCALAR >::BN().
|
finalvirtualinherited |
adds a new evidence on node id (might be soft or hard)
UndefinedElement | if the potential is defined over several nodes |
UndefinedElement | if the node on which the potential is defined does not belong to the Bayesian network |
InvalidArgument | if the node of the potential already has an evidence |
FatalError | if pot=[0,0,...,0] |
Definition at line 354 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::addEvidence().
|
finalvirtualinherited |
adds a new evidence on node id (might be soft or hard)
UndefinedElement | if the potential is defined over several nodes |
UndefinedElement | if the node on which the potential is defined does not belong to the Bayesian network |
InvalidArgument | if the node of the potential already has an evidence |
FatalError | if pot=[0,0,...,0] |
Definition at line 313 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, gum::BayesNetInference< GUM_SCALAR >::__evidence, gum::BayesNetInference< GUM_SCALAR >::__hard_evidence, gum::BayesNetInference< GUM_SCALAR >::__hard_evidence_nodes, gum::BayesNetInference< GUM_SCALAR >::__isHardEvidence(), gum::BayesNetInference< GUM_SCALAR >::__setState(), gum::BayesNetInference< GUM_SCALAR >::__soft_evidence_nodes, gum::BayesNetInference< GUM_SCALAR >::_onEvidenceAdded(), GUM_ERROR, gum::BayesNetInference< GUM_SCALAR >::hasEvidence(), gum::Set< Key, Alloc >::insert(), and gum::BayesNetInference< GUM_SCALAR >::OutdatedBNStructure.
|
finalvirtualinherited |
adds a new list of evidence
UndefinedElement | if some potential is defined over several nodes |
UndefinedElement | if the node on which some potential is defined does not belong to the Bayesian network |
InvalidArgument | if the node of some potential already has an evidence |
FatalError | if pot=[0,0,...,0] |
Definition at line 363 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::addEvidence().
|
finalvirtualinherited |
adds a new set of evidence
UndefinedElement | if some potential is defined over several nodes |
UndefinedElement | if the node on which some potential is defined does not belong to the Bayesian network |
InvalidArgument | if the node of some potential already has an evidence |
FatalError | if pot=[0,0,...,0] |
Definition at line 372 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::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 112 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, gum::BayesNetInference< GUM_SCALAR >::__setState(), gum::MarginalTargetedInference< GUM_SCALAR >::__targets, gum::MarginalTargetedInference< GUM_SCALAR >::_onMarginalTargetAdded(), gum::MarginalTargetedInference< GUM_SCALAR >::_setTargetedMode(), gum::Set< Key, Alloc >::contains(), GUM_ERROR, and gum::Set< Key, Alloc >::insert().
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), and gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact().
|
finalvirtualinherited |
Add a marginal target to the list of targets.
UndefinedElement | if target is not a NodeId in the Bayes net |
Definition at line 158 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), and GUM_ERROR.
|
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 121 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, and GUM_ERROR.
Referenced by gum::WeightedSampling< GUM_SCALAR >::_draw(), gum::MonteCarloSampling< GUM_SCALAR >::_draw(), gum::ImportanceSampling< GUM_SCALAR >::_draw(), gum::SamplingInference< GUM_SCALAR >::_posterior(), gum::BayesNetInference< GUM_SCALAR >::addEvidence(), gum::BayesNetInference< GUM_SCALAR >::chgEvidence(), gum::SamplingInference< GUM_SCALAR >::contextualize(), gum::SamplingInference< GUM_SCALAR >::currentPosterior(), gum::BayesNetInference< GUM_SCALAR >::eraseEvidence(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::MarginalTargetedInference< GUM_SCALAR >::H(), gum::BayesNetInference< GUM_SCALAR >::hasEvidence(), gum::BayesNetInference< GUM_SCALAR >::hasHardEvidence(), gum::BayesNetInference< GUM_SCALAR >::hasSoftEvidence(), gum::JointTargetedInference< GUM_SCALAR >::I(), gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), gum::JointTargetedInference< GUM_SCALAR >::posterior(), gum::SamplingInference< GUM_SCALAR >::samplingBN(), and gum::Estimator< GUM_SCALAR >::setFromLBP().
|
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 432 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__createHardEvidence().
Referenced by gum::BayesNetInference< GUM_SCALAR >::chgEvidence(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), and gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact().
|
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 440 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and gum::BayesNetInference< GUM_SCALAR >::chgEvidence().
|
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 448 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and gum::BayesNetInference< GUM_SCALAR >::chgEvidence().
|
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 456 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and gum::BayesNetInference< GUM_SCALAR >::chgEvidence().
|
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 464 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, gum::MultiDimDecorator< GUM_SCALAR >::add(), gum::BayesNetInference< GUM_SCALAR >::chgEvidence(), and GUM_ERROR.
|
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 491 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and gum::BayesNetInference< GUM_SCALAR >::chgEvidence().
|
finalvirtualinherited |
change the value of an already existing evidence (might be soft or hard)
UndefinedElement | if the potential is defined over several nodes |
UndefinedElement | if the node on which the potential is defined does not belong to the Bayesian network |
InvalidArgument | if the node of the potential does not already have an evidence |
FatalError | if pot=[0,0,...,0] |
Definition at line 499 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, gum::BayesNetInference< GUM_SCALAR >::__evidence, gum::BayesNetInference< GUM_SCALAR >::__hard_evidence, gum::BayesNetInference< GUM_SCALAR >::__hard_evidence_nodes, gum::BayesNetInference< GUM_SCALAR >::__isHardEvidence(), gum::BayesNetInference< GUM_SCALAR >::__setState(), gum::BayesNetInference< GUM_SCALAR >::__soft_evidence_nodes, gum::BayesNetInference< GUM_SCALAR >::_onEvidenceChanged(), gum::Instantiation::end(), gum::Set< Key, Alloc >::erase(), GUM_ERROR, gum::BayesNetInference< GUM_SCALAR >::hasEvidence(), gum::BayesNetInference< GUM_SCALAR >::hasHardEvidence(), gum::Instantiation::inc(), gum::Set< Key, Alloc >::insert(), gum::BayesNetInference< GUM_SCALAR >::isInferenceOutdatedBNStructure(), gum::MultiDimDecorator< GUM_SCALAR >::nbrDim(), gum::BayesNetInference< GUM_SCALAR >::OutdatedBNPotentials, gum::BayesNetInference< GUM_SCALAR >::OutdatedBNStructure, gum::MultiDimDecorator< GUM_SCALAR >::set(), gum::Instantiation::setFirst(), and gum::MultiDimDecorator< GUM_SCALAR >::variable().
|
virtualinherited |
clears all the data structures allocated for the last inference
Definition at line 153 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__setState(), gum::BayesNetInference< GUM_SCALAR >::eraseAllEvidence(), and gum::BayesNetInference< GUM_SCALAR >::OutdatedBNStructure.
Referenced by gum::BayesNetInference< GUM_SCALAR >::setBN().
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 227 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_current_epsilon, gum::ApproximationScheme::_current_rate, gum::ApproximationScheme::_current_state, gum::ApproximationScheme::_current_step, gum::ApproximationScheme::_enabled_eps, gum::ApproximationScheme::_enabled_max_iter, gum::ApproximationScheme::_enabled_max_time, gum::ApproximationScheme::_enabled_min_rate_eps, gum::ApproximationScheme::_eps, gum::ApproximationScheme::_history, gum::ApproximationScheme::_last_epsilon, gum::ApproximationScheme::_max_iter, gum::ApproximationScheme::_max_time, gum::ApproximationScheme::_min_rate_eps, gum::ApproximationScheme::_stopScheme(), gum::ApproximationScheme::_timer, gum::IApproximationSchemeConfiguration::Continue, gum::IApproximationSchemeConfiguration::Epsilon, GUM_EMIT3, GUM_ERROR, gum::IApproximationSchemeConfiguration::Limit, gum::IApproximationSchemeConfiguration::messageApproximationScheme(), gum::IApproximationSchemeConfiguration::onProgress, gum::IApproximationSchemeConfiguration::Rate, gum::ApproximationScheme::startOfPeriod(), gum::ApproximationScheme::stateApproximationScheme(), gum::Timer::step(), gum::IApproximationSchemeConfiguration::TimeLimit, and gum::ApproximationScheme::verbosity().
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::_computeKL(), gum::SamplingInference< GUM_SCALAR >::_loopApproxInference(), gum::learning::DAG2BNLearner< ALLOC >::createBN(), gum::learning::GreedyHillClimbing::learnStructure(), gum::learning::LocalSearchWithTabuList::learnStructure(), and gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::makeInference().
|
virtualinherited |
Returns the current running time in second.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 128 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_timer, and gum::Timer::step().
Referenced by gum::learning::genericBNLearner::currentTime().
|
virtualinherited |
Disable stopping criterion on epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 54 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_enabled_eps.
Referenced by gum::learning::genericBNLearner::disableEpsilon().
|
virtualinherited |
Disable stopping criterion on max iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 105 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_enabled_max_iter.
Referenced by gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::__mcInitApproximationScheme(), gum::learning::genericBNLearner::disableMaxIter(), and gum::learning::GreedyHillClimbing::GreedyHillClimbing().
|
virtualinherited |
Disable stopping criterion on timeout.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 131 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_enabled_max_time.
Referenced by gum::learning::genericBNLearner::disableMaxTime(), and gum::learning::GreedyHillClimbing::GreedyHillClimbing().
|
virtualinherited |
Disable stopping criterion on epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 79 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_enabled_min_rate_eps.
Referenced by gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::__mcInitApproximationScheme(), gum::GibbsBNdistance< GUM_SCALAR >::_computeKL(), gum::learning::genericBNLearner::disableMinEpsilonRate(), and gum::learning::GreedyHillClimbing::GreedyHillClimbing().
|
finalvirtualinherited |
get the domain sizes of the random variables of the BN
Definition at line 174 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__domain_sizes.
|
virtualinherited |
Enable stopping criterion on epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 57 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_enabled_eps.
Referenced by gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::__mcInitApproximationScheme(), and gum::learning::genericBNLearner::enableEpsilon().
|
virtualinherited |
Enable stopping criterion on max iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 108 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_enabled_max_iter.
Referenced by gum::learning::genericBNLearner::enableMaxIter().
|
virtualinherited |
Enable stopping criterion on timeout.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 134 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_enabled_max_time.
Referenced by gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::CNMonteCarloSampling(), and gum::learning::genericBNLearner::enableMaxTime().
|
virtualinherited |
Enable stopping criterion on epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 84 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_enabled_min_rate_eps.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::_computeKL(), and gum::learning::genericBNLearner::enableMinEpsilonRate().
|
virtualinherited |
Returns the value of epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 51 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_eps.
Referenced by gum::ImportanceSampling< GUM_SCALAR >::_onContextualize(), and gum::learning::genericBNLearner::epsilon().
|
finalvirtualinherited |
removes all the evidence entered into the network
Definition at line 595 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__evidence, gum::BayesNetInference< GUM_SCALAR >::__hard_evidence, gum::BayesNetInference< GUM_SCALAR >::__hard_evidence_nodes, gum::BayesNetInference< GUM_SCALAR >::__setState(), gum::BayesNetInference< GUM_SCALAR >::__soft_evidence_nodes, gum::BayesNetInference< GUM_SCALAR >::_onAllEvidenceErased(), gum::Set< Key, Alloc >::clear(), gum::BayesNetInference< GUM_SCALAR >::isInferenceOutdatedBNStructure(), gum::BayesNetInference< GUM_SCALAR >::OutdatedBNPotentials, and gum::BayesNetInference< GUM_SCALAR >::OutdatedBNStructure.
Referenced by gum::BayesNetInference< GUM_SCALAR >::clear(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), and gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation().
|
virtualinherited |
Clear all previously defined targets.
Reimplemented in gum::JointTargetedInference< GUM_SCALAR >.
Definition at line 99 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__setState(), gum::MarginalTargetedInference< GUM_SCALAR >::__targets, gum::MarginalTargetedInference< GUM_SCALAR >::_onAllMarginalTargetsErased(), gum::MarginalTargetedInference< GUM_SCALAR >::_setTargetedMode(), and gum::Set< Key, Alloc >::clear().
Referenced by gum::JointTargetedInference< GUM_SCALAR >::eraseAllMarginalTargets(), and gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact().
|
finalvirtualinherited |
removed the evidence, if any, corresponding to node id
Definition at line 566 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__evidence, gum::BayesNetInference< GUM_SCALAR >::__hard_evidence, gum::BayesNetInference< GUM_SCALAR >::__hard_evidence_nodes, gum::BayesNetInference< GUM_SCALAR >::__setState(), gum::BayesNetInference< GUM_SCALAR >::__soft_evidence_nodes, gum::BayesNetInference< GUM_SCALAR >::_onEvidenceErased(), gum::Set< Key, Alloc >::erase(), gum::BayesNetInference< GUM_SCALAR >::hasEvidence(), gum::BayesNetInference< GUM_SCALAR >::hasHardEvidence(), gum::BayesNetInference< GUM_SCALAR >::isInferenceOutdatedBNStructure(), gum::BayesNetInference< GUM_SCALAR >::OutdatedBNPotentials, and gum::BayesNetInference< GUM_SCALAR >::OutdatedBNStructure.
Referenced by gum::BayesNetInference< GUM_SCALAR >::eraseEvidence().
|
finalvirtualinherited |
removed the evidence, if any, corresponding to node of name nodeName
Definition at line 588 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and gum::BayesNetInference< GUM_SCALAR >::eraseEvidence().
|
finalvirtualinherited |
removes an existing (marginal) target
Definition at line 172 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, gum::BayesNetInference< GUM_SCALAR >::__setState(), gum::MarginalTargetedInference< GUM_SCALAR >::__targeted_mode, gum::MarginalTargetedInference< GUM_SCALAR >::__targets, gum::MarginalTargetedInference< GUM_SCALAR >::_onMarginalTargetErased(), gum::Set< Key, Alloc >::contains(), gum::Set< Key, Alloc >::erase(), and GUM_ERROR.
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::eraseTarget().
|
finalvirtualinherited |
removes an existing (marginal) target
Definition at line 197 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, gum::MarginalTargetedInference< GUM_SCALAR >::eraseTarget(), and GUM_ERROR.
|
inherited |
returns the set of evidence
Definition at line 650 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__evidence.
Referenced by gum::ImportanceSampling< GUM_SCALAR >::_onContextualize(), and gum::MarginalTargetedInference< GUM_SCALAR >::posterior().
|
inherited |
Create a gum::Potential 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 285 of file marginalTargetedInference_tpl.h.
References gum::MultiDimDecorator< GUM_SCALAR >::add(), gum::BayesNetInference< GUM_SCALAR >::addEvidence(), gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), gum::BayesNetInference< GUM_SCALAR >::BN(), gum::BayesNetInference< GUM_SCALAR >::chgEvidence(), gum::Set< Key, Alloc >::contains(), gum::Instantiation::end(), gum::BayesNetInference< GUM_SCALAR >::eraseAllEvidence(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseAllTargets(), GUM_ERROR, gum::Instantiation::incNotVar(), gum::Instantiation::incVar(), gum::BayesNetInference< GUM_SCALAR >::makeInference(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), gum::MultiDimDecorator< GUM_SCALAR >::set(), gum::Instantiation::setFirst(), gum::Instantiation::setFirstVar(), and gum::Instantiation::val().
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact().
|
inherited |
Create a gum::Potential 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 324 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), and gum::Set< Key, Alloc >::insert().
|
finalvirtualinherited |
Entropy Compute Shanon's entropy of a node given the observation.
Definition at line 269 of file marginalTargetedInference_tpl.h.
References gum::MarginalTargetedInference< GUM_SCALAR >::posterior().
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::H(), and gum::JointTargetedInference< GUM_SCALAR >::VI().
|
finalvirtualinherited |
Entropy Compute Shanon's entropy of a node given the observation.
Definition at line 278 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and gum::MarginalTargetedInference< GUM_SCALAR >::H().
|
inherited |
indicate for each node with hard evidence which value it took
Definition at line 642 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__hard_evidence.
Referenced by gum::WeightedSampling< GUM_SCALAR >::_draw(), gum::MonteCarloSampling< GUM_SCALAR >::_draw(), gum::ImportanceSampling< GUM_SCALAR >::_draw(), and gum::SamplingInference< GUM_SCALAR >::contextualize().
|
inherited |
returns the set of nodes with hard evidence
the set of nodes that received hard evidence
Definition at line 666 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__hard_evidence_nodes.
Referenced by gum::WeightedSampling< GUM_SCALAR >::_draw(), gum::MonteCarloSampling< GUM_SCALAR >::_draw(), gum::ImportanceSampling< GUM_SCALAR >::_draw(), gum::ImportanceSampling< GUM_SCALAR >::_onContextualize(), gum::SamplingInference< GUM_SCALAR >::_setEstimatorFromBN(), gum::SamplingInference< GUM_SCALAR >::_setEstimatorFromLBP(), gum::SamplingInference< GUM_SCALAR >::contextualize(), and gum::MarginalTargetedInference< GUM_SCALAR >::posterior().
|
finalvirtualinherited |
indicates whether some node(s) have received evidence
Definition at line 381 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__evidence.
Referenced by gum::BayesNetInference< GUM_SCALAR >::addEvidence(), gum::BayesNetInference< GUM_SCALAR >::chgEvidence(), gum::BayesNetInference< GUM_SCALAR >::eraseEvidence(), and gum::BayesNetInference< GUM_SCALAR >::hasEvidence().
|
finalvirtualinherited |
indicates whether node id has received an evidence
Definition at line 388 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__evidence.
|
finalvirtualinherited |
indicates whether node id has received an evidence
Definition at line 409 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and gum::BayesNetInference< GUM_SCALAR >::hasEvidence().
|
finalvirtualinherited |
indicates whether node id has received a hard evidence
Definition at line 395 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__hard_evidence_nodes, and gum::Set< Key, Alloc >::exists().
Referenced by gum::ImportanceSampling< GUM_SCALAR >::_draw(), gum::BayesNetInference< GUM_SCALAR >::chgEvidence(), gum::BayesNetInference< GUM_SCALAR >::eraseEvidence(), and gum::BayesNetInference< GUM_SCALAR >::hasHardEvidence().
|
finalvirtualinherited |
indicates whether node id has received a hard evidence
Definition at line 417 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and gum::BayesNetInference< GUM_SCALAR >::hasHardEvidence().
|
finalvirtualinherited |
indicates whether node id has received a soft evidence
Definition at line 402 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__soft_evidence_nodes, and gum::Set< Key, Alloc >::exists().
Referenced by gum::BayesNetInference< GUM_SCALAR >::hasSoftEvidence().
|
finalvirtualinherited |
indicates whether node id has received a soft evidence
Definition at line 425 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and gum::BayesNetInference< GUM_SCALAR >::hasSoftEvidence().
|
virtualinherited |
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 173 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_history, GUM_ERROR, gum::ApproximationScheme::stateApproximationScheme(), gum::IApproximationSchemeConfiguration::Undefined, and gum::ApproximationScheme::verbosity().
Referenced by gum::learning::genericBNLearner::history().
|
inherited |
Initialise the scheme.
Definition at line 187 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_current_epsilon, gum::ApproximationScheme::_current_rate, gum::ApproximationScheme::_current_state, gum::ApproximationScheme::_current_step, gum::ApproximationScheme::_history, gum::ApproximationScheme::_timer, gum::IApproximationSchemeConfiguration::Continue, and gum::Timer::reset().
Referenced by gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::__mcInitApproximationScheme(), gum::GibbsBNdistance< GUM_SCALAR >::_computeKL(), gum::SamplingInference< GUM_SCALAR >::_loopApproxInference(), gum::SamplingInference< GUM_SCALAR >::_onStateChanged(), gum::learning::DAG2BNLearner< ALLOC >::createBN(), gum::learning::GreedyHillClimbing::learnStructure(), and gum::learning::LocalSearchWithTabuList::learnStructure().
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a done 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 96 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__state, and gum::BayesNetInference< GUM_SCALAR >::Done.
Referenced by gum::JointTargetedInference< GUM_SCALAR >::jointPosterior(), gum::BayesNetInference< GUM_SCALAR >::makeInference(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), and gum::BayesNetInference< GUM_SCALAR >::prepareInference().
|
virtualinherited |
Returns true if stopping criterion on epsilon is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 61 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_enabled_eps.
Referenced by gum::learning::genericBNLearner::isEnabledEpsilon().
|
virtualinherited |
Returns true if stopping criterion on max iterations is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 112 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_enabled_max_iter.
Referenced by gum::learning::genericBNLearner::isEnabledMaxIter().
|
virtualinherited |
Returns true if stopping criterion on timeout is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 138 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_enabled_max_time.
Referenced by gum::learning::genericBNLearner::isEnabledMaxTime().
|
virtualinherited |
Returns true if stopping criterion on epsilon rate is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 90 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_enabled_min_rate_eps.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::_computeKL(), and gum::learning::genericBNLearner::isEnabledMinEpsilonRate().
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a InferenceDone state
Definition at line 89 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__state, and gum::BayesNetInference< GUM_SCALAR >::Done.
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a OutdatedBNPotential state
Definition at line 83 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__state, and gum::BayesNetInference< GUM_SCALAR >::OutdatedBNPotentials.
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a OutdatedBNStructure state
Definition at line 76 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__state, and gum::BayesNetInference< GUM_SCALAR >::OutdatedBNStructure.
Referenced by gum::BayesNetInference< GUM_SCALAR >::chgEvidence(), gum::BayesNetInference< GUM_SCALAR >::eraseAllEvidence(), and gum::BayesNetInference< GUM_SCALAR >::eraseEvidence().
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a ready state
Definition at line 70 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__state, and gum::BayesNetInference< GUM_SCALAR >::ReadyForInference.
Referenced by gum::SamplingInference< GUM_SCALAR >::_onStateChanged(), gum::BayesNetInference< GUM_SCALAR >::makeInference(), and gum::BayesNetInference< GUM_SCALAR >::prepareInference().
|
finalvirtualinherited |
return true if variable is a (marginal) target
Definition at line 76 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, gum::MarginalTargetedInference< GUM_SCALAR >::__targets, gum::Set< Key, Alloc >::contains(), and GUM_ERROR.
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::isTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), and gum::JointTargetedInference< GUM_SCALAR >::posterior().
|
finalvirtualinherited |
return true if variable is a (marginal) target
Definition at line 91 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, and gum::MarginalTargetedInference< GUM_SCALAR >::isTarget().
|
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 711 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__setState(), gum::BayesNetInference< GUM_SCALAR >::_makeInference(), gum::BayesNetInference< GUM_SCALAR >::Done, gum::BayesNetInference< GUM_SCALAR >::isDone(), gum::BayesNetInference< GUM_SCALAR >::isInferenceReady(), and gum::BayesNetInference< GUM_SCALAR >::prepareInference().
Referenced by gum::LoopySamplingInference< GUM_SCALAR, APPROX >::_makeInference(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::disturbBN(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation(), gum::JointTargetedInference< GUM_SCALAR >::jointPosterior(), and gum::MarginalTargetedInference< GUM_SCALAR >::posterior().
|
virtualinherited |
Returns the criterion on number of iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 102 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_max_iter.
Referenced by gum::learning::genericBNLearner::maxIter().
|
virtualinherited |
Returns the timeout (in seconds).
Implements gum::IApproximationSchemeConfiguration.
Definition at line 125 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_max_time.
Referenced by gum::learning::genericBNLearner::maxTime().
|
inherited |
Returns the approximation scheme message.
Definition at line 40 of file IApproximationSchemeConfiguration_inl.h.
References gum::IApproximationSchemeConfiguration::Continue, gum::IApproximationSchemeConfiguration::Epsilon, gum::IApproximationSchemeConfiguration::epsilon(), gum::IApproximationSchemeConfiguration::Limit, gum::IApproximationSchemeConfiguration::maxIter(), gum::IApproximationSchemeConfiguration::maxTime(), gum::IApproximationSchemeConfiguration::minEpsilonRate(), gum::IApproximationSchemeConfiguration::Rate, gum::IApproximationSchemeConfiguration::stateApproximationScheme(), gum::IApproximationSchemeConfiguration::Stopped, gum::IApproximationSchemeConfiguration::TimeLimit, and gum::IApproximationSchemeConfiguration::Undefined.
Referenced by gum::ApproximationScheme::_stopScheme(), gum::ApproximationScheme::continueApproximationScheme(), and gum::credal::InferenceEngine< GUM_SCALAR >::getApproximationSchemeMsg().
|
virtualinherited |
Returns the value of the minimal epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 74 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_min_rate_eps.
Referenced by gum::learning::genericBNLearner::minEpsilonRate().
|
finalvirtualinherited |
returns the number of evidence entered into the Bayesian network
Definition at line 620 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__evidence.
|
finalvirtualinherited |
returns the number of hard evidence entered into the Bayesian network
Definition at line 627 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__hard_evidence_nodes, and gum::Set< Key, Alloc >::size().
|
virtualinherited |
Returns the number of iterations.
OperationNotAllowed | Raised if the scheme did not perform. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 163 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_current_step, GUM_ERROR, gum::ApproximationScheme::stateApproximationScheme(), and gum::IApproximationSchemeConfiguration::Undefined.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::_computeKL(), and gum::learning::genericBNLearner::nbrIterations().
|
finalvirtualinherited |
returns the number of soft evidence entered into the Bayesian network
Definition at line 634 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__soft_evidence_nodes, and gum::Set< Key, Alloc >::size().
|
finalvirtualnoexceptinherited |
returns the number of marginal targets
Definition at line 218 of file marginalTargetedInference_tpl.h.
References gum::MarginalTargetedInference< GUM_SCALAR >::__targets, and gum::Set< Key, Alloc >::size().
|
virtualinherited |
Returns the period size.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 149 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_period_size.
Referenced by gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::makeInference(), and gum::learning::genericBNLearner::periodSize().
|
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 242 of file marginalTargetedInference_tpl.h.
References gum::MarginalTargetedInference< GUM_SCALAR >::_posterior(), gum::BayesNetInference< GUM_SCALAR >::evidence(), GUM_ERROR, gum::BayesNetInference< GUM_SCALAR >::hardEvidenceNodes(), gum::BayesNetInference< GUM_SCALAR >::isDone(), gum::MarginalTargetedInference< GUM_SCALAR >::isTarget(), and gum::BayesNetInference< GUM_SCALAR >::makeInference().
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::MarginalTargetedInference< GUM_SCALAR >::H(), gum::JointTargetedInference< GUM_SCALAR >::posterior(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), and gum::Estimator< GUM_SCALAR >::setFromLBP().
|
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 260 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and gum::MarginalTargetedInference< GUM_SCALAR >::posterior().
|
finalvirtualinherited |
prepare the internal inference structures for the next inference
Definition at line 692 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, gum::BayesNetInference< GUM_SCALAR >::__setState(), gum::BayesNetInference< GUM_SCALAR >::__state, gum::BayesNetInference< GUM_SCALAR >::_updateOutdatedBNPotentials(), gum::BayesNetInference< GUM_SCALAR >::_updateOutdatedBNStructure(), GUM_ERROR, gum::BayesNetInference< GUM_SCALAR >::isDone(), gum::BayesNetInference< GUM_SCALAR >::isInferenceReady(), gum::BayesNetInference< GUM_SCALAR >::OutdatedBNStructure, and gum::BayesNetInference< GUM_SCALAR >::ReadyForInference.
Referenced by gum::BayesNetInference< GUM_SCALAR >::makeInference(), and gum::SamplingInference< GUM_SCALAR >::samplingBN().
|
inherited |
Returns the remaining burn in.
Definition at line 210 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_burn_in, and gum::ApproximationScheme::_current_step.
|
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 132 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, gum::BayesNetInference< GUM_SCALAR >::__computeDomainSizes(), gum::BayesNetInference< GUM_SCALAR >::__setState(), gum::BayesNetInference< GUM_SCALAR >::_onBayesNetChanged(), gum::BayesNetInference< GUM_SCALAR >::clear(), and gum::BayesNetInference< GUM_SCALAR >::OutdatedBNStructure.
|
virtualinherited |
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. |
OutOfLowerBound | Raised if eps < 0. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 43 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_enabled_eps, gum::ApproximationScheme::_eps, and GUM_ERROR.
Referenced by gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::__mcInitApproximationScheme(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsSampling< GUM_SCALAR >::GibbsSampling(), gum::learning::GreedyHillClimbing::GreedyHillClimbing(), gum::SamplingInference< GUM_SCALAR >::SamplingInference(), and gum::learning::genericBNLearner::setEpsilon().
|
virtualinherited |
Stopping criterion on number of iterations.
If the criterion was disabled it will be enabled.
max | The maximum number of iterations. |
OutOfLowerBound | Raised if max <= 1. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 95 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_enabled_max_iter, gum::ApproximationScheme::_max_iter, and GUM_ERROR.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::SamplingInference< GUM_SCALAR >::SamplingInference(), and gum::learning::genericBNLearner::setMaxIter().
|
virtualinherited |
Stopping criterion on timeout.
If the criterion was disabled it will be enabled.
timeout | The timeout value in seconds. |
OutOfLowerBound | Raised if timeout <= 0.0. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 118 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_enabled_max_time, gum::ApproximationScheme::_max_time, and GUM_ERROR.
Referenced by gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::CNMonteCarloSampling(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::SamplingInference< GUM_SCALAR >::SamplingInference(), and gum::learning::genericBNLearner::setMaxTime().
|
virtualinherited |
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. |
OutOfLowerBound | if rate<0 |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 66 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_enabled_min_rate_eps, gum::ApproximationScheme::_min_rate_eps, and GUM_ERROR.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsSampling< GUM_SCALAR >::GibbsSampling(), gum::SamplingInference< GUM_SCALAR >::SamplingInference(), and gum::learning::genericBNLearner::setMinEpsilonRate().
|
virtualinherited |
How many samples between two stopping is enable.
p | The new period value. |
OutOfLowerBound | Raised if p < 1. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 143 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_period_size, and GUM_ERROR.
Referenced by gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::CNMonteCarloSampling(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::SamplingInference< GUM_SCALAR >::SamplingInference(), and gum::learning::genericBNLearner::setPeriodSize().
|
virtualinherited |
Set the verbosity on (true) or off (false).
v | If true, then verbosity is turned on. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 152 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_verbosity.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::SamplingInference< GUM_SCALAR >::SamplingInference(), and gum::learning::genericBNLearner::setVerbosity().
|
inherited |
returns the set of nodes with soft evidence
the set of nodes that received soft evidence
Definition at line 658 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__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 197 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_burn_in, gum::ApproximationScheme::_current_step, and gum::ApproximationScheme::_period_size.
Referenced by gum::ApproximationScheme::continueApproximationScheme().
|
finalvirtualnoexceptinherited |
returns the state of the inference engine
Definition at line 104 of file BayesNetInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__state.
Referenced by gum::BayesNetInference< GUM_SCALAR >::__setState().
|
virtualinherited |
Returns the approximation scheme state.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 158 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_current_state.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), gum::ApproximationScheme::history(), gum::ApproximationScheme::nbrIterations(), and gum::learning::genericBNLearner::stateApproximationScheme().
|
inherited |
Stop the approximation scheme.
Definition at line 219 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_current_state, gum::ApproximationScheme::_stopScheme(), gum::IApproximationSchemeConfiguration::Continue, and gum::IApproximationSchemeConfiguration::Stopped.
Referenced by gum::learning::DAG2BNLearner< ALLOC >::createBN(), gum::learning::GreedyHillClimbing::learnStructure(), and gum::learning::LocalSearchWithTabuList::learnStructure().
|
finalvirtualnoexceptinherited |
returns the list of marginal targets
Definition at line 211 of file marginalTargetedInference_tpl.h.
References gum::MarginalTargetedInference< GUM_SCALAR >::__targets.
Referenced by gum::SamplingInference< GUM_SCALAR >::contextualize().
|
inherited |
Update the scheme w.r.t the new error and increment steps.
incr | The new increment steps. |
Definition at line 206 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_current_step.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::_computeKL(), gum::SamplingInference< GUM_SCALAR >::_loopApproxInference(), gum::learning::DAG2BNLearner< ALLOC >::createBN(), gum::learning::GreedyHillClimbing::learnStructure(), gum::learning::LocalSearchWithTabuList::learnStructure(), and gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::makeInference().
|
virtualinherited |
Returns true if verbosity is enabled.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 154 of file approximationScheme_inl.h.
References gum::ApproximationScheme::_verbosity.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), gum::ApproximationScheme::history(), and gum::learning::genericBNLearner::verbosity().
|
protectedinherited |
Number of iterations before checking stopping criteria.
Definition at line 414 of file approximationScheme.h.
Referenced by gum::GibbsSampling< GUM_SCALAR >::burnIn(), gum::GibbsBNdistance< GUM_SCALAR >::burnIn(), gum::ApproximationScheme::remainingBurnIn(), gum::GibbsSampling< GUM_SCALAR >::setBurnIn(), gum::GibbsBNdistance< GUM_SCALAR >::setBurnIn(), and gum::ApproximationScheme::startOfPeriod().
|
protectedinherited |
Current epsilon.
Definition at line 369 of file approximationScheme.h.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), and gum::ApproximationScheme::initApproximationScheme().
|
protectedinherited |
Current rate.
Definition at line 375 of file approximationScheme.h.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), and gum::ApproximationScheme::initApproximationScheme().
|
protectedinherited |
The current state.
Definition at line 384 of file approximationScheme.h.
Referenced by gum::ApproximationScheme::_stopScheme(), gum::ApproximationScheme::continueApproximationScheme(), gum::ApproximationScheme::initApproximationScheme(), gum::ApproximationScheme::stateApproximationScheme(), and gum::ApproximationScheme::stopApproximationScheme().
|
protectedinherited |
The current step.
Definition at line 378 of file approximationScheme.h.
Referenced by gum::learning::Miic::_initiation(), gum::learning::Miic::_iteration(), gum::learning::Miic::_orientation_3off2(), gum::learning::Miic::_orientation_latents(), gum::learning::Miic::_orientation_miic(), gum::ApproximationScheme::continueApproximationScheme(), gum::ApproximationScheme::initApproximationScheme(), gum::learning::Miic::learnMixedStructure(), gum::ApproximationScheme::nbrIterations(), gum::ApproximationScheme::remainingBurnIn(), gum::ApproximationScheme::startOfPeriod(), and gum::ApproximationScheme::updateApproximationScheme().
|
protectedinherited |
If true, the threshold convergence is enabled.
Definition at line 393 of file approximationScheme.h.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), gum::ApproximationScheme::disableEpsilon(), gum::ApproximationScheme::enableEpsilon(), gum::ApproximationScheme::isEnabledEpsilon(), and gum::ApproximationScheme::setEpsilon().
|
protectedinherited |
If true, the maximum iterations stopping criterion is enabled.
Definition at line 411 of file approximationScheme.h.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), gum::ApproximationScheme::disableMaxIter(), gum::ApproximationScheme::enableMaxIter(), gum::ApproximationScheme::isEnabledMaxIter(), and gum::ApproximationScheme::setMaxIter().
|
protectedinherited |
If true, the timeout is enabled.
Definition at line 405 of file approximationScheme.h.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), gum::ApproximationScheme::disableMaxTime(), gum::ApproximationScheme::enableMaxTime(), gum::ApproximationScheme::isEnabledMaxTime(), and gum::ApproximationScheme::setMaxTime().
|
protectedinherited |
If true, the minimal threshold for epsilon rate is enabled.
Definition at line 399 of file approximationScheme.h.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), gum::ApproximationScheme::disableMinEpsilonRate(), gum::ApproximationScheme::enableMinEpsilonRate(), gum::ApproximationScheme::isEnabledMinEpsilonRate(), and gum::ApproximationScheme::setMinEpsilonRate().
|
protectedinherited |
Threshold for convergence.
Definition at line 390 of file approximationScheme.h.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), gum::ApproximationScheme::epsilon(), and gum::ApproximationScheme::setEpsilon().
|
protectedinherited |
The scheme history, used only if verbosity == true.
Definition at line 387 of file approximationScheme.h.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), gum::ApproximationScheme::history(), and gum::ApproximationScheme::initApproximationScheme().
|
protectedinherited |
Last epsilon value.
Definition at line 372 of file approximationScheme.h.
Referenced by gum::ApproximationScheme::continueApproximationScheme().
|
protectedinherited |
The maximum iterations.
Definition at line 408 of file approximationScheme.h.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), gum::ApproximationScheme::maxIter(), and gum::ApproximationScheme::setMaxIter().
|
protectedinherited |
The timeout.
Definition at line 402 of file approximationScheme.h.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), gum::ApproximationScheme::maxTime(), and gum::ApproximationScheme::setMaxTime().
|
protectedinherited |
Threshold for the epsilon rate.
Definition at line 396 of file approximationScheme.h.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), gum::ApproximationScheme::minEpsilonRate(), and gum::ApproximationScheme::setMinEpsilonRate().
|
protectedinherited |
Checking criteria frequency.
Definition at line 417 of file approximationScheme.h.
Referenced by gum::ApproximationScheme::periodSize(), gum::ApproximationScheme::setPeriodSize(), and gum::ApproximationScheme::startOfPeriod().
|
protectedinherited |
The timer.
Definition at line 381 of file approximationScheme.h.
Referenced by gum::learning::Miic::_initiation(), gum::learning::Miic::_iteration(), gum::learning::Miic::_orientation_3off2(), gum::learning::Miic::_orientation_latents(), gum::learning::Miic::_orientation_miic(), gum::ApproximationScheme::_stopScheme(), gum::ApproximationScheme::continueApproximationScheme(), gum::ApproximationScheme::currentTime(), gum::ApproximationScheme::initApproximationScheme(), and gum::learning::Miic::learnMixedStructure().
|
protectedinherited |
If true, verbosity is enabled.
Definition at line 420 of file approximationScheme.h.
Referenced by gum::ApproximationScheme::setVerbosity(), and gum::ApproximationScheme::verbosity().
Progression, error and time.
Definition at line 59 of file IApproximationSchemeConfiguration.h.
Referenced by gum::learning::Miic::_initiation(), gum::learning::Miic::_iteration(), gum::learning::Miic::_orientation_3off2(), gum::learning::Miic::_orientation_latents(), gum::learning::Miic::_orientation_miic(), gum::ApproximationScheme::continueApproximationScheme(), and gum::learning::genericBNLearner::distributeProgress().
|
inherited |
Criteria messageApproximationScheme.
Definition at line 62 of file IApproximationSchemeConfiguration.h.
Referenced by gum::ApproximationScheme::_stopScheme(), and gum::learning::genericBNLearner::distributeStop().