![]() |
aGrUM
0.17.2
a C++ library for (probabilistic) graphical models
|
Class representing the minimal interface for Bayesian Network. More...
#include <agrum/BN/IMarkovNet.h>
Public Member Functions | |
bool | operator== (const IMarkovNet< GUM_SCALAR > &from) const |
This operator compares 2 BNs ! More... | |
bool | operator!= (const IMarkovNet< 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 |
bool | hasSameStructure (const UGmodel &other) |
double | log10DomainSize () const |
Constructors / Destructors | |
IMarkovNet () | |
Default constructor. More... | |
IMarkovNet (std::string name) | |
Default constructor. More... | |
virtual | ~IMarkovNet () |
Destructor. More... | |
IMarkovNet (const IMarkovNet< GUM_SCALAR > &source) | |
Copy constructor. More... | |
IMarkovNet< GUM_SCALAR > & | operator= (const IMarkovNet< GUM_SCALAR > &source) |
Copy operator. More... | |
Pure Virtual methods | |
virtual const Potential< GUM_SCALAR > & | factor (const NodeSet &varIds) const =0 |
Returns the factor of a set of variable. More... | |
virtual const FactorTable< GUM_SCALAR > & | factors () const =0 |
Returns the set of factors as a IMarkovNet::FactorTable. More... | |
virtual const VariableNodeMap & | variableNodeMap () const =0 |
Returns a constant reference to the VariableNodeMap of thisBN. 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 from 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... | |
Variable manipulation methods. | |
const UndiGraph & | graph () const |
Returns a constant reference to the dag of this Bayes Net. More... | |
virtual Size | size () const final |
Returns the number of variables in this Directed Graphical Model. More... | |
Size | sizeEdges () const |
Returns the number of arcs in this Directed Graphical Model. More... | |
const NodeGraphPart & | nodes () const |
Returns a constant reference to the dag of this Bayes Net. More... | |
Edge manipulation methods. | |
const EdgeSet & | edges () const |
returns the neighbours of a node as set of nodes More... | |
const NodeSet & | neighbours (const NodeId id) const |
returns the neighbours of a node as set of nodes More... | |
const NodeSet & | neighbours (const std::string &name) const |
returns the neighbours of a node as set of nodes 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 bool | empty () const |
Retursn true if this Directed Graphical Model is empty. More... | |
Instantiation | completeInstantiation () const |
Get an instantiation over all the variables of the model. More... | |
Protected Attributes | |
UndiGraph | _graph |
The DAG of this Directed Graphical Model. More... | |
Class representing the minimal interface for Bayesian Network.
This class is used as a base class for different versions of Bayesian Networks. No data (except the dag herited from DAGmodel are included in this class. Many algorithms (inference for instance) may use this class when a simple BN is needed.
Definition at line 64 of file IMarkovNet.h.
INLINE gum::IMarkovNet< GUM_SCALAR >::IMarkovNet | ( | ) |
|
explicit |
Default constructor.
Definition at line 45 of file IMarkovNet_tpl.h.
References gum::GraphicalModel::setProperty().
|
virtual |
gum::IMarkovNet< GUM_SCALAR >::IMarkovNet | ( | const IMarkovNet< GUM_SCALAR > & | source | ) |
|
inherited |
Get an instantiation over all the variables of the model.
Definition at line 85 of file graphicalModel_inl.h.
References gum::GraphicalModel::nodes(), and gum::GraphicalModel::variable().
Size gum::IMarkovNet< GUM_SCALAR >::dim | ( | ) | const |
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 70 of file IMarkovNet_tpl.h.
References gum::IMarkovNet< GUM_SCALAR >::factors().
|
inherited |
returns the neighbours of a node as set of nodes
Note that the set of nodes returned may be empty if no edge within the EdgeGraphPart contains the given node.
id | the node toward which the edge returned are pointing |
Definition at line 44 of file UGmodel_inl.h.
References gum::UGmodel::_graph, and gum::EdgeGraphPart::edges().
Referenced by gum::UGmodel::hasSameStructure().
|
virtualinherited |
Retursn true if this Directed Graphical Model is empty.
Definition at line 95 of file graphicalModel_inl.h.
References gum::GraphicalModel::size().
|
pure virtual |
Returns the factor of a set of variable.
NotFound | If no variable's id matches varId. |
Referenced by gum::IMarkovNet< GUM_SCALAR >::toString().
|
pure virtual |
Returns the set of factors as a IMarkovNet::FactorTable.
Referenced by gum::IMarkovNet< GUM_SCALAR >::dim(), and gum::IMarkovNet< GUM_SCALAR >::toString().
|
inherited |
Returns a constant reference to the dag of this Bayes Net.
Definition at line 36 of file UGmodel_inl.h.
References gum::UGmodel::_graph.
Referenced by gum::UGmodel::size(), and gum::IMarkovNet< GUM_SCALAR >::toString().
Definition at line 47 of file UGmodel.cpp.
References gum::UGmodel::edges(), gum::Set< Key, Alloc >::exists(), gum::UGmodel::idFromName(), gum::UGmodel::nodes(), gum::UGmodel::size(), gum::UGmodel::sizeEdges(), and gum::UGmodel::variable().
|
pure virtual |
|
inherited |
Definition at line 74 of file graphicalModel_inl.h.
References gum::GraphicalModel::nodes(), and gum::GraphicalModel::variable().
Referenced by gum::InfluenceDiagram< GUM_SCALAR >::toString(), and gum::IMarkovNet< GUM_SCALAR >::toString().
GUM_SCALAR gum::IMarkovNet< GUM_SCALAR >::maxNonOneParam | ( | ) | const |
Definition at line 132 of file IMarkovNet_tpl.h.
References GUM_ERROR.
GUM_SCALAR gum::IMarkovNet< GUM_SCALAR >::maxParam | ( | ) | const |
Definition at line 105 of file IMarkovNet_tpl.h.
References GUM_ERROR.
Size gum::IMarkovNet< GUM_SCALAR >::maxVarDomainSize | ( | ) | const |
Definition at line 79 of file IMarkovNet_tpl.h.
References GUM_ERROR.
GUM_SCALAR gum::IMarkovNet< GUM_SCALAR >::minNonZeroParam | ( | ) | const |
Definition at line 118 of file IMarkovNet_tpl.h.
References GUM_ERROR.
GUM_SCALAR gum::IMarkovNet< GUM_SCALAR >::minParam | ( | ) | const |
Definition at line 92 of file IMarkovNet_tpl.h.
References GUM_ERROR.
returns the neighbours of a node as set of nodes
Note that the set of nodes returned may be empty if no edge within the EdgeGraphPart contains the given node.
id | the node toward which the edge returned are pointing |
Definition at line 46 of file UGmodel_inl.h.
References gum::UGmodel::_graph, and gum::EdgeGraphPart::neighbours().
Referenced by gum::UGmodel::neighbours().
|
inherited |
returns the neighbours of a node as set of nodes
Note that the set of nodes returned may be empty if no edge within the EdgeGraphPart contains the given node.
id | the node toward which the edge returned are pointing |
Definition at line 49 of file UGmodel_inl.h.
References gum::UGmodel::idFromName(), and gum::UGmodel::neighbours().
|
pure virtual |
Return id node from discrete var pointer.
NotFound | If no variable matches var. |
Implements gum::UGmodel.
|
virtualinherited |
Returns a constant reference to the dag of this Bayes Net.
Implements gum::GraphicalModel.
Definition at line 53 of file UGmodel_inl.h.
References gum::UGmodel::_graph.
Referenced by gum::UGmodel::hasSameStructure().
bool gum::IMarkovNet< GUM_SCALAR >::operator!= | ( | const IMarkovNet< GUM_SCALAR > & | from | ) | const |
Definition at line 254 of file IMarkovNet_tpl.h.
References gum::IMarkovNet< GUM_SCALAR >::operator==().
IMarkovNet< GUM_SCALAR > & gum::IMarkovNet< GUM_SCALAR >::operator= | ( | const IMarkovNet< GUM_SCALAR > & | source | ) |
Copy operator.
Definition at line 58 of file IMarkovNet_tpl.h.
References gum::UGmodel::operator=().
Referenced by gum::build_node().
bool gum::IMarkovNet< GUM_SCALAR >::operator== | ( | const IMarkovNet< GUM_SCALAR > & | from | ) | const |
This operator compares 2 BNs !
Definition at line 208 of file IMarkovNet_tpl.h.
Referenced by gum::IMarkovNet< GUM_SCALAR >::operator!=().
|
inherited |
Return the value of the property name of this GraphicalModel.
NotFound | Raised if no name property is found. |
Definition at line 37 of file graphicalModel_inl.h.
References gum::GraphicalModel::__properties(), and GUM_ERROR.
Referenced by gum::InfluenceDiagram< GUM_SCALAR >::toDot().
|
inherited |
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.
References gum::GraphicalModel::__properties().
|
inherited |
Add or change a property of this GraphicalModel.
Definition at line 65 of file graphicalModel_inl.h.
References gum::GraphicalModel::__properties(), and gum::HashTable< Key, Val, Alloc >::insert().
Referenced by gum::BayesNet< double >::fastPrototype(), and gum::IMarkovNet< GUM_SCALAR >::IMarkovNet().
|
finalvirtualinherited |
Returns the number of variables in this Directed Graphical Model.
Implements gum::GraphicalModel.
Definition at line 39 of file UGmodel_inl.h.
References gum::UGmodel::graph(), and gum::NodeGraphPart::size().
Referenced by gum::UGmodel::hasSameStructure(), and gum::IMarkovNet< GUM_SCALAR >::toString().
|
inherited |
Returns the number of arcs in this Directed Graphical Model.
Definition at line 42 of file UGmodel_inl.h.
References gum::UGmodel::_graph, and gum::EdgeGraphPart::sizeEdges().
Referenced by gum::UGmodel::hasSameStructure().
|
virtual |
Definition at line 166 of file IMarkovNet_tpl.h.
INLINE std::string gum::IMarkovNet< GUM_SCALAR >::toString | ( | ) | const |
Definition at line 145 of file IMarkovNet_tpl.h.
References gum::IMarkovNet< GUM_SCALAR >::factor(), gum::IMarkovNet< GUM_SCALAR >::factors(), gum::UGmodel::graph(), gum::GraphicalModel::log10DomainSize(), gum::UGmodel::size(), and gum::EdgeGraphPart::sizeEdges().
Referenced by gum::operator<<().
|
pure virtual |
Returns a constant reference over a variable given it's node id.
NotFound | If no variable's id matches varId. |
Implements gum::UGmodel.
|
pure virtual |
|
pure virtual |
Returns a constant reference to the VariableNodeMap of thisBN.
Implements gum::GraphicalModel.
|
protectedinherited |
The DAG of this Directed Graphical Model.
Definition at line 137 of file UGmodel.h.
Referenced by gum::UGmodel::edges(), gum::UGmodel::graph(), gum::UGmodel::neighbours(), gum::UGmodel::nodes(), gum::UGmodel::operator=(), and gum::UGmodel::sizeEdges().