![]() |
aGrUM
0.17.2
a C++ library for (probabilistic) graphical models
|
<agrum/PRM/structuredBayesBall.h> More...
#include <structuredBayesBall.h>
Public Member Functions | |
void | compute (const PRMInstance< GUM_SCALAR > *i, NodeId n) |
Compute the set or requisite nodes for each required instance given the current set of observations. Discard previous computations. More... | |
void | compute (const PRMInstance< GUM_SCALAR > &i, NodeId n) |
Compute the set or requisite nodes for each required instance given the current set of observations. Discard previous computations. More... | |
bool | __isHardEvidence (const PRMInstance< GUM_SCALAR > *i, NodeId n) |
Returns true if there is a hard evidence on i->get(n). More... | |
Constructors & destructor. | |
StructuredBayesBall (const PRMInference< GUM_SCALAR > &inference) | |
Default Constructor. More... | |
~StructuredBayesBall () | |
Destructor. More... | |
Getters and Setters. | |
const std::string & | key (const PRMInstance< GUM_SCALAR > *i) const |
Returns a unique key w.r.t. d-separation for i. More... | |
const std::string & | key (const PRMInstance< GUM_SCALAR > &i) const |
Returns a unique key w.r.t. d-separation for i. More... | |
const Set< NodeId > & | requisiteNodes (const PRMInstance< GUM_SCALAR > *i) const |
Returns the set of requisite nodes w.r.t. d-separation for i. More... | |
const Set< NodeId > & | requisiteNodes (const PRMInstance< GUM_SCALAR > &i) const |
Returns the set of requisite nodes w.r.t. d-separation for i. More... | |
Size | occurrence (const std::string &key) const |
Returns the number of occurrence of the given key, which is the number of PRMInstance<GUM_SCALAR> sharing the same set of requisite nodes. More... | |
float | liftRatio () const |
Returns the ratio between the total number of instances and the number of instances with the same configuration. More... | |
bool | exists (const PRMInstance< GUM_SCALAR > *i) const |
Returns true if i has requisite nodes. More... | |
bool | exists (const PRMInstance< GUM_SCALAR > &i) const |
Returns true if i has requisite nodes. More... | |
<agrum/PRM/structuredBayesBall.h>
This class represent the BayesBall algorithm applied on PRMs.
Definition at line 51 of file structuredBayesBall.h.
|
private |
Code alias.
Definition at line 123 of file structuredBayesBall.h.
|
private |
Code alias.
Definition at line 121 of file structuredBayesBall.h.
INLINE gum::prm::StructuredBayesBall< GUM_SCALAR >::StructuredBayesBall | ( | const PRMInference< GUM_SCALAR > & | inference | ) |
Default Constructor.
Definition at line 260 of file structuredBayesBall_tpl.h.
References gum::prm::StructuredBayesBall< GUM_SCALAR >::__inf, and GUM_ERROR.
gum::prm::StructuredBayesBall< GUM_SCALAR >::~StructuredBayesBall | ( | ) |
Destructor.
Definition at line 36 of file structuredBayesBall_tpl.h.
|
private |
Copy constructor.
|
private |
Builds the HashKey for the given instance and requisite nodes set.
Definition at line 248 of file structuredBayesBall_tpl.h.
References gum::Set< Key, Alloc >::exists(), and gum::prm::PRMInstance< GUM_SCALAR >::type().
|
private |
Cleans this before a new computation.
Definition at line 44 of file structuredBayesBall_tpl.h.
|
private |
The real compute method.
Definition at line 79 of file structuredBayesBall_tpl.h.
Referenced by gum::prm::StructuredBayesBall< GUM_SCALAR >::compute().
|
private |
Fill __keyMap and __reqMap.
Definition at line 204 of file structuredBayesBall_tpl.h.
References gum::Set< Key, Alloc >::insert(), and gum::HashTable< Key, Val, Alloc >::insert().
|
private |
When the ball is received on i->get(n) from a child.
Definition at line 93 of file structuredBayesBall_tpl.h.
References gum::HashTable< Key, Val, Alloc >::exists(), gum::prm::PRMInstance< GUM_SCALAR >::getInstances(), gum::prm::PRMInstance< GUM_SCALAR >::getRefAttr(), GUM_ERROR, gum::HashTable< Key, Val, Alloc >::insert(), and gum::prm::PRMInstance< GUM_SCALAR >::type().
|
private |
When the ball is receive on i->get(n) from a parent.
Definition at line 167 of file structuredBayesBall_tpl.h.
References gum::HashTable< Key, Val, Alloc >::exists(), gum::prm::PRMInstance< GUM_SCALAR >::getRefAttr(), gum::HashTable< Key, Val, Alloc >::insert(), and gum::prm::PRMInstance< GUM_SCALAR >::type().
|
private |
Code alias.
Definition at line 348 of file structuredBayesBall_tpl.h.
|
private |
Code alias.
Definition at line 342 of file structuredBayesBall_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::type().
bool gum::prm::StructuredBayesBall< GUM_SCALAR >::__isHardEvidence | ( | const PRMInstance< GUM_SCALAR > * | i, |
NodeId | n | ||
) |
Returns true if there is a hard evidence on i->get(n).
Definition at line 53 of file structuredBayesBall_tpl.h.
References gum::Instantiation::end(), gum::prm::PRMInstance< GUM_SCALAR >::get(), gum::MultiDimDecorator< GUM_SCALAR >::get(), gum::Instantiation::inc(), and gum::Instantiation::setFirst().
INLINE void gum::prm::StructuredBayesBall< GUM_SCALAR >::compute | ( | const PRMInstance< GUM_SCALAR > * | i, |
NodeId | n | ||
) |
Compute the set or requisite nodes for each required instance given the current set of observations. Discard previous computations.
Definition at line 329 of file structuredBayesBall_tpl.h.
References gum::prm::StructuredBayesBall< GUM_SCALAR >::__compute().
INLINE void gum::prm::StructuredBayesBall< GUM_SCALAR >::compute | ( | const PRMInstance< GUM_SCALAR > & | i, |
NodeId | n | ||
) |
Compute the set or requisite nodes for each required instance given the current set of observations. Discard previous computations.
Definition at line 335 of file structuredBayesBall_tpl.h.
References gum::prm::StructuredBayesBall< GUM_SCALAR >::__compute().
INLINE bool gum::prm::StructuredBayesBall< GUM_SCALAR >::exists | ( | const PRMInstance< GUM_SCALAR > * | i | ) | const |
Returns true if i has requisite nodes.
Definition at line 317 of file structuredBayesBall_tpl.h.
References gum::prm::StructuredBayesBall< GUM_SCALAR >::__keyMap.
INLINE bool gum::prm::StructuredBayesBall< GUM_SCALAR >::exists | ( | const PRMInstance< GUM_SCALAR > & | i | ) | const |
Returns true if i has requisite nodes.
Definition at line 323 of file structuredBayesBall_tpl.h.
References gum::prm::StructuredBayesBall< GUM_SCALAR >::__keyMap.
INLINE const std::string & gum::prm::StructuredBayesBall< GUM_SCALAR >::key | ( | const PRMInstance< GUM_SCALAR > * | i | ) | const |
Returns a unique key w.r.t. d-separation for i.
Definition at line 282 of file structuredBayesBall_tpl.h.
References gum::prm::StructuredBayesBall< GUM_SCALAR >::__keyMap.
Referenced by gum::prm::StructuredBayesBall< GUM_SCALAR >::occurrence().
INLINE const std::string & gum::prm::StructuredBayesBall< GUM_SCALAR >::key | ( | const PRMInstance< GUM_SCALAR > & | i | ) | const |
Returns a unique key w.r.t. d-separation for i.
Definition at line 288 of file structuredBayesBall_tpl.h.
References gum::prm::StructuredBayesBall< GUM_SCALAR >::__keyMap.
INLINE float gum::prm::StructuredBayesBall< GUM_SCALAR >::liftRatio | ( | ) | const |
Returns the ratio between the total number of instances and the number of instances with the same configuration.
Definition at line 312 of file structuredBayesBall_tpl.h.
References gum::prm::StructuredBayesBall< GUM_SCALAR >::__keyMap, and gum::prm::StructuredBayesBall< GUM_SCALAR >::__reqMap.
INLINE Size gum::prm::StructuredBayesBall< GUM_SCALAR >::occurrence | ( | const std::string & | key | ) | const |
Returns the number of occurrence of the given key, which is the number of PRMInstance<GUM_SCALAR> sharing the same set of requisite nodes.
Definition at line 306 of file structuredBayesBall_tpl.h.
References gum::prm::StructuredBayesBall< GUM_SCALAR >::__reqMap, and gum::prm::StructuredBayesBall< GUM_SCALAR >::key().
|
private |
INLINE const Set< NodeId > & gum::prm::StructuredBayesBall< GUM_SCALAR >::requisiteNodes | ( | const PRMInstance< GUM_SCALAR > * | i | ) | const |
Returns the set of requisite nodes w.r.t. d-separation for i.
Definition at line 294 of file structuredBayesBall_tpl.h.
References gum::prm::StructuredBayesBall< GUM_SCALAR >::__keyMap.
INLINE const Set< NodeId > & gum::prm::StructuredBayesBall< GUM_SCALAR >::requisiteNodes | ( | const PRMInstance< GUM_SCALAR > & | i | ) | const |
Returns the set of requisite nodes w.r.t. d-separation for i.
Definition at line 300 of file structuredBayesBall_tpl.h.
References gum::prm::StructuredBayesBall< GUM_SCALAR >::__keyMap.
|
private |
The PRM at which __model belongs.
Definition at line 156 of file structuredBayesBall.h.
Referenced by gum::prm::StructuredBayesBall< GUM_SCALAR >::StructuredBayesBall().
|
private |
Associate an PRMInstance<GUM_SCALAR> with a unique key w.r.t. d-separation and the set of requisite nodes deduced from d-separation analysis.
Definition at line 164 of file structuredBayesBall.h.
Referenced by gum::prm::StructuredBayesBall< GUM_SCALAR >::exists(), gum::prm::StructuredBayesBall< GUM_SCALAR >::key(), gum::prm::StructuredBayesBall< GUM_SCALAR >::liftRatio(), and gum::prm::StructuredBayesBall< GUM_SCALAR >::requisiteNodes().
|
private |
Associate a Key with the set of requisite nodes associated with it. The Size value is the number of instance with the same key.
Definition at line 168 of file structuredBayesBall.h.
Referenced by gum::prm::StructuredBayesBall< GUM_SCALAR >::liftRatio(), and gum::prm::StructuredBayesBall< GUM_SCALAR >::occurrence().