![]() |
aGrUM 2.3.2
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 | |
| 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 | |
| virtual NodeSet | family (const NodeId id) const =0 |
| returns the family of a noe (parents or neighbours) of a node and the node | |
| virtual NodeSet | family (const std::string &name) const =0 |
Constructors / Destructors | |
| GraphicalModel () | |
| Default constructor. | |
| virtual | ~GraphicalModel () |
| Destructor. | |
| GraphicalModel (const GraphicalModel &source) | |
| Copy constructor. | |
Getter and setters | |
| const std::string & | property (const std::string &name) const |
| Return the value of the property name of this GraphicalModel. | |
| const std::string & | propertyWithDefault (const std::string &name, const std::string &byDefault) const |
| Return the value of the property name of this GraphicalModel. | |
| void | setProperty (const std::string &name, const std::string &value) |
| Add or change a property of this GraphicalModel. | |
| std::vector< std::string > | properties () const |
| List of all the properties. | |
Variable manipulation methods. | |
| virtual const VariableNodeMap & | variableNodeMap () const =0 |
| Returns a constant reference to the VariableNodeMap of this Graphical Model. | |
| virtual Size | size () const =0 |
| Returns the number of variables in this Directed Graphical Model. | |
| virtual bool | empty () const |
| Return true if this graphical model is empty. | |
| virtual bool | exists (NodeId node) const =0 |
| Return true if this node exists in this graphical model. | |
| virtual bool | exists (const std::string &name) const =0 |
| Returns a constant reference to the VariableNodeMap of this Graphical Model. | |
| std::vector< std::string > | names (const std::vector< NodeId > &ids) const |
| transform a vector of NodeId in a vector of names | |
| std::vector< std::string > | names (const NodeSet &ids) const |
| transform a NodeSet in a vector of names | |
| std::vector< NodeId > | ids (const std::vector< std::string > &names) const |
| transform a vector of names into a vector of nodeId | |
| NodeSet | nodeset (const std::vector< std::string > &names) const |
| transform a vector of names into a NodeSet | |
| gum::VariableSet | variables (const std::vector< std::string > &l) const |
| transform a vector of names into a VariableeSet | |
| gum::VariableSet | variables (const NodeSet &ids) const |
| transform a vector of NodeId into a VariableeSet | |
| virtual const NodeGraphPart & | nodes () const =0 |
| Returns a constant reference to the VariableNodeMap of this Graphical Model. | |
| Instantiation | completeInstantiation () const |
| Get an instantiation over all the variables of the model. | |
| virtual const DiscreteVariable & | variable (NodeId id) const =0 |
| Returns a constant reference over a variable given it's node id. | |
| virtual NodeId | nodeId (const DiscreteVariable &var) const =0 |
| Return id node src discrete var pointer. | |
| virtual NodeId | idFromName (const std::string &name) const =0 |
| Getter by name. | |
| virtual const DiscreteVariable & | variableFromName (const std::string &name) const =0 |
| Getter by name. | |
Static Public Member Functions | |
| static void | spaceCplxToStream (std::stringstream &s, double dSize, int dim, Size usedMem) |
| send to the stream the space complexity with 3 parametrs | |
Protected Member Functions | |
| GraphicalModel & | operator= (const GraphicalModel &source) |
| Private copy operator. | |
Private Member Functions | |
| const HashTable< std::string, std::string > & | _properties_ () const |
| Return the properties of this Directed Graphical Model. | |
Private Attributes | |
| HashTable< std::string, std::string > | _propertiesMap_ |
| The properties of this Directed Graphical Model. | |
Virtual base class for probabilistic graphical models.
Definition at line 65 of file graphicalModel.h.
| gum::GraphicalModel::GraphicalModel | ( | ) |
Default constructor.
Definition at line 49 of file graphicalModel.cpp.
References GraphicalModel().
Referenced by GraphicalModel(), GraphicalModel(), ~GraphicalModel(), family(), and operator=().
|
virtual |
Destructor.
Definition at line 53 of file graphicalModel.cpp.
References GraphicalModel().
| gum::GraphicalModel::GraphicalModel | ( | const GraphicalModel & | source | ) |
Copy constructor.
Do nothing.
Definition at line 51 of file graphicalModel.cpp.
References GraphicalModel().
|
private |
Return the properties of this Directed Graphical Model.
Definition at line 70 of file graphicalModel_inl.h.
References _propertiesMap_.
Referenced by property().
| INLINE Instantiation gum::GraphicalModel::completeInstantiation | ( | ) | const |
Get an instantiation over all the variables of the model.
Definition at line 106 of file graphicalModel_inl.h.
References nodes().
|
virtual |
Return true if this graphical model is empty.
Definition at line 116 of file graphicalModel_inl.h.
References size().
Referenced by gum::IBayesNet< GUM_SCALAR >::check(), and gum::BayesNet< GUM_SCALAR >::clear().
|
pure virtual |
Returns a constant reference to the VariableNodeMap of this Graphical Model.
Implemented in gum::DAGmodel, and gum::UGmodel.
References ids(), and names().
Return true if this node exists in this graphical model.
Implemented in gum::DAGmodel, and gum::UGmodel.
returns the family of a noe (parents or neighbours) of a node and the node
| id | the node which is the head of an arc with the returned nodes |
| name | the name of the node the node which is the head of an arc with the returned nodes |
Implemented in gum::DAGmodel, and gum::UGmodel.
|
pure virtual |
Implemented in gum::DAGmodel, and gum::UGmodel.
References GraphicalModel().
|
pure virtual |
Getter by name.
| NotFound | if no such name exists in the graph. |
Implemented in gum::BayesNet< GUM_SCALAR >, gum::BayesNet< double >, gum::BayesNetFragment< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::IMarkovRandomField< GUM_SCALAR >, gum::InfluenceDiagram< GUM_SCALAR >, gum::prm::ClassBayesNet< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.
Referenced by gum::DAGmodel::ancestors(), gum::DAGmodel::children(), gum::IBayesNet< double >::children(), gum::DAGmodel::descendants(), gum::UGmodel::exists(), gum::DAGmodel::existsArc(), gum::UGmodel::existsEdge(), gum::DAGmodel::family(), gum::UGmodel::family(), gum::DAGmodel::hasSameStructure(), gum::MarkovBlanket::hasSameStructure(), gum::UGmodel::hasSameStructure(), gum::DAGmodel::isIndependent(), gum::UGmodel::isIndependent(), gum::UGmodel::neighbours(), nodeset(), and gum::DAGmodel::parents().
| 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 139 of file graphicalModel_inl.h.
References names().
Referenced by gum::DAGmodel::children(), exists(), names(), and gum::DAGmodel::parents().
|
pure virtual |
check if nodes X and nodes Y are independent given nodes Z
Implemented in gum::DAGmodel, and gum::UGmodel.
|
pure virtual |
check if node X and node Y are independent given nodes Z
Implemented in gum::DAGmodel, and gum::UGmodel.
| INLINE double gum::GraphicalModel::log10DomainSize | ( | ) | const |
Definition at line 95 of file graphicalModel_inl.h.
References nodes().
Referenced by gum::IBayesNet< GUM_SCALAR >::toString(), gum::IMarkovRandomField< GUM_SCALAR >::toString(), and gum::InfluenceDiagram< GUM_SCALAR >::toString().
| INLINE std::vector< std::string > gum::GraphicalModel::names | ( | const NodeSet & | ids | ) | const |
transform a NodeSet in a vector of names
Definition at line 129 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 119 of file graphicalModel_inl.h.
References ids(), and variableNodeMap().
Referenced by gum::DAGmodel::children(), exists(), ids(), nodeset(), and gum::DAGmodel::parents().
|
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::BayesNetFragment< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::IMarkovRandomField< GUM_SCALAR >, gum::InfluenceDiagram< GUM_SCALAR >, 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::DAGmodel, and gum::UGmodel.
Referenced by completeInstantiation(), and log10DomainSize().
| NodeSet gum::GraphicalModel::nodeset | ( | const std::vector< std::string > & | names | ) | const |
transform a vector of names into a NodeSet
Definition at line 60 of file graphicalModel.cpp.
References idFromName(), gum::Set< Key >::insert(), and names().
Referenced by gum::IBayesNet< double >::children(), gum::IBayesNet< double >::children(), gum::DAGmodel::isIndependent(), gum::DAGmodel::isIndependent(), gum::UGmodel::isIndependent(), gum::UGmodel::isIndependent(), gum::DAGmodel::moralizedAncestralGraph(), and gum::DAGmodel::parents().
|
protected |
Private copy operator.
Definition at line 55 of file graphicalModel.cpp.
References GraphicalModel(), and _propertiesMap_.
Referenced by gum::DAGmodel::operator=(), and gum::UGmodel::operator=().
| INLINE std::vector< std::string > gum::GraphicalModel::properties | ( | ) | const |
List of all the properties.
Definition at line 81 of file graphicalModel_inl.h.
References _propertiesMap_.
| 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 60 of file graphicalModel_inl.h.
References _properties_(), and GUM_ERROR.
Referenced by gum::IMarkovRandomField< GUM_SCALAR >::toDot(), gum::InfluenceDiagram< GUM_SCALAR >::toDot(), and gum::IMarkovRandomField< GUM_SCALAR >::toDotAsFactorGraph().
| 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 75 of file graphicalModel_inl.h.
References _propertiesMap_.
| INLINE void gum::GraphicalModel::setProperty | ( | const std::string & | name, |
| const std::string & | value ) |
Add or change a property of this GraphicalModel.
Definition at line 89 of file graphicalModel_inl.h.
References _propertiesMap_.
Referenced by gum::IBayesNet< GUM_SCALAR >::IBayesNet(), gum::IMarkovRandomField< GUM_SCALAR >::IMarkovRandomField(), and gum::InfluenceDiagram< GUM_SCALAR >::fastPrototype().
|
pure virtual |
Returns the number of variables in this Directed Graphical Model.
Implemented in gum::DAGmodel, and gum::UGmodel.
Referenced by empty().
|
static |
send to the stream the space complexity with 3 parametrs
| s | the stream |
| dSize | the log10domainSize |
| dim | the dimension |
| usedMem | the memory needed for the params |
Definition at line 69 of file graphicalModel.cpp.
Referenced by gum::IBayesNet< GUM_SCALAR >::toString().
|
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::BayesNetFragment< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::IMarkovRandomField< GUM_SCALAR >, gum::InfluenceDiagram< GUM_SCALAR >, gum::prm::ClassBayesNet< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.
Referenced by gum::DAGmodel::hasSameStructure(), and gum::UGmodel::hasSameStructure().
|
pure virtual |
Getter by name.
| NotFound | if no such name exists in the graph. |
Implemented in gum::BayesNet< GUM_SCALAR >, gum::BayesNet< double >, gum::BayesNetFragment< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::IMarkovRandomField< GUM_SCALAR >, gum::InfluenceDiagram< GUM_SCALAR >, 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::BayesNetFragment< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::IMarkovRandomField< GUM_SCALAR >, gum::InfluenceDiagram< GUM_SCALAR >, gum::prm::ClassBayesNet< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.
Referenced by gum::IBayesNet< double >::empty(), names(), variables(), and variables().
| INLINE VariableSet gum::GraphicalModel::variables | ( | const NodeSet & | ids | ) | const |
transform a vector of NodeId into a VariableeSet
Definition at line 160 of file graphicalModel_inl.h.
References gum::VariableNodeMap::get(), gum::Set< Key >::insert(), and variableNodeMap().
| INLINE VariableSet gum::GraphicalModel::variables | ( | const std::vector< std::string > & | l | ) | const |
transform a vector of names into a VariableeSet
Definition at line 150 of file graphicalModel_inl.h.
References variableNodeMap().
|
private |
The properties of this Directed Graphical Model.
Definition at line 236 of file graphicalModel.h.
Referenced by _properties_(), operator=(), properties(), propertyWithDefault(), and setProperty().