![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
Implementation of Shafer-Shenoy's propagation algorithm for inference in Bayesian networks. More...
#include <agrum/BN/inference/ShaferShenoyInference.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 | |
| ShaferShenoyInference (const IBayesNet< GUM_SCALAR > *BN, RelevantTensorsFinderType=RelevantTensorsFinderType::DSEP_BAYESBALL_TENSORS, FindBarrenNodesType barren_type=FindBarrenNodesType::FIND_BARREN_NODES, bool use_binary_join_tree=true) | |
| default constructor | |
| ShaferShenoyInference (const ShaferShenoyInference< GUM_SCALAR > &)=delete | |
| avoid copy constructors | |
| ShaferShenoyInference< GUM_SCALAR > & | operator= (const ShaferShenoyInference< GUM_SCALAR > &)=delete |
| avoid copy operators | |
| ~ShaferShenoyInference () | |
| destructor | |
Accessors / Modifiers | |
| void | setTriangulation (const Triangulation &new_triangulation) |
| use a new triangulation algorithm | |
| void | setRelevantTensorsFinderType (RelevantTensorsFinderType type) |
| sets how we determine the relevant tensors to combine | |
| void | setFindBarrenNodesType (FindBarrenNodesType type) |
| sets how we determine barren nodes | |
| 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 () |
| 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 | I (NodeId X, NodeId Y) |
| Mutual information between X and Y. | |
| GUM_SCALAR | I (const std::string &Xname, const std::string &Yname) |
| Mutual information between X and Y. | |
| GUM_SCALAR | VI (NodeId X, NodeId Y) |
| Variation of information between X and Y. | |
| GUM_SCALAR | VI (const std::string &Xname, const std::string &Yname) |
| Variation of information between X and Y. | |
| 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 | |
| virtual bool | isInTargetMode () const noexcept final |
| indicates whether the inference is in a target mode | |
Information Theory related functions | |
| virtual GUM_SCALAR | H (NodeId X) final |
| Entropy Compute Shanon's entropy of a node given the observation. | |
| virtual GUM_SCALAR | H (const std::string &nodeName) final |
| Entropy Compute Shanon's entropy of a node given the observation. | |
Accessors / Modifiers | |
| virtual void | setBN (const IBayesNet< GUM_SCALAR > *bn) |
| assigns a new BN to the inference engine | |
| virtual const IBayesNet< GUM_SCALAR > & | BN () const final |
| Returns a constant reference over the IBayesNet referenced by this class. | |
Accessors / Modifiers | |
| virtual const GraphicalModel & | model () const final |
| Returns a constant reference over the IBayesNet referenced by this class. | |
| virtual const NodeProperty< Size > & | domainSizes () const final |
| get the domain sizes of the random variables of the model | |
| virtual bool | isInferenceReady () const noexcept final |
| returns whether the inference object is in a ready state | |
| virtual bool | isInferenceOutdatedStructure () const noexcept final |
| returns whether the inference object is in a OutdatedStructure state | |
| virtual bool | isInferenceOutdatedTensors () const noexcept final |
| returns whether the inference object is in a OutdatedTensor state | |
| virtual bool | isInferenceDone () const noexcept final |
| returns whether the inference object is in a InferenceDone state | |
| virtual void | prepareInference () final |
| prepare the internal inference structures for the next inference | |
| virtual void | makeInference () final |
| perform the heavy computations needed to compute the targets' posteriors | |
| virtual void | clear () |
| clears all the data structures allocated for the last inference | |
| virtual StateOfInference | state () const noexcept final |
| returns the state of the inference engine | |
Evidence | |
| virtual void | addEvidence (NodeId id, const Idx val) final |
| adds a new hard evidence on node id | |
| virtual void | addEvidence (const std::string &nodeName, const Idx val) final |
| adds a new hard evidence on node named nodeName | |
| virtual void | addEvidence (NodeId id, const std::string &label) final |
| adds a new hard evidence on node id | |
| virtual void | addEvidence (const std::string &nodeName, const std::string &label) final |
| adds a new hard evidence on node named nodeName | |
| virtual void | addEvidence (NodeId id, const std::vector< GUM_SCALAR > &vals) final |
| adds a new evidence on node id (might be soft or hard) | |
| virtual void | addEvidence (const std::string &nodeName, const std::vector< GUM_SCALAR > &vals) final |
| adds a new evidence on node named nodeName (might be soft or hard) | |
| virtual void | addEvidence (const Tensor< GUM_SCALAR > &pot) final |
| adds a new evidence on node id (might be soft or hard) | |
| virtual void | addEvidence (Tensor< GUM_SCALAR > &&pot) final |
| adds a new evidence on node id (might be soft or hard) | |
| virtual void | addSetOfEvidence (const Set< const Tensor< GUM_SCALAR > * > &potset) final |
| adds a new set of evidence | |
| virtual void | addListOfEvidence (const List< const Tensor< GUM_SCALAR > * > &potlist) final |
| adds a new list of evidence | |
| virtual void | chgEvidence (NodeId id, const Idx val) final |
| change the value of an already existing hard evidence | |
| virtual void | chgEvidence (const std::string &nodeName, const Idx val) final |
| change the value of an already existing hard evidence | |
| virtual void | chgEvidence (NodeId id, const std::string &label) final |
| change the value of an already existing hard evidence | |
| virtual void | chgEvidence (const std::string &nodeName, const std::string &label) final |
| change the value of an already existing hard evidence | |
| virtual void | chgEvidence (NodeId id, const std::vector< GUM_SCALAR > &vals) final |
| change the value of an already existing evidence (might be soft or hard) | |
| virtual void | chgEvidence (const std::string &nodeName, const std::vector< GUM_SCALAR > &vals) final |
| change the value of an already existing evidence (might be soft or hard) | |
| virtual void | chgEvidence (const Tensor< GUM_SCALAR > &pot) final |
| change the value of an already existing evidence (might be soft or hard) | |
| virtual void | eraseAllEvidence () final |
| removes all the evidence entered into the network | |
| virtual void | eraseEvidence (NodeId id) final |
| removed the evidence, if any, corresponding to node id | |
| virtual void | eraseEvidence (const std::string &nodeName) final |
| removed the evidence, if any, corresponding to node of name nodeName | |
| virtual bool | hasEvidence () const final |
| indicates whether some node(s) have received evidence | |
| virtual bool | hasEvidence (NodeId id) const final |
| indicates whether node id has received an evidence | |
| virtual bool | hasEvidence (const std::string &nodeName) const final |
| indicates whether node id has received an evidence | |
| virtual bool | hasHardEvidence (NodeId id) const final |
| indicates whether node id has received a hard evidence | |
| virtual bool | hasHardEvidence (const std::string &nodeName) const final |
| indicates whether node id has received a hard evidence | |
| virtual bool | hasSoftEvidence (NodeId id) const final |
| indicates whether node id has received a soft evidence | |
| virtual bool | hasSoftEvidence (const std::string &nodeName) const final |
| indicates whether node id has received a soft evidence | |
| virtual Size | nbrEvidence () const final |
| returns the number of evidence entered into the Bayesian network | |
| virtual Size | nbrHardEvidence () const final |
| returns the number of hard evidence entered into the Bayesian network | |
| virtual Size | nbrSoftEvidence () const final |
| returns the number of soft evidence entered into the Bayesian network | |
| const NodeProperty< const Tensor< GUM_SCALAR > * > & | evidence () const |
| returns the set of evidence | |
| const NodeSet & | softEvidenceNodes () const |
| returns the set of nodes with soft evidence | |
| const NodeSet & | hardEvidenceNodes () const |
| returns the set of nodes with hard evidence | |
| const NodeProperty< Idx > & | hardEvidence () const |
| indicate for each node with hard evidence which value it took | |
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 | |
| 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 *bn) final |
| fired after a new Bayes 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 BN 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 | |
| void | _findRelevantTensorsWithdSeparation_ (_ScheduleMultiDimSet_ &pot_list, gum::VariableSet &kept_vars) |
| update a set of tensors: the remaining are those to be combined to produce a message on a separator | |
| void | _findRelevantTensorsWithdSeparation2_ (_ScheduleMultiDimSet_ &pot_list, gum::VariableSet &kept_vars) |
| update a set of tensors: the remaining are those to be combined to produce a message on a separator | |
| void | _findRelevantTensorsWithdSeparation3_ (_ScheduleMultiDimSet_ &pot_list, gum::VariableSet &kept_vars) |
| update a set of tensors: the remaining are those to be combined to produce a message on a separator | |
| void | _findRelevantTensorsGetAll_ (_ScheduleMultiDimSet_ &pot_list, gum::VariableSet &kept_vars) |
| update a set of tensors: the remaining are those to be combined to produce a message on a separator | |
| void | _findRelevantTensorsXX_ (_ScheduleMultiDimSet_ &pot_list, gum::VariableSet &kept_vars) |
| update a set of tensors: the remaining are those to be combined to produce a message on a separator | |
| _ScheduleMultiDimSet_ | _removeBarrenVariables_ (Schedule &schedule, _ScheduleMultiDimSet_ &pot_list, gum::VariableSet &del_vars) |
| remove barren variables and return the newly created projected tensors | |
| _TensorSet_ | _removeBarrenVariables_ (_TensorSet_ &pot_list, gum::VariableSet &del_vars) |
| remove barren variables without schedules and return the newly created projected tensors | |
| 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 | |
| void | _setAllMarginalTargets_ () |
| sets all the nodes of the Bayes net as targets | |
Private Attributes | |
| RelevantTensorsFinderType | _find_relevant_tensor_type_ |
| the type of relevant tensor finding algorithm to be used | |
| void(ShaferShenoyInference< GUM_SCALAR >::* | _findRelevantTensors_ )(Set< const IScheduleMultiDim * > &pot_list, gum::VariableSet &kept_vars) |
| update a set of tensors: the remaining are those to be combined to produce a message on a separator | |
| FindBarrenNodesType | _barren_nodes_type_ {FindBarrenNodesType::FIND_BARREN_NODES} |
| the type of barren nodes computation we wish | |
| 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 BN 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 Bayes net), associate an ID in the JT | |
| 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 | |
| NodeProperty< 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 BN | |
| NodeProperty< const IScheduleMultiDim * > | _node_to_hard_ev_projected_CPTs_ |
| the CPTs that were projected due to hard evidence nodes | |
| NodeSet | _hard_ev_nodes_ |
| the hard evidence nodes which were projected in CPTs | |
| NodeProperty< EvidenceChangeType > | _evidence_changes_ |
| indicates which nodes of the BN 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 | |
Implementation of Shafer-Shenoy's propagation algorithm for inference in Bayesian networks.
Definition at line 88 of file ShaferShenoyInference.h.
|
private |
Definition at line 263 of file ShaferShenoyInference.h.
|
private |
Definition at line 262 of file ShaferShenoyInference.h.
|
private |
Definition at line 265 of file ShaferShenoyInference.h.
|
private |
the possible types of evidence changes
| Enumerator | |
|---|---|
| EVIDENCE_ADDED | |
| EVIDENCE_ERASED | |
| EVIDENCE_MODIFIED | |
Definition at line 403 of file ShaferShenoyInference.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
References gum::BayesNetInference< GUM_SCALAR >::BN(), gum::DSEP_BAYESBALL_TENSORS, and gum::FIND_BARREN_NODES.
Referenced by ShaferShenoyInference(), and operator=().
|
delete |
avoid copy constructors
References ShaferShenoyInference().
| gum::ShaferShenoyInference< GUM_SCALAR >::~ShaferShenoyInference | ( | ) |
destructor
|
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 |
update a set of tensors: the remaining are those to be combined to produce a message on a separator
|
private |
update a set of tensors: the remaining are those to be combined to produce a message on a separator
|
private |
update a set of tensors: the remaining are those to be combined to produce a message on a separator
|
private |
update a set of tensors: the remaining are those to be combined to produce a message on a separator
|
private |
update a set of tensors: the remaining are those to be combined to produce a message on a separator
|
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
|
private |
remove barren variables without schedules and return the newly created projected tensors
|
private |
remove barren variables and return the newly created projected tensors
|
privateinherited |
sets all the nodes of the Bayes net as targets
Definition at line 229 of file marginalTargetedInference_tpl.h.
References _targets_, gum::BayesNetInference< GUM_SCALAR >::BN(), gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), and onAllMarginalTargetsAdded_().
Referenced by onModelChanged_().
|
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 144 of file marginalTargetedInference_tpl.h.
References _targets_, gum::BayesNetInference< GUM_SCALAR >::BN(), GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), onMarginalTargetAdded_(), gum::GraphicalModelInference< GUM_SCALAR >::OutdatedStructure, gum::GraphicalModelInference< GUM_SCALAR >::setState_(), and setTargetedMode_().
|
finalvirtualinherited |
adds a new hard evidence on node named nodeName
| UndefinedElement | if nodeName does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if nodeName already has an evidence |
Definition at line 235 of file graphicalModelInference_tpl.h.
References addEvidence(), and model().
|
finalvirtualinherited |
adds a new hard evidence on node named nodeName
| UndefinedElement | if nodeName does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if nodeName already has an evidence |
Definition at line 249 of file graphicalModelInference_tpl.h.
References addEvidence(), and model().
|
finalvirtualinherited |
adds a new evidence on node named nodeName (might be soft or hard)
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if nodeName already has an evidence |
| FatalError | if vals=[0,0,...,0] |
| InvalidArgument | if the size of vals is different from the domain size of node nodeName |
Definition at line 281 of file graphicalModelInference_tpl.h.
References addEvidence(), and model().
|
finalvirtualinherited |
adds a new evidence on node id (might be soft or hard)
| UndefinedElement | if the tensor is defined over several nodes |
| UndefinedElement | if the node on which the tensor is defined does not belong to the Bayesian network |
| InvalidArgument | if the node of the tensor already has an evidence |
| FatalError | if pot=[0,0,...,0] |
Definition at line 323 of file graphicalModelInference_tpl.h.
References addEvidence().
|
finalvirtualinherited |
adds a new hard evidence on node id
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if id already has an evidence |
Definition at line 229 of file graphicalModelInference_tpl.h.
References _createHardEvidence_(), and addEvidence().
Referenced by addEvidence(), addEvidence(), addEvidence(), addEvidence(), addEvidence(), addEvidence(), addEvidence(), addListOfEvidence(), addSetOfEvidence(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedMRFInference< GUM_SCALAR >::evidenceJointImpact(), and gum::LoopySamplingInference< GUM_SCALAR, APPROX >::makeInference_().
|
finalvirtualinherited |
adds a new hard evidence on node id
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if id already has an evidence |
Definition at line 242 of file graphicalModelInference_tpl.h.
References addEvidence(), and model().
|
finalvirtualinherited |
adds a new evidence on node id (might be soft or hard)
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if id already has an evidence |
| FatalError | if vals=[0,0,...,0] |
| InvalidArgument | if the size of vals is different from the domain size of node id |
Definition at line 257 of file graphicalModelInference_tpl.h.
References _model_, addEvidence(), and GUM_ERROR.
|
finalvirtualinherited |
adds a new evidence on node id (might be soft or hard)
| UndefinedElement | if the tensor is defined over several nodes |
| UndefinedElement | if the node on which the tensor is defined does not belong to the Bayesian network |
| InvalidArgument | if the node of the tensor already has an evidence |
| FatalError | if pot=[0,0,...,0] |
Definition at line 288 of file graphicalModelInference_tpl.h.
References _evidence_, _hard_evidence_, _hard_evidence_nodes_, _isHardEvidence_(), _model_, _soft_evidence_nodes_, GUM_ERROR, hasEvidence(), onEvidenceAdded_(), OutdatedStructure, and setState_().
|
finalvirtualinherited |
Add a set of nodes as a new joint target. As a collateral effect, every node is added as a marginal target.
| UndefinedElement | if some node(s) do not belong to the Bayes net |
Definition at line 126 of file jointTargetedInference_tpl.h.
References _joint_targets_, gum::BayesNetInference< GUM_SCALAR >::BN(), eraseJointTarget(), GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), onJointTargetAdded_(), gum::GraphicalModelInference< GUM_SCALAR >::OutdatedStructure, gum::GraphicalModelInference< GUM_SCALAR >::setState_(), and gum::MarginalTargetedInference< GUM_SCALAR >::setTargetedMode_().
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 Bayes net |
Definition at line 164 of file marginalTargetedInference_tpl.h.
References addTarget(), gum::BayesNetInference< GUM_SCALAR >::BN(), GUM_ERROR, and gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_().
|
finalvirtualinherited |
Add a marginal target to the list of targets.
| UndefinedElement | if target is not a NodeId in the Bayes net |
Definition at line 122 of file marginalTargetedInference_tpl.h.
References _targets_, gum::BayesNetInference< GUM_SCALAR >::BN(), GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), onMarginalTargetAdded_(), gum::GraphicalModelInference< GUM_SCALAR >::OutdatedStructure, gum::GraphicalModelInference< GUM_SCALAR >::setState_(), and setTargetedMode_().
Referenced by addTarget(), and evidenceImpact().
|
finalvirtualinherited |
Returns a constant reference over the IBayesNet referenced by this class.
| UndefinedElement | is raised if no Bayes net has been assigned to the inference. |
Definition at line 75 of file BayesNetInference_tpl.h.
References gum::GraphicalModelInference< GUM_SCALAR >::model().
Referenced by gum::LazyPropagation< GUM_SCALAR >::LazyPropagation(), gum::ShaferShenoyInference< GUM_SCALAR >::ShaferShenoyInference(), gum::VariableElimination< GUM_SCALAR >::VariableElimination(), gum::MarginalTargetedInference< GUM_SCALAR >::_setAllMarginalTargets_(), gum::MarginalTargetedInference< GUM_SCALAR >::addAllTargets(), gum::JointTargetedInference< GUM_SCALAR >::addJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), gum::SamplingInference< GUM_SCALAR >::contextualize(), gum::SamplingInference< GUM_SCALAR >::currentPosterior(), gum::SamplingInference< GUM_SCALAR >::currentPosterior(), gum::ImportanceSampling< GUM_SCALAR >::draw_(), gum::MonteCarloSampling< GUM_SCALAR >::draw_(), gum::WeightedSampling< GUM_SCALAR >::draw_(), gum::JointTargetedInference< GUM_SCALAR >::eraseJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::MarginalTargetedInference< GUM_SCALAR >::evidenceImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::MarginalTargetedInference< GUM_SCALAR >::H(), gum::JointTargetedInference< GUM_SCALAR >::isJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::isTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::isTarget(), gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation(), gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation(), gum::JointTargetedInference< GUM_SCALAR >::posterior(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), gum::SamplingInference< GUM_SCALAR >::posterior_(), gum::SamplingInference< GUM_SCALAR >::samplingBN(), and gum::Estimator< GUM_SCALAR >::setFromLBP().
|
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 jointTargetedInference_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 jointTargetedInference_tpl.h.
References gum::MarginalTargetedInference< GUM_SCALAR >::eraseAllTargets().
Referenced by eraseAllTargets().
|
virtualinherited |
Clear all previously defined targets (marginal and joint targets).
Clear all previously defined targets. As a result, no posterior can be computed (since we can only compute the posteriors of the marginal or joint targets that have been added by the user).
Reimplemented from gum::MarginalTargetedInference< GUM_SCALAR >.
Definition at line 119 of file jointTargetedInference_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 jointTargetedInference_tpl.h.
References _joint_targets_, gum::BayesNetInference< GUM_SCALAR >::BN(), GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), onJointTargetErased_(), gum::GraphicalModelInference< GUM_SCALAR >::OutdatedStructure, and gum::GraphicalModelInference< GUM_SCALAR >::setState_().
Referenced by addJointTarget().
|
finalvirtualinherited |
removes an existing (marginal) target
Definition at line 199 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), eraseTarget(), GUM_ERROR, and gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_().
|
finalvirtualinherited |
removes an existing (marginal) target
Definition at line 176 of file marginalTargetedInference_tpl.h.
References _targeted_mode_, _targets_, gum::BayesNetInference< GUM_SCALAR >::BN(), GUM_ERROR, gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_(), onMarginalTargetErased_(), gum::GraphicalModelInference< GUM_SCALAR >::OutdatedStructure, and gum::GraphicalModelInference< GUM_SCALAR >::setState_().
Referenced by eraseTarget().
|
inherited |
returns the set of evidence
Definition at line 587 of file graphicalModelInference_tpl.h.
References _evidence_.
Referenced by gum::ImportanceSampling< GUM_SCALAR >::onContextualize_(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), and gum::MarginalTargetedMRFInference< GUM_SCALAR >::posterior().
|
inherited |
Create a gum::Tensor for P(target|evs) (for all instanciation of target and evs).
| target | the nodeId of the target variable |
| evs | the nodeId of the observed variable |
Definition at line 319 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and evidenceImpact().
|
inherited |
Create a gum::Tensor for P(target|evs) (for all instanciation of target and evs).
| bn | the BayesNet |
| target | the nodeId of the targetted variable |
| evs | the vector of nodeId of the observed variables |
Definition at line 280 of file marginalTargetedInference_tpl.h.
References gum::GraphicalModelInference< GUM_SCALAR >::addEvidence(), addTarget(), gum::BayesNetInference< GUM_SCALAR >::BN(), gum::GraphicalModelInference< GUM_SCALAR >::chgEvidence(), gum::Set< Key >::contains(), gum::Instantiation::end(), gum::GraphicalModelInference< GUM_SCALAR >::eraseAllEvidence(), eraseAllTargets(), GUM_ERROR, gum::Instantiation::incNotVar(), gum::Instantiation::incVar(), gum::GraphicalModelInference< GUM_SCALAR >::makeInference(), posterior(), gum::Instantiation::setFirst(), gum::Instantiation::setFirstVar(), and gum::Instantiation::val().
Referenced by evidenceImpact().
|
inherited |
Create a gum::Tensor for P(joint targets|evs) (for all instanciation of targets and evs).
Definition at line 252 of file jointTargetedInference_tpl.h.
References gum::Instantiation::add(), gum::GraphicalModelInference< GUM_SCALAR >::addEvidence(), addJointTarget(), gum::BayesNetInference< GUM_SCALAR >::BN(), 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::Instantiation::setFirstIn(), gum::Instantiation::setFirstOut(), gum::MarginalTargetedInference< 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 293 of file jointTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), evidenceJointImpact(), and gum::MarginalTargetedInference< GUM_SCALAR >::targets().
|
finalvirtual |
returns the probability of evidence
Implements gum::EvidenceInference< 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 275 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and H().
|
finalvirtualinherited |
Entropy Compute Shanon's entropy of a node given the observation.
Definition at line 267 of file marginalTargetedInference_tpl.h.
References posterior().
Referenced by H().
|
inherited |
indicate for each node with hard evidence which value it took
Definition at line 580 of file graphicalModelInference_tpl.h.
References _hard_evidence_.
Referenced by gum::GibbsSampling< GUM_SCALAR >::GibbsSampling(), gum::SamplingInference< GUM_SCALAR >::contextualize(), gum::ImportanceSampling< GUM_SCALAR >::draw_(), and gum::WeightedSampling< GUM_SCALAR >::draw_().
|
inherited |
returns the set of nodes with hard evidence
the set of nodes that received hard evidence
Definition at line 599 of file graphicalModelInference_tpl.h.
References _hard_evidence_nodes_.
Referenced by gum::SamplingInference< GUM_SCALAR >::contextualize(), gum::ImportanceSampling< GUM_SCALAR >::draw_(), gum::MonteCarloSampling< GUM_SCALAR >::draw_(), gum::WeightedSampling< GUM_SCALAR >::draw_(), gum::ImportanceSampling< GUM_SCALAR >::onContextualize_(), gum::MarginalTargetedInference< GUM_SCALAR >::posterior(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::posterior(), gum::SamplingInference< GUM_SCALAR >::setEstimatorFromBN_(), and gum::SamplingInference< GUM_SCALAR >::setEstimatorFromLBP_().
|
finalvirtualinherited |
indicates whether some node(s) have received evidence
Definition at line 346 of file graphicalModelInference_tpl.h.
References _evidence_.
Referenced by addEvidence(), chgEvidence(), eraseEvidence(), and hasEvidence().
|
finalvirtualinherited |
indicates whether node id has received an evidence
Definition at line 371 of file graphicalModelInference_tpl.h.
References hasEvidence(), and model().
|
finalvirtualinherited |
indicates whether node id has received an evidence
Definition at line 352 of file graphicalModelInference_tpl.h.
References _evidence_.
|
finalvirtualinherited |
indicates whether node id has received a hard evidence
Definition at line 378 of file graphicalModelInference_tpl.h.
References hasHardEvidence(), and model().
|
finalvirtualinherited |
indicates whether node id has received a hard evidence
Definition at line 358 of file graphicalModelInference_tpl.h.
References _hard_evidence_nodes_.
Referenced by chgEvidence(), gum::ImportanceSampling< GUM_SCALAR >::draw_(), eraseEvidence(), hasHardEvidence(), and gum::JointTargetedMRFInference< GUM_SCALAR >::jointPosterior().
|
inlineprotectedinherited |
Definition at line 542 of file graphicalModelInference.h.
References _model_.
Referenced by gum::EvidenceInference< GUM_SCALAR >::EvidenceInference(), gum::EvidenceMRFInference< GUM_SCALAR >::EvidenceMRFInference(), gum::JointTargetedInference< GUM_SCALAR >::JointTargetedInference(), gum::JointTargetedMRFInference< GUM_SCALAR >::JointTargetedMRFInference(), gum::MarginalTargetedInference< GUM_SCALAR >::MarginalTargetedInference(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::MarginalTargetedMRFInference(), _computeDomainSizes_(), gum::MarginalTargetedInference< GUM_SCALAR >::_setAllMarginalTargets_(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::_setAllMarginalTargets_(), gum::MarginalTargetedInference< GUM_SCALAR >::addAllTargets(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addAllTargets(), gum::JointTargetedInference< GUM_SCALAR >::addJointTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::addJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addTarget(), gum::JointTargetedInference< GUM_SCALAR >::eraseJointTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::eraseJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::eraseTarget(), gum::JointTargetedInference< GUM_SCALAR >::isJointTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::isJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::isTarget(), and gum::MarginalTargetedMRFInference< GUM_SCALAR >::isTarget().
|
finalvirtualinherited |
indicates whether node id has received a soft evidence
Definition at line 385 of file graphicalModelInference_tpl.h.
References hasSoftEvidence(), and model().
|
finalvirtualinherited |
indicates whether node id has received a soft evidence
Definition at line 364 of file graphicalModelInference_tpl.h.
References _soft_evidence_nodes_.
Referenced by hasSoftEvidence().
|
inherited |
Mutual information between X and Y.
| OperationNotAllowed | in these cases |
|
inherited |
Mutual information between X and Y.
| OperationNotAllowed | in these cases |
|
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().
|
finalvirtualnoexceptinherited |
indicates whether the inference is in a target mode
Definition at line 223 of file marginalTargetedInference_tpl.h.
References _targeted_mode_.
|
finalvirtualinherited |
return true if target is a joint target.
Definition at line 86 of file jointTargetedInference_tpl.h.
References _joint_targets_, gum::BayesNetInference< GUM_SCALAR >::BN(), GUM_ERROR, and gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_().
|
finalvirtualinherited |
return true if variable is a (marginal) target
Definition at line 105 of file marginalTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), and isTarget().
|
finalvirtualinherited |
return true if variable is a (marginal) target
Definition at line 90 of file marginalTargetedInference_tpl.h.
References _targets_, gum::BayesNetInference< GUM_SCALAR >::BN(), GUM_ERROR, and gum::GraphicalModelInference< GUM_SCALAR >::hasNoModel_().
Referenced by isTarget(), gum::JointTargetedInference< GUM_SCALAR >::posterior(), and posterior().
|
protectedinherited |
Definition at line 327 of file marginalTargetedInference_tpl.h.
References _targeted_mode_.
|
inherited |
Mutual information between targets.
Definition at line 301 of file jointTargetedInference_tpl.h.
References gum::Instantiation::add(), addJointTarget(), gum::BayesNetInference< GUM_SCALAR >::BN(), 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::Instantiation::nbrDim(), gum::Instantiation::setFirst(), gum::MarginalTargetedInference< 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 351 of file jointTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), jointMutualInformation(), and gum::MarginalTargetedInference< 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 207 of file jointTargetedInference_tpl.h.
References _joint_targets_, gum::Set< Key >::empty(), gum::GraphicalModelInference< GUM_SCALAR >::isInferenceDone(), gum::Set< Key >::isStrictSubsetOf(), jointPosterior_(), and gum::GraphicalModelInference< GUM_SCALAR >::makeInference().
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::JointTargetedInference< 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::JointTargetedInference< GUM_SCALAR >.
References jointPosterior_().
| const JoinTree * gum::ShaferShenoyInference< 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 190 of file jointTargetedInference_tpl.h.
References _joint_targets_.
| const JunctionTree * gum::ShaferShenoyInference< 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 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 196 of file jointTargetedInference_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 217 of file marginalTargetedInference_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::JointTargetedInference< GUM_SCALAR >.
References onAllJointTargetsErased_().
Referenced by onAllJointTargetsErased_().
|
finalprotectedvirtual |
fired after all the nodes of the BN are added as single targets
Implements gum::MarginalTargetedInference< GUM_SCALAR >.
References onAllMarginalTargetsAdded_().
Referenced by onAllMarginalTargetsAdded_().
|
finalprotectedvirtual |
fired before all the single targets are removed
Implements gum::MarginalTargetedInference< GUM_SCALAR >.
References onAllMarginalTargetsErased_().
Referenced by onAllMarginalTargetsErased_().
|
finalprotectedvirtual |
fired before all single and joint targets are removed
Implements gum::JointTargetedInference< 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::JointTargetedInference< 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::JointTargetedInference< GUM_SCALAR >.
References onJointTargetErased_().
Referenced by onJointTargetErased_().
|
finalprotectedvirtual |
fired after a new single target is inserted
| id | The target variable's id. |
Implements gum::MarginalTargetedInference< GUM_SCALAR >.
References onMarginalTargetAdded_().
Referenced by onMarginalTargetAdded_().
|
finalprotectedvirtual |
fired before a single target is removed
| id | The target variable's id. |
Implements gum::MarginalTargetedInference< GUM_SCALAR >.
References onMarginalTargetErased_().
Referenced by onMarginalTargetErased_().
|
finalprotectedvirtual |
fired after a new Bayes net has been assigned to the inference engine
Reimplemented from gum::JointTargetedInference< GUM_SCALAR >.
References onModelChanged_().
Referenced by onModelChanged_().
|
inlinefinalprotectedvirtual |
fired when the state of the inference engine is changed
Implements gum::GraphicalModelInference< GUM_SCALAR >.
Definition at line 216 of file ShaferShenoyInference.h.
References onStateChanged_().
Referenced by onStateChanged_().
|
delete |
|
finalvirtualinherited |
Computes and returns the posterior of a node.
| node | the node for which we need a posterior probability |
| UndefinedElement | if node is not in the set of targets |
Reimplemented from gum::MarginalTargetedInference< GUM_SCALAR >.
Definition at line 246 of file jointTargetedInference_tpl.h.
References gum::BayesNetInference< GUM_SCALAR >::BN(), 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::MarginalTargetedInference< GUM_SCALAR >.
Definition at line 238 of file jointTargetedInference_tpl.h.
References gum::MarginalTargetedInference< GUM_SCALAR >::isTarget(), jointPosterior(), and gum::MarginalTargetedInference< GUM_SCALAR >::posterior().
Referenced by posterior().
|
finalprotectedvirtual |
returns the posterior of a given variable
| id | The variable's id. |
Implements gum::MarginalTargetedInference< 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().
|
virtualinherited |
assigns a new BN to the inference engine
Assigns a new BN to the BayesNetInference engine and sends messages to the descendants of BayesNetInference to inform them that the BN has changed.
Definition at line 81 of file BayesNetInference_tpl.h.
References gum::GraphicalModelInference< GUM_SCALAR >::setModel_().
| void gum::ShaferShenoyInference< GUM_SCALAR >::setFindBarrenNodesType | ( | FindBarrenNodesType | type | ) |
sets how we determine barren nodes
Barren nodes are unnecessary for probability inference, so they can be safely discarded in this case (type = FIND_BARREN_NODES). This speeds-up inference. However, there are some cases in which we do not want to remove barren nodes, typically when we want to answer queries such as Most Probable Explanations (MPE).
|
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_().
|
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_().
| void gum::ShaferShenoyInference< GUM_SCALAR >::setRelevantTensorsFinderType | ( | RelevantTensorsFinderType | type | ) |
sets how we determine the relevant tensors to combine
When a clique sends a message to a separator, it first determines the set of the tensors it contains and the tensors contained in the messages it received. If RelevantTensorsFinderType = FIND_ALL, all these tensors are combined and projected to produce the message sent to the separator. If RelevantTensorsFinderType = DSEP_BAYESBALL_NODES, then only the set of tensors d-connected to the variables of the separator are kept for combination and projection.
|
finalprotectedvirtualinherited |
set the state of the inference engine and call the notification onStateChanged_ when necessary (i.e. when the state has effectively changed).
Definition at line 117 of file graphicalModelInference_tpl.h.
References _state_, onStateChanged_(), and state().
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::addAllTargets(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addAllTargets(), addEvidence(), gum::JointTargetedInference< GUM_SCALAR >::addJointTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::addJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::addTarget(), chgEvidence(), clear(), eraseAllEvidence(), gum::JointTargetedInference< GUM_SCALAR >::eraseAllJointTargets(), gum::JointTargetedMRFInference< GUM_SCALAR >::eraseAllJointTargets(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseAllTargets(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::eraseAllTargets(), eraseEvidence(), gum::JointTargetedInference< GUM_SCALAR >::eraseJointTarget(), gum::JointTargetedMRFInference< GUM_SCALAR >::eraseJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::eraseTarget(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::eraseTarget(), makeInference(), prepareInference(), setModel_(), setModelDuringConstruction_(), setOutdatedStructureState_(), and setOutdatedTensorsState_().
|
protectedinherited |
Definition at line 332 of file marginalTargetedInference_tpl.h.
References _targeted_mode_, and _targets_.
Referenced by addAllTargets(), gum::JointTargetedInference< GUM_SCALAR >::addJointTarget(), addTarget(), and eraseAllTargets().
| void gum::ShaferShenoyInference< GUM_SCALAR >::setTriangulation | ( | const Triangulation & | new_triangulation | ) |
use a new triangulation algorithm
|
inherited |
returns the set of nodes with soft evidence
the set of nodes that received soft evidence
Definition at line 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_().
|
finalvirtualnoexceptinherited |
returns the list of marginal targets
Definition at line 211 of file marginalTargetedInference_tpl.h.
References _targets_.
Referenced by gum::VariableElimination< GUM_SCALAR >::_createNewJT_(), gum::VariableElimination< GUM_SCALAR >::_unnormalizedJointPosterior_(), gum::VariableElimination< GUM_SCALAR >::_unnormalizedJointPosterior_(), gum::SamplingInference< GUM_SCALAR >::contextualize(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedInference< GUM_SCALAR >::evidenceJointImpact(), gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation(), gum::JointTargetedInference< GUM_SCALAR >::jointMutualInformation(), and gum::JointTargetedInference< GUM_SCALAR >::VI().
|
finalprotectedvirtual |
returns a fresh tensor equal to P(argument,evidence)
Implements gum::JointTargetedInference< GUM_SCALAR >.
References unnormalizedJointPosterior_().
|
finalprotectedvirtual |
returns a fresh tensor equal to P(argument,evidence)
Implements gum::JointTargetedInference< GUM_SCALAR >.
References unnormalizedJointPosterior_().
Referenced by unnormalizedJointPosterior_(), and 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 makeInference_.
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 makeInference_.
Implements gum::GraphicalModelInference< GUM_SCALAR >.
References updateOutdatedTensors_().
Referenced by updateOutdatedTensors_().
|
inherited |
Variation of information between X and Y.
| OperationNotAllowed | in these cases |
References gum::MarginalTargetedInference< GUM_SCALAR >::targets().
|
inherited |
Variation of information between X and Y.
| OperationNotAllowed | in these cases |
|
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 361 of file ShaferShenoyInference.h.
|
private |
the type of barren nodes computation we wish
Definition at line 279 of file ShaferShenoyInference.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_tensors.
Definition at line 346 of file ShaferShenoyInference.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 CPTs 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 339 of file ShaferShenoyInference.h.
|
inlineprivate |
the operator for performing the combinations
Definition at line 279 of file ShaferShenoyInference.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 375 of file ShaferShenoyInference.h.
|
private |
indicates which nodes of the BN have evidence that changed since the last inference
Definition at line 407 of file ShaferShenoyInference.h.
|
private |
the type of relevant tensor finding algorithm to be used
Definition at line 269 of file ShaferShenoyInference.h.
|
private |
update a set of tensors: the remaining are those to be combined to produce a message on a separator
Definition at line 274 of file ShaferShenoyInference.h.
|
private |
the undigraph extracted from the BN and used to construct the join tree
If all nodes are targets, this graph corresponds to the moral graph of the BN. Otherwise, it may be a subgraph of this moral graph. For instance if the BN is A->B->C and only B is a target, graph will be equal to A-B if we exploit barren nodes (C is a barren node and, therefore, can be removed for inference).
Definition at line 302 of file ShaferShenoyInference.h.
|
private |
the hard evidence nodes which were projected in CPTs
Definition at line 400 of file ShaferShenoyInference.h.
|
private |
indicates whether a new join tree is needed for the next inference
when modifying the set of hard evidence, we can determine that the current JT is no more appropriate for inference. This variable enables us to keep track of this.
Definition at line 314 of file ShaferShenoyInference.h.
|
private |
the set of set target posteriors computed during the last inference
the posteriors are owned by ShaferShenoyInference.
Definition at line 369 of file ShaferShenoyInference.h.
|
private |
for each set target, assign a clique in the JT that contains it
Definition at line 329 of file ShaferShenoyInference.h.
|
privateinherited |
the set of joint targets
Definition at line 323 of file jointTargetedInference.h.
Referenced by addJointTarget(), eraseAllJointTargets(), eraseJointTarget(), isJointTarget(), jointPosterior(), jointTargets(), nbrJointTargets(), and onModelChanged_().
|
private |
the join (or junction) tree used to answer the last inference query
Definition at line 305 of file ShaferShenoyInference.h.
|
private |
the junction tree to answer the last inference query
Definition at line 308 of file ShaferShenoyInference.h.
|
private |
indicates whether a message (from one clique to another) has been computed
Here, all the messages, computed or not, are put into the property, only the Boolean makes the difference between messages computed and those that were not computed
Definition at line 381 of file ShaferShenoyInference.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 Bayes net), associate an ID in the JT
Definition at line 326 of file ShaferShenoyInference.h.
|
private |
the CPTs that were projected due to hard evidence nodes
For each node whose CPT is defined over some nodes that contain some hard evidence, assigns a new projected CPT that does not contain these nodes anymore.
Definition at line 397 of file ShaferShenoyInference.h.
|
private |
the soft evidence stored in the cliques per their assigned node in the BN
This variable is useful for method updateOutdatedTensors_: it enables to know which soft evidence should be removed/added into the cliques of the join tree.
Definition at line 390 of file ShaferShenoyInference.h.
|
staticconstexprprivate |
|
inlineprivate |
the operator for performing the projections
Definition at line 279 of file ShaferShenoyInference.h.
|
private |
a clique node used as a root in each connected component of JT
For usual probabilistic inference, roots is useless. This is useful when computing the probability of evidence. In this case, we need to compute this probability in every connected component and multiply them to get the overall probability of evidence.
Definition at line 323 of file ShaferShenoyInference.h.
|
staticconstexprprivate |
minimal number of operations to perform in the JT to use schedules
Definition at line 413 of file ShaferShenoyInference.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 it did not receive any tensor, then it contains a nullptr pointer.
Definition at line 352 of file ShaferShenoyInference.h.
|
private |
the set of single posteriors computed during the last inference
the posteriors are owned by ShaferShenoyInference.
Definition at line 365 of file ShaferShenoyInference.h.
|
privateinherited |
whether the actual targets are default
Definition at line 260 of file marginalTargetedInference.h.
Referenced by MarginalTargetedInference(), eraseTarget(), isInTargetMode(), isTargetedMode_(), onModelChanged_(), and setTargetedMode_().
|
privateinherited |
the set of marginal targets
Definition at line 263 of file marginalTargetedInference.h.
Referenced by MarginalTargetedInference(), _setAllMarginalTargets_(), addAllTargets(), addTarget(), eraseAllTargets(), eraseTarget(), isTarget(), nbrTargets(), setTargetedMode_(), and targets().
|
private |
the triangulation class creating the junction tree used for inference
Definition at line 290 of file ShaferShenoyInference.h.
|
private |
indicates whether we should transform junction trees into binary join trees
Definition at line 294 of file ShaferShenoyInference.h.
|
private |
indicates whether we should use schedules for inference
Definition at line 410 of file ShaferShenoyInference.h.