![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
Virtual base class for probabilistic graphical models. More...
#include <graphicalModel.h>
Public Member Functions | |
double | log10DomainSize () const |
virtual bool | isIndependent (NodeId X, NodeId Y, const NodeSet &Z) const =0 |
check if node X and node Y are independent given nodes Z More... | |
virtual bool | isIndependent (const NodeSet &X, const NodeSet &Y, const NodeSet &Z) const =0 |
check if nodes X and nodes Y are independent given nodes Z More... | |
Constructors / Destructors | |
GraphicalModel () | |
Default constructor. More... | |
virtual | ~GraphicalModel () |
Destructor. More... | |
GraphicalModel (const GraphicalModel &source) | |
Copy constructor. More... | |
Getter and setters | |
const std::string & | property (const std::string &name) const |
Return the value of the property name of this GraphicalModel. More... | |
const std::string & | propertyWithDefault (const std::string &name, const std::string &byDefault) const |
Return the value of the property name of this GraphicalModel. More... | |
void | setProperty (const std::string &name, const std::string &value) |
Add or change a property of this GraphicalModel. More... | |
Variable manipulation methods. | |
virtual const VariableNodeMap & | variableNodeMap () const =0 |
Returns a constant reference to the VariableNodeMap of this Graphical Model. More... | |
virtual Size | size () const =0 |
Returns the number of variables in this Directed Graphical Model. More... | |
virtual bool | empty () const |
Return true if this graphical model is empty. More... | |
virtual bool | exists (NodeId node) const =0 |
Return true if this node exists in this graphical model. More... | |
bool | exists (const std::string &name) const |
Return true if this graphical model is empty. More... | |
std::vector< std::string > | names (const std::vector< NodeId > &ids) const |
transform a vector of NodeId in a vector of names More... | |
std::vector< std::string > | names (const NodeSet &ids) const |
transform a NodeSet in a vector of names More... | |
std::vector< NodeId > | ids (const std::vector< std::string > &names) const |
transform a vector of names into a vector of nodeId More... | |
NodeSet | nodeset (const std::vector< std::string > &names) const |
transform a vector of names into a NodeSet More... | |
virtual const NodeGraphPart & | nodes () const =0 |
Returns a constant reference to the VariableNodeMap of this Graphical Model. More... | |
Instantiation | completeInstantiation () const |
Get an instantiation over all the variables of the model. More... | |
virtual const DiscreteVariable & | variable (NodeId id) const =0 |
Returns a constant reference over a variable given it's node id. More... | |
virtual NodeId | nodeId (const DiscreteVariable &var) const =0 |
Return id node src discrete var pointer. More... | |
virtual NodeId | idFromName (const std::string &name) const =0 |
Getter by name. More... | |
virtual const DiscreteVariable & | variableFromName (const std::string &name) const =0 |
Getter by name. More... | |
Protected Member Functions | |
GraphicalModel & | operator= (const GraphicalModel &source) |
Private copy operator. More... | |
Virtual base class for probabilistic graphical models.
Definition at line 47 of file graphicalModel.h.
gum::GraphicalModel::GraphicalModel | ( | ) |
Default constructor.
Definition at line 29 of file graphicalModel.cpp.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
Destructor.
Definition at line 39 of file graphicalModel.cpp.
References gum::Set< Key, Alloc >::emplace().
gum::GraphicalModel::GraphicalModel | ( | const GraphicalModel & | source | ) |
Copy constructor.
Do nothing.
Definition at line 31 of file graphicalModel.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
Return the properties of this Directed Graphical Model and initialize the hash table is necessary.
Definition at line 48 of file graphicalModel_inl.h.
INLINE Instantiation gum::GraphicalModel::completeInstantiation | ( | ) | const |
Get an instantiation over all the variables of the model.
Definition at line 84 of file graphicalModel_inl.h.
|
virtual |
Return true if this graphical model is empty.
Definition at line 94 of file graphicalModel_inl.h.
Return true if this node exists in this graphical model.
Implemented in gum::UGmodel, and gum::DAGmodel.
|
inline |
Return true if this graphical model is empty.
Definition at line 112 of file graphicalModel.h.
|
pure virtual |
Getter by name.
NotFound | if no such name exists in the graph. |
Implemented in gum::BayesNet< GUM_SCALAR >, gum::BayesNet< double >, gum::InfluenceDiagram< GUM_SCALAR >, gum::BayesNetFragment< GUM_SCALAR >, gum::IMarkovNet< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::prm::ClassBayesNet< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.
INLINE std::vector< NodeId > gum::GraphicalModel::ids | ( | const std::vector< std::string > & | names | ) | const |
transform a vector of names into a vector of nodeId
Definition at line 117 of file graphicalModel_inl.h.
|
pure virtual |
check if node X and node Y are independent given nodes Z
Implemented in gum::DAGmodel, and gum::UGmodel.
|
pure virtual |
check if nodes X and nodes Y are independent given nodes Z
Implemented in gum::DAGmodel, and gum::UGmodel.
INLINE double gum::GraphicalModel::log10DomainSize | ( | ) | const |
Definition at line 73 of file graphicalModel_inl.h.
INLINE std::vector< std::string > gum::GraphicalModel::names | ( | const std::vector< NodeId > & | ids | ) | const |
transform a vector of NodeId in a vector of names
Definition at line 97 of file graphicalModel_inl.h.
INLINE std::vector< std::string > gum::GraphicalModel::names | ( | const NodeSet & | ids | ) | const |
transform a NodeSet in a vector of names
Definition at line 107 of file graphicalModel_inl.h.
|
pure virtual |
Return id node src discrete var pointer.
NotFound | If no variable matches var. |
Implemented in gum::BayesNet< GUM_SCALAR >, gum::BayesNet< double >, gum::InfluenceDiagram< GUM_SCALAR >, gum::BayesNetFragment< GUM_SCALAR >, gum::IMarkovNet< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::prm::ClassBayesNet< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.
|
pure virtual |
Returns a constant reference to the VariableNodeMap of this Graphical Model.
Implemented in gum::UGmodel, and gum::DAGmodel.
NodeSet gum::GraphicalModel::nodeset | ( | const std::vector< std::string > & | names | ) | const |
transform a vector of names into a NodeSet
Definition at line 58 of file graphicalModel.cpp.
References gum::Set< Key, Alloc >::emplace().
|
protected |
Private copy operator.
Definition at line 44 of file graphicalModel.cpp.
References gum::Set< Key, Alloc >::emplace().
INLINE const std::string & gum::GraphicalModel::property | ( | const std::string & | name | ) | const |
Return the value of the property name of this GraphicalModel.
NotFound | Raised if no name property is found. |
Definition at line 38 of file graphicalModel_inl.h.
INLINE const std::string & gum::GraphicalModel::propertyWithDefault | ( | const std::string & | name, |
const std::string & | byDefault | ||
) | const |
Return the value of the property name of this GraphicalModel.
return byDefault if the property name is not found
Definition at line 57 of file graphicalModel_inl.h.
INLINE void gum::GraphicalModel::setProperty | ( | const std::string & | name, |
const std::string & | value | ||
) |
Add or change a property of this GraphicalModel.
Definition at line 65 of file graphicalModel_inl.h.
|
pure virtual |
Returns the number of variables in this Directed Graphical Model.
Implemented in gum::UGmodel, and gum::DAGmodel.
|
pure virtual |
Returns a constant reference over a variable given it's node id.
NotFound | If no variable's id matches varId. |
Implemented in gum::BayesNet< GUM_SCALAR >, gum::BayesNet< double >, gum::InfluenceDiagram< GUM_SCALAR >, gum::BayesNetFragment< GUM_SCALAR >, gum::IMarkovNet< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::prm::ClassBayesNet< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.
|
pure virtual |
Getter by name.
NotFound | if no such name exists in the graph. |
Implemented in gum::BayesNet< GUM_SCALAR >, gum::BayesNet< double >, gum::InfluenceDiagram< GUM_SCALAR >, gum::BayesNetFragment< GUM_SCALAR >, gum::IMarkovNet< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::prm::ClassBayesNet< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.
|
pure virtual |
Returns a constant reference to the VariableNodeMap of this Graphical Model.
Implemented in gum::BayesNet< GUM_SCALAR >, gum::BayesNet< double >, gum::InfluenceDiagram< GUM_SCALAR >, gum::BayesNetFragment< GUM_SCALAR >, gum::IMarkovNet< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::prm::ClassBayesNet< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.
|
mutableprivate |
The properties of this Directed Graphical Model. Initialized using a lazy instantiation.
Definition at line 184 of file graphicalModel.h.