![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
<agrum/MRF/inference/ShaferShenoyMRFInference.h> More...
#include <ShaferShenoyMRFInference.h>
Public Types | |
| enum class | StateOfInference { OutdatedStructure , OutdatedTensors , ReadyForInference , Done } |
| current state of the inference More... | |
Public Member Functions | |
| Tensor< GUM_SCALAR > | evidenceJointImpact (const NodeSet &targets, const NodeSet &evs) |
| Create a gum::Tensor for P(joint targets|evs) (for all instanciation of targets and evs). | |
| Tensor< GUM_SCALAR > | evidenceJointImpact (const std::vector< std::string > &targets, const std::vector< std::string > &evs) |
| Create a gum::Tensor for P(joint targets|evs) (for all instanciation of targets and evs). | |
| Tensor< GUM_SCALAR > | evidenceImpact (NodeId target, const NodeSet &evs) |
| Create a gum::Tensor for P(target|evs) (for all instanciation of target and evs). | |
| Tensor< GUM_SCALAR > | evidenceImpact (const std::string &target, const std::vector< std::string > &evs) |
| Create a gum::Tensor for P(target|evs) (for all instanciation of target and evs). | |
Constructors / Destructors | |
| ShaferShenoyMRFInference (const IMarkovRandomField< GUM_SCALAR > *MN, bool use_binary_join_tree=true) | |
| default constructor | |
| ~ShaferShenoyMRFInference () | |
| destructor | |
Accessors / Modifiers | |
| void | setTriangulation (const Triangulation &new_triangulation) |
| use a new triangulation algorithm | |
| const JoinTree * | joinTree () |
| returns the current join tree used | |
| const JunctionTree * | junctionTree () |
| returns the current junction tree | |
| GUM_SCALAR | evidenceProbability () final |
| returns the probability of evidence | |
Probability computations | |
| virtual const Tensor< GUM_SCALAR > & | jointPosterior (const NodeSet &nodes) final |
| Compute the joint posterior of a set of nodes. | |
| virtual const Tensor< GUM_SCALAR > & | posterior (NodeId node) final |
| Computes and returns the posterior of a node. | |
| virtual const Tensor< GUM_SCALAR > & | posterior (const std::string &nodeName) final |
| Computes and returns the posterior of a node. | |
Targets | |
| virtual void | eraseAllTargets () final |
| Clear all previously defined targets (marginal and joint targets). | |
| virtual void | eraseAllJointTargets () final |
| Clear all previously defined joint targets. | |
| virtual void | eraseAllMarginalTargets () final |
| Clear all the previously defined marginal targets. | |
| 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. | |
| virtual void | eraseJointTarget (const NodeSet &joint_target) final |
| removes an existing joint target | |
| virtual bool | isJointTarget (const NodeSet &vars) const final |
| return true if target is a joint target. | |
| virtual const Set< NodeSet > & | jointTargets () const noexcept final |
| returns the list of joint targets | |
| virtual Size | nbrJointTargets () const noexcept final |
| returns the number of joint targets | |
Information Theory related functions | |
| GUM_SCALAR | jointMutualInformation (const NodeSet &targets) |
| Mutual information between targets. | |
| GUM_SCALAR | jointMutualInformation (const std::vector< std::string > &targets) |
| Mutual information between targets. | |
Targets | |
| virtual void | addAllTargets () final |
| adds all nodes as targets | |
| virtual void | addTarget (NodeId target) final |
| Add a marginal target to the list of targets. | |
| virtual void | addTarget (const std::string &nodeName) final |
| Add a marginal target to the list of targets. | |
| virtual void | eraseTarget (NodeId target) final |
| removes an existing (marginal) target | |
| virtual void | eraseTarget (const std::string &nodeName) final |
| removes an existing (marginal) target | |
| virtual bool | isTarget (NodeId node) const final |
| return true if variable is a (marginal) target | |
| virtual bool | isTarget (const std::string &nodeName) const final |
| return true if variable is a (marginal) target | |
| virtual Size | nbrTargets () const noexcept final |
| returns the number of marginal targets | |
| virtual const NodeSet & | targets () const noexcept final |
| returns the list of marginal targets | |
Information Theory related functions | |
| virtual GUM_SCALAR | H (NodeId X) final |
| Entropy Compute Shanon's entropy of a node given the observation. | |
| virtual GUM_SCALAR | H (const std::string &nodeName) final |
| Entropy Compute Shanon's entropy of a node given the observation. | |
Accessors / Modifiers | |
| virtual void | setMRF (const IMarkovRandomField< GUM_SCALAR > *mrf) |
| assigns a new MRF to the inference engine | |
| virtual const IMarkovRandomField< GUM_SCALAR > & | MRF () const final |
| Returns a constant reference over the IMarkovRandomField referenced by this class. | |
Accessors / Modifiers | |
| virtual const GraphicalModel & | model () const final |
| Returns a constant reference over the IBayesNet referenced by this class. | |
| virtual const NodeProperty< Size > & | domainSizes () const final |
| get the domain sizes of the random variables of the model | |
| virtual bool | isInferenceReady () const noexcept final |
| returns whether the inference object is in a ready state | |
| virtual bool | isInferenceOutdatedStructure () const noexcept final |
| returns whether the inference object is in a OutdatedStructure state | |
| virtual bool | isInferenceOutdatedTensors () const noexcept final |
| returns whether the inference object is in a OutdatedTensor state | |
| virtual bool | isInferenceDone () const noexcept final |
| returns whether the inference object is in a InferenceDone state | |
| virtual void | prepareInference () final |
| prepare the internal inference structures for the next inference | |
| virtual void | makeInference () final |
| perform the heavy computations needed to compute the targets' posteriors | |
| virtual void | clear () |
| clears all the data structures allocated for the last inference | |
| virtual StateOfInference | state () const noexcept final |
| returns the state of the inference engine | |
Evidence | |
| virtual void | addEvidence (NodeId id, const Idx val) final |
| adds a new hard evidence on node id | |
| virtual void | addEvidence (const std::string &nodeName, const Idx val) final |
| adds a new hard evidence on node named nodeName | |
| virtual void | addEvidence (NodeId id, const std::string &label) final |
| adds a new hard evidence on node id | |
| virtual void | addEvidence (const std::string &nodeName, const std::string &label) final |
| adds a new hard evidence on node named nodeName | |
| virtual void | addEvidence (NodeId id, const std::vector< GUM_SCALAR > &vals) final |
| adds a new evidence on node id (might be soft or hard) | |
| virtual void | addEvidence (const std::string &nodeName, const std::vector< GUM_SCALAR > &vals) final |
| adds a new evidence on node named nodeName (might be soft or hard) | |
| virtual void | addEvidence (const Tensor< GUM_SCALAR > &pot) final |
| adds a new evidence on node id (might be soft or hard) | |
| virtual void | addEvidence (Tensor< GUM_SCALAR > &&pot) final |
| adds a new evidence on node id (might be soft or hard) | |
| virtual void | addSetOfEvidence (const Set< const Tensor< GUM_SCALAR > * > &potset) final |
| adds a new set of evidence | |
| virtual void | addListOfEvidence (const List< const Tensor< GUM_SCALAR > * > &potlist) final |
| adds a new list of evidence | |
| virtual void | chgEvidence (NodeId id, const Idx val) final |
| change the value of an already existing hard evidence | |
| virtual void | chgEvidence (const std::string &nodeName, const Idx val) final |
| change the value of an already existing hard evidence | |
| virtual void | chgEvidence (NodeId id, const std::string &label) final |
| change the value of an already existing hard evidence | |
| virtual void | chgEvidence (const std::string &nodeName, const std::string &label) final |
| change the value of an already existing hard evidence | |
| virtual void | chgEvidence (NodeId id, const std::vector< GUM_SCALAR > &vals) final |
| change the value of an already existing evidence (might be soft or hard) | |
| virtual void | chgEvidence (const std::string &nodeName, const std::vector< GUM_SCALAR > &vals) final |
| change the value of an already existing evidence (might be soft or hard) | |
| virtual void | chgEvidence (const Tensor< GUM_SCALAR > &pot) final |
| change the value of an already existing evidence (might be soft or hard) | |
| virtual void | eraseAllEvidence () final |
| removes all the evidence entered into the network | |
| virtual void | eraseEvidence (NodeId id) final |
| removed the evidence, if any, corresponding to node id | |
| virtual void | eraseEvidence (const std::string &nodeName) final |
| removed the evidence, if any, corresponding to node of name nodeName | |
| virtual bool | hasEvidence () const final |
| indicates whether some node(s) have received evidence | |
| virtual bool | hasEvidence (NodeId id) const final |
| indicates whether node id has received an evidence | |
| virtual bool | hasEvidence (const std::string &nodeName) const final |
| indicates whether node id has received an evidence | |
| virtual bool | hasHardEvidence (NodeId id) const final |
| indicates whether node id has received a hard evidence | |
| virtual bool | hasHardEvidence (const std::string &nodeName) const final |
| indicates whether node id has received a hard evidence | |
| virtual bool | hasSoftEvidence (NodeId id) const final |
| indicates whether node id has received a soft evidence | |
| virtual bool | hasSoftEvidence (const std::string &nodeName) const final |
| indicates whether node id has received a soft evidence | |
| virtual Size | nbrEvidence () const final |
| returns the number of evidence entered into the Bayesian network | |
| virtual Size | nbrHardEvidence () const final |
| returns the number of hard evidence entered into the Bayesian network | |
| virtual Size | nbrSoftEvidence () const final |
| returns the number of soft evidence entered into the Bayesian network | |
| const NodeProperty< const Tensor< GUM_SCALAR > * > & | evidence () const |
| returns the set of evidence | |
| const NodeSet & | softEvidenceNodes () const |
| returns the set of nodes with soft evidence | |
| const NodeSet & | hardEvidenceNodes () const |
| returns the set of nodes with hard evidence | |
| const NodeProperty< Idx > & | hardEvidence () const |
| indicate for each node with hard evidence which value it took | |
Constructors / Destructors | |
| virtual ScheduledInference * | clone () const |
| virtual copy constructor | |
Accessors/Modifiers | |
| Scheduler & | scheduler () const |
| returns the current scheduler | |
| void | setNumberOfThreads (Size nb) final |
| sets the number max of threads that can be used | |
| void | setMaxMemory (double megabytes) |
| sets an upper bound on the memory consumption admissible | |
| virtual double | maxMemory () const |
| returns the Max memory (in megabytes) available for executing schedules | |
Accessors/Modifiers | |
| virtual Size | getNumberOfThreads () const |
| returns the current max number of threads used by the class containing this ThreadNumberManager | |
| bool | isGumNumberOfThreadsOverriden () const |
| indicates whether the class containing this ThreadNumberManager set its own number of threads | |
Protected Member Functions | |
| virtual bool | isExactJointComputable_ (const NodeSet &vars) final |
| check if the vars form a possible computable joint (can be redefined by subclass) | |
| virtual NodeSet | superForJointComputable_ (const NodeSet &vars) final |
| void | onEvidenceAdded_ (const NodeId id, bool isHardEvidence) final |
| fired after a new evidence is inserted | |
| void | onEvidenceErased_ (const NodeId id, bool isHardEvidence) final |
| fired before an evidence is removed | |
| void | onAllEvidenceErased_ (bool has_hard_evidence) final |
| fired before all the evidence are erased | |
| void | onEvidenceChanged_ (const NodeId id, bool hasChangedSoftHard) final |
| fired after an evidence is changed, in particular when its status (soft/hard) changes | |
| void | onMarginalTargetAdded_ (const NodeId id) final |
| fired after a new single target is inserted | |
| void | onMarginalTargetErased_ (const NodeId id) final |
| fired before a single target is removed | |
| void | onModelChanged_ (const GraphicalModel *mn) final |
| fired after a new Markov net has been assigned to the inference engine | |
| virtual void | onMRFChanged_ (const IMarkovRandomField< GUM_SCALAR > *mn) final |
| fired after a new Markov net has been assigned to the inference engine | |
| void | onJointTargetAdded_ (const NodeSet &set) final |
| fired after a new joint target is inserted | |
| void | onJointTargetErased_ (const NodeSet &set) final |
| fired before a joint target is removed | |
| void | onAllMarginalTargetsAdded_ () final |
| fired after all the nodes of the MRF are added as single targets | |
| void | onAllMarginalTargetsErased_ () final |
| fired before all the single targets are removed | |
| void | onAllJointTargetsErased_ () final |
| fired before all the joint targets are removed | |
| void | onAllTargetsErased_ () final |
| fired before all single and joint targets are removed | |
| void | onStateChanged_ () final |
| fired when the state of the inference engine is changed | |
| void | updateOutdatedStructure_ () final |
| prepares inference when the latter is in OutdatedStructure state | |
| void | updateOutdatedTensors_ () final |
| prepares inference when the latter is in OutdatedTensors state | |
| void | makeInference_ () final |
| called when the inference has to be performed effectively | |
| const Tensor< GUM_SCALAR > & | posterior_ (NodeId id) final |
| returns the posterior of a given variable | |
| const Tensor< GUM_SCALAR > & | jointPosterior_ (const NodeSet &set) final |
| returns the posterior of a declared target set | |
| const Tensor< 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 | |
| Tensor< GUM_SCALAR > * | unnormalizedJointPosterior_ (NodeId id) final |
| returns a fresh tensor equal to P(argument,evidence) | |
| Tensor< GUM_SCALAR > * | unnormalizedJointPosterior_ (const NodeSet &set) final |
| returns a fresh tensor equal to P(argument,evidence) | |
| void | setTargetedMode_ () |
| bool | isTargetedMode_ () const |
| void | setOutdatedStructureState_ () |
| put the inference into an outdated model structure state | |
| void | setOutdatedTensorsState_ () |
| puts the inference into an OutdatedTensors state if it is not already in an OutdatedStructure state | |
| virtual void | setState_ (const StateOfInference state) final |
| set the state of the inference engine and call the notification onStateChanged_ when necessary (i.e. when the state has effectively changed). | |
| void | setModel_ (const GraphicalModel *model) |
| void | setModelDuringConstruction_ (const GraphicalModel *model) |
| assigns a model during the inference engine construction | |
| bool | hasNoModel_ () const |
Private Types | |
| enum | EvidenceChangeType { EVIDENCE_ADDED , EVIDENCE_ERASED , EVIDENCE_MODIFIED } |
| the possible types of evidence changes More... | |
| using | _TensorSet_ = Set< const Tensor< GUM_SCALAR >* > |
| using | _ScheduleMultiDimSet_ = Set< const IScheduleMultiDim* > |
| using | _TensorSetIterator_ = SetIteratorSafe< const Tensor< GUM_SCALAR >* > |
Private Member Functions | |
| bool | _isNewJTNeeded_ () const |
| check whether a new join tree is really needed for the next inference | |
| void | _createNewJT_ () |
| create a new junction tree as well as its related data structures | |
| void | _initializeJTCliques_ (Schedule &schedule) |
| put all the CPTs into the cliques when creating the JT using a schedule | |
| void | _initializeJTCliques_ () |
| put all the CPTs into the cliques when creating the JT without using a schedule | |
| void | _setProjectionFunction_ (Tensor< GUM_SCALAR >(*proj)(const Tensor< GUM_SCALAR > &, const gum::VariableSet &)) |
| sets the operator for performing the projections | |
| void | _setCombinationFunction_ (Tensor< GUM_SCALAR >(*comb)(const Tensor< GUM_SCALAR > &, const Tensor< GUM_SCALAR > &)) |
| sets the operator for performing the combinations | |
| void | _diffuseMessageInvalidations_ (NodeId from_id, NodeId to_id, NodeSet &invalidated_cliques) |
| invalidate all the messages sent from a given clique | |
| void | _invalidateAllMessages_ () |
| invalidate all messages, posteriors and created tensors | |
| void | _computeJoinTreeRoots_ () |
| compute a root for each connected component of JT | |
| const IScheduleMultiDim * | _marginalizeOut_ (Schedule &schedule, _ScheduleMultiDimSet_ pot_list, gum::VariableSet &del_vars, gum::VariableSet &kept_vars) |
| removes variables del_vars from a list of tensors and returns the resulting list using schedules | |
| const IScheduleMultiDim * | _marginalizeOut_ (_ScheduleMultiDimSet_ &pot_list, gum::VariableSet &del_vars, gum::VariableSet &kept_vars) |
| removes variables del_vars from a list of tensors and returns the resulting list directly without schedules | |
| void | _produceMessage_ (Schedule &schedule, NodeId from_id, NodeId to_id) |
| creates the message sent by clique from_id to clique to_id using schedules | |
| void | _produceMessage_ (NodeId from_id, NodeId to_id) |
| creates the message sent by clique from_id to clique to_id without schedules | |
| void | _collectMessage_ (Schedule &schedule, NodeId id, NodeId from) |
| perform the collect phase using schedules | |
| void | _collectMessage_ (NodeId id, NodeId from) |
| actually perform the collect phase directly without schedules | |
| Tensor< GUM_SCALAR > * | _unnormalizedJointPosterior_ (Schedule &schedule, NodeId id) |
| computes the unnormalized posterior of a node using schedules | |
| Tensor< GUM_SCALAR > * | _unnormalizedJointPosterior_ (NodeId id) |
| computes the unnormalized posterior of a node without using schedules | |
| Tensor< GUM_SCALAR > * | _unnormalizedJointPosterior_ (Schedule &schedule, const NodeSet &set) |
| returns a fresh tensor equal to P(argument,evidence) using schedules | |
| Tensor< GUM_SCALAR > * | _unnormalizedJointPosterior_ (const NodeSet &set) |
| returns a fresh tensor equal to P(argument,evidence) without using schedules | |
| ShaferShenoyMRFInference (const ShaferShenoyMRFInference< GUM_SCALAR > &)=delete | |
| avoid copy constructors | |
| ShaferShenoyMRFInference< GUM_SCALAR > & | operator= (const ShaferShenoyMRFInference< GUM_SCALAR > &)=delete |
| avoid copy operators | |
| void | _setAllMarginalTargets_ () |
| sets all the nodes of the Markov net as targets | |
Private Attributes | |
| Tensor< GUM_SCALAR >(* | _projection_op_ )(const Tensor< GUM_SCALAR > &, const gum::VariableSet &) |
| the operator for performing the projections | |
| Tensor< GUM_SCALAR >(* | _combination_op_ )(const Tensor< GUM_SCALAR > &, const Tensor< GUM_SCALAR > &) |
| the operator for performing the combinations | |
| Triangulation * | _triangulation_ |
| the triangulation class creating the junction tree used for inference | |
| bool | _use_binary_join_tree_ {true} |
| indicates whether we should transform junction trees into binary join trees | |
| UndiGraph | _graph_ |
| the undigraph extracted from the MRF and used to construct the join tree | |
| JoinTree * | _JT_ {nullptr} |
| the join (or junction) tree used to answer the last inference query | |
| JunctionTree * | _junctionTree_ {nullptr} |
| the junction tree to answer the last inference query | |
| bool | _is_new_jt_needed_ {true} |
| indicates whether a new join tree is needed for the next inference | |
| NodeSet | _roots_ |
| a clique node used as a root in each connected component of JT | |
| NodeProperty< NodeId > | _node_to_clique_ |
| for each node of graph (~ in the Markov net), associate an ID in the JT | |
| HashTable< const Tensor< GUM_SCALAR > *, NodeId > | _factor_to_clique_ |
| assign to each factor in the MRF the clique that will contain it | |
| NodeProperty< _TensorSet_ > | _node_to_factors_ |
| assign to each node the set of factors containing it | |
| HashTable< NodeSet, NodeId > | _joint_target_to_clique_ |
| for each set target, assign a clique in the JT that contains it | |
| NodeProperty< _ScheduleMultiDimSet_ > | _clique_tensors_ |
| the list of all tensors stored in the cliques | |
| NodeProperty< const IScheduleMultiDim * > | _clique_ss_tensor_ |
| the tensors stored into the cliques by Shafer-Shenoy | |
| ArcProperty< const IScheduleMultiDim * > | _separator_tensors_ |
| the list of all tensors stored in the separators after inferences | |
| ArcProperty< const IScheduleMultiDim * > | _arc_to_created_tensors_ |
| the set of tensors created for the last inference messages | |
| NodeProperty< const Tensor< GUM_SCALAR > * > | _target_posteriors_ |
| the set of single posteriors computed during the last inference | |
| HashTable< NodeSet, const Tensor< GUM_SCALAR > * > | _joint_target_posteriors_ |
| the set of set target posteriors computed during the last inference | |
| HashTable< const Tensor< GUM_SCALAR > *, GUM_SCALAR > | _constants_ |
| the constants resulting from the projections of CPTs defined over only hard evidence nodes @TODO remove this constant and insert the notion of a constant into tensors/multidim arrays | |
| ArcProperty< bool > | _messages_computed_ |
| indicates whether a message (from one clique to another) has been computed | |
| NodeProperty< const IScheduleMultiDim * > | _node_to_soft_evidence_ |
| the soft evidence stored in the cliques per their assigned node in the MRF | |
| HashTable< const Tensor< GUM_SCALAR > *, const IScheduleMultiDim * > | _hard_ev_projected_factors_ |
| the factors that were projected due to hard evidence nodes | |
| NodeSet | _hard_ev_nodes_ |
| the hard evidence nodes which were projected in factors | |
| NodeProperty< EvidenceChangeType > | _evidence_changes_ |
| indicates which nodes of the MRF have evidence that changed since the last inference | |
| bool | _use_schedules_ {false} |
| indicates whether we should use schedules for inference | |
| Set< NodeSet > | _joint_targets_ |
| the set of joint targets | |
| bool | _targeted_mode_ |
| whether the actual targets are default | |
| NodeSet | _targets_ |
| the set of marginal targets | |
| SchedulerParallel | _scheduler_parallel_ |
| SchedulerSequential | _scheduler_sequential_ |
| Size | _nb_threads_ {0} |
| the max number of threads used by the class | |
Static Private Attributes | |
| static constexpr double | _schedule_threshold_ {1000000.0} |
| minimal number of operations to perform in the JT to use schedules | |
| static constexpr GUM_SCALAR | _one_minus_epsilon_ {GUM_SCALAR(1.0 - 1e-6)} |
| for comparisons with 1 - epsilon | |
<agrum/MRF/inference/ShaferShenoyMRFInference.h>
Implementation of Shafer-Shenoy's propagation algorithm for inference in Markov random fields
Definition at line 86 of file ShaferShenoyMRFInference.h.
|
private |
Definition at line 239 of file ShaferShenoyMRFInference.h.
|
private |
Definition at line 238 of file ShaferShenoyMRFInference.h.
|
private |
Definition at line 240 of file ShaferShenoyMRFInference.h.
|
private |
the possible types of evidence changes
| Enumerator | |
|---|---|
| EVIDENCE_ADDED | |
| EVIDENCE_ERASED | |
| EVIDENCE_MODIFIED | |
Definition at line 373 of file ShaferShenoyMRFInference.h.
|
stronginherited |
current state of the inference
graphicalModelInference can be in one of 4 different states:
| Enumerator | |
|---|---|
| OutdatedStructure | |
| OutdatedTensors | |
| ReadyForInference | |
| Done | |
Definition at line 127 of file graphicalModelInference.h.
|
explicit |
default constructor
Referenced by ShaferShenoyMRFInference(), and operator=().
| gum::ShaferShenoyMRFInference< GUM_SCALAR >::~ShaferShenoyMRFInference | ( | ) |
destructor
|
privatedelete |
avoid copy constructors
References ShaferShenoyMRFInference().
|
private |
actually perform the collect phase directly without schedules
|
private |
perform the collect phase using schedules
|
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 |
put all the CPTs into the cliques when creating the JT without using a schedule
|
private |
put all the CPTs into the cliques when creating the JT using a schedule
|
private |
invalidate all messages, posteriors and created tensors
|
private |
check whether a new join tree is really needed for the next inference
|
private |
removes variables del_vars from a list of tensors and returns the resulting list directly without schedules
|
private |
removes variables del_vars from a list of tensors and returns the resulting list using schedules
|
private |
creates the message sent by clique from_id to clique to_id without schedules
|
private |
creates the message sent by clique from_id to clique to_id using schedules
|
privateinherited |
sets all the nodes of the Markov net as targets
Definition at line 222 of file marginalTargetedMRFInference_tpl.h.
References _targets_, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), gum::MRFInference< GUM_SCALAR >::MRF(), and onAllMarginalTargetsAdded_().
Referenced by onModelChanged_().
|
private |
sets the operator for performing the combinations
|
private |
sets the operator for performing the projections
|
private |
returns a fresh tensor equal to P(argument,evidence) without using schedules
|
private |
computes the unnormalized posterior of a node without using schedules
|
private |
returns a fresh tensor equal to P(argument,evidence) using schedules
|
private |
computes the unnormalized posterior of a node using schedules
|
finalvirtualinherited |
adds all nodes as targets
Definition at line 143 of file marginalTargetedMRFInference_tpl.h.
References _targets_, GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), gum::MRFInference< GUM_SCALAR >::MRF(), onMarginalTargetAdded_(), gum::GraphicalModelInference< GUM_SCALAR >::OutdatedStructure, gum::GraphicalModelInference< GUM_SCALAR >::setState_(), and setTargetedMode_().
|
finalvirtualinherited |
adds a new hard evidence on node named nodeName
| UndefinedElement | if nodeName does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if nodeName already has an evidence |
Definition at line 235 of file graphicalModelInference_tpl.h.
References addEvidence(), and model().
|
finalvirtualinherited |
adds a new hard evidence on node named nodeName
| UndefinedElement | if nodeName does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if nodeName already has an evidence |
Definition at line 249 of file graphicalModelInference_tpl.h.
References addEvidence(), and model().
|
finalvirtualinherited |
adds a new evidence on node named nodeName (might be soft or hard)
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if nodeName already has an evidence |
| FatalError | if vals=[0,0,...,0] |
| InvalidArgument | if the size of vals is different from the domain size of node nodeName |
Definition at line 281 of file graphicalModelInference_tpl.h.
References addEvidence(), and model().
|
finalvirtualinherited |
adds a new evidence on node id (might be soft or hard)
| UndefinedElement | if the tensor is defined over several nodes |
| UndefinedElement | if the node on which the tensor is defined does not belong to the Bayesian network |
| InvalidArgument | if the node of the tensor already has an evidence |
| FatalError | if pot=[0,0,...,0] |
Definition at line 323 of file graphicalModelInference_tpl.h.
References addEvidence().
|
finalvirtualinherited |
adds a new hard evidence on node id
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if id already has an evidence |
Definition at line 229 of file graphicalModelInference_tpl.h.
References _createHardEvidence_(), and addEvidence().
Referenced by addEvidence(), addEvidence(), addEvidence(), addEvidence(), addEvidence(), addEvidence(), addEvidence(), addListOfEvidence(), addSetOfEvidence(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedMRFInference< GUM_SCALAR >::evidenceJointImpact(), and gum::LoopySamplingInference< GUM_SCALAR, APPROX >::makeInference_().
|
finalvirtualinherited |
adds a new hard evidence on node id
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if id already has an evidence |
Definition at line 242 of file graphicalModelInference_tpl.h.
References addEvidence(), and model().
|
finalvirtualinherited |
adds a new evidence on node id (might be soft or hard)
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if id already has an evidence |
| FatalError | if vals=[0,0,...,0] |
| InvalidArgument | if the size of vals is different from the domain size of node id |
Definition at line 257 of file graphicalModelInference_tpl.h.
References _model_, addEvidence(), and GUM_ERROR.
|
finalvirtualinherited |
adds a new evidence on node id (might be soft or hard)
| UndefinedElement | if the tensor is defined over several nodes |
| UndefinedElement | if the node on which the tensor is defined does not belong to the Bayesian network |
| InvalidArgument | if the node of the tensor already has an evidence |
| FatalError | if pot=[0,0,...,0] |
Definition at line 288 of file graphicalModelInference_tpl.h.
References _evidence_, _hard_evidence_, _hard_evidence_nodes_, _isHardEvidence_(), _model_, _soft_evidence_nodes_, GUM_ERROR, hasEvidence(), onEvidenceAdded_(), OutdatedStructure, and setState_().
|
finalvirtualinherited |
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 126 of file jointTargetedMRFInference_tpl.h.
References _joint_targets_, eraseJointTarget(), GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), isExactJointComputable_(), gum::MRFInference< GUM_SCALAR >::MRF(), onJointTargetAdded_(), gum::GraphicalModelInference< GUM_SCALAR >::OutdatedStructure, gum::GraphicalModelInference< GUM_SCALAR >::setState_(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::setTargetedMode_(), and superForJointComputable_().
Referenced by evidenceJointImpact(), and jointMutualInformation().
|
finalvirtualinherited |
adds a new list of evidence
| UndefinedElement | if some tensor is defined over several nodes |
| UndefinedElement | if the node on which some tensor is defined does not belong to the Bayesian network |
| InvalidArgument | if the node of some tensor already has an evidence |
| FatalError | if pot=[0,0,...,0] |
Definition at line 330 of file graphicalModelInference_tpl.h.
References addEvidence().
|
finalvirtualinherited |
adds a new set of evidence
| UndefinedElement | if some tensor is defined over several nodes |
| UndefinedElement | if the node on which some tensor is defined does not belong to the Bayesian network |
| InvalidArgument | if the node of some tensor already has an evidence |
| FatalError | if pot=[0,0,...,0] |
Definition at line 338 of file graphicalModelInference_tpl.h.
References addEvidence().
|
finalvirtualinherited |
Add a marginal target to the list of targets.
| UndefinedElement | if target is not a NodeId in the Markov net |
Definition at line 163 of file marginalTargetedMRFInference_tpl.h.
References addTarget(), GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), and gum::MRFInference< GUM_SCALAR >::MRF().
|
finalvirtualinherited |
Add a marginal target to the list of targets.
| UndefinedElement | if target is not a NodeId in the Markov net |
Definition at line 121 of file marginalTargetedMRFInference_tpl.h.
References _targets_, GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), gum::MRFInference< GUM_SCALAR >::MRF(), onMarginalTargetAdded_(), gum::GraphicalModelInference< GUM_SCALAR >::OutdatedStructure, gum::GraphicalModelInference< GUM_SCALAR >::setState_(), and setTargetedMode_().
Referenced by addTarget(), and evidenceImpact().
|
finalvirtualinherited |
change the value of an already existing hard evidence
| UndefinedElement | if nodeName does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if id does not already have an evidence |
Definition at line 397 of file graphicalModelInference_tpl.h.
References chgEvidence(), and model().
|
finalvirtualinherited |
change the value of an already existing hard evidence
| UndefinedElement | if nodeName does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if id does not already have an evidence |
Definition at line 411 of file graphicalModelInference_tpl.h.
References chgEvidence(), and model().
|
finalvirtualinherited |
change the value of an already existing evidence (might be soft or hard)
| UndefinedElement | if nodeName does not belong to the Bayesian network |
| InvalidArgument | if the node does not already have an evidence |
| FatalError | if vals=[0,0,...,0] |
| InvalidArgument | if the size of vals is different from the domain size of node id |
Definition at line 445 of file graphicalModelInference_tpl.h.
References chgEvidence(), and model().
|
finalvirtualinherited |
change the value of an already existing evidence (might be soft or hard)
| UndefinedElement | if the tensor is defined over several nodes |
| UndefinedElement | if the node on which the tensor is defined does not belong to the Bayesian network |
| InvalidArgument | if the node of the tensor does not already have an evidence |
| FatalError | if pot=[0,0,...,0] |
Definition at line 452 of file graphicalModelInference_tpl.h.
References _evidence_, _hard_evidence_, _hard_evidence_nodes_, _isHardEvidence_(), _model_, _soft_evidence_nodes_, gum::Instantiation::end(), GUM_ERROR, hasEvidence(), hasHardEvidence(), gum::Instantiation::inc(), isInferenceOutdatedStructure(), onEvidenceChanged_(), OutdatedStructure, OutdatedTensors, gum::Instantiation::setFirst(), and setState_().
|
finalvirtualinherited |
change the value of an already existing hard evidence
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if id does not already have an evidence |
Definition at line 391 of file graphicalModelInference_tpl.h.
References _createHardEvidence_(), and chgEvidence().
Referenced by chgEvidence(), chgEvidence(), chgEvidence(), chgEvidence(), chgEvidence(), chgEvidence(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), and gum::JointTargetedMRFInference< GUM_SCALAR >::evidenceJointImpact().
|
finalvirtualinherited |
change the value of an already existing hard evidence
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if id does not already have an evidence |
Definition at line 404 of file graphicalModelInference_tpl.h.
References chgEvidence(), and model().
|
finalvirtualinherited |
change the value of an already existing evidence (might be soft or hard)
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if the node does not already have an evidence |
| FatalError | if vals=[0,0,...,0] |
| InvalidArgument | if the size of vals is different from the domain size of node id |
Definition at line 420 of file graphicalModelInference_tpl.h.
References _model_, chgEvidence(), and GUM_ERROR.
|
virtualinherited |
clears all the data structures allocated for the last inference
Reimplemented in gum::ShaferShenoyLIMIDInference< GUM_SCALAR >.
Definition at line 155 of file graphicalModelInference_tpl.h.
References eraseAllEvidence(), OutdatedStructure, and setState_().
Referenced by setModel_().
|
virtualinherited |
virtual copy constructor
Definition at line 104 of file scheduledInference.cpp.
References ScheduledInference().
|
finalvirtualinherited |
get the domain sizes of the random variables of the model
Definition at line 173 of file graphicalModelInference_tpl.h.
References _domain_sizes_.
|
finalvirtualinherited |
removes all the evidence entered into the network
Definition at line 540 of file graphicalModelInference_tpl.h.
References _evidence_, _hard_evidence_, _hard_evidence_nodes_, _soft_evidence_nodes_, isInferenceOutdatedStructure(), onAllEvidenceErased_(), OutdatedStructure, OutdatedTensors, and setState_().
Referenced by clear(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedMRFInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation(), and gum::JointTargetedMRFInference< GUM_SCALAR >::jointMutualInformation().
|
finalvirtualinherited |
Clear all previously defined joint targets.
Definition at line 108 of file jointTargetedMRFInference_tpl.h.
References _joint_targets_, onAllJointTargetsErased_(), gum::GraphicalModelInference< GUM_SCALAR >::OutdatedStructure, and gum::GraphicalModelInference< GUM_SCALAR >::setState_().
Referenced by eraseAllTargets().
|
finalvirtualinherited |
Clear all the previously defined marginal targets.
Definition at line 102 of file jointTargetedMRFInference_tpl.h.
References gum::MarginalTargetedMRFInference< GUM_SCALAR >::eraseAllTargets().
Referenced by eraseAllTargets().
|
finalvirtualinherited |
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::MarginalTargetedMRFInference< GUM_SCALAR >.
Definition at line 119 of file jointTargetedMRFInference_tpl.h.
References eraseAllJointTargets(), and eraseAllMarginalTargets().
Referenced by evidenceJointImpact(), and jointMutualInformation().
|
finalvirtualinherited |
removed the evidence, if any, corresponding to node of name nodeName
Definition at line 534 of file graphicalModelInference_tpl.h.
References eraseEvidence(), and model().
|
finalvirtualinherited |
removed the evidence, if any, corresponding to node id
Definition at line 514 of file graphicalModelInference_tpl.h.
References _evidence_, _hard_evidence_, _hard_evidence_nodes_, _soft_evidence_nodes_, hasEvidence(), hasHardEvidence(), isInferenceOutdatedStructure(), onEvidenceErased_(), OutdatedStructure, OutdatedTensors, and setState_().
Referenced by eraseEvidence().
|
finalvirtualinherited |
removes an existing joint target
Definition at line 163 of file jointTargetedMRFInference_tpl.h.
References _joint_targets_, GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), gum::MRFInference< GUM_SCALAR >::MRF(), onJointTargetErased_(), gum::GraphicalModelInference< GUM_SCALAR >::OutdatedStructure, and gum::GraphicalModelInference< GUM_SCALAR >::setState_().
Referenced by addJointTarget().
|
finalvirtualinherited |
removes an existing (marginal) target
Definition at line 198 of file marginalTargetedMRFInference_tpl.h.
References eraseTarget(), GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), and gum::MRFInference< GUM_SCALAR >::MRF().
|
finalvirtualinherited |
removes an existing (marginal) target
Definition at line 175 of file marginalTargetedMRFInference_tpl.h.
References _targeted_mode_, _targets_, GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), gum::MRFInference< GUM_SCALAR >::MRF(), onMarginalTargetErased_(), gum::GraphicalModelInference< GUM_SCALAR >::OutdatedStructure, and gum::GraphicalModelInference< GUM_SCALAR >::setState_().
Referenced by eraseTarget().
|
inherited |
returns the set of evidence
Definition at line 587 of file graphicalModelInference_tpl.h.
References _evidence_.
Referenced by gum::ImportanceSampling< GUM_SCALAR >::onContextualize_(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), and gum::MarginalTargetedMRFInference< GUM_SCALAR >::posterior().
|
inherited |
Create a gum::Tensor for P(target|evs) (for all instanciation of target and evs).
| target | the nodeId of the target variable |
| evs | the nodeId of the observed variable |
Definition at line 312 of file marginalTargetedMRFInference_tpl.h.
References evidenceImpact(), and gum::MRFInference< GUM_SCALAR >::MRF().
|
inherited |
Create a gum::Tensor for P(target|evs) (for all instanciation of target and evs).
| mn | the MarkovRandomField |
| target | the nodeId of the targetted variable |
| evs | the vector of nodeId of the observed variables |
Definition at line 274 of file marginalTargetedMRFInference_tpl.h.
References gum::GraphicalModelInference< GUM_SCALAR >::addEvidence(), addTarget(), gum::GraphicalModelInference< GUM_SCALAR >::chgEvidence(), gum::Set< Key >::contains(), gum::Instantiation::end(), gum::GraphicalModelInference< GUM_SCALAR >::eraseAllEvidence(), eraseAllTargets(), GUM_ERROR, gum::Instantiation::incNotVar(), gum::Instantiation::incVar(), gum::GraphicalModelInference< GUM_SCALAR >::makeInference(), gum::MRFInference< GUM_SCALAR >::MRF(), posterior(), gum::Instantiation::setFirst(), gum::Instantiation::setFirstVar(), and gum::Instantiation::val().
Referenced by evidenceImpact().
|
inherited |
Create a gum::Tensor for P(joint targets|evs) (for all instanciation of targets and evs).
Definition at line 254 of file jointTargetedMRFInference_tpl.h.
References gum::Instantiation::add(), gum::GraphicalModelInference< GUM_SCALAR >::addEvidence(), addJointTarget(), gum::GraphicalModelInference< GUM_SCALAR >::chgEvidence(), gum::Instantiation::end(), gum::GraphicalModelInference< GUM_SCALAR >::eraseAllEvidence(), eraseAllTargets(), GUM_ERROR, gum::Instantiation::incIn(), gum::Instantiation::incOut(), jointPosterior(), gum::GraphicalModelInference< GUM_SCALAR >::makeInference(), gum::MRFInference< GUM_SCALAR >::MRF(), gum::Instantiation::setFirstIn(), gum::Instantiation::setFirstOut(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::targets(), and gum::Instantiation::val().
Referenced by evidenceJointImpact().
|
inherited |
Create a gum::Tensor 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 295 of file jointTargetedMRFInference_tpl.h.
References evidenceJointImpact(), gum::MRFInference< GUM_SCALAR >::MRF(), and gum::MarginalTargetedMRFInference< GUM_SCALAR >::targets().
|
finalvirtual |
returns the probability of evidence
Implements gum::EvidenceMRFInference< GUM_SCALAR >.
|
virtualinherited |
returns the current max number of threads used by the class containing this ThreadNumberManager
Implements gum::IThreadNumberManager.
Referenced by gum::learning::IBNLearner::createParamEstimator_(), gum::learning::IBNLearner::createScore_(), gum::credal::InferenceEngine< GUM_SCALAR >::displatchMarginalsToThreads_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::expFusion_(), gum::ScheduledInference::scheduler(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::verticesFusion_().
|
finalvirtualinherited |
Entropy Compute Shanon's entropy of a node given the observation.
Definition at line 268 of file marginalTargetedMRFInference_tpl.h.
References H(), and gum::MRFInference< GUM_SCALAR >::MRF().
|
finalvirtualinherited |
Entropy Compute Shanon's entropy of a node given the observation.
Definition at line 260 of file marginalTargetedMRFInference_tpl.h.
References posterior().
Referenced by H().
|
inherited |
indicate for each node with hard evidence which value it took
Definition at line 580 of file graphicalModelInference_tpl.h.
References _hard_evidence_.
Referenced by gum::GibbsSampling< GUM_SCALAR >::GibbsSampling(), gum::SamplingInference< GUM_SCALAR >::contextualize(), gum::ImportanceSampling< GUM_SCALAR >::draw_(), and gum::WeightedSampling< GUM_SCALAR >::draw_().
|
inherited |
returns the set of nodes with hard evidence
the set of nodes that received hard evidence
Definition at line 599 of file graphicalModelInference_tpl.h.
References _hard_evidence_nodes_.
Referenced by gum::SamplingInference< GUM_SCALAR >::contextualize(), gum::ImportanceSampling< GUM_SCALAR >::draw_(), gum::MonteCarloSampling< GUM_SCALAR >::draw_(), gum::WeightedSampling< GUM_SCALAR >::draw_(), gum::ImportanceSampling< GUM_SCALAR >::onContextualize_(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::posterior(), gum::SamplingInference< GUM_SCALAR >::setEstimatorFromBN_(), and gum::SamplingInference< GUM_SCALAR >::setEstimatorFromLBP_().
|
finalvirtualinherited |
indicates whether some node(s) have received evidence
Definition at line 346 of file graphicalModelInference_tpl.h.
References _evidence_.
Referenced by addEvidence(), chgEvidence(), eraseEvidence(), and hasEvidence().
|
finalvirtualinherited |
indicates whether node id has received an evidence
Definition at line 371 of file graphicalModelInference_tpl.h.
References hasEvidence(), and model().
|
finalvirtualinherited |
indicates whether node id has received an evidence
Definition at line 352 of file graphicalModelInference_tpl.h.
References _evidence_.
|
finalvirtualinherited |
indicates whether node id has received a hard evidence
Definition at line 378 of file graphicalModelInference_tpl.h.
References hasHardEvidence(), and model().
|
finalvirtualinherited |
indicates whether node id has received a hard evidence
Definition at line 358 of file graphicalModelInference_tpl.h.
References _hard_evidence_nodes_.
Referenced by chgEvidence(), gum::ImportanceSampling< GUM_SCALAR >::draw_(), eraseEvidence(), hasHardEvidence(), and gum::JointTargetedMRFInference< GUM_SCALAR >::jointPosterior().
|
inlineprotectedinherited |
Definition at line 542 of file graphicalModelInference.h.
References _model_.
Referenced by gum::EvidenceInference< GUM_SCALAR >::EvidenceInference(), gum::EvidenceMRFInference< GUM_SCALAR >::EvidenceMRFInference(), gum::JointTargetedInference< GUM_SCALAR >::JointTargetedInference(), gum::JointTargetedMRFInference< GUM_SCALAR >::JointTargetedMRFInference(), gum::MarginalTargetedInference< GUM_SCALAR >::MarginalTargetedInference(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::MarginalTargetedMRFInference(), _computeDomainSizes_(), gum::MarginalTargetedInference< GUM_SCALAR >::_setAllMarginalTargets_(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::_setAllMarginalTargets_(), gum::MarginalTargetedInference< GUM_SCALAR >::addAllTargets(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addAllTargets(), gum::JointTargetedInference< GUM_SCALAR >::addJointTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::addJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addTarget(), gum::JointTargetedInference< GUM_SCALAR >::eraseJointTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::eraseJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::eraseTarget(), gum::JointTargetedInference< GUM_SCALAR >::isJointTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::isJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::isTarget(), and gum::MarginalTargetedMRFInference< GUM_SCALAR >::isTarget().
|
finalvirtualinherited |
indicates whether node id has received a soft evidence
Definition at line 385 of file graphicalModelInference_tpl.h.
References hasSoftEvidence(), and model().
|
finalvirtualinherited |
indicates whether node id has received a soft evidence
Definition at line 364 of file graphicalModelInference_tpl.h.
References _soft_evidence_nodes_.
Referenced by hasSoftEvidence().
|
finalprotectedvirtual |
check if the vars form a possible computable joint (can be redefined by subclass)
Reimplemented from gum::JointTargetedMRFInference< GUM_SCALAR >.
References isExactJointComputable_().
Referenced by isExactJointComputable_().
|
virtualinherited |
indicates whether the class containing this ThreadNumberManager set its own number of threads
Implements gum::IThreadNumberManager.
Referenced by gum::learning::IBNLearner::createParamEstimator_(), and gum::learning::IBNLearner::createScore_().
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a InferenceDone state
The inference object is in a done state when the posteriors can be retrieved without performing a new inference, i.e., all the heavy computations have already been performed. Typically, in a junction tree algorithm, this corresponds to a situation in which all the messages needed in the JT have been computed and sent.
Definition at line 104 of file graphicalModelInference_tpl.h.
Referenced by gum::JointTargetedInference< GUM_SCALAR >::jointPosterior(), gum::JointTargetedMRFInference< GUM_SCALAR >::jointPosterior(), makeInference(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::posterior(), and prepareInference().
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a OutdatedStructure state
Definition at line 92 of file graphicalModelInference_tpl.h.
References _state_, and OutdatedStructure.
Referenced by chgEvidence(), eraseAllEvidence(), and eraseEvidence().
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a OutdatedTensor state
Definition at line 98 of file graphicalModelInference_tpl.h.
References _state_, and OutdatedTensors.
|
finalvirtualnoexceptinherited |
returns whether the inference object is in a ready state
Definition at line 86 of file graphicalModelInference_tpl.h.
References _state_, and ReadyForInference.
Referenced by makeInference(), gum::SamplingInference< GUM_SCALAR >::onStateChanged_(), and prepareInference().
|
finalvirtualinherited |
return true if target is a joint target.
Definition at line 84 of file jointTargetedMRFInference_tpl.h.
References _joint_targets_, GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), and gum::MRFInference< GUM_SCALAR >::MRF().
|
finalvirtualinherited |
return true if variable is a (marginal) target
Definition at line 104 of file marginalTargetedMRFInference_tpl.h.
References isTarget(), and gum::MRFInference< GUM_SCALAR >::MRF().
|
finalvirtualinherited |
return true if variable is a (marginal) target
Definition at line 88 of file marginalTargetedMRFInference_tpl.h.
References _targets_, GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), and gum::MRFInference< GUM_SCALAR >::MRF().
Referenced by isTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::posterior(), and posterior().
|
protectedinherited |
Definition at line 320 of file marginalTargetedMRFInference_tpl.h.
References _targeted_mode_.
|
inherited |
Mutual information between targets.
Definition at line 304 of file jointTargetedMRFInference_tpl.h.
References gum::Instantiation::add(), addJointTarget(), gum::Set< Key >::clear(), gum::Instantiation::end(), gum::GraphicalModelInference< GUM_SCALAR >::eraseAllEvidence(), eraseAllTargets(), GUM_ERROR, gum::Instantiation::inc(), gum::Set< Key >::insert(), jointPosterior(), gum::GraphicalModelInference< GUM_SCALAR >::makeInference(), gum::MRFInference< GUM_SCALAR >::MRF(), gum::Instantiation::nbrDim(), gum::Instantiation::setFirst(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::targets(), gum::Instantiation::val(), and gum::Instantiation::variable().
Referenced by jointMutualInformation().
|
inherited |
Mutual information between targets.
| targets | the vector of std::string of the targeted variables |
Definition at line 354 of file jointTargetedMRFInference_tpl.h.
References jointMutualInformation(), gum::MRFInference< GUM_SCALAR >::MRF(), and gum::MarginalTargetedMRFInference< GUM_SCALAR >::targets().
|
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 208 of file jointTargetedMRFInference_tpl.h.
References _joint_targets_, gum::Set< Key >::empty(), GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasHardEvidence(), gum::Set< Key >::insert(), isExactJointComputable_(), gum::GraphicalModelInference< GUM_SCALAR >::isInferenceDone(), jointPosterior_(), gum::GraphicalModelInference< GUM_SCALAR >::makeInference(), and superForJointComputable_().
Referenced by evidenceJointImpact(), jointMutualInformation(), and posterior().
|
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::JointTargetedMRFInference< GUM_SCALAR >.
References jointPosterior_().
Referenced by jointPosterior_(), and jointPosterior_().
|
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::JointTargetedMRFInference< GUM_SCALAR >.
References jointPosterior_().
| const JoinTree * gum::ShaferShenoyMRFInference< GUM_SCALAR >::joinTree | ( | ) |
returns the current join tree used
ShaferShenoy 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 some cliques are contained into others in this tree.
|
finalvirtualnoexceptinherited |
returns the list of joint targets
returns the list of target sets
Definition at line 191 of file jointTargetedMRFInference_tpl.h.
References _joint_targets_.
| const JunctionTree * gum::ShaferShenoyMRFInference< GUM_SCALAR >::junctionTree | ( | ) |
returns the current junction tree
ShaferShenoy 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 638 of file graphicalModelInference_tpl.h.
References Done, isInferenceDone(), isInferenceReady(), makeInference_(), prepareInference(), and setState_().
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedMRFInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation(), gum::JointTargetedMRFInference< GUM_SCALAR >::jointMutualInformation(), gum::JointTargetedInference< GUM_SCALAR >::jointPosterior(), gum::JointTargetedMRFInference< GUM_SCALAR >::jointPosterior(), gum::LoopySamplingInference< GUM_SCALAR, APPROX >::makeInference_(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), and gum::MarginalTargetedMRFInference< GUM_SCALAR >::posterior().
|
finalprotectedvirtual |
called when the inference has to be performed effectively
Once the inference is done, fillPosterior_ can be called.
Implements gum::GraphicalModelInference< GUM_SCALAR >.
References makeInference_().
Referenced by makeInference_().
|
virtualinherited |
returns the Max memory (in megabytes) available for executing schedules
Definition at line 68 of file scheduledInference_inl.h.
References _scheduler_parallel_.
|
finalvirtualinherited |
Returns a constant reference over the IBayesNet referenced by this class.
| UndefinedElement | is raised if no Bayes net has been assigned to the inference. |
Definition at line 126 of file graphicalModelInference_tpl.h.
References _model_, and GUM_ERROR.
Referenced by GraphicalModelInference(), addEvidence(), addEvidence(), addEvidence(), addEvidence(), gum::BayesNetInference< GUM_SCALAR >::BN(), chgEvidence(), chgEvidence(), chgEvidence(), chgEvidence(), eraseEvidence(), hasEvidence(), hasHardEvidence(), hasSoftEvidence(), gum::MRFInference< GUM_SCALAR >::MRF(), onModelChanged_(), gum::ShaferShenoyLIMIDInference< GUM_SCALAR >::onModelChanged_(), setModel_(), and setModelDuringConstruction_().
|
finalvirtualinherited |
Returns a constant reference over the IMarkovRandomField referenced by this class.
| UndefinedElement | is raised if no Markov net has been assigned to the inference. |
Definition at line 75 of file MRFInference_tpl.h.
References gum::GraphicalModelInference< GUM_SCALAR >::model().
Referenced by gum::MarginalTargetedMRFInference< GUM_SCALAR >::_setAllMarginalTargets_(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addAllTargets(), gum::JointTargetedMRFInference< GUM_SCALAR >::addJointTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::eraseJointTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::evidenceImpact(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedMRFInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedMRFInference< GUM_SCALAR >::evidenceJointImpact(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::H(), gum::JointTargetedMRFInference< GUM_SCALAR >::isJointTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::isTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::isTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::jointMutualInformation(), gum::JointTargetedMRFInference< GUM_SCALAR >::jointMutualInformation(), gum::JointTargetedMRFInference< GUM_SCALAR >::posterior(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::posterior(), and gum::JointTargetedMRFInference< GUM_SCALAR >::superForJointComputable_().
|
finalvirtualinherited |
returns the number of evidence entered into the Bayesian network
Definition at line 562 of file graphicalModelInference_tpl.h.
References _evidence_.
|
finalvirtualinherited |
returns the number of hard evidence entered into the Bayesian network
Definition at line 568 of file graphicalModelInference_tpl.h.
References _hard_evidence_nodes_.
|
finalvirtualnoexceptinherited |
returns the number of joint targets
returns the number of target sets
Definition at line 197 of file jointTargetedMRFInference_tpl.h.
References _joint_targets_.
|
finalvirtualinherited |
returns the number of soft evidence entered into the Bayesian network
Definition at line 574 of file graphicalModelInference_tpl.h.
References _soft_evidence_nodes_.
|
finalvirtualnoexceptinherited |
returns the number of marginal targets
Definition at line 216 of file marginalTargetedMRFInference_tpl.h.
References _targets_.
|
finalprotectedvirtual |
fired before all the evidence are erased
Implements gum::GraphicalModelInference< GUM_SCALAR >.
References onAllEvidenceErased_().
Referenced by onAllEvidenceErased_().
|
finalprotectedvirtual |
fired before all the joint targets are removed
Implements gum::JointTargetedMRFInference< GUM_SCALAR >.
References onAllJointTargetsErased_().
Referenced by onAllJointTargetsErased_().
|
finalprotectedvirtual |
fired after all the nodes of the MRF are added as single targets
Implements gum::MarginalTargetedMRFInference< GUM_SCALAR >.
References onAllMarginalTargetsAdded_().
Referenced by onAllMarginalTargetsAdded_().
|
finalprotectedvirtual |
fired before all the single targets are removed
Implements gum::MarginalTargetedMRFInference< GUM_SCALAR >.
References onAllMarginalTargetsErased_().
Referenced by onAllMarginalTargetsErased_().
|
finalprotectedvirtual |
fired before all single and joint targets are removed
Implements gum::JointTargetedMRFInference< GUM_SCALAR >.
References onAllTargetsErased_().
Referenced by onAllTargetsErased_().
|
finalprotectedvirtual |
fired after a new evidence is inserted
Implements gum::GraphicalModelInference< GUM_SCALAR >.
References onEvidenceAdded_().
Referenced by onEvidenceAdded_().
|
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::GraphicalModelInference< GUM_SCALAR >.
References onEvidenceChanged_().
Referenced by onEvidenceChanged_().
|
finalprotectedvirtual |
fired before an evidence is removed
Implements gum::GraphicalModelInference< GUM_SCALAR >.
References onEvidenceErased_().
Referenced by onEvidenceErased_().
|
finalprotectedvirtual |
fired after a new joint target is inserted
| set | The set of target variable's ids. |
Implements gum::JointTargetedMRFInference< GUM_SCALAR >.
References onJointTargetAdded_().
Referenced by onJointTargetAdded_().
|
finalprotectedvirtual |
fired before a joint target is removed
| set | The set of target variable's ids. |
Implements gum::JointTargetedMRFInference< GUM_SCALAR >.
References onJointTargetErased_().
Referenced by onJointTargetErased_().
|
finalprotectedvirtual |
fired after a new single target is inserted
| id | The target variable's id. |
Implements gum::MarginalTargetedMRFInference< GUM_SCALAR >.
References onMarginalTargetAdded_().
Referenced by onMarginalTargetAdded_().
|
finalprotectedvirtual |
fired before a single target is removed
| id | The target variable's id. |
Implements gum::MarginalTargetedMRFInference< GUM_SCALAR >.
References onMarginalTargetErased_().
Referenced by onMarginalTargetErased_().
|
finalprotectedvirtual |
fired after a new Markov net has been assigned to the inference engine
Reimplemented from gum::JointTargetedMRFInference< GUM_SCALAR >.
References onModelChanged_().
Referenced by onModelChanged_().
|
finalprotectedvirtual |
fired after a new Markov net has been assigned to the inference engine
References onMRFChanged_().
Referenced by onMRFChanged_().
|
inlinefinalprotectedvirtual |
fired when the state of the inference engine is changed
Implements gum::GraphicalModelInference< GUM_SCALAR >.
Definition at line 192 of file ShaferShenoyMRFInference.h.
References onStateChanged_().
Referenced by onStateChanged_().
|
privatedelete |
avoid copy operators
References ShaferShenoyMRFInference().
|
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::MarginalTargetedMRFInference< GUM_SCALAR >.
Definition at line 244 of file jointTargetedMRFInference_tpl.h.
References gum::MRFInference< GUM_SCALAR >::MRF(), and 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::MarginalTargetedMRFInference< GUM_SCALAR >.
Definition at line 236 of file jointTargetedMRFInference_tpl.h.
References gum::MarginalTargetedMRFInference< GUM_SCALAR >::isTarget(), jointPosterior(), and gum::MarginalTargetedMRFInference< GUM_SCALAR >::posterior().
Referenced by posterior().
|
finalprotectedvirtual |
returns the posterior of a given variable
| id | The variable's id. |
Implements gum::MarginalTargetedMRFInference< GUM_SCALAR >.
References posterior_().
Referenced by posterior_().
|
finalvirtualinherited |
prepare the internal inference structures for the next inference
Definition at line 622 of file graphicalModelInference_tpl.h.
References _model_, _state_, GUM_ERROR, isInferenceDone(), isInferenceReady(), OutdatedStructure, ReadyForInference, setState_(), updateOutdatedStructure_(), and updateOutdatedTensors_().
Referenced by makeInference(), and gum::SamplingInference< GUM_SCALAR >::samplingBN().
|
inherited |
returns the current scheduler
Definition at line 48 of file scheduledInference_inl.h.
References _scheduler_parallel_, _scheduler_sequential_, and gum::ThreadNumberManager::getNumberOfThreads().
|
inherited |
sets an upper bound on the memory consumption admissible
| megabytes | the number of megabytes that can be used for the execution of the schedule. If this number is equal to 0, then no memory limit is applied. |
Definition at line 61 of file scheduledInference_inl.h.
References _scheduler_parallel_, and _scheduler_sequential_.
Referenced by ScheduledInference().
|
protectedinherited |
Definition at line 136 of file graphicalModelInference_tpl.h.
References _computeDomainSizes_(), _model_, clear(), model(), onModelChanged_(), OutdatedStructure, and setState_().
Referenced by gum::BayesNetInference< GUM_SCALAR >::setBN(), and gum::MRFInference< GUM_SCALAR >::setMRF().
|
protectedinherited |
assigns a model during the inference engine construction
Definition at line 146 of file graphicalModelInference_tpl.h.
References _computeDomainSizes_(), _model_, model(), OutdatedStructure, and setState_().
Referenced by gum::BayesNetInference< GUM_SCALAR >::_setBayesNetDuringConstruction_(), and gum::MRFInference< GUM_SCALAR >::_setMRFDuringConstruction_().
|
virtualinherited |
assigns a new MRF to the inference engine
Assigns a new MRF to the MRFInference engine and sends messages to the descendants of MRFInference to inform them that the MRF has changed.
Definition at line 81 of file MRFInference_tpl.h.
References gum::GraphicalModelInference< GUM_SCALAR >::setModel_().
|
finalvirtualinherited |
sets the number max of threads that can be used
| nb | the number max of threads used for executing schedules. If this number is set to 0, then it is defaulted to aGrUM's number of threads |
Reimplemented from gum::ThreadNumberManager.
Definition at line 55 of file scheduledInference_inl.h.
References _scheduler_parallel_, and gum::ThreadNumberManager::setNumberOfThreads().
|
protectedinherited |
put the inference into an outdated model structure state
OutdatedStructure: in this state, the inference is fully unprepared to be applied because some events changed the "logical" structure of the model: for instance a node received a hard evidence, which implies that its outgoing arcs can be removed from the model, hence involving a structural change in the model. As a consequence, the (incremental) inference (probably) needs a significant amount of preparation to be ready for the next inference. In a Lazy propagation, for instance, this step amounts to compute a new join tree, hence a new structure in which inference will be applied. Note that classes that inherit from graphicalModelInference may be smarter than graphicalModelInference and may, in some situations, find out that their data structures are still ok for inference and, therefore, only resort to perform the actions related to the OutdatedTensors state. As an example, consider a LazyPropagation inference in Bayes Net A->B->C->D->E in which C has received hard evidence e_C and E is the only target. In this case, A and B are not needed for inference, the only tensors that matter are P(D|e_C) and P(E|D). So the smallest join tree needed for inference contains only one clique DE. Now, adding new evidence e_A on A has no impact on E given hard evidence e_C. In this case, LazyPropagation can be smart and not update its join tree.
Definition at line 609 of file graphicalModelInference_tpl.h.
References OutdatedStructure, and setState_().
Referenced by makeInference_().
|
protectedinherited |
puts the inference into an OutdatedTensors state if it is not already in an OutdatedStructure state
OutdatedTensors: in this state, the structure of the model remains unchanged, only some tensors stored in it have changed. Therefore, the inference probably just needs to invalidate some already computed tensors to be ready. Only a light amount of preparation is needed to be able to perform inference.
Definition at line 616 of file graphicalModelInference_tpl.h.
References OutdatedTensors, and setState_().
Referenced by makeInference_().
|
finalprotectedvirtualinherited |
set the state of the inference engine and call the notification onStateChanged_ when necessary (i.e. when the state has effectively changed).
Definition at line 117 of file graphicalModelInference_tpl.h.
References _state_, onStateChanged_(), and state().
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::addAllTargets(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addAllTargets(), addEvidence(), gum::JointTargetedInference< GUM_SCALAR >::addJointTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::addJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addTarget(), chgEvidence(), clear(), eraseAllEvidence(), gum::JointTargetedInference< GUM_SCALAR >::eraseAllJointTargets(), gum::JointTargetedMRFInference< GUM_SCALAR >::eraseAllJointTargets(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseAllTargets(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::eraseAllTargets(), eraseEvidence(), gum::JointTargetedInference< GUM_SCALAR >::eraseJointTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::eraseJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::eraseTarget(), makeInference(), prepareInference(), setModel_(), setModelDuringConstruction_(), setOutdatedStructureState_(), and setOutdatedTensorsState_().
|
protectedinherited |
Definition at line 325 of file marginalTargetedMRFInference_tpl.h.
References _targeted_mode_, and _targets_.
Referenced by addAllTargets(), gum::JointTargetedMRFInference< GUM_SCALAR >::addJointTarget(), addTarget(), and eraseAllTargets().
| void gum::ShaferShenoyMRFInference< 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 593 of file graphicalModelInference_tpl.h.
References _soft_evidence_nodes_.
Referenced by gum::SamplingInference< GUM_SCALAR >::contextualize().
|
finalvirtualnoexceptinherited |
returns the state of the inference engine
Definition at line 111 of file graphicalModelInference_tpl.h.
References _state_.
Referenced by setState_().
|
finalprotectedvirtual |
Reimplemented from gum::JointTargetedMRFInference< GUM_SCALAR >.
References superForJointComputable_().
Referenced by superForJointComputable_().
|
finalvirtualnoexceptinherited |
returns the list of marginal targets
Definition at line 210 of file marginalTargetedMRFInference_tpl.h.
References _targets_.
Referenced by gum::JointTargetedMRFInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedMRFInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedMRFInference< GUM_SCALAR >::jointMutualInformation(), and gum::JointTargetedMRFInference< GUM_SCALAR >::jointMutualInformation().
|
finalprotectedvirtual |
returns a fresh tensor equal to P(argument,evidence)
Implements gum::JointTargetedMRFInference< GUM_SCALAR >.
|
finalprotectedvirtual |
returns a fresh tensor equal to P(argument,evidence)
Implements gum::JointTargetedMRFInference< GUM_SCALAR >.
References unnormalizedJointPosterior_().
Referenced by unnormalizedJointPosterior_().
|
finalprotectedvirtual |
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 makeMRFInference_.
Implements gum::GraphicalModelInference< GUM_SCALAR >.
|
finalprotectedvirtual |
prepares inference when the latter is in OutdatedTensors state
Note that the values of evidence are not necessarily known and can be changed between updateOutdatedStructure_ and makeMRFInference_.
Implements gum::GraphicalModelInference< GUM_SCALAR >.
References updateOutdatedTensors_().
Referenced by updateOutdatedTensors_().
|
private |
the set of tensors created for the last inference messages
This structure contains some pointer only for the arcs on which a tensor has been created. Arcs for which no tensor was created do not belong to this structure.
Definition at line 331 of file ShaferShenoyMRFInference.h.
|
private |
the tensors stored into the cliques by Shafer-Shenoy
For a given clique, there is an entry in clique_ss_tensor even if the clique received no tensor. In this case, the tensor stored is equal to nullptr, else it is equal to the combination of all the corresponding list of tensors in clique_ss_tensor.
Definition at line 316 of file ShaferShenoyMRFInference.h.
|
private |
the list of all tensors stored in the cliques
This structure contains a list for each clique in the join tree. If a clique did not received any tensor, then its list is empty but the entry for the clique does exist. Note that clique tensors contain also soft evidence and the factors that were projected to remove their variables that received hard evidence. The product of all these tensors is precisely the tensor stored into clique_ss_tensor
Definition at line 309 of file ShaferShenoyMRFInference.h.
|
inlineprivate |
the operator for performing the combinations
Definition at line 234 of file ShaferShenoyMRFInference.h.
|
private |
the constants resulting from the projections of CPTs defined over only hard evidence nodes @TODO remove this constant and insert the notion of a constant into tensors/multidim arrays
Definition at line 345 of file ShaferShenoyMRFInference.h.
|
private |
indicates which nodes of the MRF have evidence that changed since the last inference
Definition at line 377 of file ShaferShenoyMRFInference.h.
|
private |
assign to each factor in the MRF the clique that will contain it
Definition at line 291 of file ShaferShenoyMRFInference.h.
|
private |
the undigraph extracted from the MRF and used to construct the join tree
If all nodes are targets, this graph corresponds to the graph of the MRF. Otherwise, it may be a subgraph of this moral graph.
Definition at line 260 of file ShaferShenoyMRFInference.h.
|
private |
the hard evidence nodes which were projected in factors
Definition at line 370 of file ShaferShenoyMRFInference.h.
|
private |
the factors that were projected due to hard evidence nodes
For each node whose factor is defined over some nodes that contain some hard evidence, assigns a new projected factor that does not contain these nodes anymore.
Definition at line 367 of file ShaferShenoyMRFInference.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 272 of file ShaferShenoyMRFInference.h.
|
private |
the set of set target posteriors computed during the last inference
the posteriors are owned by ShaferShenoyMRFInference.
Definition at line 339 of file ShaferShenoyMRFInference.h.
|
private |
for each set target, assign a clique in the JT that contains it
Definition at line 299 of file ShaferShenoyMRFInference.h.
|
privateinherited |
the set of joint targets
Definition at line 295 of file jointTargetedMRFInference.h.
Referenced by addJointTarget(), eraseAllJointTargets(), eraseJointTarget(), isExactJointComputable_(), isJointTarget(), jointPosterior(), jointTargets(), nbrJointTargets(), onModelChanged_(), and superForJointComputable_().
|
private |
the join (or junction) tree used to answer the last inference query
Definition at line 263 of file ShaferShenoyMRFInference.h.
|
private |
the junction tree to answer the last inference query
Definition at line 266 of file ShaferShenoyMRFInference.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 351 of file ShaferShenoyMRFInference.h.
|
privateinherited |
the max number of threads used by the class
Definition at line 126 of file threadNumberManager.h.
|
private |
for each node of graph (~ in the Markov net), associate an ID in the JT
This mapping is useful notably to determine where the soft evidence are entered into the JT.
Definition at line 288 of file ShaferShenoyMRFInference.h.
|
private |
assign to each node the set of factors containing it
Nodes that are assigned no factor (do they exist?) are assigned an empty factor set
Definition at line 296 of file ShaferShenoyMRFInference.h.
|
private |
the soft evidence stored in the cliques per their assigned node in the MRF
This variable is useful for method updateOutdatedTensors_: it enables to know which soft evidence should be removed/added into the cliques of the join tree.
Definition at line 360 of file ShaferShenoyMRFInference.h.
|
staticconstexprprivate |
|
inlineprivate |
the operator for performing the projections
Definition at line 234 of file ShaferShenoyMRFInference.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 281 of file ShaferShenoyMRFInference.h.
|
staticconstexprprivate |
minimal number of operations to perform in the JT to use schedules
Definition at line 383 of file ShaferShenoyMRFInference.h.
|
privateinherited |
Definition at line 137 of file scheduledInference.h.
Referenced by ScheduledInference(), ScheduledInference(), ScheduledInference(), maxMemory(), operator=(), operator=(), scheduler(), setMaxMemory(), and setNumberOfThreads().
|
privateinherited |
Definition at line 140 of file scheduledInference.h.
Referenced by ScheduledInference(), ScheduledInference(), ScheduledInference(), operator=(), operator=(), scheduler(), and setMaxMemory().
|
private |
the list of all tensors 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 tensor or not. If they did not receive any tensor, then they contain a nullptr pointer.
Definition at line 322 of file ShaferShenoyMRFInference.h.
|
private |
the set of single posteriors computed during the last inference
the posteriors are owned by ShaferShenoyMRFInference.
Definition at line 335 of file ShaferShenoyMRFInference.h.
|
privateinherited |
whether the actual targets are default
Definition at line 259 of file marginalTargetedMRFInference.h.
Referenced by MarginalTargetedMRFInference(), eraseTarget(), isTargetedMode_(), onModelChanged_(), and setTargetedMode_().
|
privateinherited |
the set of marginal targets
Definition at line 262 of file marginalTargetedMRFInference.h.
Referenced by MarginalTargetedMRFInference(), _setAllMarginalTargets_(), addAllTargets(), addTarget(), eraseAllTargets(), eraseTarget(), isTarget(), nbrTargets(), setTargetedMode_(), and targets().
|
private |
the triangulation class creating the junction tree used for inference
Definition at line 251 of file ShaferShenoyMRFInference.h.
|
private |
indicates whether we should transform junction trees into binary join trees
Definition at line 255 of file ShaferShenoyMRFInference.h.
|
private |
indicates whether we should use schedules for inference
Definition at line 380 of file ShaferShenoyMRFInference.h.