![]() |
aGrUM
0.16.0
|
Portion of a BN identified by the list of nodes and a BayesNet. More...
#include <agrum/BN/BayesNetFragment.h>
Public Member Functions | |
bool | operator== (const IBayesNet< GUM_SCALAR > &from) const |
This operator compares 2 BNs ! More... | |
bool | operator!= (const IBayesNet< GUM_SCALAR > &from) const |
Size | dim () const |
Returns the dimension (the number of free parameters) in this bayes net. More... | |
Size | maxVarDomainSize () const |
GUM_SCALAR | minParam () const |
GUM_SCALAR | maxParam () const |
GUM_SCALAR | minNonZeroParam () const |
GUM_SCALAR | maxNonOneParam () const |
std::string | toString () const |
NodeSet | minimalCondSet (NodeId target, const NodeSet &soids) const |
NodeSet | minimalCondSet (const NodeSet &targets, const NodeSet &soids) const |
double | log10DomainSize () const |
bool | hasSameStructure (const DAGmodel &other) |
void | attachSignal__ (__sig__::ISignaler *sender) |
void | detachSignal__ (__sig__::ISignaler *sender) |
Constructors / Destructors | |
BayesNetFragment ()=delete | |
BayesNetFragment (const BayesNetFragment< GUM_SCALAR > &fragment)=delete | |
BayesNetFragment (BayesNetFragment< GUM_SCALAR > &&fragment)=delete | |
BayesNetFragment (const IBayesNet< GUM_SCALAR > &bn) | |
virtual | ~BayesNetFragment () |
signals | |
virtual void | whenNodeAdded (const void *src, NodeId id) noexcept override |
the action to take when a new node is inserted into the graph More... | |
virtual void | whenNodeDeleted (const void *src, NodeId id) noexcept override |
the action to take when a node has just been removed from the graph More... | |
virtual void | whenArcAdded (const void *src, NodeId from, NodeId to) noexcept override |
the action to take when a new arc is inserted into the graph More... | |
virtual void | whenArcDeleted (const void *src, NodeId from, NodeId to) noexcept override |
the action to take when an arc has just been removed from the graph More... | |
IBayesNet interface | |
virtual const Potential< GUM_SCALAR > & | cpt (NodeId varId) const override |
Returns the CPT of a variable. More... | |
virtual const VariableNodeMap & | variableNodeMap () const override |
Returns a constant reference to the VariableNodeMap of this BN. More... | |
virtual const DiscreteVariable & | variable (NodeId id) const override |
Returns a constant reference over a variabe given it's node id. More... | |
virtual NodeId | nodeId (const DiscreteVariable &var) const override |
Return id node from discrete var pointer. More... | |
virtual NodeId | idFromName (const std::string &name) const override |
Getter by name. More... | |
virtual const DiscreteVariable & | variableFromName (const std::string &name) const override |
Getter by name. More... | |
virtual std::string | toDot () const override |
creates a dot representing the whole referred BN hilighting the fragment. More... | |
API for Fragment | |
bool | isInstalledNode (NodeId id) const noexcept |
check if a certain NodeId exists in the fragment More... | |
void | installNode (NodeId id) |
install a node referenced by its nodeId More... | |
void | installAscendants (NodeId id) |
install a node and all its ascendants More... | |
void | uninstallNode (NodeId id) noexcept |
uninstall a node referenced by its nodeId More... | |
void | installMarginal (NodeId id, const Potential< GUM_SCALAR > *pot) |
install a local marginal for a node into the fragment. More... | |
void | installCPT (NodeId id, const Potential< GUM_SCALAR > *pot) |
install a local cpt for a node into the fragment. More... | |
void | uninstallCPT (NodeId id) noexcept |
uninstall a local CPT. More... | |
bool | checkConsistency (NodeId id) const |
returns true if the nodeId's (local or not) cpt is consistent with its parents in the fragment More... | |
bool | checkConsistency () const noexcept |
returns true if all nodes in the fragment are consistent More... | |
Joint Probability manipulation methods | |
GUM_SCALAR | jointProbability (const Instantiation &i) const |
Compute a parameter of the joint probability for the BN (given an instantiation of the vars) More... | |
GUM_SCALAR | log2JointProbability (const Instantiation &i) const |
Compute a parameter of the log joint probability for the BN (given an instantiation of the vars) More... | |
Getter and setters | |
const std::string & | property (const std::string &name) const |
Return the value of the property name of this DAGModel. More... | |
const std::string & | propertyWithDefault (const std::string &name, const std::string &byDefault) const |
Return the value of the property name of this DAGModel. More... | |
void | setProperty (const std::string &name, const std::string &value) |
Add or change a property of this DAGModel. More... | |
Variable manipulation methods. | |
const DAG & | dag () const |
Returns a constant reference to the dag of this Bayes Net. More... | |
Size | size () const |
Returns the number of variables in this Directed Graphical Model. More... | |
Size | sizeArcs () const |
Returns the number of arcs in this Directed Graphical Model. More... | |
bool | empty () const |
Retursn true if this Directed Graphical Model is empty. More... | |
const NodeGraphPart & | nodes () const |
Returns a constant reference to the dag of this Bayes Net. More... | |
virtual Instantiation | completeInstantiation () const final |
Get an instantiation over all the variables of the model. More... | |
Arc manipulation methods. | |
const ArcSet & | arcs () const |
returns the set of nodes with arc ingoing to a given node More... | |
const NodeSet & | parents (const NodeId id) const |
returns the set of nodes with arc ingoing to a given node More... | |
const NodeSet & | parents (const std::string &name) const |
returns the set of nodes with arc ingoing to a given node More... | |
const NodeSet & | children (const NodeId id) const |
returns the set of nodes with arc outgoing from a given node More... | |
const NodeSet & | children (const std::string &name) const |
returns the set of nodes with arc ingoing to a given node More... | |
Graphical methods | |
const UndiGraph & | moralGraph (bool clear=true) const |
The node's id are coherent with the variables and nodes of the topology. More... | |
const Sequence< NodeId > & | topologicalOrder (bool clear=true) const |
The topological order stays the same as long as no variable or arcs are added or erased src the topology. More... | |
Protected Attributes | |
DAG | _dag |
The DAG of this Directed Graphical Model. More... | |
DiGraph * | _graph |
the graph to listen to More... | |
Protected Member Functions | |
void | _uninstallArc (NodeId from, NodeId to) noexcept |
void | _installArc (NodeId from, NodeId to) noexcept |
void | _installCPT (NodeId id, const Potential< GUM_SCALAR > *pot) noexcept |
void | _uninstallCPT (NodeId id) noexcept |
uninstall a local CPT. More... | |
Portion of a BN identified by the list of nodes and a BayesNet.
This class is a decorator of a BayesNet implementing the IBayesNet interface. CPTs can be shared with the BN or can be specific to the Fragment if different.
BayesNetFragment is a DiGraphListener in order to be synchronized (especially when removing nodes or arcs).
In a BayesNetFragment, one can install or remove nodes. An arc can be in the fragment if and only if its head and tail are installed in the fragment. *When installing a node, all the arcs that can be added in the fragment are *effectively installed (resp. *when uninstalling a node, etc.).
A BayesNetFragment can redefine potential for node. The main reason is to be able to install a node without installing all its parents (and its ascendants). So local CPT to the node can be installed. However, it is not done automatically.
If a cpt is not locally defined, the fragment uses the cpt defined in the referred BN. The checkConsistency() method verifies that, for all installed nodes, either all the parents are installed or a local CPT is defined.
Definition at line 73 of file BayesNetFragment.h.
|
delete |
|
delete |
|
delete |
|
explicit |
Definition at line 35 of file BayesNetFragment_tpl.h.
|
virtual |
Definition at line 43 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::__localCPTs, gum::BayesNetFragment< GUM_SCALAR >::_uninstallCPT(), and gum::DAGmodel::nodes().
|
protectednoexcept |
Definition at line 188 of file BayesNetFragment_tpl.h.
References gum::DAGmodel::_dag, and gum::DAG::addArc().
Referenced by gum::BayesNetFragment< GUM_SCALAR >::_installCPT(), and gum::BayesNetFragment< GUM_SCALAR >::uninstallCPT().
|
protectednoexcept |
Definition at line 194 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::__bn, gum::BayesNetFragment< GUM_SCALAR >::__localCPTs, gum::BayesNetFragment< GUM_SCALAR >::_installArc(), gum::BayesNetFragment< GUM_SCALAR >::_uninstallArc(), gum::BayesNetFragment< GUM_SCALAR >::_uninstallCPT(), gum::Set< Key, Alloc >::beginSafe(), gum::Set< Key, Alloc >::endSafe(), gum::BayesNetFragment< GUM_SCALAR >::isInstalledNode(), and gum::DAGmodel::parents().
Referenced by gum::BayesNetFragment< GUM_SCALAR >::installCPT(), and gum::BayesNetFragment< GUM_SCALAR >::installMarginal().
|
protectednoexcept |
Definition at line 182 of file BayesNetFragment_tpl.h.
References gum::DAGmodel::_dag, and gum::ArcGraphPart::eraseArc().
Referenced by gum::BayesNetFragment< GUM_SCALAR >::_installCPT(), and gum::BayesNetFragment< GUM_SCALAR >::whenArcDeleted().
|
protectednoexcept |
uninstall a local CPT.
Does nothing if no local CPT for this nodeId No check. No change in the topology. Checks are made in public methods.
Definition at line 239 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::__localCPTs.
Referenced by gum::BayesNetFragment< GUM_SCALAR >::_installCPT(), gum::BayesNetFragment< GUM_SCALAR >::uninstallCPT(), and gum::BayesNetFragment< GUM_SCALAR >::~BayesNetFragment().
|
inherited |
returns the set of nodes with arc ingoing to a given node
Note that the set of arcs returned may be empty if no arc within the ArcGraphPart is ingoing into the given node.
id | the node toward which the arcs returned are pointing |
Definition at line 104 of file DAGmodel_inl.h.
References gum::DAGmodel::_dag, and gum::ArcGraphPart::arcs().
Referenced by gum::EssentialGraph::__buildEssentialGraph(), gum::DAGmodel::__moralGraph(), gum::MarkovBlanket::hasSameStructure(), and gum::DAGmodel::hasSameStructure().
|
inherited |
bool gum::BayesNetFragment< GUM_SCALAR >::checkConsistency | ( | NodeId | id | ) | const |
returns true if the nodeId's (local or not) cpt is consistent with its parents in the fragment
NotFound | if the id is not in the fragment |
Definition at line 281 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::__bn, gum::BayesNetFragment< GUM_SCALAR >::cpt(), GUM_ERROR, gum::Set< Key, Alloc >::insert(), gum::BayesNetFragment< GUM_SCALAR >::isInstalledNode(), and gum::DAGmodel::parents().
|
noexcept |
returns true if all nodes in the fragment are consistent
Definition at line 296 of file BayesNetFragment_tpl.h.
References gum::DAGmodel::nodes().
Referenced by gum::BayesNetFragment< GUM_SCALAR >::toDot().
returns the set of nodes with arc outgoing from a given node
Note that the set of arcs returned may be empty if no arc within the ArcGraphPart is outgoing from the given node.
id | the node which is the tail of the arcs returned |
Definition at line 111 of file DAGmodel_inl.h.
References gum::DAGmodel::_dag, and gum::ArcGraphPart::children().
Referenced by gum::MarkovBlanket::__buildMarkovBlanket(), gum::DAGmodel::parents(), gum::prm::InstanceBayesNet< GUM_SCALAR >::toDot(), and gum::prm::ClassBayesNet< GUM_SCALAR >::toDot().
|
inlineinherited |
returns the set of nodes with arc ingoing to a given node
Note that the set of arcs returned may be empty if no arc within the ArcGraphPart is ingoing into the given node.
id | the node toward which the arcs returned are pointing |
Definition at line 165 of file DAGmodel.h.
References gum::DAGmodel::hasSameStructure(), gum::DAGmodel::idFromName(), gum::DAGmodel::log10DomainSize(), gum::DAGmodel::moralGraph(), gum::DAGmodel::operator=(), gum::DAGmodel::parents(), and gum::DAGmodel::topologicalOrder().
|
finalvirtualinherited |
Get an instantiation over all the variables of the model.
Definition at line 86 of file DAGmodel_inl.h.
References gum::DAGmodel::dag(), and gum::DAGmodel::variable().
|
overridevirtual |
Returns the CPT of a variable.
NotFound | If no variable's id matches varId. |
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 80 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::__bn, gum::BayesNetFragment< GUM_SCALAR >::__localCPTs, GUM_ERROR, and gum::BayesNetFragment< GUM_SCALAR >::isInstalledNode().
Referenced by gum::ImportanceSampling< GUM_SCALAR >::_unsharpenBN(), gum::BayesNetFragment< GUM_SCALAR >::checkConsistency(), and gum::BayesNetFragment< GUM_SCALAR >::uninstallCPT().
|
inherited |
Returns a constant reference to the dag of this Bayes Net.
Definition at line 63 of file DAGmodel_inl.h.
References gum::DAGmodel::_dag.
Referenced by gum::DAGmodel::__moralGraph(), gum::DAGmodel::completeInstantiation(), gum::learning::DAG2BNLearner< ALLOC >::createBN(), gum::learning::genericBNLearner::Database::Database(), gum::BayesNetFragment< GUM_SCALAR >::installCPT(), gum::BayesNetFragment< GUM_SCALAR >::isInstalledNode(), gum::MarginalTargetedInference< GUM_SCALAR >::MarginalTargetedInference(), gum::BayesBall::relevantPotentials(), gum::dSeparation::relevantPotentials(), gum::DAGmodel::size(), gum::BayesNetFragment< GUM_SCALAR >::toDot(), gum::DAGmodel::topologicalOrder(), gum::InfluenceDiagram< GUM_SCALAR >::toString(), and gum::BayesNetFragment< GUM_SCALAR >::whenArcDeleted().
|
inherited |
|
inherited |
Returns the dimension (the number of free parameters) in this bayes net.
\( dim(G)=\sum_{i \in nodes} ((r_i-1)\cdot q_i) \) where \( r_i \) is the number of instantiations of node \( i \) and \( q_i \) is the number of instantiations of its parents.
Definition at line 79 of file IBayesNet_tpl.h.
|
inherited |
Retursn true if this Directed Graphical Model is empty.
Definition at line 99 of file DAGmodel_inl.h.
References gum::DAGmodel::size().
Definition at line 121 of file DAGmodel.cpp.
References gum::DAGmodel::arcs(), gum::Set< Key, Alloc >::exists(), gum::DAGmodel::idFromName(), gum::DAGmodel::nodes(), gum::DAGmodel::size(), gum::DAGmodel::sizeArcs(), and gum::DAGmodel::variable().
Referenced by gum::DAGmodel::children().
|
overridevirtual |
Getter by name.
NotFound | if no such name exists in the graph. |
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 117 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::__bn, GUM_ERROR, and gum::BayesNetFragment< GUM_SCALAR >::isInstalledNode().
INLINE void gum::BayesNetFragment< GUM_SCALAR >::installAscendants | ( | NodeId | id | ) |
install a node and all its ascendants
NotFound | if the node does not exist in the referred BN |
Definition at line 165 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::__bn, and gum::BayesNetFragment< GUM_SCALAR >::installNode().
void gum::BayesNetFragment< GUM_SCALAR >::installCPT | ( | NodeId | id, |
const Potential< GUM_SCALAR > * | pot | ||
) |
install a local cpt for a node into the fragment.
This function will change the arcs from the parents to the node in order to be consistent with the new local potential.
id | the nodeId |
pot | the potential< |
NotFound | if the id is not in the fragment |
OperationNotAllowed | if the potential is not compliant with the variable or if a variable in the CPT is not a parent in the referred bn. |
Definition at line 215 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::__bn, gum::BayesNetFragment< GUM_SCALAR >::_installCPT(), gum::Set< Key, Alloc >::contains(), gum::DAGmodel::dag(), GUM_ERROR, gum::MultiDimDecorator< GUM_SCALAR >::nbrDim(), gum::DAGmodel::parents(), gum::MultiDimDecorator< GUM_SCALAR >::variable(), and gum::BayesNetFragment< GUM_SCALAR >::variable().
Referenced by gum::ImportanceSampling< GUM_SCALAR >::_onContextualize(), and gum::ImportanceSampling< GUM_SCALAR >::_unsharpenBN().
void gum::BayesNetFragment< GUM_SCALAR >::installMarginal | ( | NodeId | id, |
const Potential< GUM_SCALAR > * | pot | ||
) |
install a local marginal for a node into the fragment.
This function will remove all the arcs from the parents to the node.
id | the nodeId |
pot | the potential |
NotFound | if the id is not in the fragment |
OperationNotAllowed | if the potential is not compliant with the variable (or is not a marginal) |
Definition at line 261 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::__bn, gum::BayesNetFragment< GUM_SCALAR >::_installCPT(), GUM_ERROR, gum::BayesNetFragment< GUM_SCALAR >::isInstalledNode(), gum::MultiDimDecorator< GUM_SCALAR >::nbrDim(), and gum::MultiDimDecorator< GUM_SCALAR >::variable().
void gum::BayesNetFragment< GUM_SCALAR >::installNode | ( | NodeId | id | ) |
install a node referenced by its nodeId
NotFound | if the node does not exist in the referred BN |
Definition at line 146 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::__bn, gum::DAGmodel::_dag, gum::DAG::addArc(), gum::NodeGraphPart::addNodeWithId(), GUM_ERROR, and gum::BayesNetFragment< GUM_SCALAR >::isInstalledNode().
Referenced by gum::BayesNetFragment< GUM_SCALAR >::installAscendants().
|
noexcept |
check if a certain NodeId exists in the fragment
Definition at line 140 of file BayesNetFragment_tpl.h.
References gum::DAGmodel::dag(), and gum::NodeGraphPart::existsNode().
Referenced by gum::BayesNetFragment< GUM_SCALAR >::_installCPT(), gum::BayesNetFragment< GUM_SCALAR >::checkConsistency(), gum::BayesNetFragment< GUM_SCALAR >::cpt(), gum::BayesNetFragment< GUM_SCALAR >::idFromName(), gum::BayesNetFragment< GUM_SCALAR >::installMarginal(), gum::BayesNetFragment< GUM_SCALAR >::installNode(), gum::BayesNetFragment< GUM_SCALAR >::nodeId(), gum::BayesNetFragment< GUM_SCALAR >::toDot(), gum::BayesNetFragment< GUM_SCALAR >::uninstallCPT(), gum::BayesNetFragment< GUM_SCALAR >::uninstallNode(), gum::BayesNetFragment< GUM_SCALAR >::variable(), and gum::BayesNetFragment< GUM_SCALAR >::variableFromName().
|
inherited |
Compute a parameter of the joint probability for the BN (given an instantiation of the vars)
Definition at line 220 of file IBayesNet_tpl.h.
|
inherited |
Definition at line 75 of file DAGmodel_inl.h.
References gum::DAGmodel::nodes(), and gum::DAGmodel::variable().
Referenced by gum::DAGmodel::children(), and gum::InfluenceDiagram< GUM_SCALAR >::toString().
|
inherited |
Compute a parameter of the log joint probability for the BN (given an instantiation of the vars)
Compute a parameter of the joint probability for the BN (given an instantiation of the vars)
Definition at line 239 of file IBayesNet_tpl.h.
|
inherited |
Definition at line 135 of file IBayesNet_tpl.h.
|
inherited |
Definition at line 115 of file IBayesNet_tpl.h.
|
inherited |
Definition at line 95 of file IBayesNet_tpl.h.
Referenced by gum::ImportanceSampling< GUM_SCALAR >::_onContextualize().
|
inherited |
Definition at line 355 of file IBayesNet_tpl.h.
|
inherited |
Definition at line 375 of file IBayesNet_tpl.h.
|
inherited |
Definition at line 125 of file IBayesNet_tpl.h.
Referenced by gum::ImportanceSampling< GUM_SCALAR >::_onContextualize().
|
inherited |
Definition at line 105 of file IBayesNet_tpl.h.
The node's id are coherent with the variables and nodes of the topology.
clear | If false returns the previously created moral graph. |
Definition at line 101 of file DAGmodel.cpp.
References gum::DAGmodel::__moralGraph(), gum::DAGmodel::__mutableMoralGraph, and gum::UndiGraph::clear().
Referenced by gum::prm::SVED< GUM_SCALAR >::__eliminateNodes(), gum::prm::SVE< GUM_SCALAR >::__eliminateNodes(), gum::prm::SVED< GUM_SCALAR >::__eliminateNodesWithEvidence(), gum::prm::SVE< GUM_SCALAR >::__eliminateNodesWithEvidence(), gum::prm::SVED< GUM_SCALAR >::__initLiftedNodes(), gum::prm::SVE< GUM_SCALAR >::__initLiftedNodes(), and gum::DAGmodel::children().
|
overridevirtual |
Return id node from discrete var pointer.
NotFound | If no variable matches var. |
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 106 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::__bn, GUM_ERROR, gum::BayesNetFragment< GUM_SCALAR >::isInstalledNode(), and gum::Variable::name().
|
inherited |
Returns a constant reference to the dag of this Bayes Net.
Definition at line 115 of file DAGmodel_inl.h.
References gum::DAGmodel::_dag.
Referenced by gum::credal::CredalNet< GUM_SCALAR >::__bnCopy(), gum::EssentialGraph::__buildEssentialGraph(), gum::MarkovBlanket::__buildMarkovBlanket(), gum::DAGmodel::__moralGraph(), gum::credal::CredalNet< GUM_SCALAR >::__sort_varType(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::__verticesSampling(), gum::ImportanceSampling< GUM_SCALAR >::_unsharpenBN(), gum::BayesNetFactory< GUM_SCALAR >::BayesNetFactory(), gum::BayesNetFragment< GUM_SCALAR >::checkConsistency(), gum::learning::DAG2BNLearner< ALLOC >::createBN(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::disturbBN(), gum::Estimator< GUM_SCALAR >::Estimator(), gum::getMaxModality(), gum::DAGmodel::hasSameStructure(), gum::DAGmodel::log10DomainSize(), gum::prm::InstanceBayesNet< GUM_SCALAR >::modalities(), gum::prm::ClassBayesNet< GUM_SCALAR >::modalities(), gum::Estimator< GUM_SCALAR >::setFromBN(), gum::prm::InstanceBayesNet< GUM_SCALAR >::toDot(), gum::prm::ClassBayesNet< GUM_SCALAR >::toDot(), gum::credal::CredalNet< GUM_SCALAR >::toString(), and gum::BayesNetFragment< GUM_SCALAR >::~BayesNetFragment().
|
inherited |
Definition at line 303 of file IBayesNet_tpl.h.
|
inherited |
This operator compares 2 BNs !
Definition at line 256 of file IBayesNet_tpl.h.
returns the set of nodes with arc ingoing to a given node
Note that the set of arcs returned may be empty if no arc within the ArcGraphPart is ingoing into the given node.
id | the node toward which the arcs returned are pointing |
Definition at line 106 of file DAGmodel_inl.h.
References gum::DAGmodel::_dag, and gum::ArcGraphPart::parents().
Referenced by gum::MarkovBlanket::__buildMarkovBlanket(), gum::DAGmodel::__moralGraph(), gum::BayesNetFragment< GUM_SCALAR >::_installCPT(), gum::BayesNetFragment< GUM_SCALAR >::checkConsistency(), gum::DAGmodel::children(), gum::BayesNetFragment< GUM_SCALAR >::installCPT(), gum::DAGmodel::parents(), gum::prm::InstanceBayesNet< GUM_SCALAR >::toDot(), and gum::prm::ClassBayesNet< GUM_SCALAR >::toDot().
|
inlineinherited |
returns the set of nodes with arc ingoing to a given node
Note that the set of arcs returned may be empty if no arc within the ArcGraphPart is ingoing into the given node.
id | the node toward which the arcs returned are pointing |
Definition at line 156 of file DAGmodel.h.
References gum::DAGmodel::children(), gum::DAGmodel::idFromName(), and gum::DAGmodel::parents().
|
inherited |
Return the value of the property name of this DAGModel.
NotFound | Raised if no name property is found. |
Definition at line 37 of file DAGmodel_inl.h.
References gum::DAGmodel::__properties(), and GUM_ERROR.
Referenced by gum::InfluenceDiagram< GUM_SCALAR >::toDot().
|
inherited |
Return the value of the property name of this DAGModel.
return byDefault if the property name is not found
Definition at line 48 of file DAGmodel_inl.h.
References gum::DAGmodel::__properties().
|
inherited |
Add or change a property of this DAGModel.
Definition at line 56 of file DAGmodel_inl.h.
References gum::DAGmodel::__properties(), and gum::HashTable< Key, Val, Alloc >::insert().
Referenced by gum::BayesNet< double >::fastPrototype().
|
inherited |
Returns the number of variables in this Directed Graphical Model.
Definition at line 96 of file DAGmodel_inl.h.
References gum::DAGmodel::dag(), and gum::NodeGraphPart::size().
Referenced by gum::credal::CredalNet< GUM_SCALAR >::__initCNNets(), gum::InfluenceDiagram< GUM_SCALAR >::decisionNodeSize(), gum::DAGmodel::empty(), gum::MarkovBlanket::hasSameStructure(), gum::DAGmodel::hasSameStructure(), gum::IBayesNet< double >::operator==(), gum::prm::InstanceBayesNet< GUM_SCALAR >::toDot(), and gum::prm::ClassBayesNet< GUM_SCALAR >::toDot().
|
inherited |
Returns the number of arcs in this Directed Graphical Model.
Definition at line 102 of file DAGmodel_inl.h.
References gum::DAGmodel::_dag, and gum::ArcGraphPart::sizeArcs().
Referenced by gum::MarkovBlanket::hasSameStructure(), gum::DAGmodel::hasSameStructure(), and gum::IBayesNet< double >::operator==().
|
overridevirtual |
creates a dot representing the whole referred BN hilighting the fragment.
Reimplemented from gum::IBayesNet< GUM_SCALAR >.
Definition at line 304 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::__bn, gum::BayesNetFragment< GUM_SCALAR >::__localCPTs, gum::BayesNetFragment< GUM_SCALAR >::checkConsistency(), gum::DAGmodel::dag(), and gum::BayesNetFragment< GUM_SCALAR >::isInstalledNode().
The topological order stays the same as long as no variable or arcs are added or erased src the topology.
clear | If false returns the previously created topology. |
Definition at line 117 of file DAGmodel.cpp.
References gum::DAGmodel::dag(), and gum::DiGraph::topologicalOrder().
Referenced by gum::EssentialGraph::__buildEssentialGraph(), gum::InfluenceDiagramGenerator< GUM_SCALAR >::__checkTemporalOrder(), gum::DAGmodel::children(), gum::InfluenceDiagram< GUM_SCALAR >::decisionOrderExists(), and gum::InfluenceDiagram< GUM_SCALAR >::getDecisionOrder().
|
inherited |
Definition at line 145 of file IBayesNet_tpl.h.
Referenced by gum::operator<<().
|
noexcept |
uninstall a local CPT.
Definition at line 245 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::__bn, gum::BayesNetFragment< GUM_SCALAR >::__localCPTs, gum::BayesNetFragment< GUM_SCALAR >::_installArc(), gum::BayesNetFragment< GUM_SCALAR >::_uninstallCPT(), gum::BayesNetFragment< GUM_SCALAR >::cpt(), gum::BayesNetFragment< GUM_SCALAR >::isInstalledNode(), gum::MultiDimDecorator< GUM_SCALAR >::nbrDim(), and gum::MultiDimDecorator< GUM_SCALAR >::variable().
Referenced by gum::ImportanceSampling< GUM_SCALAR >::_onContextualize(), and gum::BayesNetFragment< GUM_SCALAR >::uninstallNode().
|
noexcept |
uninstall a node referenced by its nodeId
Definition at line 174 of file BayesNetFragment_tpl.h.
References gum::DAGmodel::_dag, gum::DiGraph::eraseNode(), gum::BayesNetFragment< GUM_SCALAR >::isInstalledNode(), and gum::BayesNetFragment< GUM_SCALAR >::uninstallCPT().
Referenced by gum::BayesNetFragment< GUM_SCALAR >::whenNodeDeleted().
|
overridevirtual |
Returns a constant reference over a variabe given it's node id.
NotFound | If no variable's id matches varId. |
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 98 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::__bn, GUM_ERROR, and gum::BayesNetFragment< GUM_SCALAR >::isInstalledNode().
Referenced by gum::BayesNetFragment< GUM_SCALAR >::installCPT().
|
overridevirtual |
Getter by name.
NotFound | if no such name exists in the graph. |
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 127 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::__bn, GUM_ERROR, and gum::BayesNetFragment< GUM_SCALAR >::isInstalledNode().
|
overridevirtual |
Returns a constant reference to the VariableNodeMap of this BN.
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 91 of file BayesNetFragment_tpl.h.
References GUM_ERROR.
|
overridevirtualnoexcept |
the action to take when a new arc is inserted into the graph
src | the object that sent the signal |
from | the id of tail of the new arc inserted into the graph |
to | the id of head of the new arc inserted into the graph |
Implements gum::DiGraphListener.
Definition at line 63 of file BayesNetFragment_tpl.h.
|
overridevirtualnoexcept |
the action to take when an arc has just been removed from the graph
src | the object that sent the signal |
from | the id of tail of the arc removed from the graph |
to | the id of head of the arc removed from the graph |
Implements gum::DiGraphListener.
Definition at line 69 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::_uninstallArc(), and gum::DAGmodel::dag().
|
overridevirtualnoexcept |
the action to take when a new node is inserted into the graph
src | the object that sent the signal |
id | the id of the new node inserted into the graph |
Implements gum::DiGraphListener.
Definition at line 53 of file BayesNetFragment_tpl.h.
|
overridevirtualnoexcept |
the action to take when a node has just been removed from the graph
src | the object that sent the signal |
id | the id of the node has just been removed from the graph |
Implements gum::DiGraphListener.
Definition at line 58 of file BayesNetFragment_tpl.h.
References gum::BayesNetFragment< GUM_SCALAR >::uninstallNode().
|
private |
The referred BayesNet.
Definition at line 78 of file BayesNetFragment.h.
Referenced by gum::BayesNetFragment< GUM_SCALAR >::_installCPT(), gum::BayesNetFragment< GUM_SCALAR >::checkConsistency(), gum::BayesNetFragment< GUM_SCALAR >::cpt(), gum::BayesNetFragment< GUM_SCALAR >::idFromName(), gum::BayesNetFragment< GUM_SCALAR >::installAscendants(), gum::BayesNetFragment< GUM_SCALAR >::installCPT(), gum::BayesNetFragment< GUM_SCALAR >::installMarginal(), gum::BayesNetFragment< GUM_SCALAR >::installNode(), gum::BayesNetFragment< GUM_SCALAR >::nodeId(), gum::BayesNetFragment< GUM_SCALAR >::toDot(), gum::BayesNetFragment< GUM_SCALAR >::uninstallCPT(), gum::BayesNetFragment< GUM_SCALAR >::variable(), and gum::BayesNetFragment< GUM_SCALAR >::variableFromName().
|
private |
Mapping between the variable's id and their CPT specific to this Fragment.
Definition at line 82 of file BayesNetFragment.h.
Referenced by gum::BayesNetFragment< GUM_SCALAR >::_installCPT(), gum::BayesNetFragment< GUM_SCALAR >::_uninstallCPT(), gum::BayesNetFragment< GUM_SCALAR >::cpt(), gum::BayesNetFragment< GUM_SCALAR >::toDot(), gum::BayesNetFragment< GUM_SCALAR >::uninstallCPT(), and gum::BayesNetFragment< GUM_SCALAR >::~BayesNetFragment().
|
protectedinherited |
The DAG of this Directed Graphical Model.
Definition at line 203 of file DAGmodel.h.
Referenced by gum::prm::ClassBayesNet< GUM_SCALAR >::__get(), gum::InfluenceDiagram< GUM_SCALAR >::_addNode(), gum::InfluenceDiagram< GUM_SCALAR >::_copyTables(), gum::InfluenceDiagram< GUM_SCALAR >::_getChildrenDecision(), gum::BayesNetFragment< GUM_SCALAR >::_installArc(), gum::InfluenceDiagram< GUM_SCALAR >::_moralGraph(), gum::InfluenceDiagram< GUM_SCALAR >::_removeTables(), gum::BayesNetFragment< GUM_SCALAR >::_uninstallArc(), gum::InfluenceDiagram< GUM_SCALAR >::addArc(), gum::DAGmodel::arcs(), gum::DAGmodel::children(), gum::DAGmodel::dag(), gum::InfluenceDiagram< GUM_SCALAR >::erase(), gum::InfluenceDiagram< GUM_SCALAR >::eraseArc(), gum::InfluenceDiagram< GUM_SCALAR >::existsPathBetween(), gum::InfluenceDiagram< GUM_SCALAR >::getDecisionGraph(), gum::InfluenceDiagram< GUM_SCALAR >::getPartialTemporalOrder(), gum::BayesNetFragment< GUM_SCALAR >::installNode(), gum::DAGmodel::nodes(), gum::DAGmodel::operator=(), gum::DAGmodel::parents(), gum::DAGmodel::sizeArcs(), gum::InfluenceDiagram< GUM_SCALAR >::toDot(), and gum::BayesNetFragment< GUM_SCALAR >::uninstallNode().
|
protectedinherited |
the graph to listen to
Definition at line 99 of file diGraphListener.h.
Referenced by gum::DiGraphListener::DiGraphListener().