![]() |
aGrUM
0.16.0
|
Class representing a Bayesian Network. More...
#include <agrum/BN/BayesNet.h>
Public Member Functions | |
NodeId | addNoisyAND (const DiscreteVariable &var, GUM_SCALAR external_weight, NodeId id) |
Add a variable, its associate node and a noisyAND implementation. More... | |
NodeId | addNoisyAND (const DiscreteVariable &var, GUM_SCALAR external_weight) |
Add a variable, its associate node and a noisyAND implementation. More... | |
NodeId | addLogit (const DiscreteVariable &var, GUM_SCALAR external_weight, NodeId id) |
Add a variable, its associate node and a Logit implementation. More... | |
NodeId | addLogit (const DiscreteVariable &var, GUM_SCALAR external_weight) |
Add a variable, its associate node and a Logit implementation. More... | |
NodeId | addOR (const DiscreteVariable &var) |
Add a variable, it's associate node and an OR implementation. More... | |
NodeId | addAND (const DiscreteVariable &var) |
Add a variable, it's associate node and an AND implementation. More... | |
void | addWeightedArc (NodeId tail, NodeId head, GUM_SCALAR causalWeight) |
Add an arc in the BN, and update arc.head's CPT. More... | |
void | addWeightedArc (const std::string &tail, const std::string &head, GUM_SCALAR causalWeight) |
Add an arc in the BN, and update arc.head's CPT. More... | |
void | generateCPTs () const |
randomly generates CPTs for a given structure More... | |
void | generateCPT (NodeId node) const |
randomly generate CPT for a given node in a given structure More... | |
void | generateCPT (const std::string &name) const |
void | changePotential (NodeId id, Potential< GUM_SCALAR > *newPot) |
change the CPT associated to nodeId to newPot delete the old CPT associated to nodeId. More... | |
void | changePotential (const std::string &name, Potential< GUM_SCALAR > *newPot) |
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 |
virtual std::string | toDot () 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) |
Constructors and Destructor | |
BayesNet () | |
Default constructor. More... | |
BayesNet (std::string name) | |
Default constructor. More... | |
~BayesNet () final | |
Destructor. More... | |
BayesNet (const BayesNet< GUM_SCALAR > &source) | |
Copy constructor. More... | |
Operators | |
BayesNet< GUM_SCALAR > & | operator= (const BayesNet< GUM_SCALAR > &source) |
Copy operator. More... | |
Variable manipulation methods | |
const Potential< GUM_SCALAR > & | cpt (NodeId varId) const final |
Returns the CPT of a variable. More... | |
const Potential< GUM_SCALAR > & | cpt (const std::string &name) const |
Returns the CPT of a variable. More... | |
const VariableNodeMap & | variableNodeMap () const final |
Returns a map between variables and nodes of this gum::BayesNet. More... | |
NodeId | add (const DiscreteVariable &var) |
Add a variable to the gum::BayesNet. More... | |
NodeId | add (const std::string &name, unsigned int nbrmod) |
Shortcut for add(gum::LabelizedVariable(name,name,nbrmod)) More... | |
NodeId | add (const DiscreteVariable &var, MultiDimImplementation< GUM_SCALAR > *aContent) |
Add a variable to the gum::BayesNet. More... | |
NodeId | add (const DiscreteVariable &var, NodeId id) |
Add a variable to the gum::BayesNet. More... | |
NodeId | add (const DiscreteVariable &var, MultiDimImplementation< GUM_SCALAR > *aContent, NodeId id) |
Add a variable to the gum::BayesNet. More... | |
void | erase (NodeId varId) |
Remove a variable from the gum::BayesNet. More... | |
void | erase (const std::string &name) |
Removes a variable from the gum::BayesNet. More... | |
void | erase (const DiscreteVariable &var) |
Remove a variable from the gum::BayesNet. More... | |
const DiscreteVariable & | variable (NodeId id) const final |
Returns a gum::DiscreteVariable given its gum::NodeId in the gum::BayesNet. More... | |
const DiscreteVariable & | variable (const std::string &name) const |
Returns a gum::DiscreteVariable given its gum::NodeId in the gum::BayesNet. More... | |
void | changeVariableName (NodeId id, const std::string &new_name) |
Changes a variable's name in the gum::BayesNet. More... | |
void | changeVariableName (const std::string &name, const std::string &new_name) |
Changes a variable's name. More... | |
void | changeVariableLabel (NodeId id, const std::string &old_label, const std::string &new_label) |
Changes a variable's label in the gum::BayesNet. More... | |
void | changeVariableLabel (const std::string &name, const std::string &old_label, const std::string &new_label) |
Changes a variable's name. More... | |
NodeId | nodeId (const DiscreteVariable &var) const final |
Returns a variable's id in the gum::BayesNet. More... | |
NodeId | idFromName (const std::string &name) const final |
Returns a variable's id given its name in the gum::BayesNet. More... | |
const DiscreteVariable & | variableFromName (const std::string &name) const final |
Returns a variable given its name in the gum::BayesNet. More... | |
Arc manipulation methods. | |
void | addArc (NodeId tail, NodeId head) |
Add an arc in the BN, and update arc.head's CPT. More... | |
void | addArc (const std::string &tail, const std::string &head) |
Add an arc in the BN, and update arc.head's CPT. More... | |
void | eraseArc (const Arc &arc) |
Removes an arc in the BN, and update head's CTP. More... | |
void | eraseArc (NodeId tail, NodeId head) |
Removes an arc in the BN, and update head's CTP. More... | |
void | eraseArc (const std::string &tail, const std::string &head) |
Removes an arc in the BN, and update head's CTP. More... | |
void | beginTopologyTransformation () |
When inserting/removing arcs, node CPTs change their dimension with a cost in time. More... | |
void | endTopologyTransformation () |
terminates a sequence of insertions/deletions of arcs by adjusting all CPTs dimensions. More... | |
void | reverseArc (NodeId tail, NodeId head) |
Reverses an arc while preserving the same joint distribution. More... | |
void | reverseArc (const std::string &tail, const std::string &head) |
Reverses an arc while preserving the same joint distribution. More... | |
void | reverseArc (const Arc &arc) |
Reverses an arc while preserving the same joint distribution. More... | |
Accessors for nodes with CI or logical implementation | |
NodeId | addNoisyOR (const DiscreteVariable &var, GUM_SCALAR external_weight) |
Add a variable, it's associate node and a gum::noisyOR implementation. More... | |
NodeId | addNoisyORNet (const DiscreteVariable &var, GUM_SCALAR external_weight) |
Add a variable, it's associate node and a gum::noisyOR implementation. More... | |
NodeId | addNoisyORCompound (const DiscreteVariable &var, GUM_SCALAR external_weight) |
Add a variable, it's associate node and a gum::noisyOR implementation. More... | |
NodeId | addNoisyOR (const DiscreteVariable &var, GUM_SCALAR external_weight, NodeId id) |
Add a variable, its associate node and a noisyOR implementation. More... | |
NodeId | addNoisyORNet (const DiscreteVariable &var, GUM_SCALAR external_weight, NodeId id) |
Add a variable, its associate node and a noisyOR implementation. More... | |
NodeId | addNoisyORCompound (const DiscreteVariable &var, GUM_SCALAR external_weight, NodeId id) |
Add a variable, its associate node and a noisyOR implementation. More... | |
NodeId | addAMPLITUDE (const DiscreteVariable &var) |
Others aggregators. More... | |
NodeId | addCOUNT (const DiscreteVariable &var, Idx value=1) |
Others aggregators. More... | |
NodeId | addEXISTS (const DiscreteVariable &var, Idx value=1) |
Others aggregators. More... | |
NodeId | addFORALL (const DiscreteVariable &var, Idx value=1) |
Others aggregators. More... | |
NodeId | addMAX (const DiscreteVariable &var) |
Others aggregators. More... | |
NodeId | addMEDIAN (const DiscreteVariable &var) |
Others aggregators. More... | |
NodeId | addMIN (const DiscreteVariable &var) |
Others aggregators. 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... | |
Static Public Member Functions | |
static BayesNet< GUM_SCALAR > | fastPrototype (const std::string &dotlike, Size domainSize=2) |
Create a bn with a dotlike syntax : 'a->b->c;b->d;'. More... | |
Protected Attributes | |
DAG | _dag |
The DAG of this Directed Graphical Model. More... | |
Friends | |
class | BayesNetFactory< GUM_SCALAR > |
Class representing a Bayesian Network.
Bayesian Networks are a probabilistic graphical model in which nodes are random variables and the probability distribution is defined by the product:
where \(\pi(X_i)\) is the parent of \(X_i\).
The probability distribution can be represented as a directed acyclic graph (DAG) where:
After a variable is added to the BN, if it's domain size changes, then the data in it's CPT is lost.
You should look a the gum::BayesNetFactory class which can help build Bayesian Networks.
You can print a BayesNet using gum::operator<<(std::ostream&, const BayesNet<GUM_SCALAR>&).
Definition at line 78 of file BayesNet.h.
INLINE gum::BayesNet< GUM_SCALAR >::BayesNet | ( | ) |
|
explicit |
Default constructor.
name | The BayesNet's name. |
Definition at line 165 of file BayesNet_tpl.h.
|
final |
Destructor.
Definition at line 193 of file BayesNet_tpl.h.
gum::BayesNet< GUM_SCALAR >::BayesNet | ( | const BayesNet< GUM_SCALAR > & | source | ) |
Copy constructor.
Definition at line 171 of file BayesNet_tpl.h.
|
private |
clear all potentials
Definition at line 627 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::generateCPT().
|
private |
copy of potentials from a BN to another, using names of vars as ref.
Definition at line 638 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::generateCPT().
|
private |
change the CPT associated to nodeId to newPot delete the old CPT associated to nodeId.
Definition at line 692 of file BayesNet_tpl.h.
INLINE NodeId gum::BayesNet< GUM_SCALAR >::add | ( | const DiscreteVariable & | var | ) |
Add a variable to the gum::BayesNet.
Add a gum::DiscreteVariable, it's associated gum::NodeId and it's gum::Potential.
The variable is added by copy to the gum::BayesNet. The variable's gum::Potential implementation will be a gum::MultiDimArray.
var | The variable added by copy. |
DuplicateLabel | Raised if variable.name() is already used in this gum::BayesNet. |
Definition at line 232 of file BayesNet_tpl.h.
Referenced by gum::credal::CredalNet< GUM_SCALAR >::__bnCopy(), gum::learning::genericBNLearner::Database::__BNVars(), gum::credal::CredalNet< GUM_SCALAR >::approximatedBinarization(), gum::build_node(), gum::BayesNet< double >::cpt(), and gum::learning::DAG2BNLearner< ALLOC >::createBN().
INLINE NodeId gum::BayesNet< GUM_SCALAR >::add | ( | const std::string & | name, |
unsigned int | nbrmod | ||
) |
Shortcut for add(gum::LabelizedVariable(name,name,nbrmod))
Add a gum::LabelizedVariable to the gum::BayesNet
This method is just a shortcut for a often used pattern
DuplicateLabel | Raised if variable.name() is already used in this gum::BayesNet. |
NotAllowed | if nbrmod<2 |
Definition at line 248 of file BayesNet_tpl.h.
INLINE NodeId gum::BayesNet< GUM_SCALAR >::add | ( | const DiscreteVariable & | var, |
MultiDimImplementation< GUM_SCALAR > * | aContent | ||
) |
Add a variable to the gum::BayesNet.
Add a gum::DiscreteVariable, it's associated gum::NodeId and it's gum::Potential.
The variable is added by copy to the gum::BayesNet.
var | The variable added by copy. |
aContent | The gum::MultiDimImplementation to use for this variable's gum::Potential implementation. |
DuplicateLabel | Raised if variable.name() is already used in this gum::BayesNet. |
Definition at line 261 of file BayesNet_tpl.h.
INLINE NodeId gum::BayesNet< GUM_SCALAR >::add | ( | const DiscreteVariable & | var, |
NodeId | id | ||
) |
Add a variable to the gum::BayesNet.
Add a gum::DiscreteVariable, it's associated gum::NodeId and it's gum::Potential.
The variable is added by copy to the gum::BayesNet. The variable's gum::Potential implementation will be a gum::MultiDimArray.
var | The variable added by copy. |
id | The variable's forced gum::NodeId in the gum::BayesNet. |
DuplicateElement | Raised id is already used. |
DuplicateLabel | Raised if variable.name() is already used in this gum::BayesNet. |
Definition at line 272 of file BayesNet_tpl.h.
NodeId gum::BayesNet< GUM_SCALAR >::add | ( | const DiscreteVariable & | var, |
MultiDimImplementation< GUM_SCALAR > * | aContent, | ||
NodeId | id | ||
) |
Add a variable to the gum::BayesNet.
Add a gum::DiscreteVariable, it's associated gum::NodeId and it's gum::Potential.
var | The variable added by copy. |
aContent | The gum::MultiDimImplementation to use for this variable's gum::Potential implementation. |
id | The variable's forced gum::NodeId in the gum::BayesNet. |
DuplicateElement | Raised id is already used. |
DuplicateLabel | Raised if variable.name() is already used in this gum::BayesNet. |
Definition at line 290 of file BayesNet_tpl.h.
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addAMPLITUDE | ( | const DiscreteVariable & | var | ) |
Others aggregators.
Definition at line 461 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::reverseArc().
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addAND | ( | const DiscreteVariable & | var | ) |
Add a variable, it's associate node and an AND implementation.
The id of the new variable is automatically generated.
var | The variable added by copy. |
SizeError | if variable.domainSize()>2 |
Definition at line 466 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::reverseArc().
INLINE void gum::BayesNet< GUM_SCALAR >::addArc | ( | NodeId | tail, |
NodeId | head | ||
) |
Add an arc in the BN, and update arc.head's CPT.
head | and |
tail | as NodeId |
InvalidEdge | If arc.tail and/or arc.head are not in the BN. |
DuplicateElement | if the arc already exists |
Definition at line 348 of file BayesNet_tpl.h.
Referenced by gum::credal::CredalNet< GUM_SCALAR >::__bnCopy(), gum::credal::CredalNet< GUM_SCALAR >::approximatedBinarization(), gum::BayesNet< double >::changeVariableLabel(), gum::learning::DAG2BNLearner< ALLOC >::createBN(), and gum::BayesNet< double >::fastPrototype().
INLINE void gum::BayesNet< GUM_SCALAR >::addArc | ( | const std::string & | tail, |
const std::string & | head | ||
) |
Add an arc in the BN, and update arc.head's CPT.
gum::DuplicateElement | if the arc already exists |
Definition at line 360 of file BayesNet_tpl.h.
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addCOUNT | ( | const DiscreteVariable & | var, |
Idx | value = 1 |
||
) |
Others aggregators.
Definition at line 473 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::reverseArc().
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addEXISTS | ( | const DiscreteVariable & | var, |
Idx | value = 1 |
||
) |
Others aggregators.
Definition at line 479 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::reverseArc().
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addFORALL | ( | const DiscreteVariable & | var, |
Idx | value = 1 |
||
) |
Others aggregators.
Definition at line 487 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::reverseArc().
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addLogit | ( | const DiscreteVariable & | var, |
GUM_SCALAR | external_weight, | ||
NodeId | id | ||
) |
Add a variable, its associate node and a Logit implementation.
var | The variable added by copy |
external_weight | see gum::MultiDimLogit |
id | proposed gum::nodeId for the variable |
Definition at line 565 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::reverseArc().
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addLogit | ( | const DiscreteVariable & | var, |
GUM_SCALAR | external_weight | ||
) |
Add a variable, its associate node and a Logit implementation.
The id of the new variable is automatically generated.
var | The variable added by copy. |
external_weight | see gum::MultiDimLogit |
Definition at line 545 of file BayesNet_tpl.h.
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addMAX | ( | const DiscreteVariable & | var | ) |
Others aggregators.
Definition at line 495 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::reverseArc().
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addMEDIAN | ( | const DiscreteVariable & | var | ) |
Others aggregators.
Definition at line 500 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::reverseArc().
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addMIN | ( | const DiscreteVariable & | var | ) |
Others aggregators.
Definition at line 505 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::reverseArc().
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addNoisyAND | ( | const DiscreteVariable & | var, |
GUM_SCALAR | external_weight, | ||
NodeId | id | ||
) |
Add a variable, its associate node and a noisyAND implementation.
var | The variable added by copy |
external_weight | see gum::MultiDimNoisyAND |
id | proposed gum::nodeId for the variable |
Definition at line 558 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::reverseArc().
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addNoisyAND | ( | const DiscreteVariable & | var, |
GUM_SCALAR | external_weight | ||
) |
Add a variable, its associate node and a noisyAND implementation.
The id of the new variable is automatically generated.
var | The variable added by copy. |
external_weight | see gum::MultiDimNoisyAND |
Definition at line 539 of file BayesNet_tpl.h.
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addNoisyOR | ( | const DiscreteVariable & | var, |
GUM_SCALAR | external_weight | ||
) |
Add a variable, it's associate node and a gum::noisyOR implementation.
The id of the new variable is automatically generated. Since it seems that the 'classical' noisyOR is the Compound noisyOR, we keep the gum::BayesNet::addNoisyOR as an alias for gum::BayesNet::addNoisyORCompound
var | The variable added by copy. |
external_weight | see ref gum::MultiDimNoisyORNet,gum::MultiDimNoisyORCompound |
Definition at line 521 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::reverseArc().
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addNoisyOR | ( | const DiscreteVariable & | var, |
GUM_SCALAR | external_weight, | ||
NodeId | id | ||
) |
Add a variable, its associate node and a noisyOR implementation.
Since it seems that the 'classical' noisyOR is the Compound noisyOR, we keep the addNoisyOR as an alias for addNoisyORCompound.
var | The variable added by copy. |
external_weight | see gum::MultiDimNoisyORNet, gum::MultiDimNoisyORCompound |
id | The chosen id |
DuplicateElement | if id is already used |
Definition at line 551 of file BayesNet_tpl.h.
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addNoisyORCompound | ( | const DiscreteVariable & | var, |
GUM_SCALAR | external_weight | ||
) |
Add a variable, it's associate node and a gum::noisyOR implementation.
The id of the new variable is automatically generated. Since it seems that the 'classical' noisyOR is the Compound noisyOR, we keep the gum::BayesNet::addNoisyOR as an alias for gum::BayesNet::addNoisyORCompound
var | The variable added by copy. |
external_weight | see ref gum::MultiDimNoisyORNet,gum::MultiDimNoisyORCompound |
Definition at line 527 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::reverseArc().
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addNoisyORCompound | ( | const DiscreteVariable & | var, |
GUM_SCALAR | external_weight, | ||
NodeId | id | ||
) |
Add a variable, its associate node and a noisyOR implementation.
Since it seems that the 'classical' noisyOR is the Compound noisyOR, we keep the addNoisyOR as an alias for addNoisyORCompound.
var | The variable added by copy. |
external_weight | see gum::MultiDimNoisyORNet, gum::MultiDimNoisyORCompound |
id | The chosen id |
DuplicateElement | if id is already used |
Definition at line 572 of file BayesNet_tpl.h.
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addNoisyORNet | ( | const DiscreteVariable & | var, |
GUM_SCALAR | external_weight | ||
) |
Add a variable, it's associate node and a gum::noisyOR implementation.
The id of the new variable is automatically generated. Since it seems that the 'classical' noisyOR is the Compound noisyOR, we keep the gum::BayesNet::addNoisyOR as an alias for gum::BayesNet::addNoisyORCompound
var | The variable added by copy. |
external_weight | see ref gum::MultiDimNoisyORNet,gum::MultiDimNoisyORCompound |
Definition at line 533 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::reverseArc().
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addNoisyORNet | ( | const DiscreteVariable & | var, |
GUM_SCALAR | external_weight, | ||
NodeId | id | ||
) |
Add a variable, its associate node and a noisyOR implementation.
Since it seems that the 'classical' noisyOR is the Compound noisyOR, we keep the addNoisyOR as an alias for addNoisyORCompound.
var | The variable added by copy. |
external_weight | see gum::MultiDimNoisyORNet, gum::MultiDimNoisyORCompound |
id | The chosen id |
DuplicateElement | if id is already used |
Definition at line 579 of file BayesNet_tpl.h.
INLINE NodeId gum::BayesNet< GUM_SCALAR >::addOR | ( | const DiscreteVariable & | var | ) |
Add a variable, it's associate node and an OR implementation.
The id of the new variable is automatically generated.
var | The variable added by copy. |
SizeError | if variable.domainSize()>2 |
Definition at line 510 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::reverseArc().
void gum::BayesNet< GUM_SCALAR >::addWeightedArc | ( | NodeId | tail, |
NodeId | head, | ||
GUM_SCALAR | causalWeight | ||
) |
Add an arc in the BN, and update arc.head's CPT.
head | and |
tail | as NodeId |
causalWeight | see gum::MultiDimICIModel |
InvalidArc | If arc.tail and/or arc.head are not in the BN. |
InvalidArc | If variable in arc.head is not a NoisyOR variable. |
Definition at line 586 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::addWeightedArc(), and gum::BayesNet< double >::reverseArc().
|
inline |
Add an arc in the BN, and update arc.head's CPT.
head | and |
tail | as std::string |
causalWeight | see gum::MultiDimICIModel |
NotFound | if no node with sun names is found |
InvalidArc | If arc.tail and/or arc.head are not in the BN. |
InvalidArc | If variable in arc.head is not a NoisyOR variable. |
Definition at line 620 of file BayesNet.h.
|
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().
void gum::BayesNet< GUM_SCALAR >::beginTopologyTransformation | ( | ) |
When inserting/removing arcs, node CPTs change their dimension with a cost in time.
begin Multiple Change for all CPTs
These functions delay the CPTs change to be done just once at the end of a sequence of topology modification. begins a sequence of insertions/deletions of arcs without changing the dimensions of the CPTs.
Definition at line 613 of file BayesNet_tpl.h.
Referenced by gum::credal::CredalNet< GUM_SCALAR >::__bnCopy(), gum::credal::CredalNet< GUM_SCALAR >::approximatedBinarization(), gum::learning::DAG2BNLearner< ALLOC >::createBN(), and gum::BayesNet< double >::eraseArc().
void gum::BayesNet< GUM_SCALAR >::changePotential | ( | NodeId | id, |
Potential< GUM_SCALAR > * | newPot | ||
) |
change the CPT associated to nodeId to newPot delete the old CPT associated to nodeId.
NotAllowed | if newPot has not the same signature as __probaMap[NodeId] |
Definition at line 671 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::generateCPT().
void gum::BayesNet< GUM_SCALAR >::changePotential | ( | const std::string & | name, |
Potential< GUM_SCALAR > * | newPot | ||
) |
Definition at line 699 of file BayesNet_tpl.h.
INLINE void gum::BayesNet< GUM_SCALAR >::changeVariableLabel | ( | NodeId | id, |
const std::string & | old_label, | ||
const std::string & | new_label | ||
) |
Changes a variable's label in the gum::BayesNet.
This will change the gum::LabelizedVariable names in the gum::BayesNet.
DuplicateLabel | Raised if new_label is already used in this gum::LabelizedVariable. |
NotFound | Raised if no variable matches id or if the variable is not a LabelizedVariable |
Definition at line 214 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::changeVariableLabel(), and gum::BayesNet< double >::changeVariableName().
|
inline |
Changes a variable's name.
Definition at line 336 of file BayesNet.h.
INLINE void gum::BayesNet< GUM_SCALAR >::changeVariableName | ( | NodeId | id, |
const std::string & | new_name | ||
) |
Changes a variable's name in the gum::BayesNet.
This will change the gum::DiscreteVariable names in the gum::BayesNet.
DuplicateLabel | Raised if newName is already used in this gum::BayesNet. |
NotFound | Raised if no variable matches id. |
Definition at line 208 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::changeVariableName(), and gum::BayesNet< double >::variable().
|
inline |
Changes a variable's name.
Definition at line 315 of file BayesNet.h.
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().
|
finalvirtual |
Returns the CPT of a variable.
varId | A variable's id in the gum::BayesNet. |
NotFound | If no variable's id matches varId. |
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 315 of file BayesNet_tpl.h.
Referenced by gum::credal::CredalNet< GUM_SCALAR >::__bnCopy(), gum::credal::CredalNet< GUM_SCALAR >::approximatedBinarization(), gum::BayesNet< double >::cpt(), gum::learning::DAG2BNLearner< ALLOC >::createBN(), gum::SimpleCPTDisturber< GUM_SCALAR >::disturbAugmCPT(), gum::SimpleCPTDisturber< GUM_SCALAR >::disturbReducCPT(), and gum::credal::CredalNet< GUM_SCALAR >::toString().
|
inline |
Returns the CPT of a variable.
Definition at line 155 of file BayesNet.h.
|
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 |
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().
void gum::BayesNet< GUM_SCALAR >::endTopologyTransformation | ( | ) |
terminates a sequence of insertions/deletions of arcs by adjusting all CPTs dimensions.
end Multiple Change for all CPTs
Definition at line 620 of file BayesNet_tpl.h.
Referenced by gum::credal::CredalNet< GUM_SCALAR >::__bnCopy(), gum::credal::CredalNet< GUM_SCALAR >::approximatedBinarization(), gum::learning::DAG2BNLearner< ALLOC >::createBN(), and gum::BayesNet< double >::eraseArc().
void gum::BayesNet< GUM_SCALAR >::erase | ( | NodeId | varId | ) |
Remove a variable from the gum::BayesNet.
Removes the corresponding variable from the gum::BayesNet and from all of it's children gum::Potential.
If no variable matches the given id, then nothing is done.
varId | The variable's id to remove. |
Definition at line 330 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::cpt(), and gum::BayesNet< double >::erase().
|
inline |
Removes a variable from the gum::BayesNet.
Definition at line 267 of file BayesNet.h.
Referenced by gum::BayesNet< double >::erase().
INLINE void gum::BayesNet< GUM_SCALAR >::erase | ( | const DiscreteVariable & | var | ) |
Remove a variable from the gum::BayesNet.
Removes the corresponding variable from the gum::BayesNet and from all of it's children gum::Potential.
If no variable matches the given variable, then nothing is done.
var | A reference on the variable to remove. |
Definition at line 325 of file BayesNet_tpl.h.
INLINE void gum::BayesNet< GUM_SCALAR >::eraseArc | ( | const Arc & | arc | ) |
Removes an arc in the BN, and update head's CTP.
If (tail, head) doesn't exist, the nothing happens.
arc | The arc removed. |
Definition at line 371 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::changeVariableLabel(), and gum::BayesNet< double >::eraseArc().
INLINE void gum::BayesNet< GUM_SCALAR >::eraseArc | ( | NodeId | tail, |
NodeId | head | ||
) |
Removes an arc in the BN, and update head's CTP.
If (tail, head) doesn't exist, the nothing happens.
head | and |
tail | as NodeId |
Definition at line 381 of file BayesNet_tpl.h.
|
inline |
Removes an arc in the BN, and update head's CTP.
Definition at line 416 of file BayesNet.h.
|
static |
Create a bn with a dotlike syntax : 'a->b->c;b->d;'.
The domain size maybe specified using 'a[10]' or using 'a{yes|maybe|no}'. Note that if the dotlike string contains such a specification for an already defined variable, the first specification will be used.
dotlike | the string containing the specification |
domainSize | the default domain size for variables |
Definition at line 127 of file BayesNet_tpl.h.
INLINE void gum::BayesNet< GUM_SCALAR >::generateCPT | ( | NodeId | node | ) | const |
randomly generate CPT for a given node in a given structure
Definition at line 664 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::addWeightedArc(), and gum::BayesNet< double >::generateCPT().
|
inline |
Definition at line 632 of file BayesNet.h.
INLINE void gum::BayesNet< GUM_SCALAR >::generateCPTs | ( | ) | const |
randomly generates CPTs for a given structure
Definition at line 658 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::addWeightedArc(), and gum::BayesNet< double >::fastPrototype().
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().
|
finalvirtual |
Returns a variable's id given its name in the gum::BayesNet.
name | The variable's name from which the gum::NodeId is returned. |
NotFound | Raised if name does not match a variable in the gum::BayesNet. |
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 303 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::addWeightedArc(), gum::build_node(), gum::BayesNet< double >::changeVariableLabel(), gum::BayesNet< double >::changeVariableName(), gum::BayesNet< double >::cpt(), gum::BayesNet< double >::erase(), gum::BayesNet< double >::eraseArc(), gum::BayesNet< double >::generateCPT(), gum::BayesNet< double >::idFromName(), gum::BayesNet< double >::reverseArc(), and gum::BayesNet< double >::variable().
|
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().
|
finalvirtual |
Returns a variable's id in the gum::BayesNet.
var | The variable from which the gum::NodeId is returned. |
NotFound | If var is not in the gum::BayesNet. |
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 227 of file BayesNet_tpl.h.
Referenced by gum::credal::CredalNet< GUM_SCALAR >::__bnCopy(), and gum::BayesNet< double >::changeVariableLabel().
|
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.
BayesNet< GUM_SCALAR > & gum::BayesNet< GUM_SCALAR >::operator= | ( | const BayesNet< GUM_SCALAR > & | source | ) |
Copy operator.
source | The copied BayesNet. |
Definition at line 180 of file BayesNet_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().
INLINE void gum::BayesNet< GUM_SCALAR >::reverseArc | ( | NodeId | tail, |
NodeId | head | ||
) |
Reverses an arc while preserving the same joint distribution.
This method uses Shachter's 1986 algorithm for reversing an arc in the Bayes net while preserving the same joint distribution. By performing this reversal, we also add new arcs (required to not alter the joint distribution)
InvalidArc | exception if the arc does not exist or if its reversal would induce a directed cycle. |
Definition at line 452 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::eraseArc(), and gum::BayesNet< double >::reverseArc().
|
inline |
Reverses an arc while preserving the same joint distribution.
This method uses Shachter's 1986 algorithm for reversing an arc in the Bayes net while preserving the same joint distribution. By performing this reversal, we also add new arcs (required to not alter the joint distribution)
InvalidArc | exception if the arc does not exist or if its reversal would induce a directed cycle. |
Definition at line 449 of file BayesNet.h.
void gum::BayesNet< GUM_SCALAR >::reverseArc | ( | const Arc & | arc | ) |
Reverses an arc while preserving the same joint distribution.
This method uses Shachter's 1986 algorithm for reversing an arc in the Bayes net while preserving the same joint distribution. By performing this reversal, we also add new arcs (required to not alter the joint distribution)
InvalidArc | exception if the arc does not exist or if its reversal would induce a directed cycle. |
Definition at line 386 of file BayesNet_tpl.h.
|
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==().
|
virtualinherited |
Reimplemented in gum::BayesNetFragment< GUM_SCALAR >, gum::prm::ClassBayesNet< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.
Definition at line 175 of file IBayesNet_tpl.h.
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<<().
|
finalvirtual |
Returns a gum::DiscreteVariable given its gum::NodeId in the gum::BayesNet.
id | The variable's id to return. |
NotFound | Raised if id does not match a a variable in the gum::BayesNet. |
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 202 of file BayesNet_tpl.h.
Referenced by gum::credal::CredalNet< GUM_SCALAR >::__bnCopy(), gum::credal::CredalNet< GUM_SCALAR >::approximatedBinarization(), gum::BayesNetFactory< GUM_SCALAR >::BayesNetFactory(), gum::learning::genericBNLearner::Database::Database(), gum::BayesNet< double >::erase(), gum::getMaxModality(), gum::credal::CredalNet< GUM_SCALAR >::toString(), and gum::BayesNet< double >::variable().
|
inline |
Returns a gum::DiscreteVariable given its gum::NodeId in the gum::BayesNet.
Definition at line 297 of file BayesNet.h.
|
finalvirtual |
Returns a variable given its name in the gum::BayesNet.
name | The variable's name in the gum::BayesNet. |
NotFound | Raised if name does not match a variable in the gum::BayesNet. |
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 309 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::changeVariableLabel(), and gum::BayesNet< double >::variableFromName().
|
finalvirtual |
Returns a map between variables and nodes of this gum::BayesNet.
Implements gum::IBayesNet< GUM_SCALAR >.
Definition at line 320 of file BayesNet_tpl.h.
Referenced by gum::BayesNet< double >::cpt(), and gum::learning::DAG2BNLearner< ALLOC >::createBN().
|
friend |
Definition at line 79 of file BayesNet.h.
|
private |
Mapping between the variable's id and their CPT.
Definition at line 654 of file BayesNet.h.
Referenced by gum::BayesNet< double >::__copyPotentials().
|
private |
the map between variable and id
Definition at line 651 of file BayesNet.h.
Referenced by gum::BayesNet< double >::operator=().
|
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().