![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
<agrum/PRM/structuredInference.h> More...
#include <structuredInference.h>
Classes | |
| struct | RGData |
| Private structure to represent data about a reduced graph. More... | |
| struct | PData |
| Private structure to represent data about a pattern. More... | |
| struct | CData |
| Private structure to represent data about a Class<GUM_SCALAR>. More... | |
Public Types | |
| using | Chain = std::pair< const PRMInstance< GUM_SCALAR >*, const PRMAttribute< GUM_SCALAR >* > |
| Code alias. | |
| using | EMap = NodeProperty< const Tensor< GUM_SCALAR >* > |
| Code alias. | |
| using | EMapIterator = typename NodeProperty< const Tensor< GUM_SCALAR >* >::iterator_safe |
| Code alias. | |
| using | EMapConstIterator |
| Code alias. | |
Public Member Functions | |
| std::string | info () const |
Constructor & destructor. | |
| StructuredInference (const PRM< GUM_SCALAR > &prm, const PRMSystem< GUM_SCALAR > &system, gspan::SearchStrategy< GUM_SCALAR > *strategy=0) | |
| Default constructor. | |
| StructuredInference (const StructuredInference &source) | |
| Copy constructor. | |
| virtual | ~StructuredInference () |
| Destructor. | |
| StructuredInference & | operator= (const StructuredInference &source) |
| Copy operator. | |
Getters and setters. | |
| void | setPatternMining (bool b) |
| Tells this algorithm to use pattern mining or not. | |
| virtual std::string | name () const |
| Tells this algorithm to use pattern mining or not. | |
| GSpan< GUM_SCALAR > & | gspan () |
| Returns the instance of gspan used to search patterns. | |
| const GSpan< GUM_SCALAR > & | gspan () const |
| Returns the instance of gspan used to search patterns. | |
| void | searchPatterns () |
| Search for patterns without doing any computations. | |
Query methods. | |
| void | posterior (const Chain &chain, Tensor< GUM_SCALAR > &m) |
| Compute the posterior of the formal attribute pointed by chain and stores it in m. | |
| void | joint (const std::vector< Chain > &chains, Tensor< GUM_SCALAR > &j) |
| Compute the joint probability of the formals attributes pointed by chains and stores it in m. | |
Evidence handling. | |
| EMap & | evidence (const PRMInstance< GUM_SCALAR > &i) |
| Returns EMap of evidences over i. | |
| EMap & | evidence (const PRMInstance< GUM_SCALAR > *i) |
| Returns EMap of evidences over i. | |
| const EMap & | evidence (const PRMInstance< GUM_SCALAR > &i) const |
| Returns EMap of evidences over i. | |
| const EMap & | evidence (const PRMInstance< GUM_SCALAR > *i) const |
| Returns EMap of evidences over i. | |
| bool | hasEvidence (const PRMInstance< GUM_SCALAR > &i) const |
| Returns true if i has evidence. | |
| bool | hasEvidence (const PRMInstance< GUM_SCALAR > *i) const |
| Returns EMap of evidences over i. | |
| bool | hasEvidence (const Chain &chain) const |
| Returns true if i has evidence on PRMAttribute<GUM_SCALAR> a. | |
| bool | hasEvidence () const |
| Returns true if i has evidence on PRMAttribute<GUM_SCALAR> a. | |
| void | addEvidence (const Chain &chain, const Tensor< GUM_SCALAR > &p) |
| Add an evidence to the given instance's elt. | |
| void | removeEvidence (const Chain &chain) |
| Remove evidence on the given instance's elt. | |
| void | clearEvidence () |
| Remove all evidences. | |
Public Attributes | |
| Timer | timer |
| Timer | plopTimer |
| double | triang_time |
| double | mining_time |
| double | pattern_time |
| double | inner_time |
| double | obs_time |
| double | full_time |
Protected Member Functions | |
Protected members. | |
| virtual void | evidenceAdded_ (const typename PRMInference< GUM_SCALAR >::Chain &chain) |
| See PRMInference::evidenceAdded_(). | |
| virtual void | evidenceRemoved_ (const typename PRMInference< GUM_SCALAR >::Chain &chain) |
| See PRMInference::evidenceRemoved_(). | |
| virtual void | posterior_ (const typename PRMInference< GUM_SCALAR >::Chain &chain, Tensor< GUM_SCALAR > &m) |
| See PRMInference::posterior_(). | |
| virtual void | joint_ (const std::vector< typename PRMInference< GUM_SCALAR >::Chain > &queries, Tensor< GUM_SCALAR > &j) |
| See PRMInference::joint_(). | |
Private Member Functions | |
| void | _buildReduceGraph_ (RGData &data) |
| This calls reducePattern() over each pattern and then build the reduced graph which is used for inference. The reduce graph is a triangulated instance graph. | |
| void | _addEdgesInReducedGraph_ (RGData &data) |
| Add the nodes in the reduced graph. | |
| void | _removeNode_ (typename StructuredInference::PData &data, NodeId id, Set< Tensor< GUM_SCALAR > * > &pool) |
| void | _reduceAloneInstances_ (RGData &data) |
| Add the reduced tensors of instances not in any used patterns. | |
| void | _reducePattern_ (const gspan::Pattern *p) |
| Proceed with the elimination of all inner variables (observed or not) of all usable matches of Pattern p. Inner variables which are part of the query are not eliminated. | |
| void | _buildPatternGraph_ (PData &data, Set< Tensor< GUM_SCALAR > * > &pool, const Sequence< PRMInstance< GUM_SCALAR > * > &match) |
| Build the DAG corresponding to Pattern data.pattern, initialize pool with all the Tensors of all variables in data.pattern. The first match of data.pattern (aka data.match) is used. | |
| void | _insertNodeInElimLists_ (typename StructuredInference::PData &data, const Sequence< PRMInstance< GUM_SCALAR > * > &match, PRMInstance< GUM_SCALAR > *inst, PRMAttribute< GUM_SCALAR > *attr, NodeId id, std::pair< Idx, std::string > &v) |
| bool | _allInstanceNoRefAttr_ (typename StructuredInference::PData &data, std::pair< Idx, std::string > attr) |
| void | _removeBarrenNodes_ (typename StructuredInference::PData &data, Set< Tensor< GUM_SCALAR > * > &pool) |
| Set< Tensor< GUM_SCALAR > * > * | _eliminateObservedNodes_ (typename StructuredInference::PData &data, const Set< Tensor< GUM_SCALAR > * > &pool, const Sequence< PRMInstance< GUM_SCALAR > * > &match, const std::vector< NodeId > &elim_order) |
| Add in data.queries() any queried variable in one of data.pattern matches. | |
| Set< Tensor< GUM_SCALAR > * > * | _eliminateObservedNodesInSource_ (typename StructuredInference::PData &data, const Set< Tensor< GUM_SCALAR > * > &pool, const Sequence< PRMInstance< GUM_SCALAR > * > &match, const std::vector< NodeId > &elim_order) |
| Set< Tensor< GUM_SCALAR > * > * | _translatePotSet_ (typename StructuredInference::PData &data, const Set< Tensor< GUM_SCALAR > * > &pool, const Sequence< PRMInstance< GUM_SCALAR > * > &match) |
| Translate a given Tensor Set into one w.r.t. variables in match. | |
| std::string | _str_ (const PRMInstance< GUM_SCALAR > *i, const PRMAttribute< GUM_SCALAR > *a) const |
| std::string | _str_ (const PRMInstance< GUM_SCALAR > *i, const PRMAttribute< GUM_SCALAR > &a) const |
| std::string | _str_ (const PRMInstance< GUM_SCALAR > *i, const PRMSlotChain< GUM_SCALAR > &a) const |
Private Attributes | |
| GSpan< GUM_SCALAR > * | _gspan_ |
| Pointer over th GSpan<GUM_SCALAR> instance used by this class. | |
| HashTable< const Sequence< PRMInstance< GUM_SCALAR > * > *, Set< Tensor< GUM_SCALAR > * > * > | _elim_map_ |
| Mapping between a Pattern's match and its tensor pool after inner variables were eliminated. | |
| HashTable< const PRMClass< GUM_SCALAR > *, CData * > | _cdata_map_ |
| Mapping between a Class<GUM_SCALAR> and data about instances reduced using only Class<GUM_SCALAR> level information. | |
| Set< Tensor< GUM_SCALAR > * > | _trash_ |
| Keeping track of create tensors to delete them after inference. | |
| HashTable< const PRMClass< GUM_SCALAR > *, std::vector< NodeId > * > | _outputs_ |
| Set< const PRMInstance< GUM_SCALAR > * > | _reducedInstances_ |
| This keeps track of reduced instances. | |
| PRMInference< GUM_SCALAR >::Chain | _query_ |
| The query. | |
| PData * | _pdata_ |
| The pattern data of the pattern which one of its matches contains the query. | |
| bool | _mining_ |
| Flag which tells to use pattern mining or not. | |
| bool | _found_query_ |
| Flag with an explicit name. | |
| std::pair< Idx, std::string > | _query_data_ |
| std::string | _dot_ |
| Unreduce the match containing the query. | |
Private evidence handling methods and members. | |
| HashTable< const PRMInstance< GUM_SCALAR > *, EMap * > | _evidences_ |
| Mapping of evidence over PRMInstance<GUM_SCALAR>'s nodes. | |
| EMap & | _EMap_ (const PRMInstance< GUM_SCALAR > *i) |
| Private getter over evidences, if necessary creates an EMap for i. | |
| using | EvidenceIterator |
| Code alias. | |
| using | EvidenceConstIterator |
| Code alias. | |
Protected members. | |
| virtual void | evidenceAdded_ (const Chain &chain)=0 |
| This method is called whenever an evidence is added, but AFTER any processing made by PRMInference. | |
| virtual void | evidenceRemoved_ (const Chain &chain)=0 |
| This method is called whenever an evidence is removed, but BEFORE any processing made by PRMInference. | |
| virtual void | posterior_ (const Chain &chain, Tensor< GUM_SCALAR > &m)=0 |
| Generic method to compute the posterior of given element. | |
| virtual void | joint_ (const std::vector< Chain > &queries, Tensor< GUM_SCALAR > &j)=0 |
| Generic method to compute the posterior of given element. | |
| PRM< GUM_SCALAR > const * | prm_ |
| The PRM<GUM_SCALAR> on which inference is done. | |
| PRMSystem< GUM_SCALAR > const * | sys_ |
| The Model on which inference is done. | |
<agrum/PRM/structuredInference.h>
This PRM<GUM_SCALAR> inference algorithm exploits the GSpan<GUM_SCALAR> algorithm to discover new patters and exploit them in a structured way.
Definition at line 69 of file structuredInference.h.
|
inherited |
Code alias.
Definition at line 71 of file PRMInference.h.
|
inherited |
Code alias.
Definition at line 74 of file PRMInference.h.
|
inherited |
Code alias.
Definition at line 80 of file PRMInference.h.
|
inherited |
Code alias.
Definition at line 77 of file PRMInference.h.
|
privateinherited |
Code alias.
Definition at line 241 of file PRMInference.h.
|
privateinherited |
| gum::prm::StructuredInference< GUM_SCALAR >::StructuredInference | ( | const PRM< GUM_SCALAR > & | prm, |
| const PRMSystem< GUM_SCALAR > & | system, | ||
| gspan::SearchStrategy< GUM_SCALAR > * | strategy = 0 ) |
Default constructor.
Definition at line 56 of file structuredInference_tpl.h.
References gum::prm::PRMInference< GUM_SCALAR >::PRMInference(), StructuredInference(), _dot_, _gspan_, _mining_, _pdata_, full_time, inner_time, mining_time, obs_time, pattern_time, and triang_time.
Referenced by StructuredInference(), StructuredInference(), ~StructuredInference(), and operator=().
| gum::prm::StructuredInference< GUM_SCALAR >::StructuredInference | ( | const StructuredInference< GUM_SCALAR > & | source | ) |
Copy constructor.
Definition at line 73 of file structuredInference_tpl.h.
References gum::prm::PRMInference< GUM_SCALAR >::PRMInference(), StructuredInference(), _dot_, _found_query_, _gspan_, _mining_, _pdata_, gum::prm::PRMInference< GUM_SCALAR >::prm_, and gum::prm::PRMInference< GUM_SCALAR >::sys_.
|
virtual |
Destructor.
Definition at line 82 of file structuredInference_tpl.h.
References StructuredInference(), _cdata_map_, _elim_map_, _gspan_, _outputs_, _pdata_, and _trash_.
|
private |
Add the nodes in the reduced graph.
Add edges in the reduced graph.
Definition at line 709 of file structuredInference_tpl.h.
References _elim_map_, gum::UndiGraph::addEdge(), gum::NodeGraphPart::addNode(), gum::SequenceImplementation< Key, Gen >::atPos(), gum::Set< Key >::insert(), gum::prm::StructuredInference< GUM_SCALAR >::RGData::mods, gum::prm::StructuredInference< GUM_SCALAR >::RGData::outputs(), gum::prm::StructuredInference< GUM_SCALAR >::RGData::pool, gum::prm::StructuredInference< GUM_SCALAR >::RGData::reducedGraph, gum::SequenceImplementation< Key, Gen >::size(), and gum::prm::StructuredInference< GUM_SCALAR >::RGData::var2node.
Referenced by _buildReduceGraph_().
|
private |
Definition at line 403 of file structuredInference_tpl.h.
References gum::prm::StructuredInference< GUM_SCALAR >::PData::matches.
Referenced by _buildPatternGraph_().
|
private |
Build the DAG corresponding to Pattern data.pattern, initialize pool with all the Tensors of all variables in data.pattern. The first match of data.pattern (aka data.match) is used.
Definition at line 348 of file structuredInference_tpl.h.
References _allInstanceNoRefAttr_(), _found_query_, _insertNodeInElimLists_(), _query_, _query_data_, _str_(), gum::UndiGraph::addEdge(), gum::NodeGraphPart::addNode(), gum::prm::StructuredInference< GUM_SCALAR >::PData::barren, gum::Set< Key >::erase(), gum::Set< Key >::exists(), gum::prm::StructuredInference< GUM_SCALAR >::PData::graph, gum::prm::StructuredInference< GUM_SCALAR >::PData::inners(), gum::BijectionImplementation< T1, T2, std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value >::insert(), gum::Set< Key >::insert(), gum::prm::StructuredInference< GUM_SCALAR >::PData::map, gum::prm::StructuredInference< GUM_SCALAR >::PData::matches, gum::prm::StructuredInference< GUM_SCALAR >::PData::mod, gum::prm::StructuredInference< GUM_SCALAR >::PData::node2attr, gum::prm::StructuredInference< GUM_SCALAR >::PData::obs(), gum::prm::StructuredInference< GUM_SCALAR >::PData::outputs(), gum::prm::StructuredInference< GUM_SCALAR >::PData::queries(), and gum::prm::StructuredInference< GUM_SCALAR >::PData::vars.
Referenced by _reducePattern_().
|
private |
This calls reducePattern() over each pattern and then build the reduced graph which is used for inference. The reduce graph is a triangulated instance graph.
Definition at line 224 of file structuredInference_tpl.h.
References _addEdgesInReducedGraph_(), _gspan_, _mining_, _query_, _reduceAloneInstances_(), _reducePattern_(), _trash_, gum::prm::eliminateNode(), gum::StaticTriangulation::eliminationOrder(), gum::Set< Key >::erase(), gum::Set< Key >::insert(), mining_time, gum::prm::StructuredInference< GUM_SCALAR >::RGData::mods, gum::prm::StructuredInference< GUM_SCALAR >::RGData::outputs(), gum::prm::StructuredInference< GUM_SCALAR >::RGData::partial_order, pattern_time, plopTimer, gum::prm::StructuredInference< GUM_SCALAR >::RGData::pool, gum::prm::StructuredInference< GUM_SCALAR >::RGData::queries(), gum::prm::StructuredInference< GUM_SCALAR >::RGData::reducedGraph, and gum::prm::StructuredInference< GUM_SCALAR >::RGData::var2node.
Referenced by posterior_(), and searchPatterns().
|
private |
Add in data.queries() any queried variable in one of data.pattern matches.
Proceeds with the elimination of observed variables in math and then call translatePotSet().
Definition at line 487 of file structuredInference_tpl.h.
References _translatePotSet_(), _trash_, gum::prm::eliminateNode(), gum::prm::StructuredInference< GUM_SCALAR >::PData::inners(), gum::prm::StructuredInference< GUM_SCALAR >::PData::map, gum::prm::StructuredInference< GUM_SCALAR >::PData::obs(), gum::Set< Key >::size(), and gum::prm::StructuredInference< GUM_SCALAR >::PData::vars.
Referenced by _reducePattern_().
|
private |
Definition at line 467 of file structuredInference_tpl.h.
References _trash_, gum::prm::eliminateNode(), gum::prm::StructuredInference< GUM_SCALAR >::PData::inners(), gum::prm::StructuredInference< GUM_SCALAR >::PData::map, gum::prm::StructuredInference< GUM_SCALAR >::PData::obs(), gum::Set< Key >::size(), and gum::prm::StructuredInference< GUM_SCALAR >::PData::vars.
Referenced by _reducePattern_().
|
privateinherited |
Private getter over evidences, if necessary creates an EMap for i.
Definition at line 116 of file PRMInference_tpl.h.
References _evidences_.
Referenced by removeEvidence().
|
private |
Definition at line 314 of file structuredInference_tpl.h.
References gum::Set< Key >::exists(), gum::prm::PRMInstance< GUM_SCALAR >::get(), gum::prm::PRMInstance< GUM_SCALAR >::getRefAttr(), gum::prm::PRMInference< GUM_SCALAR >::hasEvidence(), gum::prm::StructuredInference< GUM_SCALAR >::PData::inners(), gum::Set< Key >::insert(), gum::prm::StructuredInference< GUM_SCALAR >::PData::matches, gum::prm::StructuredInference< GUM_SCALAR >::PData::obs(), gum::prm::StructuredInference< GUM_SCALAR >::PData::outputs(), gum::Set< Key >::size(), and gum::prm::PRMInstance< GUM_SCALAR >::type().
Referenced by _buildPatternGraph_().
|
private |
Add the reduced tensors of instances not in any used patterns.
Definition at line 595 of file structuredInference_tpl.h.
References _cdata_map_, _query_, _reducedInstances_, _trash_, gum::prm::StructuredInference< GUM_SCALAR >::CData::aggregators(), gum::prm::PRMInstance< GUM_SCALAR >::begin(), gum::prm::PRMInstance< GUM_SCALAR >::bijection(), gum::prm::StructuredInference< GUM_SCALAR >::CData::c, gum::prm::copyTensor(), gum::prm::StructuredInference< GUM_SCALAR >::CData::elim_order(), gum::prm::eliminateNode(), gum::StaticTriangulation::eliminationOrder(), gum::prm::PRMInstance< GUM_SCALAR >::end(), gum::List< Val >::erase(), gum::prm::PRMInference< GUM_SCALAR >::evidence(), gum::prm::PRMInstance< GUM_SCALAR >::get(), gum::prm::PRMInference< GUM_SCALAR >::hasEvidence(), gum::prm::StructuredInference< GUM_SCALAR >::CData::inners(), gum::List< Val >::insert(), gum::Set< Key >::insert(), gum::prm::StructuredInference< GUM_SCALAR >::CData::instances, gum::prm::StructuredInference< GUM_SCALAR >::CData::mods, gum::prm::StructuredInference< GUM_SCALAR >::CData::moral_graph, gum::prm::StructuredInference< GUM_SCALAR >::CData::outputs(), gum::prm::StructuredInference< GUM_SCALAR >::CData::pool, gum::prm::StructuredInference< GUM_SCALAR >::RGData::pool, gum::List< Val >::push_back(), gum::List< Val >::size(), gum::prm::PRMInstance< GUM_SCALAR >::size(), gum::Set< Key >::size(), gum::prm::PRMInference< GUM_SCALAR >::sys_, and gum::prm::PRMInstance< GUM_SCALAR >::type().
Referenced by _buildReduceGraph_().
|
private |
Proceed with the elimination of all inner variables (observed or not) of all usable matches of Pattern p. Inner variables which are part of the query are not eliminated.
Definition at line 257 of file structuredInference_tpl.h.
References _buildPatternGraph_(), _elim_map_, _eliminateObservedNodes_(), _eliminateObservedNodesInSource_(), _gspan_, _query_, _query_data_, _reducedInstances_, _removeBarrenNodes_(), _translatePotSet_(), _trash_, gum::prm::StructuredInference< GUM_SCALAR >::PData::barren, gum::prm::eliminateNode(), gum::StaticTriangulation::eliminationOrder(), gum::Set< Key >::exists(), gum::prm::StructuredInference< GUM_SCALAR >::PData::graph, gum::prm::StructuredInference< GUM_SCALAR >::PData::inners(), gum::Set< Key >::insert(), gum::prm::StructuredInference< GUM_SCALAR >::PData::matches, gum::prm::StructuredInference< GUM_SCALAR >::PData::mod, gum::prm::StructuredInference< GUM_SCALAR >::PData::obs(), obs_time, gum::prm::StructuredInference< GUM_SCALAR >::PData::partial_order(), plopTimer, gum::prm::StructuredInference< GUM_SCALAR >::PData::queries(), gum::Set< Key >::size(), and gum::prm::StructuredInference< GUM_SCALAR >::PData::vars.
Referenced by _buildReduceGraph_().
|
private |
Definition at line 414 of file structuredInference_tpl.h.
References gum::SequenceImplementation< Key, std::is_scalar< Key >::value >::back(), gum::prm::StructuredInference< GUM_SCALAR >::PData::barren, gum::SequenceImplementation< Key, std::is_scalar< Key >::value >::erase(), gum::Set< Key >::exists(), gum::prm::StructuredInference< GUM_SCALAR >::PData::graph, gum::prm::StructuredInference< GUM_SCALAR >::PData::inners(), gum::SequenceImplementation< Key, std::is_scalar< Key >::value >::insert(), gum::Set< Key >::insert(), gum::EdgeGraphPart::neighbours(), gum::SequenceImplementation< Key, std::is_scalar< Key >::value >::size(), and gum::prm::StructuredInference< GUM_SCALAR >::PData::vars.
Referenced by _reducePattern_().
|
private |
Definition at line 987 of file structuredInference_tpl.h.
References gum::Set< Key >::erase(), gum::BijectionImplementation< T1, T2, std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value >::eraseFirst(), gum::UndiGraph::eraseNode(), gum::NodeGraphPart::exists(), gum::Set< Key >::exists(), gum::BijectionImplementation< T1, T2, std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value >::existsFirst(), gum::prm::StructuredInference< GUM_SCALAR >::PData::graph, gum::prm::StructuredInference< GUM_SCALAR >::PData::inners(), gum::prm::StructuredInference< GUM_SCALAR >::PData::map, gum::prm::StructuredInference< GUM_SCALAR >::PData::mod, gum::prm::StructuredInference< GUM_SCALAR >::PData::node2attr, gum::prm::StructuredInference< GUM_SCALAR >::PData::pots, and gum::prm::StructuredInference< GUM_SCALAR >::PData::vars.
|
private |
Definition at line 949 of file structuredInference_tpl.h.
References _dot_, gum::prm::PRMObject::name(), and gum::prm::PRMClassElement< GUM_SCALAR >::safeName().
|
private |
Definition at line 942 of file structuredInference_tpl.h.
References _dot_, gum::prm::PRMObject::name(), and gum::prm::PRMClassElement< GUM_SCALAR >::safeName().
Referenced by _buildPatternGraph_().
|
private |
Definition at line 956 of file structuredInference_tpl.h.
References _dot_, gum::prm::PRMSlotChain< GUM_SCALAR >::lastElt(), and gum::prm::PRMObject::name().
|
private |
Translate a given Tensor Set into one w.r.t. variables in match.
Definition at line 507 of file structuredInference_tpl.h.
References _reducedInstances_, gum::prm::copyTensor(), gum::BijectionImplementation< T1, T2, Gen >::existsFirst(), gum::BijectionImplementation< T1, T2, Gen >::first(), GUM_ERROR, gum::BijectionImplementation< T1, T2, Gen >::insert(), gum::Set< Key >::insert(), gum::prm::StructuredInference< GUM_SCALAR >::PData::map, gum::prm::StructuredInference< GUM_SCALAR >::PData::matches, and gum::prm::StructuredInference< GUM_SCALAR >::PData::vars.
Referenced by _eliminateObservedNodes_(), and _reducePattern_().
|
inherited |
Add an evidence to the given instance's elt.
| chain | The variable being observed. |
| p | The Tensor added (by copy) as evidence. |
| NotFound | Raised if elt does not belong to i. |
| OperationNotAllowed | Raised if p is inconsistent with elt. |
Definition at line 126 of file PRMInference_tpl.h.
|
inherited |
Remove all evidences.
Definition at line 56 of file PRMInference_tpl.h.
References _evidences_.
Referenced by operator=().
|
inherited |
Returns EMap of evidences over i.
| NotFound | if i has no evidence. |
Definition at line 171 of file PRMInference_tpl.h.
References _evidences_, and GUM_ERROR.
Referenced by gum::prm::SVE< GUM_SCALAR >::_eliminateNodesWithEvidence_(), gum::prm::SVED< GUM_SCALAR >::_eliminateNodesWithEvidence_(), gum::prm::SVE< GUM_SCALAR >::_insertEvidence_(), gum::prm::SVED< GUM_SCALAR >::_insertEvidence_(), gum::prm::StructuredInference< GUM_SCALAR >::_reduceAloneInstances_(), gum::prm::GroundedInference< GUM_SCALAR >::evidenceAdded_(), hasEvidence(), posterior(), and gum::prm::StructuredInference< GUM_SCALAR >::posterior_().
|
inherited |
Returns EMap of evidences over i.
| NotFound | if i has no evidence. |
Definition at line 179 of file PRMInference_tpl.h.
References _evidences_.
|
inherited |
Returns EMap of evidences over i.
| NotFound | if i has no evidence. |
Definition at line 187 of file PRMInference_tpl.h.
|
inherited |
Returns EMap of evidences over i.
| NotFound | if i has no evidence. |
Definition at line 195 of file PRMInference_tpl.h.
References _evidences_, and GUM_ERROR.
|
protectedpure virtualinherited |
This method is called whenever an evidence is added, but AFTER any processing made by PRMInference.
Implemented in gum::prm::SVE< GUM_SCALAR >, and gum::prm::SVED< GUM_SCALAR >.
|
protectedvirtual |
See PRMInference::evidenceAdded_().
Definition at line 114 of file structuredInference_tpl.h.
|
protectedpure virtualinherited |
This method is called whenever an evidence is removed, but BEFORE any processing made by PRMInference.
Implemented in gum::prm::SVE< GUM_SCALAR >, and gum::prm::SVED< GUM_SCALAR >.
Referenced by removeEvidence().
|
protectedvirtual |
See PRMInference::evidenceRemoved_().
Definition at line 118 of file structuredInference_tpl.h.
| INLINE GSpan< GUM_SCALAR > & gum::prm::StructuredInference< GUM_SCALAR >::gspan | ( | ) |
Returns the instance of gspan used to search patterns.
Definition at line 977 of file structuredInference_tpl.h.
References _gspan_.
| INLINE const GSpan< GUM_SCALAR > & gum::prm::StructuredInference< GUM_SCALAR >::gspan | ( | ) | const |
Returns the instance of gspan used to search patterns.
Definition at line 982 of file structuredInference_tpl.h.
References _gspan_.
|
inherited |
Returns true if i has evidence on PRMAttribute<GUM_SCALAR> a.
Definition at line 217 of file PRMInference_tpl.h.
References _evidences_.
|
inherited |
Returns true if i has evidence on PRMAttribute<GUM_SCALAR> a.
Definition at line 212 of file PRMInference_tpl.h.
References evidence(), and hasEvidence().
|
inherited |
Returns true if i has evidence.
Definition at line 202 of file PRMInference_tpl.h.
References _evidences_.
Referenced by gum::prm::SVE< GUM_SCALAR >::_eliminateNodes_(), gum::prm::SVED< GUM_SCALAR >::_eliminateNodes_(), gum::prm::SVED< GUM_SCALAR >::_eliminateNodesDownward_(), gum::prm::SVED< GUM_SCALAR >::_eliminateNodesUpward_(), gum::prm::StructuredInference< GUM_SCALAR >::_insertNodeInElimLists_(), gum::prm::StructuredInference< GUM_SCALAR >::_reduceAloneInstances_(), gum::prm::SVE< GUM_SCALAR >::_variableElimination_(), hasEvidence(), posterior(), and gum::prm::StructuredInference< GUM_SCALAR >::posterior_().
|
inherited |
Returns EMap of evidences over i.
Definition at line 207 of file PRMInference_tpl.h.
References _evidences_.
| std::string gum::prm::StructuredInference< GUM_SCALAR >::info | ( | ) | const |
Definition at line 200 of file structuredInference_tpl.h.
References _gspan_, full_time, inner_time, mining_time, obs_time, pattern_time, and triang_time.
|
inherited |
Compute the joint probability of the formals attributes pointed by chains and stores it in m.
| chains | A Set of strings of the form instance.attribute. |
| j | An empty CPF which will be filed by the joint probability over chains. |
| NotFound | Raised if some chain in chains does not point to a formal attribute. |
| OperationNotAllowed | Raise if m is not empty. |
Definition at line 261 of file PRMInference_tpl.h.
References GUM_ERROR, and joint_().
|
protectedpure virtualinherited |
Generic method to compute the posterior of given element.
| queries | Set of pairs of PRMInstance<GUM_SCALAR> and PRMAttribute<GUM_SCALAR>. |
| j | CPF filled with the joint probability of queries. It is initialized properly. |
Implemented in gum::prm::SVE< GUM_SCALAR >, and gum::prm::SVED< GUM_SCALAR >.
Referenced by joint().
|
protectedvirtual |
Definition at line 193 of file structuredInference_tpl.h.
References GUM_ERROR.
|
virtual |
Tells this algorithm to use pattern mining or not.
Implements gum::prm::PRMInference< GUM_SCALAR >.
Definition at line 972 of file structuredInference_tpl.h.
| StructuredInference< GUM_SCALAR > & gum::prm::StructuredInference< GUM_SCALAR >::operator= | ( | const StructuredInference< GUM_SCALAR > & | source | ) |
Copy operator.
Definition at line 102 of file structuredInference_tpl.h.
References StructuredInference(), _gspan_, gum::prm::PRMInference< GUM_SCALAR >::prm_, and gum::prm::PRMInference< GUM_SCALAR >::sys_.
|
inherited |
Compute the posterior of the formal attribute pointed by chain and stores it in m.
| chain | A string of the form instance.attribute. |
| m | An empty CPF which will be filed by the posterior of chain. |
| NotFound | Raised if chain is invalid. |
| TypeError | Raised if chain does not point to an PRMAttribute<GUM_SCALAR>. |
| OperationNotAllowed | Raise if m is not empty. |
Definition at line 235 of file PRMInference_tpl.h.
References gum::prm::PRMInstance< GUM_SCALAR >::end(), evidence(), GUM_ERROR, hasEvidence(), gum::Instantiation::inc(), and gum::Instantiation::setFirst().
|
protectedpure virtualinherited |
Generic method to compute the posterior of given element.
| chain | |
| m | CPF filled with the posterior of elt. It is initialized properly. |
Implemented in gum::prm::SVE< GUM_SCALAR >, and gum::prm::SVED< GUM_SCALAR >.
|
protectedvirtual |
See PRMInference::posterior_().
Definition at line 122 of file structuredInference_tpl.h.
References _buildReduceGraph_(), _found_query_, _pdata_, _query_, gum::Set< Key >::begin(), gum::Instantiation::end(), gum::prm::PRMInference< GUM_SCALAR >::evidence(), gum::MultiDimCombinationDefault< TABLE >::execute(), full_time, gum::prm::PRMInference< GUM_SCALAR >::hasEvidence(), gum::Instantiation::inc(), gum::Set< Key >::insert(), gum::prm::multTensor(), gum::prm::StructuredInference< GUM_SCALAR >::RGData::pool, gum::Instantiation::setFirst(), gum::Set< Key >::size(), and timer.
|
inherited |
Remove evidence on the given instance's elt.
| chain | The variable being observed. |
| NotFound | Raised if the given names are not found. |
| TypeError | Raised if the elt is not an PRMAttribute<GUM_SCALAR>. |
Definition at line 222 of file PRMInference_tpl.h.
References _EMap_(), and evidenceRemoved_().
| void gum::prm::StructuredInference< GUM_SCALAR >::searchPatterns | ( | ) |
Search for patterns without doing any computations.
Definition at line 927 of file structuredInference_tpl.h.
References _buildReduceGraph_(), _found_query_, _query_, gum::prm::PRMInstance< GUM_SCALAR >::begin(), and gum::prm::PRMInference< GUM_SCALAR >::sys_.
| INLINE void gum::prm::StructuredInference< GUM_SCALAR >::setPatternMining | ( | bool | b | ) |
Tells this algorithm to use pattern mining or not.
Definition at line 936 of file structuredInference_tpl.h.
References _mining_.
|
private |
Mapping between a Class<GUM_SCALAR> and data about instances reduced using only Class<GUM_SCALAR> level information.
Definition at line 275 of file structuredInference.h.
Referenced by ~StructuredInference(), and _reduceAloneInstances_().
|
private |
Unreduce the match containing the query.
Used to create strings
Definition at line 378 of file structuredInference.h.
Referenced by StructuredInference(), StructuredInference(), _str_(), _str_(), and _str_().
|
private |
Mapping between a Pattern's match and its tensor pool after inner variables were eliminated.
Definition at line 269 of file structuredInference.h.
Referenced by ~StructuredInference(), _addEdgesInReducedGraph_(), and _reducePattern_().
|
privateinherited |
Mapping of evidence over PRMInstance<GUM_SCALAR>'s nodes.
Definition at line 245 of file PRMInference.h.
Referenced by PRMInference(), _EMap_(), clearEvidence(), evidence(), evidence(), evidence(), hasEvidence(), hasEvidence(), and hasEvidence().
|
private |
Flag with an explicit name.
Definition at line 296 of file structuredInference.h.
Referenced by StructuredInference(), _buildPatternGraph_(), posterior_(), and searchPatterns().
|
private |
Pointer over th GSpan<GUM_SCALAR> instance used by this class.
Definition at line 263 of file structuredInference.h.
Referenced by StructuredInference(), StructuredInference(), ~StructuredInference(), _buildReduceGraph_(), _reducePattern_(), gspan(), gspan(), info(), and operator=().
|
private |
Flag which tells to use pattern mining or not.
Definition at line 293 of file structuredInference.h.
Referenced by StructuredInference(), StructuredInference(), _buildReduceGraph_(), and setPatternMining().
|
private |
Definition at line 280 of file structuredInference.h.
Referenced by ~StructuredInference().
|
private |
The pattern data of the pattern which one of its matches contains the query.
Definition at line 290 of file structuredInference.h.
Referenced by StructuredInference(), StructuredInference(), ~StructuredInference(), and posterior_().
|
private |
The query.
Definition at line 286 of file structuredInference.h.
Referenced by _buildPatternGraph_(), _buildReduceGraph_(), _reduceAloneInstances_(), _reducePattern_(), posterior_(), and searchPatterns().
|
private |
Definition at line 297 of file structuredInference.h.
Referenced by _buildPatternGraph_(), and _reducePattern_().
|
private |
This keeps track of reduced instances.
Definition at line 283 of file structuredInference.h.
Referenced by _reduceAloneInstances_(), _reducePattern_(), and _translatePotSet_().
|
private |
Keeping track of create tensors to delete them after inference.
Definition at line 278 of file structuredInference.h.
Referenced by ~StructuredInference(), _buildReduceGraph_(), _eliminateObservedNodes_(), _eliminateObservedNodesInSource_(), _reduceAloneInstances_(), and _reducePattern_().
| double gum::prm::StructuredInference< GUM_SCALAR >::full_time |
Definition at line 395 of file structuredInference.h.
Referenced by StructuredInference(), info(), and posterior_().
| double gum::prm::StructuredInference< GUM_SCALAR >::inner_time |
Definition at line 393 of file structuredInference.h.
Referenced by StructuredInference(), and info().
| double gum::prm::StructuredInference< GUM_SCALAR >::mining_time |
Definition at line 391 of file structuredInference.h.
Referenced by StructuredInference(), _buildReduceGraph_(), and info().
| double gum::prm::StructuredInference< GUM_SCALAR >::obs_time |
Definition at line 394 of file structuredInference.h.
Referenced by StructuredInference(), _reducePattern_(), and info().
| double gum::prm::StructuredInference< GUM_SCALAR >::pattern_time |
Definition at line 392 of file structuredInference.h.
Referenced by StructuredInference(), _buildReduceGraph_(), and info().
| Timer gum::prm::StructuredInference< GUM_SCALAR >::plopTimer |
Definition at line 389 of file structuredInference.h.
Referenced by _buildReduceGraph_(), and _reducePattern_().
|
protectedinherited |
The PRM<GUM_SCALAR> on which inference is done.
Definition at line 224 of file PRMInference.h.
Referenced by PRMInference(), PRMInference(), gum::prm::StructuredInference< GUM_SCALAR >::StructuredInference(), gum::prm::SVE< GUM_SCALAR >::_initElimOrder_(), gum::prm::SVED< GUM_SCALAR >::_initElimOrder_(), operator=(), and gum::prm::StructuredInference< GUM_SCALAR >::operator=().
|
protectedinherited |
The Model on which inference is done.
Definition at line 227 of file PRMInference.h.
Referenced by PRMInference(), PRMInference(), gum::prm::StructuredInference< GUM_SCALAR >::StructuredInference(), gum::prm::StructuredInference< GUM_SCALAR >::_reduceAloneInstances_(), operator=(), gum::prm::StructuredInference< GUM_SCALAR >::operator=(), and gum::prm::StructuredInference< GUM_SCALAR >::searchPatterns().
| Timer gum::prm::StructuredInference< GUM_SCALAR >::timer |
Definition at line 388 of file structuredInference.h.
Referenced by posterior_().
| double gum::prm::StructuredInference< GUM_SCALAR >::triang_time |
Definition at line 390 of file structuredInference.h.
Referenced by StructuredInference(), and info().