aGrUM  0.13.2
gum::learning::AprioriSmoothing< IdSetAlloc, CountAlloc > Class Template Reference

the smooth a priori: adds a weight w to all the countings More...

#include <aprioriSmoothing.h>

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

Public Member Functions

Constructors / Destructors
 AprioriSmoothing ()
 default constructor More...
 
virtual AprioriSmoothing< IdSetAlloc, CountAlloc > * copyFactory () const
 virtual copy constructor More...
 
virtual ~AprioriSmoothing ()
 destructor More...
 
Accessors / Modifiers
virtual void compute () final
 include the apriori into a given set of counts More...
 
virtual bool isOfType (const std::string &type) final
 indicates whether an apriori is of a certain type More...
 
virtual const std::string & getType () const noexceptfinal
 returns the type of the apriori 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...
 
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...
 
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...
 

Public Types

using type = AprioriSmoothingType
 

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

 AprioriSmoothing (const AprioriSmoothing< IdSetAlloc, CountAlloc > &from)
 copy constructor More...
 
 AprioriSmoothing (AprioriSmoothing< IdSetAlloc, CountAlloc > &&from)
 move constructor More...
 
AprioriSmoothing< IdSetAlloc, CountAlloc > & operator= (const AprioriSmoothing< IdSetAlloc, CountAlloc > &)=delete
 prevent copy operator More...
 

Detailed Description

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

the smooth a priori: adds a weight w to all the countings

Definition at line 43 of file aprioriSmoothing.h.

Member Typedef Documentation

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
using gum::learning::AprioriSmoothing< IdSetAlloc, CountAlloc >::type = AprioriSmoothingType

Definition at line 45 of file aprioriSmoothing.h.

Constructor & Destructor Documentation

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

default constructor

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

destructor

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

copy constructor

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

move constructor

Member Function Documentation

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual void gum::learning::AprioriSmoothing< IdSetAlloc, CountAlloc >::compute ( )
finalvirtual

include the apriori into a given set of counts

Implements gum::learning::Apriori< IdSetAlloc, CountAlloc >.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual AprioriSmoothing< IdSetAlloc, CountAlloc >* gum::learning::AprioriSmoothing< IdSetAlloc, CountAlloc >::copyFactory ( ) const
virtual

virtual copy constructor

Implements gum::learning::Apriori< IdSetAlloc, CountAlloc >.

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

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)
inherited

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::AprioriSmoothing< IdSetAlloc, CountAlloc >::getType ( ) const
finalvirtualnoexcept

returns the type of the apriori

Implements gum::learning::Apriori< IdSetAlloc, CountAlloc >.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
virtual bool gum::learning::AprioriSmoothing< IdSetAlloc, CountAlloc >::isOfType ( const std::string &  type)
finalvirtual

indicates whether an apriori is of a certain type

Implements gum::learning::Apriori< IdSetAlloc, CountAlloc >.

template<typename IdSetAlloc = std::allocator< Idx >, typename CountAlloc = std::allocator< double >>
AprioriSmoothing< IdSetAlloc, CountAlloc >& gum::learning::AprioriSmoothing< IdSetAlloc, CountAlloc >::operator= ( const AprioriSmoothing< IdSetAlloc, CountAlloc > &  )
protecteddelete

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 
)
inherited

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)
virtualinherited

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
noexceptinherited

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
protectedinherited

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}
protectedinherited

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}
protectedinherited

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}
protectedinherited

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}
protectedinherited

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}
protectedinherited

the weight of the apriori

Definition at line 102 of file apriori.h.


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