![]() |
aGrUM
0.16.0
|
<agrum/BN/inference/ShaferShenoyInference.h> More...
#include <ShaferShenoyInference.h>
Public Member Functions | |
Potential< GUM_SCALAR > | evidenceJointImpact (const NodeSet &targets, const NodeSet &evs) |
Create a gum::Potential for P(joint targets|evs) (for all instanciation of targets and evs) More... | |
Potential< GUM_SCALAR > | evidenceJointImpact (const std::vector< std::string > &targets, const std::vector< std::string > &evs) |
Create a gum::Potential for P(joint targets|evs) (for all instanciation of targets and evs) More... | |
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... | |
Constructors / Destructors | |
ShaferShenoyInference (const IBayesNet< GUM_SCALAR > *BN, FindBarrenNodesType barren_type=FindBarrenNodesType::FIND_BARREN_NODES, bool use_binary_join_tree=true) | |
default constructor More... | |
~ShaferShenoyInference () final | |
destructor More... | |
Accessors / Modifiers | |
void | setTriangulation (const Triangulation &new_triangulation) |
use a new triangulation algorithm More... | |
void | setFindBarrenNodesType (FindBarrenNodesType type) |
sets how we determine barren nodes More... | |
const JoinTree * | joinTree () |
returns the current join tree used More... | |
const JunctionTree * | junctionTree () |
returns the current junction tree More... | |
GUM_SCALAR | evidenceProbability () |
returns the probability of evidence More... | |
Probability computations | |
virtual const Potential< GUM_SCALAR > & | jointPosterior (const NodeSet &nodes) final |
Compute the joint posterior of a set of nodes. More... | |
virtual const Potential< GUM_SCALAR > & | posterior (NodeId node) final |
Computes and returns the posterior of a node. More... | |
virtual const Potential< GUM_SCALAR > & | posterior (const std::string &nodeName) final |
Computes and returns the posterior of a node. More... | |
Targets | |
virtual void | eraseAllTargets () |
Clear all previously defined targets (marginal and joint targets) More... | |
virtual void | eraseAllJointTargets () final |
Clear all previously defined joint targets. More... | |
virtual void | eraseAllMarginalTargets () final |
Clear all the previously defined marginal targets. More... | |
virtual void | addJointTarget (const NodeSet &joint_target) final |
Add a set of nodes as a new joint target. As a collateral effect, every node is added as a marginal target. More... | |
virtual void | eraseJointTarget (const NodeSet &joint_target) final |
removes an existing joint target More... | |
virtual bool | isJointTarget (const NodeSet &vars) const final |
return true if target is a joint target. More... | |
virtual const Set< NodeSet > & | jointTargets () const noexcept final |
returns the list of joint targets More... | |
virtual Size | nbrJointTargets () const noexcept final |
returns the number of joint targets More... | |
Information Theory related functions | |
GUM_SCALAR | I (NodeId X, NodeId Y) |
Mutual information between X and Y. More... | |
GUM_SCALAR | VI (NodeId X, NodeId Y) |
Variation of information between X and Y. More... | |
GUM_SCALAR | jointMutualInformation (const NodeSet &targets) |
Mutual information between targets. More... | |
GUM_SCALAR | jointMutualInformation (const std::vector< std::string > &targets) |
Mutual information between targets. More... | |
Targets | |
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... | |
Public Types | |
enum | StateOfInference { StateOfInference::OutdatedBNStructure, StateOfInference::OutdatedBNPotentials, StateOfInference::ReadyForInference, StateOfInference::Done } |
current state of the inference More... | |
Protected Member Functions | |
void | _onStateChanged () final |
fired when the stage is changed More... | |
void | _onEvidenceAdded (const NodeId id, bool isHardEvidence) final |
fired after a new evidence is inserted More... | |
void | _onEvidenceErased (const NodeId id, bool isHardEvidence) final |
fired before an evidence is removed More... | |
void | _onAllEvidenceErased (bool contains_hard_evidence) final |
fired before all the evidence are erased More... | |
void | _onEvidenceChanged (const NodeId id, bool hasChangedSoftHard) final |
fired after an evidence is changed, in particular when its status (soft/hard) changes More... | |
void | _onMarginalTargetAdded (const NodeId id) final |
fired after a new single target is inserted More... | |
void | _onMarginalTargetErased (const NodeId id) final |
fired before a single target is removed More... | |
virtual void | _onBayesNetChanged (const IBayesNet< GUM_SCALAR > *bn) final |
fired after a new Bayes net has been assigned to the engine More... | |
void | _onJointTargetAdded (const NodeSet &set) final |
fired after a new joint target is inserted More... | |
void | _onJointTargetErased (const NodeSet &set) final |
fired before a joint target is removed More... | |
void | _onAllMarginalTargetsAdded () final |
fired after all the nodes of the BN are added as single targets More... | |
void | _onAllMarginalTargetsErased () final |
fired before a all the single targets are removed More... | |
void | _onAllJointTargetsErased () final |
fired before a all the joint targets are removed More... | |
void | _onAllTargetsErased () final |
fired before a all single and joint_targets are removed More... | |
void | _updateOutdatedBNStructure () final |
prepares inference when the latter is in OutdatedBNStructure state More... | |
void | _updateOutdatedBNPotentials () final |
prepares inference when the latter is in OutdatedBNPotentials state More... | |
void | _makeInference () final |
called when the inference has to be performed effectively More... | |
const Potential< GUM_SCALAR > & | _posterior (NodeId id) final |
returns the posterior of a given variable More... | |
const Potential< GUM_SCALAR > & | _jointPosterior (const NodeSet &set) final |
returns the posterior of a declared target set More... | |
const Potential< GUM_SCALAR > & | _jointPosterior (const NodeSet &wanted_target, const NodeSet &declared_target) final |
asks derived classes for the joint posterior of a set of variables not declared as a joint target More... | |
Potential< GUM_SCALAR > * | _unnormalizedJointPosterior (NodeId id) final |
returns a fresh potential equal to P(argument,evidence) More... | |
Potential< GUM_SCALAR > * | _unnormalizedJointPosterior (const NodeSet &set) final |
returns a fresh potential equal to P(argument,evidence) More... | |
void | _setTargetedMode () |
bool | _isTargetedMode () const |
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... | |
<agrum/BN/inference/ShaferShenoyInference.h>
Implementation of Shafer-Shenoy's propagation algorithm for inference in Bayesian Networks
Definition at line 68 of file ShaferShenoyInference.h.
|
private |
Definition at line 222 of file ShaferShenoyInference.h.
|
private |
Definition at line 224 of file ShaferShenoyInference.h.
|
private |
the possible types of evidence changes
Enumerator | |
---|---|
EVIDENCE_ADDED | |
EVIDENCE_ERASED | |
EVIDENCE_MODIFIED |
Definition at line 353 of file ShaferShenoyInference.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.
|
explicit |
default constructor
|
final |
destructor
|
private |
avoid copy constructors
|
private |
actually perform the collect phase
|
private |
compute a root for each connected component of __JT
|
private |
create a new junction tree as well as its related data structures
|
private |
invalidate all the messages sent from a given clique
|
private |
invalidate all messages, posteriors and created potentials
|
private |
check whether a new join tree is really needed for the next inference
|
private |
removes variables del_vars from a list of potentials and returns the resulting list
|
private |
creates the message sent by clique from_id to clique to_id
|
private |
|
private |
sets the operator for performing the combinations
|
private |
sets the operator for performing the projections
|
protectedinherited |
Definition at line 338 of file marginalTargetedInference_tpl.h.
References gum::MarginalTargetedInference< GUM_SCALAR >::__targeted_mode.
|
finalprotectedvirtual |
returns the posterior of a declared target set
set | The set of ids of the variables whose joint posterior is looked for. |
Implements gum::JointTargetedInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
finalprotectedvirtual |
asks derived classes for the joint posterior of a set of variables not declared as a joint target
wanted_target | The set of ids of the variables whose joint posterior is looked for. |
declared_target | the joint target declared by the user that contains set |
Implements gum::JointTargetedInference< GUM_SCALAR >.
|
finalprotectedvirtual |
called when the inference has to be performed effectively
Once the inference is done, _fillPosterior can be called.
Implements gum::BayesNetInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
finalprotectedvirtual |
fired before all the evidence are erased
Implements gum::BayesNetInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
finalprotectedvirtual |
fired before a all the joint targets are removed
Implements gum::JointTargetedInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
finalprotectedvirtual |
fired after all the nodes of the BN are added as single targets
Implements gum::MarginalTargetedInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
finalprotectedvirtual |
fired before a all the single targets are removed
Implements gum::MarginalTargetedInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
finalprotectedvirtual |
fired before a all single and joint_targets are removed
Implements gum::JointTargetedInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
finalprotectedvirtual |
fired after a new Bayes net has been assigned to the engine
Reimplemented from gum::JointTargetedInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
finalprotectedvirtual |
fired after a new evidence is inserted
Implements gum::BayesNetInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
finalprotectedvirtual |
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::BayesNetInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
finalprotectedvirtual |
fired before an evidence is removed
Implements gum::BayesNetInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
finalprotectedvirtual |
fired after a new joint target is inserted
set | The set of target variable's ids. |
Implements gum::JointTargetedInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
finalprotectedvirtual |
fired before a joint target is removed
set | The set of target variable's ids. |
Implements gum::JointTargetedInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
finalprotectedvirtual |
fired after a new single target is inserted
id | The target variable's id. |
Implements gum::MarginalTargetedInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
finalprotectedvirtual |
fired before a single target is removed
id | The target variable's id. |
Implements gum::MarginalTargetedInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
inlinefinalprotectedvirtual |
fired when the stage is changed
Implements gum::BayesNetInference< GUM_SCALAR >.
Definition at line 126 of file ShaferShenoyInference.h.
References gum::ShaferShenoyInference< GUM_SCALAR >::_jointPosterior(), gum::ShaferShenoyInference< GUM_SCALAR >::_makeInference(), gum::ShaferShenoyInference< GUM_SCALAR >::_onAllEvidenceErased(), gum::ShaferShenoyInference< GUM_SCALAR >::_onAllJointTargetsErased(), gum::ShaferShenoyInference< GUM_SCALAR >::_onAllMarginalTargetsAdded(), gum::ShaferShenoyInference< GUM_SCALAR >::_onAllMarginalTargetsErased(), gum::ShaferShenoyInference< GUM_SCALAR >::_onAllTargetsErased(), gum::ShaferShenoyInference< GUM_SCALAR >::_onBayesNetChanged(), gum::ShaferShenoyInference< GUM_SCALAR >::_onEvidenceAdded(), gum::ShaferShenoyInference< GUM_SCALAR >::_onEvidenceChanged(), gum::ShaferShenoyInference< GUM_SCALAR >::_onEvidenceErased(), gum::ShaferShenoyInference< GUM_SCALAR >::_onJointTargetAdded(), gum::ShaferShenoyInference< GUM_SCALAR >::_onJointTargetErased(), gum::ShaferShenoyInference< GUM_SCALAR >::_onMarginalTargetAdded(), gum::ShaferShenoyInference< GUM_SCALAR >::_onMarginalTargetErased(), gum::ShaferShenoyInference< GUM_SCALAR >::_posterior(), gum::ShaferShenoyInference< GUM_SCALAR >::_unnormalizedJointPosterior(), gum::ShaferShenoyInference< GUM_SCALAR >::_updateOutdatedBNPotentials(), and gum::ShaferShenoyInference< GUM_SCALAR >::_updateOutdatedBNStructure().
|
finalprotectedvirtual |
returns the posterior of a given variable
id | The variable's id. |
Implements gum::MarginalTargetedInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
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().
|
finalprotectedvirtual |
returns a fresh potential equal to P(argument,evidence)
Implements gum::JointTargetedInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
finalprotectedvirtual |
returns a fresh potential equal to P(argument,evidence)
Implements gum::JointTargetedInference< GUM_SCALAR >.
|
finalprotectedvirtual |
prepares inference when the latter is in OutdatedBNPotentials state
Note that the values of evidence are not necessarily known and can be changed between _updateOutdatedBNStructure and _makeInference.
Implements gum::BayesNetInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
finalprotectedvirtual |
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.
Implements gum::BayesNetInference< GUM_SCALAR >.
Referenced by gum::ShaferShenoyInference< GUM_SCALAR >::_onStateChanged().
|
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 |
Add a set of nodes as a new joint target. As a collateral effect, every node is added as a marginal target.
UndefinedElement | if some node(s) do not belong to the Bayes net |
Definition at line 118 of file jointTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, gum::JointTargetedInference< GUM_SCALAR >::__joint_targets, gum::BayesNetInference< GUM_SCALAR >::__setState(), gum::JointTargetedInference< GUM_SCALAR >::_onJointTargetAdded(), gum::MarginalTargetedInference< GUM_SCALAR >::_setTargetedMode(), gum::JointTargetedInference< GUM_SCALAR >::eraseJointTarget(), and GUM_ERROR.
Referenced by gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), and gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation().
|
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().
|
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.
|
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().
|
finalvirtualinherited |
Clear all previously defined joint targets.
Definition at line 97 of file jointTargetedInference_tpl.h.
References gum::JointTargetedInference< GUM_SCALAR >::__joint_targets, gum::BayesNetInference< GUM_SCALAR >::__setState(), and gum::JointTargetedInference< GUM_SCALAR >::_onAllJointTargetsErased().
Referenced by gum::JointTargetedInference< GUM_SCALAR >::eraseAllTargets().
|
finalvirtualinherited |
Clear all the previously defined marginal targets.
Definition at line 90 of file jointTargetedInference_tpl.h.
References gum::MarginalTargetedInference< GUM_SCALAR >::eraseAllTargets().
Referenced by gum::JointTargetedInference< GUM_SCALAR >::eraseAllTargets().
|
virtualinherited |
Clear all previously defined targets (marginal and joint targets)
Clear all previously defined targets. As a result, no posterior can be computed (since we can only compute the posteriors of the marginal or joint targets that have been added by the user).
Reimplemented from gum::MarginalTargetedInference< GUM_SCALAR >.
Definition at line 110 of file jointTargetedInference_tpl.h.
References gum::JointTargetedInference< GUM_SCALAR >::eraseAllJointTargets(), and gum::JointTargetedInference< GUM_SCALAR >::eraseAllMarginalTargets().
Referenced by gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), and gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation().
|
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 joint target
Definition at line 161 of file jointTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, gum::JointTargetedInference< GUM_SCALAR >::__joint_targets, gum::BayesNetInference< GUM_SCALAR >::__setState(), gum::JointTargetedInference< GUM_SCALAR >::_onJointTargetErased(), and GUM_ERROR.
Referenced by gum::JointTargetedInference< GUM_SCALAR >::addJointTarget().
|
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().
|
inherited |
Create a gum::Potential for P(joint targets|evs) (for all instanciation of targets and evs)
targets | the NodeSet of the targeted variables |
evs | the NodeSet of observed variables |
Definition at line 331 of file jointTargetedInference_tpl.h.
References gum::MultiDimDecorator< GUM_SCALAR >::add(), gum::Instantiation::add(), gum::BayesNetInference< GUM_SCALAR >::addEvidence(), gum::JointTargetedInference< GUM_SCALAR >::addJointTarget(), gum::BayesNetInference< GUM_SCALAR >::BN(), gum::BayesNetInference< GUM_SCALAR >::chgEvidence(), gum::Instantiation::end(), gum::BayesNetInference< GUM_SCALAR >::eraseAllEvidence(), gum::JointTargetedInference< GUM_SCALAR >::eraseAllTargets(), GUM_ERROR, gum::Instantiation::incIn(), gum::Instantiation::incOut(), gum::JointTargetedInference< GUM_SCALAR >::jointPosterior(), gum::BayesNetInference< GUM_SCALAR >::makeInference(), gum::MultiDimDecorator< GUM_SCALAR >::set(), gum::Instantiation::setFirstIn(), gum::Instantiation::setFirstOut(), and gum::Instantiation::val().
Referenced by gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact().
|
inherited |
Create a gum::Potential for P(joint targets|evs) (for all instanciation of targets and evs)
targets | the vector of std::string of the targeted variables |
evs | the vector of std::string of observed variables |
Definition at line 374 of file jointTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), and gum::Set< Key, Alloc >::insert().
|
virtual |
returns the probability of evidence
Implements gum::EvidenceInference< GUM_SCALAR >.
|
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().
|
inherited |
Mutual information between X and Y.
OperationNotAllowed | in these cases |
Definition at line 273 of file jointTargetedInference_tpl.h.
References gum::JointTargetedInference< GUM_SCALAR >::_unnormalizedJointPosterior(), gum::BayesNetInference< GUM_SCALAR >::BN(), gum::Instantiation::end(), GUM_ERROR, gum::Potential< GUM_SCALAR >::margSumOut(), gum::Potential< GUM_SCALAR >::normalize(), and gum::Instantiation::setFirst().
Referenced by gum::JointTargetedInference< GUM_SCALAR >::VI().
|
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().
|
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 target is a joint target.
Definition at line 70 of file jointTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::__bn, gum::JointTargetedInference< GUM_SCALAR >::__joint_targets, and GUM_ERROR.
|
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().
|
inherited |
Mutual information between targets.
targets | the NodeSet of the targeted variables |
Definition at line 394 of file jointTargetedInference_tpl.h.
References gum::Instantiation::add(), gum::JointTargetedInference< GUM_SCALAR >::addJointTarget(), gum::BayesNetInference< GUM_SCALAR >::BN(), gum::Set< Key, Alloc >::clear(), gum::Instantiation::end(), gum::BayesNetInference< GUM_SCALAR >::eraseAllEvidence(), gum::JointTargetedInference< GUM_SCALAR >::eraseAllTargets(), GUM_ERROR, gum::Instantiation::inc(), gum::Set< Key, Alloc >::insert(), gum::JointTargetedInference< GUM_SCALAR >::jointPosterior(), gum::BayesNetInference< GUM_SCALAR >::makeInference(), gum::Instantiation::nbrDim(), gum::Instantiation::setFirst(), gum::Set< Key, Alloc >::size(), gum::Instantiation::val(), and gum::Instantiation::variable().
Referenced by gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation().
|
inherited |
Mutual information between targets.
targets | the vector of std::string of the targeted variables |
Definition at line 446 of file jointTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), gum::Set< Key, Alloc >::insert(), and gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation().
|
finalvirtualinherited |
Compute the joint posterior of a set of nodes.
nodes | the set of nodes whose posterior joint probability is wanted |
UndefinedElement | if nodes is not in the targets |
Definition at line 212 of file jointTargetedInference_tpl.h.
References gum::JointTargetedInference< GUM_SCALAR >::__joint_targets, gum::JointTargetedInference< GUM_SCALAR >::_jointPosterior(), GUM_ERROR, gum::BayesNetInference< GUM_SCALAR >::isDone(), gum::Set< Key, Alloc >::isSubsetOf(), and gum::BayesNetInference< GUM_SCALAR >::makeInference().
Referenced by gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation(), and gum::JointTargetedInference< GUM_SCALAR >::posterior().
const JoinTree* gum::ShaferShenoyInference< GUM_SCALAR >::joinTree | ( | ) |
returns the current join tree used
Lazy Propagation does not use a junction tree but a binary join tree because this may enable faster inferences. So do not be surprised to see that somes cliques are contained into others in this tree.
|
finalvirtualnoexceptinherited |
returns the list of joint targets
returns the list of target sets
Definition at line 193 of file jointTargetedInference_tpl.h.
References gum::JointTargetedInference< GUM_SCALAR >::__joint_targets.
const JunctionTree* gum::ShaferShenoyInference< GUM_SCALAR >::junctionTree | ( | ) |
returns the current junction tree
Lazy Propagation does not use a junction tree but a binary join tree because this may enable faster inferences. This method return the junction tree, before optimizations
|
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().
|
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().
|
finalvirtualnoexceptinherited |
returns the number of joint targets
returns the number of target sets
Definition at line 199 of file jointTargetedInference_tpl.h.
References gum::JointTargetedInference< GUM_SCALAR >::__joint_targets.
|
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().
|
private |
avoid copy operators
|
finalvirtualinherited |
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 from gum::MarginalTargetedInference< GUM_SCALAR >.
Definition at line 247 of file jointTargetedInference_tpl.h.
References gum::MarginalTargetedInference< GUM_SCALAR >::isTarget(), gum::JointTargetedInference< GUM_SCALAR >::jointPosterior(), and gum::MarginalTargetedInference< GUM_SCALAR >::posterior().
Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::disturbBN(), and gum::JointTargetedInference< GUM_SCALAR >::posterior().
|
finalvirtualinherited |
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 from gum::MarginalTargetedInference< GUM_SCALAR >.
Definition at line 257 of file jointTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and gum::JointTargetedInference< 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().
|
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.
void gum::ShaferShenoyInference< GUM_SCALAR >::setFindBarrenNodesType | ( | FindBarrenNodesType | type | ) |
sets how we determine barren nodes
Barren nodes are unnecessary for probability inference, so they can be safely discarded in this case (type = FIND_BARREN_NODES). This speeds-up inference. However, there are some cases in which we do not want to remove barren nodes, typically when we want to answer queries such as Most Probable Explanations (MPE).
void gum::ShaferShenoyInference< GUM_SCALAR >::setTriangulation | ( | const Triangulation & | new_triangulation | ) |
use a new triangulation algorithm
|
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().
|
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().
|
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 |
Variation of information between X and Y.
OperationNotAllowed | in these cases |
OperationNotAllowed | in these cases |
Definition at line 324 of file jointTargetedInference_tpl.h.
References gum::MarginalTargetedInference< GUM_SCALAR >::H(), and gum::JointTargetedInference< GUM_SCALAR >::I().
|
private |
for comparisons with 1 - epsilon
Definition at line 360 of file ShaferShenoyInference.h.
|
private |
the type of barren nodes computation we wish
Definition at line 228 of file ShaferShenoyInference.h.
|
private |
the list of all potentials stored in the cliques
This structure contains a list for each clique in the join tree. If a clique did not received any potential, then its list is empty but the entry for the clique does exist. Note that clique potentials contain also soft evidence and the CPTs that were projected to remove their variables that received hard evidence. The product of all these potentials is precisely the potential stored into __clique_ss_potential
Definition at line 290 of file ShaferShenoyInference.h.
|
private |
the potentials stored into the cliques by Shafer-Shenoy
For a given clique, there is an entry in __clique_ss_potential if and only if the clique received some potential(s). In this case, the potential stored is the combination of all the corresponding list of potentials in __clique_potentials.
Definition at line 297 of file ShaferShenoyInference.h.
|
inlineprivate |
the operator for performing the combinations
Definition at line 236 of file ShaferShenoyInference.h.
|
private |
the constants resulting from the projections of CPTs defined over only hard evidence nodes remove this constant and insert the notion of a constant into potentials/multidim arrays
Definition at line 324 of file ShaferShenoyInference.h.
|
private |
the set of potentials created for the last inference messages
This structure contains only the arcs on which potentials have been created.
Definition at line 310 of file ShaferShenoyInference.h.
|
private |
indicates which nodes of the BN have evidence that changed since the last inference
Definition at line 357 of file ShaferShenoyInference.h.
|
private |
the undigraph extracted from the BN and used to construct the join tree
If all nodes are targets, this graph corresponds to the moral graph of the BN. Otherwise, it may be a subgraph of this moral graph. For instance if the BN is A->B->C and only B is a target, __graph will be equal to A-B if we exploit barren nodes (C is a barren node and, therefore, can be removed for inference).
Definition at line 253 of file ShaferShenoyInference.h.
|
private |
the hard evidence nodes which were projected in CPTs
Definition at line 350 of file ShaferShenoyInference.h.
|
private |
the CPTs that were projected due to hard evidence nodes
For each node whose CPT is defined over some nodes that contain some hard evidence, assigns a new projected CPT that does not contain these nodes anymore.
Definition at line 347 of file ShaferShenoyInference.h.
|
private |
indicates whether a new join tree is needed for the next inference
when modifying the set of hard evidence, we can determine that the current JT is no more appropriate for inference. This variable enables us to keep track of this.
Definition at line 265 of file ShaferShenoyInference.h.
|
private |
the set of set target posteriors computed during the last inference
the posteriors are owned by ShaferShenoyInference.
Definition at line 318 of file ShaferShenoyInference.h.
|
private |
for each set target, assign a clique in the JT that contains it
Definition at line 280 of file ShaferShenoyInference.h.
|
private |
the join (or junction) tree used to answer the last inference query
Definition at line 256 of file ShaferShenoyInference.h.
|
private |
the junction tree to answer the last inference query
Definition at line 259 of file ShaferShenoyInference.h.
|
private |
indicates whether a message (from one clique to another) has been computed
Here, all the messages, computed or not, are put into the property, only the Boolean makes the difference between messages computed and those that were not computed
Definition at line 331 of file ShaferShenoyInference.h.
|
private |
for each node of __graph (~ in the Bayes net), associate an ID in the JT
Definition at line 277 of file ShaferShenoyInference.h.
|
private |
the soft evidence stored in the cliques per their assigned node in the BN
This variable is useful for method _updateOutdatedBNPotentials: it enables to know which soft evidence should be removed/added into the cliques of the join tree.
Definition at line 340 of file ShaferShenoyInference.h.
|
inlineprivate |
the operator for performing the projections
Definition at line 231 of file ShaferShenoyInference.h.
|
private |
a clique node used as a root in each connected component of __JT
For usual probabilistic inference, roots is useless. This is useful when computing the probability of evidence. In this case, we need to compute this probability in every connected component and multiply them to get the overall probability of evidence.
Definition at line 274 of file ShaferShenoyInference.h.
|
private |
the list of all potentials stored in the separators after inferences
This structure contains all the arcs of the join tree (edges in both directions) whether the arc received any potential or not.
Definition at line 302 of file ShaferShenoyInference.h.
|
private |
the set of single posteriors computed during the last inference
the posteriors are owned by ShaferShenoyInference.
Definition at line 314 of file ShaferShenoyInference.h.
|
private |
the triangulation class creating the junction tree used for inference
Definition at line 238 of file ShaferShenoyInference.h.
|
private |
indicates whether we should transform junction trees into binary join trees
Definition at line 245 of file ShaferShenoyInference.h.