55#ifndef GUM_STRUCTURED_BB_H
56# define GUM_STRUCTURED_BB_H
66 template <
typename GUM_SCALAR >
139 std::pair< bool, bool >&
178# ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
The class for generic Hash Tables.
This abstract class is used as base class for all inference class on PRM<GUM_SCALAR>.
An PRMInstance is a Bayesian network fragment defined by a Class and used in a PRMSystem.
A PRMSlotChain represents a sequence of gum::prm::PRMClassElement<GUM_SCALAR> where the n-1 first gum...
<agrum/PRM/structuredBayesBall.h>
float liftRatio() const
Returns the ratio between the total number of instances and the number of instances with the same con...
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...
const PRMInference< GUM_SCALAR > * _inf_
The PRM at which model belongs.
StructuredBayesBall(const StructuredBayesBall &source)
Copy constructor.
const Set< NodeId > & requisiteNodes(const PRMInstance< GUM_SCALAR > *i) const
Returns the set of requisite nodes w.r.t. d-separation for i.
const std::string & key(const PRMInstance< GUM_SCALAR > *i) const
Returns a unique key w.r.t. d-separation for i.
void _clean_()
Cleans this before a new computation.
HashTable< NodeId, std::pair< bool, bool > > MarkMap
Code alias.
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 & operator=(const StructuredBayesBall &source)
Copy operator.
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....
StructuredBayesBall(const PRMInference< GUM_SCALAR > &inference)
Default Constructor.
void _fillMaps_(InstanceMap &marks)
Fill keyMap and reqMap.
Size occurrence(const std::string &key) const
Returns the number of occurrence of the given key, which is the number of PRMInstance<GUM_SCALAR> sha...
void _fromParent_(const PRMInstance< GUM_SCALAR > *i, NodeId n, InstanceMap &marks)
When the ball is receive on i->get(n) from a parent.
void _fromChild_(const PRMInstance< GUM_SCALAR > *i, NodeId n, InstanceMap &marks)
When the ball is received on i->get(n) from a child.
bool exists(const PRMInstance< GUM_SCALAR > *i) const
Returns true if i has requisite nodes.
void _compute_(const PRMInstance< GUM_SCALAR > *i, NodeId n)
The real compute method.
std::string _buildHashKey_(const PRMInstance< GUM_SCALAR > *i, Set< NodeId > &req_nodes)
Builds the HashKey for the given instance and requisite nodes set.
HashTable< const PRMInstance< GUM_SCALAR > *, MarkMap * > InstanceMap
const PRMSlotChain< GUM_SCALAR > & _getSC_(const PRMInstance< GUM_SCALAR > *i, NodeId n)
Code alias.
~StructuredBayesBall()
Destructor.
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).
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size NodeId
Type for node ids.
namespace for all probabilistic relational models entities
gum is the global namespace for all aGrUM entities
Inline implementation of StructuredBayesBall.