![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
<agrum/MN/inference/jointTargetedMNInference.h> More...
#include <jointTargetedMNInference.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 | |
JointTargetedMNInference (const IMarkovNet< GUM_SCALAR > *mn) | |
default constructor More... | |
virtual | ~JointTargetedMNInference () |
destructor 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 | I (const std::string &X, const std::string &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 | VI (const std::string &X, const std::string &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 | setMN (const IMarkovNet< GUM_SCALAR > *mn) |
assigns a new MN to the inference engine More... | |
virtual const IMarkovNet< GUM_SCALAR > & | MN () const final |
Returns a constant reference over the IMarkovNet referenced by this class. More... | |
Accessors / Modifiers | |
virtual const GraphicalModel & | model () 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 model More... | |
virtual bool | isInferenceReady () const noexcept final |
returns whether the inference object is in a ready state More... | |
virtual bool | isInferenceOutdatedStructure () const noexcept final |
returns whether the inference object is in a OutdatedStructure state More... | |
virtual bool | isInferenceOutdatedPotentials () const noexcept final |
returns whether the inference object is in a OutdatedPotential state More... | |
virtual bool | isInferenceDone () const noexcept final |
returns whether the inference object is in a InferenceDone 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::OutdatedStructure, StateOfInference::OutdatedPotentials, StateOfInference::ReadyForInference, StateOfInference::Done } |
current state of the inference More... | |
Protected Member Functions | |
virtual bool | isExactJointComputable_ (const NodeSet &vars) |
check if the vars form a possible computable joint (can be redefined by subclass) More... | |
virtual NodeSet | superForJointComputable_ (const NodeSet &vars) |
virtual void | onModelChanged_ (const GraphicalModel *mn) |
fired after a new Markov net has been assigned to the engine More... | |
virtual void | onJointTargetAdded_ (const NodeSet &set)=0 |
fired after a new joint target is inserted More... | |
virtual void | onJointTargetErased_ (const NodeSet &set)=0 |
fired before a joint target is removed More... | |
virtual void | onAllTargetsErased_ ()=0 |
fired before a all the marginal and joint targets are removed More... | |
virtual void | onAllJointTargetsErased_ ()=0 |
fired before a all the joint targets are removed More... | |
virtual const Potential< GUM_SCALAR > & | jointPosterior_ (const NodeSet &set)=0 |
asks derived classes for the joint posterior of a declared target set More... | |
virtual const Potential< GUM_SCALAR > & | jointPosterior_ (const NodeSet &wanted_target, const NodeSet &declared_target)=0 |
asks derived classes for the joint posterior of a set of variables not declared as a joint target More... | |
virtual Potential< GUM_SCALAR > * | unnormalizedJointPosterior_ (const NodeSet &set)=0 |
returns a fresh unnormalized joint posterior of a given set of variables More... | |
virtual Potential< GUM_SCALAR > * | unnormalizedJointPosterior_ (NodeId id)=0 |
returns a fresh potential equal to P(argument,evidence) More... | |
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 MN are added as marginal targets More... | |
virtual void | onAllMarginalTargetsErased_ ()=0 |
fired before a all marginal targets are removed 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 | updateOutdatedStructure_ ()=0 |
prepares inference when the latter is in OutdatedStructure state More... | |
virtual void | updateOutdatedPotentials_ ()=0 |
prepares inference when the latter is in OutdatedPotentials state More... | |
virtual void | makeInference_ ()=0 |
called when the inference has to be performed effectively More... | |
void | setOutdatedStructureState_ () |
put the inference into an outdated model structure state More... | |
void | setOutdatedPotentialsState_ () |
puts the inference into an OutdatedPotentials state if it is not already in an OutdatedStructure state More... | |
virtual void | setState_ (const StateOfInference state) final |
set the state of the inference engine and call the notification onStateChanged_ when necessary (i.e. when the state has effectively changed). More... | |
void | setModel_ (const GraphicalModel *model) |
void | setModelDuringConstruction_ (const GraphicalModel *model) |
assigns a model during the inference engine construction More... | |
bool | hasNoModel_ () const |
<agrum/MN/inference/jointTargetedMNInference.h>
A generic class for the computation of (possibly incrementally) joint posteriors
The goal of this class is to take care of the joint targets used for computing joint posteriors. The JointTargetedMNInference class inherits from Inference that takes care of handling both evidence and the current state of the inference and from MarginalTargetedMNInference for the handling of marginal targets. Note that the JointTargetedMNInference is designed to be used in incremental inference engines.
Definition at line 56 of file jointTargetedMNInference.h.
|
stronginherited |
current state of the inference
graphicalModelInference can be in one of 4 different states:
Enumerator | |
---|---|
OutdatedStructure | |
OutdatedPotentials | |
ReadyForInference | |
Done |
Definition at line 106 of file graphicalModelInference.h.
|
explicit |
default constructor
Definition at line 35 of file jointTargetedMNInference_tpl.h.
|
virtual |
destructor
Definition at line 48 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
adds all nodes as targets
Definition at line 131 of file marginalTargetedMNInference_tpl.h.
|
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 228 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 234 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 241 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 248 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 256 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 280 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 325 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 287 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
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 Markov net |
Definition at line 114 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 333 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 342 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
Add a marginal target to the list of targets.
UndefinedElement | if target is not a NodeId in the Markov net |
Definition at line 108 of file marginalTargetedMNInference_tpl.h.
|
finalvirtualinherited |
Add a marginal target to the list of targets.
UndefinedElement | if target is not a NodeId in the Markov net |
Definition at line 152 of file marginalTargetedMNInference_tpl.h.
|
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 402 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 408 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 415 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 422 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 431 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 456 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 464 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
clears all the data structures allocated for the last inference
Reimplemented in gum::ShaferShenoyLIMIDInference< GUM_SCALAR >.
Definition at line 139 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
get the domain sizes of the random variables of the model
Definition at line 159 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
removes all the evidence entered into the network
Definition at line 553 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
Clear all previously defined joint targets.
Definition at line 94 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
Clear all the previously defined marginal targets.
Definition at line 87 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
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::MarginalTargetedMNInference< GUM_SCALAR >.
Definition at line 106 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
removed the evidence, if any, corresponding to node id
Definition at line 527 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
removed the evidence, if any, corresponding to node of name nodeName
Definition at line 546 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
removes an existing joint target
Definition at line 152 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
removes an existing (marginal) target
Definition at line 165 of file marginalTargetedMNInference_tpl.h.
|
finalvirtualinherited |
removes an existing (marginal) target
Definition at line 189 of file marginalTargetedMNInference_tpl.h.
|
inherited |
returns the set of evidence
Definition at line 605 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Create a gum::Potential for P(target|evs) (for all instanciation of target and evs)
mn | the MarkovNet |
target | the nodeId of the targetted variable |
evs | the vector of nodeId of the observed variables |
Definition at line 269 of file marginalTargetedMNInference_tpl.h.
|
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 307 of file marginalTargetedMNInference_tpl.h.
Potential< GUM_SCALAR > gum::JointTargetedMNInference< 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)
targets | the NodeSet of the targeted variables |
evs | the NodeSet of observed variables |
Definition at line 319 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
Potential< GUM_SCALAR > gum::JointTargetedMNInference< 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)
targets | the vector of std::string of the targeted variables |
evs | the vector of std::string of observed variables |
Definition at line 360 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
Entropy Compute Shanon's entropy of a node given the observation.
Definition at line 254 of file marginalTargetedMNInference_tpl.h.
|
finalvirtualinherited |
Entropy Compute Shanon's entropy of a node given the observation.
Definition at line 262 of file marginalTargetedMNInference_tpl.h.
|
inherited |
indicate for each node with hard evidence which value it took
Definition at line 597 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
returns the set of nodes with hard evidence
the set of nodes that received hard evidence
Definition at line 619 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
indicates whether some node(s) have received evidence
Definition at line 351 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
indicates whether node id has received an evidence
Definition at line 358 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
indicates whether node id has received an evidence
Definition at line 380 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
indicates whether node id has received a hard evidence
Definition at line 365 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
indicates whether node id has received a hard evidence
Definition at line 388 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inlineprotectedinherited |
Definition at line 527 of file graphicalModelInference.h.
|
finalvirtualinherited |
indicates whether node id has received a soft evidence
Definition at line 372 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
indicates whether node id has received a soft evidence
Definition at line 396 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
GUM_SCALAR gum::JointTargetedMNInference< GUM_SCALAR >::I | ( | NodeId | X, |
NodeId | Y | ||
) |
Mutual information between X and Y.
OperationNotAllowed | in these cases |
Definition at line 263 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
GUM_SCALAR gum::JointTargetedMNInference< GUM_SCALAR >::I | ( | const std::string & | X, |
const std::string & | Y | ||
) |
Mutual information between X and Y.
OperationNotAllowed | in these cases |
Definition at line 244 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtual |
check if the vars form a possible computable joint (can be redefined by subclass)
Reimplemented in gum::ShaferShenoyMNInference< GUM_SCALAR >.
Definition at line 426 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a InferenceDone state
The inference object is in a done state when the posteriors can be retrieved without performing a new inference, i.e., all the heavy computations have already been performed. Typically, in a junction tree algorithm, this corresponds to a situation in which all the messages needed in the JT have been computed and sent.
Definition at line 84 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a OutdatedPotential state
Definition at line 79 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a OutdatedStructure state
Definition at line 73 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a ready state
Definition at line 68 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
return true if target is a joint target.
Definition at line 68 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
return true if variable is a (marginal) target
Definition at line 73 of file marginalTargetedMNInference_tpl.h.
|
finalvirtualinherited |
return true if variable is a (marginal) target
Definition at line 89 of file marginalTargetedMNInference_tpl.h.
|
protectedinherited |
Definition at line 316 of file marginalTargetedMNInference_tpl.h.
GUM_SCALAR gum::JointTargetedMNInference< GUM_SCALAR >::jointMutualInformation | ( | const NodeSet & | targets | ) |
Mutual information between targets.
targets | the NodeSet of the targeted variables |
Definition at line 370 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
GUM_SCALAR gum::JointTargetedMNInference< GUM_SCALAR >::jointMutualInformation | ( | const std::vector< std::string > & | targets | ) |
Mutual information between targets.
targets | the vector of std::string of the targeted variables |
Definition at line 420 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
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 199 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedpure virtual |
asks derived classes for the joint posterior of a declared target set
set | The set of ids of the variables whose joint posterior is looked for. |
Implemented in gum::ShaferShenoyMNInference< GUM_SCALAR >.
|
protectedpure virtual |
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 |
Implemented in gum::ShaferShenoyMNInference< GUM_SCALAR >.
|
finalvirtualnoexcept |
returns the list of joint targets
returns the list of target sets
Definition at line 181 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 664 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 >, gum::ShaferShenoyMNInference< GUM_SCALAR >, gum::ShaferShenoyLIMIDInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
|
finalvirtualinherited |
Returns a constant reference over the IMarkovNet referenced by this class.
UndefinedElement | is raised if no Markov net has been assigned to the inference. |
Definition at line 57 of file MarkovNetInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 107 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
returns the number of evidence entered into the Bayesian network
Definition at line 576 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
returns the number of hard evidence entered into the Bayesian network
Definition at line 583 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualnoexcept |
returns the number of joint targets
returns the number of target sets
Definition at line 187 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualinherited |
returns the number of soft evidence entered into the Bayesian network
Definition at line 590 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualnoexceptinherited |
returns the number of marginal targets
Definition at line 208 of file marginalTargetedMNInference_tpl.h.
|
protectedpure virtualinherited |
fired before all the evidence are erased
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::ShaferShenoyLIMIDInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, gum::ShaferShenoyMNInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
|
protectedpure virtual |
fired before a all the joint targets are removed
Implemented in gum::ShaferShenoyMNInference< GUM_SCALAR >.
|
protectedpure virtualinherited |
fired after all the nodes of the MN are added as marginal targets
Implemented in gum::ShaferShenoyMNInference< GUM_SCALAR >.
|
protectedpure virtualinherited |
fired before a all marginal targets are removed
Implemented in gum::ShaferShenoyMNInference< GUM_SCALAR >.
|
protectedpure virtual |
fired before a all the marginal and joint targets are removed
Implemented in gum::ShaferShenoyMNInference< GUM_SCALAR >.
|
protectedpure virtualinherited |
fired after a new evidence is inserted
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::ShaferShenoyLIMIDInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, gum::ShaferShenoyMNInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
|
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::ShaferShenoyLIMIDInference< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, gum::ShaferShenoyMNInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
|
protectedpure virtualinherited |
fired before an evidence is removed
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::ShaferShenoyLIMIDInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, gum::ShaferShenoyMNInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
|
protectedpure virtual |
fired after a new joint target is inserted
set | The set of target variable's ids. |
Implemented in gum::ShaferShenoyMNInference< GUM_SCALAR >.
|
protectedpure virtual |
fired before a joint target is removed
set | The set of target variable's ids. |
Implemented in gum::ShaferShenoyMNInference< GUM_SCALAR >.
|
protectedpure virtualinherited |
fired after a new marginal target is inserted
id | The target variable's id. |
Implemented in gum::ShaferShenoyMNInference< GUM_SCALAR >.
|
protectedpure virtualinherited |
fired before a marginal target is removed
id | The target variable's id. |
Implemented in gum::ShaferShenoyMNInference< GUM_SCALAR >.
|
protectedvirtual |
fired after a new Markov net has been assigned to the engine
Reimplemented from gum::MarginalTargetedMNInference< GUM_SCALAR >.
Definition at line 55 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedpure virtualinherited |
fired when the stage is changed
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::ShaferShenoyLIMIDInference< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, gum::ShaferShenoyMNInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
|
finalvirtual |
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::MarginalTargetedMNInference< GUM_SCALAR >.
Definition at line 226 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
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::MarginalTargetedMNInference< GUM_SCALAR >.
Definition at line 236 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedpure virtualinherited |
asks derived classes for the posterior of a given variable
id | The variable's id. |
Implemented in gum::ShaferShenoyMNInference< GUM_SCALAR >.
|
finalvirtualinherited |
prepare the internal inference structures for the next inference
Definition at line 645 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
assigns a new MN to the inference engine
Assigns a new MN to the MarkovNetInference engine and sends messages to the descendants of MarkovNetInference to inform them that the MN has changed.
Definition at line 64 of file MarkovNetInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedinherited |
Definition at line 118 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedinherited |
assigns a model during the inference engine construction
Definition at line 129 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedinherited |
puts the inference into an OutdatedPotentials state if it is not already in an OutdatedStructure state
OutdatedPotentials: in this state, the structure of the model 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 638 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedinherited |
put the inference into an outdated model structure state
OutdatedStructure: in this state, the inference is fully unprepared to be applied because some events changed the "logical" structure of the model: for instance a node received a hard evidence, which implies that its outgoing arcs can be removed from the model, hence involving a structural change in the model. As a consequence, the (incremental) inference (probably) needs a significant amount of preparation to be ready for the next inference. In a Lazy propagation, for instance, this step amounts to compute a new join tree, hence a new structure in which inference will be applied. Note that classes that inherit from graphicalModelInference may be smarter than graphicalModelInference and may, in some situations, find out that their data structures are still ok for inference and, therefore, only resort to perform the actions related to the OutdatedPotentials 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 630 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalprotectedvirtualinherited |
set the state of the inference engine and call the notification onStateChanged_ when necessary (i.e. when the state has effectively changed).
Definition at line 98 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedinherited |
Definition at line 320 of file marginalTargetedMNInference_tpl.h.
|
inherited |
returns the set of nodes with soft evidence
the set of nodes that received soft evidence
Definition at line 612 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualnoexceptinherited |
returns the state of the inference engine
Definition at line 92 of file graphicalModelInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtual |
Reimplemented in gum::ShaferShenoyMNInference< GUM_SCALAR >.
Definition at line 433 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtualnoexceptinherited |
returns the list of marginal targets
Definition at line 202 of file marginalTargetedMNInference_tpl.h.
|
protectedpure virtual |
returns a fresh unnormalized joint posterior of a given set of variables
set | The set of ids of the variables whose joint posterior is looked for. |
Implemented in gum::ShaferShenoyMNInference< GUM_SCALAR >.
|
protectedpure virtual |
returns a fresh potential equal to P(argument,evidence)
Implemented in gum::ShaferShenoyMNInference< GUM_SCALAR >.
|
protectedpure virtualinherited |
prepares inference when the latter is in OutdatedPotentials state
Note that the values of evidence are not necessarily known and can be changed between updateOutdatedPotentials_ and makeInference_.
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, gum::ShaferShenoyMNInference< GUM_SCALAR >, gum::ShaferShenoyLIMIDInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
|
protectedpure virtualinherited |
prepares inference when the latter is in OutdatedStructure state
Note that the values of evidence are not necessarily known and can be changed between updateOutdatedStructure_ and makeInference_.
Implemented in gum::SamplingInference< GUM_SCALAR >, gum::LazyPropagation< GUM_SCALAR >, gum::VariableElimination< GUM_SCALAR >, gum::ShaferShenoyInference< GUM_SCALAR >, gum::ShaferShenoyMNInference< GUM_SCALAR >, gum::ShaferShenoyLIMIDInference< GUM_SCALAR >, and gum::LoopyBeliefPropagation< GUM_SCALAR >.
INLINE GUM_SCALAR gum::JointTargetedMNInference< GUM_SCALAR >::VI | ( | NodeId | X, |
NodeId | Y | ||
) |
Variation of information between X and Y.
OperationNotAllowed | in these cases |
OperationNotAllowed | in these cases |
Definition at line 312 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
GUM_SCALAR gum::JointTargetedMNInference< GUM_SCALAR >::VI | ( | const std::string & | X, |
const std::string & | Y | ||
) |
Variation of information between X and Y.
OperationNotAllowed | in these cases |
Definition at line 250 of file jointTargetedMNInference_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
private |
the set of joint targets
Definition at line 308 of file jointTargetedMNInference.h.