![]() |
aGrUM
0.14.2
|
<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 48 of file structuredBayesBall.h.
|
private |
Code alias.
Definition at line 120 of file structuredBayesBall.h.
|
private |
Code alias.
Definition at line 118 of file structuredBayesBall.h.
INLINE gum::prm::StructuredBayesBall< GUM_SCALAR >::StructuredBayesBall | ( | const PRMInference< GUM_SCALAR > & | inference | ) |
Default Constructor.
Definition at line 257 of file structuredBayesBall_tpl.h.
References gum::prm::StructuredBayesBall< GUM_SCALAR >::__inf, GUM_ERROR, and gum::prm::StructuredBayesBall< GUM_SCALAR >::operator=().
gum::prm::StructuredBayesBall< GUM_SCALAR >::~StructuredBayesBall | ( | ) |
Destructor.
Definition at line 33 of file structuredBayesBall_tpl.h.
|
private |
Copy constructor.
|
private |
Builds the HashKey for the given instance and requisite nodes set.
Definition at line 245 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 41 of file structuredBayesBall_tpl.h.
|
private |
The real compute method.
Definition at line 76 of file structuredBayesBall_tpl.h.
Referenced by gum::prm::StructuredBayesBall< GUM_SCALAR >::compute().
|
private |
Fill __keyMap and __reqMap.
Definition at line 201 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 90 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 164 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 344 of file structuredBayesBall_tpl.h.
|
private |
Code alias.
Definition at line 338 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 50 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 325 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 331 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 313 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 319 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 278 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 284 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 308 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 302 of file structuredBayesBall_tpl.h.
References gum::prm::StructuredBayesBall< GUM_SCALAR >::__reqMap, and gum::prm::StructuredBayesBall< GUM_SCALAR >::key().
|
private |
Copy operator.
Definition at line 273 of file structuredBayesBall_tpl.h.
References GUM_ERROR.
Referenced by gum::prm::StructuredBayesBall< GUM_SCALAR >::StructuredBayesBall().
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 290 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 296 of file structuredBayesBall_tpl.h.
References gum::prm::StructuredBayesBall< GUM_SCALAR >::__keyMap.
|
private |
The PRM at which __model belongs.
Definition at line 153 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 161 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 165 of file structuredBayesBall.h.
Referenced by gum::prm::StructuredBayesBall< GUM_SCALAR >::liftRatio(), and gum::prm::StructuredBayesBall< GUM_SCALAR >::occurrence().