aGrUM  0.13.2
gum::learning::Apriori< IdSetAlloc, CountAlloc > Class Template Referenceabstract

the base class for all apriori More...

#include <apriori.h>

+ Inheritance diagram for gum::learning::Apriori< IdSetAlloc, CountAlloc >:
+ Collaboration diagram for gum::learning::Apriori< IdSetAlloc, CountAlloc >:

Public Member Functions

Constructors / Destructors
 Apriori ()
 default constructor More...
 
virtual Apriori< IdSetAlloc, CountAlloc > * copyFactory () const =0
 virtual copy constructor More...
 
virtual ~Apriori ()
 destructor More...
 
Accessors / Modifiers
virtual void setWeight (double weight)
 sets the weight of the a priori (kind of effective sample size) More...
 
double weight () const noexcept
 returns the weight assigned to the apriori More...
 
virtual bool isOfType (const std::string &type)=0
 indicates whether an apriori is of a certain type More...
 
virtual const std::string & getType () const noexcept=0
 returns the type of the apriori More...
 
void setParameters (const std::vector< Size > &modalities, std::vector< std::vector< double, CountAlloc > > &counts, const std::vector< std::pair< std::vector< Idx, IdSetAlloc >, Idx > * > &target_nodesets, const std::vector< std::pair< std::vector< Idx, IdSetAlloc >, Idx > * > &conditioning_nodesets)
 sets the parameters for the apriori More...
 
virtual void compute ()=0
 compute the apriori into a given set of counts More...
 
const std::vector< double, CountAlloc > & getAllApriori (Idx index)
 returns the apriori vector for a given (conditioned) target set More...
 
const std::vector< double, CountAlloc > & getConditioningApriori (Idx index)
 returns the apriori vector for a conditioning set More...
 

Protected Attributes

double _weight {1.0f}
 the weight of the apriori More...
 
const std::vector< Size > * _modalities {nullptr}
 the modalities of the nodes More...
 
std::vector< std::vector< double, CountAlloc > > * _unapriori_counts {nullptr}
 the counts that were performed by the class on which we add an apriori More...
 
const std::vector< std::pair< std::vector< Idx, IdSetAlloc >, Idx > * > * _target_nodesets {nullptr}
 the set of target + cond nodes, and their counting indices More...
 
const std::vector< std::pair< std::vector< Idx, IdSetAlloc >, Idx > * > * _conditioning_nodesets {nullptr}
 the set of conditioning nodesets More...
 
std::vector< std::vector< double, CountAlloc > > _apriori_counts
 the a priori More...
 

Protected Member Functions

 Apriori (const Apriori< IdSetAlloc, CountAlloc > &from)
 copy constructor More...
 
 Apriori (Apriori< IdSetAlloc, CountAlloc > &&from)
 move constructor More...
 

Detailed Description

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
class gum::learning::Apriori< IdSetAlloc, CountAlloc >

the base class for all apriori

Definition at line 45 of file apriori.h.

Constructor & Destructor Documentation

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
gum::learning::Apriori< IdSetAlloc, CountAlloc >::Apriori ( )

default constructor

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual gum::learning::Apriori< IdSetAlloc, CountAlloc >::~Apriori ( )
virtual

destructor

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
gum::learning::Apriori< IdSetAlloc, CountAlloc >::Apriori ( const Apriori< IdSetAlloc, CountAlloc > &  from)
protected

copy constructor

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
gum::learning::Apriori< IdSetAlloc, CountAlloc >::Apriori ( Apriori< IdSetAlloc, CountAlloc > &&  from)
protected

move constructor

Member Function Documentation

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual void gum::learning::Apriori< IdSetAlloc, CountAlloc >::compute ( )
pure virtual
template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual Apriori< IdSetAlloc, CountAlloc >* gum::learning::Apriori< IdSetAlloc, CountAlloc >::copyFactory ( ) const
pure virtual
template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
const std::vector< double, CountAlloc >& gum::learning::Apriori< IdSetAlloc, CountAlloc >::getAllApriori ( Idx  index)

returns the apriori vector for a given (conditioned) target set

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
const std::vector< double, CountAlloc >& gum::learning::Apriori< IdSetAlloc, CountAlloc >::getConditioningApriori ( Idx  index)

returns the apriori vector for a conditioning set

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual const std::string& gum::learning::Apriori< IdSetAlloc, CountAlloc >::getType ( ) const
pure virtualnoexcept
template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual bool gum::learning::Apriori< IdSetAlloc, CountAlloc >::isOfType ( const std::string &  type)
pure virtual
template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
Apriori< IdSetAlloc, CountAlloc >& gum::learning::Apriori< IdSetAlloc, CountAlloc >::operator= ( const Apriori< IdSetAlloc, CountAlloc > &  )
privatedelete

prevent copy operator

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
void gum::learning::Apriori< IdSetAlloc, CountAlloc >::setParameters ( const std::vector< Size > &  modalities,
std::vector< std::vector< double, CountAlloc > > &  counts,
const std::vector< std::pair< std::vector< Idx, IdSetAlloc >, Idx > * > &  target_nodesets,
const std::vector< std::pair< std::vector< Idx, IdSetAlloc >, Idx > * > &  conditioning_nodesets 
)

sets the parameters for the apriori

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual void gum::learning::Apriori< IdSetAlloc, CountAlloc >::setWeight ( double  weight)
virtual

sets the weight of the a priori (kind of effective sample size)

Reimplemented in gum::learning::AprioriNoApriori< IdSetAlloc, CountAlloc >.

Referenced by gum::learning::genericBNLearner::__createApriori().

+ Here is the caller graph for this function:

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
double gum::learning::Apriori< IdSetAlloc, CountAlloc >::weight ( ) const
noexcept

returns the weight assigned to the apriori

Member Data Documentation

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
std::vector< std::vector< double, CountAlloc > > gum::learning::Apriori< IdSetAlloc, CountAlloc >::_apriori_counts
protected

the a priori

Definition at line 130 of file apriori.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
const std::vector< std::pair< std::vector< Idx, IdSetAlloc >, Idx >* >* gum::learning::Apriori< IdSetAlloc, CountAlloc >::_conditioning_nodesets {nullptr}
protected

the set of conditioning nodesets

for details, see _target_nodesets

Definition at line 127 of file apriori.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
const std::vector< Size >* gum::learning::Apriori< IdSetAlloc, CountAlloc >::_modalities {nullptr}
protected

the modalities of the nodes

Definition at line 105 of file apriori.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
const std::vector< std::pair< std::vector< Idx, IdSetAlloc >, Idx >* >* gum::learning::Apriori< IdSetAlloc, CountAlloc >::_target_nodesets {nullptr}
protected

the set of target + cond nodes, and their counting indices

The first element of the pairs correspond to a nodeset and the second one to the corresponding index in _unapriori_counts. Some pointers on the pair might be nullptr. In this case, this means that the countings have already been processed and have been put into a cache. So, for these pointers, no a priori operation needs be performed.

Definition at line 122 of file apriori.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
std::vector< std::vector< double, CountAlloc > >* gum::learning::Apriori< IdSetAlloc, CountAlloc >::_unapriori_counts {nullptr}
protected

the counts that were performed by the class on which we add an apriori

Say that a score needs an apriori, then _unapriori_counts corresponds to the countings performed by the score. Those are given to the apriori so that the latter can add what is needed to _unapriori_counts to take into account the so-called apriori.

Definition at line 112 of file apriori.h.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
double gum::learning::Apriori< IdSetAlloc, CountAlloc >::_weight {1.0f}
protected

the weight of the apriori

Definition at line 102 of file apriori.h.


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