aGrUM  0.14.2
gum::prm::StructuredBayesBall< GUM_SCALAR > Class Template Reference

<agrum/PRM/structuredBayesBall.h> More...

#include <structuredBayesBall.h>

+ Collaboration diagram for gum::prm::StructuredBayesBall< GUM_SCALAR >:

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...
 

Detailed Description

template<typename GUM_SCALAR>
class gum::prm::StructuredBayesBall< GUM_SCALAR >

<agrum/PRM/structuredBayesBall.h>

This class represent the BayesBall algorithm applied on PRMs.

Definition at line 48 of file structuredBayesBall.h.

Member Typedef Documentation

◆ InstanceMap

template<typename GUM_SCALAR>
typedef HashTable< const PRMInstance< GUM_SCALAR >*, MarkMap* > gum::prm::StructuredBayesBall< GUM_SCALAR >::InstanceMap
private

Code alias.

Definition at line 120 of file structuredBayesBall.h.

◆ MarkMap

template<typename GUM_SCALAR>
typedef HashTable< NodeId, std::pair< bool, bool > > gum::prm::StructuredBayesBall< GUM_SCALAR >::MarkMap
private

Code alias.

Definition at line 118 of file structuredBayesBall.h.

Constructor & Destructor Documentation

◆ StructuredBayesBall() [1/2]

template<typename GUM_SCALAR >
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=().

258  :
259  __inf(&inference) {
260  GUM_CONSTRUCTOR(StructuredBayesBall);
261  }
StructuredBayesBall(const PRMInference< GUM_SCALAR > &inference)
Default Constructor.
const PRMInference< GUM_SCALAR > * __inf
The PRM at which __model belongs.
+ Here is the call graph for this function:

◆ ~StructuredBayesBall()

template<typename GUM_SCALAR >
gum::prm::StructuredBayesBall< GUM_SCALAR >::~StructuredBayesBall ( )

Destructor.

Definition at line 33 of file structuredBayesBall_tpl.h.

33  {
34  GUM_DESTRUCTOR(StructuredBayesBall);
35 
36  for (const auto& elt : __reqMap)
37  delete elt.second.first;
38  }
HashTable< std::string, std::pair< Set< NodeId > *, Size > > __reqMap
Associate a Key with the set of requisite nodes associated with it. The Size value is the number of i...
StructuredBayesBall(const PRMInference< GUM_SCALAR > &inference)
Default Constructor.

◆ StructuredBayesBall() [2/2]

template<typename GUM_SCALAR>
gum::prm::StructuredBayesBall< GUM_SCALAR >::StructuredBayesBall ( const StructuredBayesBall< GUM_SCALAR > &  source)
private

Copy constructor.

Member Function Documentation

◆ __buildHashKey()

template<typename GUM_SCALAR >
std::string gum::prm::StructuredBayesBall< GUM_SCALAR >::__buildHashKey ( const PRMInstance< GUM_SCALAR > *  i,
Set< NodeId > &  req_nodes 
)
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().

246  {
247  std::stringstream sBuff;
248  sBuff << i->type().name();
249 
250  for (const auto node : i->type().containerDag().nodes())
251  if (req_nodes.exists(node)) sBuff << "-" << node;
252 
253  return sBuff.str();
254  }
bool exists(const Key &k) const
Indicates whether a given elements belong to the set.
Definition: set_tpl.h:604
+ Here is the call graph for this function:

◆ __clean()

template<typename GUM_SCALAR >
void gum::prm::StructuredBayesBall< GUM_SCALAR >::__clean ( )
private

Cleans this before a new computation.

Definition at line 41 of file structuredBayesBall_tpl.h.

41  {
42  for (const auto& elt : __reqMap)
43  delete elt.second.first;
44 
45  __keyMap.clear();
46  __reqMap.clear();
47  }
HashTable< const PRMInstance< GUM_SCALAR > *, std::pair< std::string, Set< NodeId > *> > __keyMap
Associate an PRMInstance<GUM_SCALAR> with a unique key w.r.t. d-separation and the set of requisite n...
HashTable< std::string, std::pair< Set< NodeId > *, Size > > __reqMap
Associate a Key with the set of requisite nodes associated with it. The Size value is the number of i...

◆ __compute()

template<typename GUM_SCALAR >
void gum::prm::StructuredBayesBall< GUM_SCALAR >::__compute ( const PRMInstance< GUM_SCALAR > *  i,
NodeId  n 
)
private

The real compute method.

Definition at line 76 of file structuredBayesBall_tpl.h.

Referenced by gum::prm::StructuredBayesBall< GUM_SCALAR >::compute().

77  {
78  __clean();
82  __fromChild(i, n, marks);
83  __fillMaps(marks);
84 
85  for (const auto& elt : marks)
86  delete elt.second;
87  }
void __fillMaps(InstanceMap &marks)
Fill __keyMap and __reqMap.
void __fromChild(const PRMInstance< GUM_SCALAR > *i, NodeId n, InstanceMap &marks)
When the ball is received on i->get(n) from a child.
void __clean()
Cleans this before a new computation.
HashTable< const PRMInstance< GUM_SCALAR > *, MarkMap *> InstanceMap
Code alias.
+ Here is the caller graph for this function:

◆ __fillMaps()

template<typename GUM_SCALAR >
void gum::prm::StructuredBayesBall< GUM_SCALAR >::__fillMaps ( InstanceMap marks)
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().

201  {
202  // First find for each instance it's requisite nodes
203  HashTable< const PRMInstance< GUM_SCALAR >*, Set< NodeId >* > req_map;
204 
205  for (const auto& elt : marks) {
206  Set< NodeId >* req_set = new Set< NodeId >();
207 
208  for (const auto& elt2 : *elt.second)
209  if (elt2.second.first) req_set->insert(elt2.first);
210 
211  req_map.insert(elt.first, req_set);
212  }
213 
214  // Remove all instances with 0 requisite nodes
215  Set< const PRMInstance< GUM_SCALAR >* > to_remove;
216 
217  for (const auto& elt : req_map)
218  if (elt.second->size() == 0) to_remove.insert(elt.first);
219 
220  for (const auto remo : to_remove) {
221  delete req_map[remo];
222  req_map.erase(remo);
223  }
224 
225  // Fill __reqMap and __keyMap
226  for (const auto& elt : req_map) {
227  std::string key = __buildHashKey(elt.first, *elt.second);
228 
229  if (__reqMap.exists(key)) {
230  __keyMap.insert(
231  elt.first,
232  std::pair< std::string, Set< NodeId >* >(key, __reqMap[key].first));
233  __reqMap[key].second += 1;
234  delete elt.second;
235  req_map[elt.first] = 0;
236  } else {
237  __reqMap.insert(key, std::pair< Set< NodeId >*, Size >(elt.second, 1));
238  __keyMap.insert(
239  elt.first, std::pair< std::string, Set< NodeId >* >(key, elt.second));
240  }
241  }
242  }
HashTable< const PRMInstance< GUM_SCALAR > *, std::pair< std::string, Set< NodeId > *> > __keyMap
Associate an PRMInstance<GUM_SCALAR> with a unique key w.r.t. d-separation and the set of requisite n...
HashTable< std::string, std::pair< Set< NodeId > *, Size > > __reqMap
Associate a Key with the set of requisite nodes associated with it. The Size value is the number of i...
std::string __buildHashKey(const PRMInstance< GUM_SCALAR > *i, Set< NodeId > &req_nodes)
Builds the HashKey for the given instance and requisite nodes set.
const std::string & key(const PRMInstance< GUM_SCALAR > *i) const
Returns a unique key w.r.t. d-separation for i.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
void insert(const Key &k)
Inserts a new element into the set.
Definition: set_tpl.h:610
+ Here is the call graph for this function:

◆ __fromChild()

template<typename GUM_SCALAR >
void gum::prm::StructuredBayesBall< GUM_SCALAR >::__fromChild ( const PRMInstance< GUM_SCALAR > *  i,
NodeId  n,
InstanceMap marks 
)
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().

91  {
92  if (!marks.exists(i)) {
93  marks.insert(i, new StructuredBayesBall< GUM_SCALAR >::MarkMap());
94  }
95 
96  if (!marks[i]->exists(n)) {
97  marks[i]->insert(n, std::pair< bool, bool >(false, false));
98  }
99 
100  // Sending message to parents
101  switch (i->type().get(n).elt_type()) {
103  if (!__getMark(marks, i, n).first) {
104  __getMark(marks, i, n).first = true;
105 
106  for (const auto inst : i->getInstances(n))
107  __fromChild(
108  inst, inst->get(__getSC(i, n).lastElt().safeName()).id(), marks);
109  }
110 
111  if (!__getMark(marks, i, n).second) {
112  __getMark(marks, i, n).second = true;
113 
114  for (const auto chi : i->type().containerDag().children(n))
115  __fromParent(i, chi, marks);
116  }
117 
118  break;
119  }
120 
123  if (!__getMark(marks, i, n).first) {
124  __getMark(marks, i, n).first = true;
125 
126  if (!__isHardEvidence(i, n))
127  for (const auto par : i->type().containerDag().parents(n))
128  __fromChild(i, par, marks);
129  }
130 
131  if (!__getMark(marks, i, n).second) {
132  __getMark(marks, i, n).second = true;
133 
134  // In i.
135  for (const auto chi : i->type().containerDag().children(n))
136  __fromParent(i, chi, marks);
137 
138  // Out of i.
139  try {
140  const auto& refs = i->getRefAttr(n);
141 
142  for (auto iter = refs.begin(); iter != refs.end(); ++iter)
143  __fromParent(
144  iter->first, iter->first->type().get(iter->second).id(), marks);
145  } catch (NotFound&) {
146  // Not an inverse sc
147  }
148  }
149 
150  break;
151  }
152 
153  default: {
154  // We shouldn't reach any other PRMClassElement<GUM_DATA> than
155  // PRMAttribute
156  // or
157  // PRMSlotChain<GUM_SCALAR>.
158  GUM_ERROR(FatalError, "This case is impossible.");
159  }
160  }
161  }
std::pair< bool, bool > & __getMark(InstanceMap &marks, const PRMInstance< GUM_SCALAR > *i, NodeId n)
Code alias.
bool __isHardEvidence(const PRMInstance< GUM_SCALAR > *i, NodeId n)
Returns true if there is a hard evidence on i->get(n).
bool exists(const PRMInstance< GUM_SCALAR > *i) const
Returns true if i has requisite nodes.
HashTable< NodeId, std::pair< bool, bool > > MarkMap
Code alias.
void __fromChild(const PRMInstance< GUM_SCALAR > *i, NodeId n, InstanceMap &marks)
When the ball is received on i->get(n) from a child.
const PRMSlotChain< GUM_SCALAR > & __getSC(const PRMInstance< GUM_SCALAR > *i, NodeId n)
Code alias.
void __fromParent(const PRMInstance< GUM_SCALAR > *i, NodeId n, InstanceMap &marks)
When the ball is receive on i->get(n) from a parent.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:52
+ Here is the call graph for this function:

◆ __fromParent()

template<typename GUM_SCALAR >
void gum::prm::StructuredBayesBall< GUM_SCALAR >::__fromParent ( const PRMInstance< GUM_SCALAR > *  i,
NodeId  n,
InstanceMap marks 
)
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().

165  {
166  if (!marks.exists(i)) {
167  marks.insert(i, new StructuredBayesBall< GUM_SCALAR >::MarkMap());
168  }
169 
170  if (!marks[i]->exists(n)) {
171  marks[i]->insert(n, std::pair< bool, bool >(false, false));
172  }
173 
174  // Concerns only PRMAttribute (because of the hard evidence)
175  if ((__isHardEvidence(i, n)) && (!__getMark(marks, i, n).first)) {
176  __getMark(marks, i, n).first = true;
177 
178  for (const auto par : i->type().containerDag().parents(n))
179  __fromChild(i, par, marks);
180  } else if (!__getMark(marks, i, n).second) {
181  __getMark(marks, i, n).second = true;
182 
183  // In i.
184  for (const auto chi : i->type().containerDag().children(n))
185  __fromParent(i, chi, marks);
186 
187  // Out of i.
188  try {
189  for (auto iter = i->getRefAttr(n).begin();
190  iter != i->getRefAttr(n).end();
191  ++iter)
192  __fromParent(
193  iter->first, iter->first->type().get(iter->second).id(), marks);
194  } catch (NotFound&) {
195  // Not an inverse sc
196  }
197  }
198  }
std::pair< bool, bool > & __getMark(InstanceMap &marks, const PRMInstance< GUM_SCALAR > *i, NodeId n)
Code alias.
bool __isHardEvidence(const PRMInstance< GUM_SCALAR > *i, NodeId n)
Returns true if there is a hard evidence on i->get(n).
bool exists(const PRMInstance< GUM_SCALAR > *i) const
Returns true if i has requisite nodes.
HashTable< NodeId, std::pair< bool, bool > > MarkMap
Code alias.
void __fromChild(const PRMInstance< GUM_SCALAR > *i, NodeId n, InstanceMap &marks)
When the ball is received on i->get(n) from a child.
void __fromParent(const PRMInstance< GUM_SCALAR > *i, NodeId n, InstanceMap &marks)
When the ball is receive on i->get(n) from a parent.
+ Here is the call graph for this function:

◆ __getMark()

template<typename GUM_SCALAR >
INLINE std::pair< bool, bool > & gum::prm::StructuredBayesBall< GUM_SCALAR >::__getMark ( InstanceMap marks,
const PRMInstance< GUM_SCALAR > *  i,
NodeId  n 
)
private

Code alias.

Definition at line 344 of file structuredBayesBall_tpl.h.

345  {
346  return (*(marks[i]))[n];
347  }

◆ __getSC()

template<typename GUM_SCALAR >
INLINE const PRMSlotChain< GUM_SCALAR > & gum::prm::StructuredBayesBall< GUM_SCALAR >::__getSC ( const PRMInstance< GUM_SCALAR > *  i,
NodeId  n 
)
private

Code alias.

Definition at line 338 of file structuredBayesBall_tpl.h.

References gum::prm::PRMInstance< GUM_SCALAR >::type().

339  {
340  return static_cast< const PRMSlotChain< GUM_SCALAR >& >(i->type().get(n));
341  }
+ Here is the call graph for this function:

◆ __isHardEvidence()

template<typename GUM_SCALAR >
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().

51  {
52  try {
53  typename PRMInference< GUM_SCALAR >::Chain chain =
54  std::make_pair(i, &(i->get(n)));
55 
56  if (__inf->hasEvidence(chain)) {
57  const Potential< GUM_SCALAR >* e = __inf->evidence(i)[n];
58  Instantiation inst(e);
59  Size count = 0;
60 
61  for (inst.setFirst(); !inst.end(); inst.inc()) {
62  if ((e->get(inst) == (GUM_SCALAR)1.0))
63  ++count;
64  else if (e->get(inst) != (GUM_SCALAR)0.0)
65  return false;
66  }
67 
68  return (count == 1);
69  }
70 
71  return false;
72  } catch (NotFound&) { return false; }
73  }
std::pair< const PRMInstance< GUM_SCALAR > *, const PRMAttribute< GUM_SCALAR > *> Chain
Code alias.
Definition: PRMInference.h:54
const PRMInference< GUM_SCALAR > * __inf
The PRM at which __model belongs.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
+ Here is the call graph for this function:

◆ compute() [1/2]

template<typename GUM_SCALAR >
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().

326  {
327  __compute(i, n);
328  }
void __compute(const PRMInstance< GUM_SCALAR > *i, NodeId n)
The real compute method.
+ Here is the call graph for this function:

◆ compute() [2/2]

template<typename GUM_SCALAR >
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().

332  {
333  __compute(&i, n);
334  }
void __compute(const PRMInstance< GUM_SCALAR > *i, NodeId n)
The real compute method.
+ Here is the call graph for this function:

◆ exists() [1/2]

template<typename GUM_SCALAR >
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.

314  {
315  return __keyMap.exists(i);
316  }
HashTable< const PRMInstance< GUM_SCALAR > *, std::pair< std::string, Set< NodeId > *> > __keyMap
Associate an PRMInstance<GUM_SCALAR> with a unique key w.r.t. d-separation and the set of requisite n...

◆ exists() [2/2]

template<typename GUM_SCALAR >
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.

320  {
321  return __keyMap.exists(&i);
322  }
HashTable< const PRMInstance< GUM_SCALAR > *, std::pair< std::string, Set< NodeId > *> > __keyMap
Associate an PRMInstance<GUM_SCALAR> with a unique key w.r.t. d-separation and the set of requisite n...

◆ key() [1/2]

template<typename GUM_SCALAR >
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().

279  {
280  return __keyMap[i].first;
281  }
HashTable< const PRMInstance< GUM_SCALAR > *, std::pair< std::string, Set< NodeId > *> > __keyMap
Associate an PRMInstance<GUM_SCALAR> with a unique key w.r.t. d-separation and the set of requisite n...
+ Here is the caller graph for this function:

◆ key() [2/2]

template<typename GUM_SCALAR >
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.

285  {
286  return __keyMap[&i].first;
287  }
HashTable< const PRMInstance< GUM_SCALAR > *, std::pair< std::string, Set< NodeId > *> > __keyMap
Associate an PRMInstance<GUM_SCALAR> with a unique key w.r.t. d-separation and the set of requisite n...

◆ liftRatio()

template<typename GUM_SCALAR >
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.

308  {
309  return ((float)__reqMap.size()) / ((float)__keyMap.size());
310  }
HashTable< const PRMInstance< GUM_SCALAR > *, std::pair< std::string, Set< NodeId > *> > __keyMap
Associate an PRMInstance<GUM_SCALAR> with a unique key w.r.t. d-separation and the set of requisite n...
HashTable< std::string, std::pair< Set< NodeId > *, Size > > __reqMap
Associate a Key with the set of requisite nodes associated with it. The Size value is the number of i...

◆ occurrence()

template<typename GUM_SCALAR >
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().

303  {
304  return __reqMap[key].second;
305  }
HashTable< std::string, std::pair< Set< NodeId > *, Size > > __reqMap
Associate a Key with the set of requisite nodes associated with it. The Size value is the number of i...
const std::string & key(const PRMInstance< GUM_SCALAR > *i) const
Returns a unique key w.r.t. d-separation for i.
+ Here is the call graph for this function:

◆ operator=()

template<typename GUM_SCALAR>
INLINE StructuredBayesBall< GUM_SCALAR > & gum::prm::StructuredBayesBall< GUM_SCALAR >::operator= ( const StructuredBayesBall< GUM_SCALAR > &  source)
private

Copy operator.

Definition at line 273 of file structuredBayesBall_tpl.h.

References GUM_ERROR.

Referenced by gum::prm::StructuredBayesBall< GUM_SCALAR >::StructuredBayesBall().

273  {
274  GUM_ERROR(FatalError, "Not allowed.");
275  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:52
+ Here is the caller graph for this function:

◆ requisiteNodes() [1/2]

template<typename GUM_SCALAR >
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.

291  {
292  return *(__keyMap[i].second);
293  }
HashTable< const PRMInstance< GUM_SCALAR > *, std::pair< std::string, Set< NodeId > *> > __keyMap
Associate an PRMInstance<GUM_SCALAR> with a unique key w.r.t. d-separation and the set of requisite n...

◆ requisiteNodes() [2/2]

template<typename GUM_SCALAR >
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.

297  {
298  return *(__keyMap[&i].second);
299  }
HashTable< const PRMInstance< GUM_SCALAR > *, std::pair< std::string, Set< NodeId > *> > __keyMap
Associate an PRMInstance<GUM_SCALAR> with a unique key w.r.t. d-separation and the set of requisite n...

Member Data Documentation

◆ __inf

template<typename GUM_SCALAR>
const PRMInference< GUM_SCALAR >* gum::prm::StructuredBayesBall< GUM_SCALAR >::__inf
private

The PRM at which __model belongs.

Definition at line 153 of file structuredBayesBall.h.

Referenced by gum::prm::StructuredBayesBall< GUM_SCALAR >::StructuredBayesBall().

◆ __keyMap

template<typename GUM_SCALAR>
HashTable< const PRMInstance< GUM_SCALAR >*, std::pair< std::string, Set< NodeId >* > > gum::prm::StructuredBayesBall< GUM_SCALAR >::__keyMap
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().

◆ __reqMap

template<typename GUM_SCALAR>
HashTable< std::string, std::pair< Set< NodeId >*, Size > > gum::prm::StructuredBayesBall< GUM_SCALAR >::__reqMap
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().


The documentation for this class was generated from the following files: