![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
This class discovers pattern in a PRM<GUM_SCALAR>'s PRMSystem<GUM_SCALAR> to speed up structured inference. More...
#include <agrum/PRM/gspan.h>
Public Member Functions | |
Constructors & destructor. | |
GSpan (const PRM< GUM_SCALAR > &prm, const PRMSystem< GUM_SCALAR > &sys, gspan::SearchStrategy< GUM_SCALAR > *strategy=0) | |
Default constructor. More... | |
~GSpan () | |
Destructor. More... | |
Getters and setters. | |
Size | getMaxDFSDepth () const |
Returns the maximal depth of the DFSTree used to discover new patterns. More... | |
void | setMaxDFSDepth (Size depth) |
Defines the maximal depth of the DFSTree used by this class to discover new patterns. More... | |
gspan::DFSTree< GUM_SCALAR > & | tree () |
Returns the DFSTree used to discover new patters. More... | |
const gspan::DFSTree< GUM_SCALAR > & | tree () const |
Returns the DFSTree used to discover new patters. More... | |
gspan::InterfaceGraph< GUM_SCALAR > & | interfaceGraph () |
Returns the InterfaceGraph used by this. More... | |
const gspan::InterfaceGraph< GUM_SCALAR > & | interfaceGraph () const |
Returns the InterfaceGraph used by this. More... | |
Classes | |
class | LabelSort |
Private class used to sort LabelData using STL sort algorithms. More... | |
class | PatternSort |
Private class used to sort Pattern using STL sort algorithms. More... | |
Pattern discovery methods. | |
typedef Set< Sequence< PRMInstance< GUM_SCALAR > *> *> | MatchedInstances |
Code alias. More... | |
void | discoverPatterns () |
This will methods will discover repeated patterns in the PRMSystem<GUM_SCALAR> assigned to this class. More... | |
std::vector< gspan::Pattern *> & | patterns () |
Returns the Pattern mined by this class in a decreasing order of interest. More... | |
const std::vector< gspan::Pattern *> & | patterns () const |
Returns the Pattern mined by this class in a decreasing order of interest. More... | |
MatchedInstances & | matches (const gspan::Pattern &p) |
Returns a mapping between patterns and the sequence of instance in the interface graph matching them. More... | |
const MatchedInstances & | matches (const gspan::Pattern &p) const |
Returns a mapping between patterns and the sequence of instance in the interface graph matching them. More... | |
This class discovers pattern in a PRM<GUM_SCALAR>'s PRMSystem<GUM_SCALAR> to speed up structured inference.
This class is not an inference algorithm for PRM<GUM_SCALAR>, however it can be used to speed up structured inference as it will discover repeated patterns including more than one PRMInstance<GUM_SCALAR>.
This algorithm proceeds in three main steps represented by the private methods GSpan:: sortNodesAndEdges(), GSpan:: subgraph_mining() and GSpan:: sortPatterns().
typedef Set< Sequence< PRMInstance< GUM_SCALAR >* >* > gum::prm::GSpan< GUM_SCALAR >::MatchedInstances |
INLINE gum::prm::GSpan< GUM_SCALAR >::GSpan | ( | const PRM< GUM_SCALAR > & | prm, |
const PRMSystem< GUM_SCALAR > & | sys, | ||
gspan::SearchStrategy< GUM_SCALAR > * | strategy = 0 |
||
) |
Default constructor.
prm | The PRM<GUM_SCALAR> used by this class. |
sys | The PRMSystem<GUM_SCALAR> on which this class searches for patterns. |
strategy | The search strategy used for pattern mining, the default strategy is gspan::FrequenceSearch. |
Definition at line 344 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
INLINE gum::prm::GSpan< GUM_SCALAR >::~GSpan | ( | ) |
Destructor.
Definition at line 353 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Returns the cost with respect to an interface size and its frequency.
interface_size | The size of all output nodes of a pattern. |
frequency | The frequency of the pattern in the current interface graph. |
Definition at line 383 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Returns true if e is an eligible root edge.
e | An EdgeData<GUM_SCALAR>. |
Definition at line 420 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Sort the nodes and edges of graph.
Definition at line 57 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Sort the patterns and compute their respective costs.
Definition at line 219 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
Discovers new patterns by developing p.
graph | The interface graph used in this discovery process. |
p | The pattern used as a base for discovery. |
Definition at line 99 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
void gum::prm::GSpan< GUM_SCALAR >::discoverPatterns | ( | ) |
This will methods will discover repeated patterns in the PRMSystem<GUM_SCALAR> assigned to this class.
The results are saved in a vector of Patterns which can be obtained by calling GSpan::patterns().
Definition at line 35 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
INLINE Size gum::prm::GSpan< GUM_SCALAR >::getMaxDFSDepth | ( | ) | const |
Returns the maximal depth of the DFSTree used to discover new patterns.
Definition at line 363 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
INLINE gspan::InterfaceGraph< GUM_SCALAR > & gum::prm::GSpan< GUM_SCALAR >::interfaceGraph | ( | ) |
Returns the InterfaceGraph used by this.
Definition at line 410 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
INLINE const gspan::InterfaceGraph< GUM_SCALAR > & gum::prm::GSpan< GUM_SCALAR >::interfaceGraph | ( | ) | const |
Returns the InterfaceGraph used by this.
Definition at line 415 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
INLINE GSpan< GUM_SCALAR >::MatchedInstances & gum::prm::GSpan< GUM_SCALAR >::matches | ( | const gspan::Pattern & | p | ) |
Returns a mapping between patterns and the sequence of instance in the interface graph matching them.
Definition at line 399 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
INLINE const GSpan< GUM_SCALAR >::MatchedInstances & gum::prm::GSpan< GUM_SCALAR >::matches | ( | const gspan::Pattern & | p | ) | const |
Returns a mapping between patterns and the sequence of instance in the interface graph matching them.
Definition at line 405 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
INLINE std::vector< gspan::Pattern *> & gum::prm::GSpan< GUM_SCALAR >::patterns | ( | ) |
Returns the Pattern mined by this class in a decreasing order of interest.
Definition at line 388 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
INLINE const std::vector< gspan::Pattern *> & gum::prm::GSpan< GUM_SCALAR >::patterns | ( | ) | const |
Returns the Pattern mined by this class in a decreasing order of interest.
Definition at line 393 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
INLINE void gum::prm::GSpan< GUM_SCALAR >::setMaxDFSDepth | ( | Size | depth | ) |
Defines the maximal depth of the DFSTree used by this class to discover new patterns.
depth | The new maximal DFSTree depth. |
Definition at line 368 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
INLINE gspan::DFSTree< GUM_SCALAR > & gum::prm::GSpan< GUM_SCALAR >::tree | ( | ) |
Returns the DFSTree used to discover new patters.
Definition at line 373 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
INLINE const gspan::DFSTree< GUM_SCALAR > & gum::prm::GSpan< GUM_SCALAR >::tree | ( | ) | const |
Returns the DFSTree used to discover new patters.
Definition at line 378 of file gspan_tpl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |