aGrUM  0.16.0
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 51 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 123 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 121 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 260 of file structuredBayesBall_tpl.h.

References gum::prm::StructuredBayesBall< GUM_SCALAR >::__inf, GUM_ERROR, and gum::prm::StructuredBayesBall< GUM_SCALAR >::operator=().

261  :
262  __inf(&inference) {
263  GUM_CONSTRUCTOR(StructuredBayesBall);
264  }
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 36 of file structuredBayesBall_tpl.h.

36  {
37  GUM_DESTRUCTOR(StructuredBayesBall);
38 
39  for (const auto& elt : __reqMap)
40  delete elt.second.first;
41  }
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 248 of file structuredBayesBall_tpl.h.

References gum::Set< Key, Alloc >::exists(), and gum::prm::PRMInstance< GUM_SCALAR >::type().

249  {
250  std::stringstream sBuff;
251  sBuff << i->type().name();
252 
253  for (const auto node : i->type().containerDag().nodes())
254  if (req_nodes.exists(node)) sBuff << "-" << node;
255 
256  return sBuff.str();
257  }
bool exists(const Key &k) const
Indicates whether a given elements belong to the set.
Definition: set_tpl.h:607
+ 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 44 of file structuredBayesBall_tpl.h.

44  {
45  for (const auto& elt : __reqMap)
46  delete elt.second.first;
47 
48  __keyMap.clear();
49  __reqMap.clear();
50  }
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 79 of file structuredBayesBall_tpl.h.

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

80  {
81  __clean();
85  __fromChild(i, n, marks);
86  __fillMaps(marks);
87 
88  for (const auto& elt : marks)
89  delete elt.second;
90  }
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 204 of file structuredBayesBall_tpl.h.

References gum::Set< Key, Alloc >::insert(), and gum::HashTable< Key, Val, Alloc >::insert().

204  {
205  // First find for each instance it's requisite nodes
206  HashTable< const PRMInstance< GUM_SCALAR >*, Set< NodeId >* > req_map;
207 
208  for (const auto& elt : marks) {
209  Set< NodeId >* req_set = new Set< NodeId >();
210 
211  for (const auto& elt2 : *elt.second)
212  if (elt2.second.first) req_set->insert(elt2.first);
213 
214  req_map.insert(elt.first, req_set);
215  }
216 
217  // Remove all instances with 0 requisite nodes
218  Set< const PRMInstance< GUM_SCALAR >* > to_remove;
219 
220  for (const auto& elt : req_map)
221  if (elt.second->size() == 0) to_remove.insert(elt.first);
222 
223  for (const auto remo : to_remove) {
224  delete req_map[remo];
225  req_map.erase(remo);
226  }
227 
228  // Fill __reqMap and __keyMap
229  for (const auto& elt : req_map) {
230  std::string key = __buildHashKey(elt.first, *elt.second);
231 
232  if (__reqMap.exists(key)) {
233  __keyMap.insert(
234  elt.first,
235  std::pair< std::string, Set< NodeId >* >(key, __reqMap[key].first));
236  __reqMap[key].second += 1;
237  delete elt.second;
238  req_map[elt.first] = 0;
239  } else {
240  __reqMap.insert(key, std::pair< Set< NodeId >*, Size >(elt.second, 1));
241  __keyMap.insert(
242  elt.first, std::pair< std::string, Set< NodeId >* >(key, elt.second));
243  }
244  }
245  }
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:48
void insert(const Key &k)
Inserts a new element into the set.
Definition: set_tpl.h:613
+ 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 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().

94  {
95  if (!marks.exists(i)) {
96  marks.insert(i, new StructuredBayesBall< GUM_SCALAR >::MarkMap());
97  }
98 
99  if (!marks[i]->exists(n)) {
100  marks[i]->insert(n, std::pair< bool, bool >(false, false));
101  }
102 
103  // Sending message to parents
104  switch (i->type().get(n).elt_type()) {
106  if (!__getMark(marks, i, n).first) {
107  __getMark(marks, i, n).first = true;
108 
109  for (const auto inst : i->getInstances(n))
110  __fromChild(
111  inst, inst->get(__getSC(i, n).lastElt().safeName()).id(), marks);
112  }
113 
114  if (!__getMark(marks, i, n).second) {
115  __getMark(marks, i, n).second = true;
116 
117  for (const auto chi : i->type().containerDag().children(n))
118  __fromParent(i, chi, marks);
119  }
120 
121  break;
122  }
123 
126  if (!__getMark(marks, i, n).first) {
127  __getMark(marks, i, n).first = true;
128 
129  if (!__isHardEvidence(i, n))
130  for (const auto par : i->type().containerDag().parents(n))
131  __fromChild(i, par, marks);
132  }
133 
134  if (!__getMark(marks, i, n).second) {
135  __getMark(marks, i, n).second = true;
136 
137  // In i.
138  for (const auto chi : i->type().containerDag().children(n))
139  __fromParent(i, chi, marks);
140 
141  // Out of i.
142  try {
143  const auto& refs = i->getRefAttr(n);
144 
145  for (auto iter = refs.begin(); iter != refs.end(); ++iter)
146  __fromParent(
147  iter->first, iter->first->type().get(iter->second).id(), marks);
148  } catch (NotFound&) {
149  // Not an inverse sc
150  }
151  }
152 
153  break;
154  }
155 
156  default: {
157  // We shouldn't reach any other PRMClassElement<GUM_DATA> than
158  // PRMAttribute
159  // or
160  // PRMSlotChain<GUM_SCALAR>.
161  GUM_ERROR(FatalError, "This case is impossible.");
162  }
163  }
164  }
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:55
+ 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 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().

168  {
169  if (!marks.exists(i)) {
170  marks.insert(i, new StructuredBayesBall< GUM_SCALAR >::MarkMap());
171  }
172 
173  if (!marks[i]->exists(n)) {
174  marks[i]->insert(n, std::pair< bool, bool >(false, false));
175  }
176 
177  // Concerns only PRMAttribute (because of the hard evidence)
178  if ((__isHardEvidence(i, n)) && (!__getMark(marks, i, n).first)) {
179  __getMark(marks, i, n).first = true;
180 
181  for (const auto par : i->type().containerDag().parents(n))
182  __fromChild(i, par, marks);
183  } else if (!__getMark(marks, i, n).second) {
184  __getMark(marks, i, n).second = true;
185 
186  // In i.
187  for (const auto chi : i->type().containerDag().children(n))
188  __fromParent(i, chi, marks);
189 
190  // Out of i.
191  try {
192  for (auto iter = i->getRefAttr(n).begin();
193  iter != i->getRefAttr(n).end();
194  ++iter)
195  __fromParent(
196  iter->first, iter->first->type().get(iter->second).id(), marks);
197  } catch (NotFound&) {
198  // Not an inverse sc
199  }
200  }
201  }
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 347 of file structuredBayesBall_tpl.h.

348  {
349  return (*(marks[i]))[n];
350  }

◆ __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 341 of file structuredBayesBall_tpl.h.

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

342  {
343  return static_cast< const PRMSlotChain< GUM_SCALAR >& >(i->type().get(n));
344  }
+ 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 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().

54  {
55  try {
56  typename PRMInference< GUM_SCALAR >::Chain chain =
57  std::make_pair(i, &(i->get(n)));
58 
59  if (__inf->hasEvidence(chain)) {
60  const Potential< GUM_SCALAR >* e = __inf->evidence(i)[n];
61  Instantiation inst(e);
62  Size count = 0;
63 
64  for (inst.setFirst(); !inst.end(); inst.inc()) {
65  if ((e->get(inst) == (GUM_SCALAR)1.0))
66  ++count;
67  else if (e->get(inst) != (GUM_SCALAR)0.0)
68  return false;
69  }
70 
71  return (count == 1);
72  }
73 
74  return false;
75  } catch (NotFound&) { return false; }
76  }
std::pair< const PRMInstance< GUM_SCALAR > *, const PRMAttribute< GUM_SCALAR > *> Chain
Code alias.
Definition: PRMInference.h:57
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:48
+ 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 328 of file structuredBayesBall_tpl.h.

References gum::prm::StructuredBayesBall< GUM_SCALAR >::__compute().

329  {
330  __compute(i, n);
331  }
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 334 of file structuredBayesBall_tpl.h.

References gum::prm::StructuredBayesBall< GUM_SCALAR >::__compute().

335  {
336  __compute(&i, n);
337  }
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 316 of file structuredBayesBall_tpl.h.

References gum::prm::StructuredBayesBall< GUM_SCALAR >::__keyMap.

317  {
318  return __keyMap.exists(i);
319  }
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 322 of file structuredBayesBall_tpl.h.

References gum::prm::StructuredBayesBall< GUM_SCALAR >::__keyMap.

323  {
324  return __keyMap.exists(&i);
325  }
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 281 of file structuredBayesBall_tpl.h.

References gum::prm::StructuredBayesBall< GUM_SCALAR >::__keyMap.

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

282  {
283  return __keyMap[i].first;
284  }
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 287 of file structuredBayesBall_tpl.h.

References gum::prm::StructuredBayesBall< GUM_SCALAR >::__keyMap.

288  {
289  return __keyMap[&i].first;
290  }
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 311 of file structuredBayesBall_tpl.h.

References gum::prm::StructuredBayesBall< GUM_SCALAR >::__keyMap, and gum::prm::StructuredBayesBall< GUM_SCALAR >::__reqMap.

311  {
312  return ((float)__reqMap.size()) / ((float)__keyMap.size());
313  }
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 305 of file structuredBayesBall_tpl.h.

References gum::prm::StructuredBayesBall< GUM_SCALAR >::__reqMap, and gum::prm::StructuredBayesBall< GUM_SCALAR >::key().

306  {
307  return __reqMap[key].second;
308  }
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 276 of file structuredBayesBall_tpl.h.

References GUM_ERROR.

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

276  {
277  GUM_ERROR(FatalError, "Not allowed.");
278  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55
+ 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 293 of file structuredBayesBall_tpl.h.

References gum::prm::StructuredBayesBall< GUM_SCALAR >::__keyMap.

294  {
295  return *(__keyMap[i].second);
296  }
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 299 of file structuredBayesBall_tpl.h.

References gum::prm::StructuredBayesBall< GUM_SCALAR >::__keyMap.

300  {
301  return *(__keyMap[&i].second);
302  }
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 156 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 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().

◆ __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 168 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: