![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
the base class for all a priori More...
#include <agrum/tools/database/apriori.h>
Public Member Functions | |
Constructors / Destructors | |
Apriori (const DatabaseTable< ALLOC > &database, const Bijection< NodeId, std::size_t, ALLOC< std::size_t > > &nodeId2columns=Bijection< NodeId, std::size_t, ALLOC< std::size_t > >(), const allocator_type &alloc=allocator_type()) | |
default constructor More... | |
virtual Apriori< ALLOC > * | clone () const =0 |
virtual copy constructor More... | |
virtual Apriori< ALLOC > * | clone (const allocator_type &alloc) const =0 |
virtual copy constructor with a given allocator More... | |
virtual | ~Apriori () |
destructor More... | |
Accessors / Modifiers | |
virtual void | setWeight (const double weight) |
sets the weight of the a priori (kind of effective sample size) More... | |
double | weight () const |
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 =0 |
returns the type of the apriori More... | |
virtual bool | isInformative () const =0 |
indicates whether the apriori is potentially informative More... | |
virtual void | addAllApriori (const IdCondSet< ALLOC > &idset, std::vector< double, ALLOC< double > > &counts)=0 |
adds the apriori to a counting vector corresponding to the idset More... | |
virtual void | addConditioningApriori (const IdCondSet< ALLOC > &idset, std::vector< double, ALLOC< double > > &counts)=0 |
adds the apriori to a counting vectordefined over the right hand side of the idset More... | |
allocator_type | getAllocator () const |
returns the allocator used by the internal apriori More... | |
Public Types | |
using | allocator_type = ALLOC< NodeId > |
type for the allocators passed in arguments of methods More... | |
Protected Attributes | |
double | weight_ {1.0} |
the weight of the apriori More... | |
const DatabaseTable< ALLOC > * | database_ |
a reference to the database in order to have access to its variables More... | |
Bijection< NodeId, std::size_t, ALLOC< std::size_t > > | nodeId2columns_ |
a mapping from the NodeIds of the variables to the indices of the columns in the database More... | |
Protected Member Functions | |
Apriori (const Apriori< ALLOC > &from) | |
copy constructor More... | |
Apriori (const Apriori< ALLOC > &from, const allocator_type &alloc) | |
copy constructor with a given allocator More... | |
Apriori (Apriori< ALLOC > &&from) | |
move constructor More... | |
Apriori (Apriori< ALLOC > &&from, const allocator_type &alloc) | |
move constructor with a given allocator More... | |
Apriori< ALLOC > & | operator= (const Apriori< ALLOC > &from) |
copy operator More... | |
Apriori< ALLOC > & | operator= (Apriori< ALLOC > &&from) |
move operator More... | |
the base class for all a priori
using gum::learning::Apriori< ALLOC >::allocator_type = ALLOC< NodeId > |
gum::learning::Apriori< ALLOC >::Apriori | ( | const DatabaseTable< ALLOC > & | database, |
const Bijection< NodeId, std::size_t, ALLOC< std::size_t > > & | nodeId2columns = Bijection< NodeId, std::size_t, ALLOC< std::size_t > >() , |
||
const allocator_type & | alloc = allocator_type() |
||
) |
default constructor
database | the database from which learning is performed. This is useful to get access to the random variables |
nodeId2Columns | a mapping from the ids of the nodes in the graphical model to the corresponding column in the DatabaseTable. This enables estimating from a database in which variable A corresponds to the 2nd column the parameters of a BN in which variable A has a NodeId of 5. An empty nodeId2Columns bijection means that the mapping is an identity, i.e., the value of a NodeId is equal to the index of the column in the DatabaseTable. |
alloc | the allocator used to allocate the structures within the RecordCounter. |
|
virtual |
destructor
|
protected |
copy constructor
|
protected |
copy constructor with a given allocator
|
protected |
move constructor
|
protected |
move constructor with a given allocator
|
pure virtual |
adds the apriori to a counting vector corresponding to the idset
adds the apriori to an already created counting vector defined over the union of the variables on both the left and right hand side of the conditioning bar of the idset.
Implemented in gum::learning::AprioriDirichletFromDatabase< ALLOC >, gum::learning::AprioriBDeu< ALLOC >, gum::learning::AprioriNoApriori< ALLOC >, and gum::learning::AprioriSmoothing< ALLOC >.
|
pure virtual |
adds the apriori to a counting vectordefined over the right hand side of the idset
Implemented in gum::learning::AprioriDirichletFromDatabase< ALLOC >, gum::learning::AprioriBDeu< ALLOC >, gum::learning::AprioriNoApriori< ALLOC >, and gum::learning::AprioriSmoothing< ALLOC >.
|
pure virtual |
virtual copy constructor
Implemented in gum::learning::AprioriDirichletFromDatabase< ALLOC >, gum::learning::AprioriBDeu< ALLOC >, gum::learning::AprioriK2< ALLOC >, gum::learning::AprioriNoApriori< ALLOC >, and gum::learning::AprioriSmoothing< ALLOC >.
|
pure virtual |
virtual copy constructor with a given allocator
Implemented in gum::learning::AprioriDirichletFromDatabase< ALLOC >, gum::learning::AprioriBDeu< ALLOC >, gum::learning::AprioriK2< ALLOC >, gum::learning::AprioriNoApriori< ALLOC >, and gum::learning::AprioriSmoothing< ALLOC >.
allocator_type gum::learning::Apriori< ALLOC >::getAllocator | ( | ) | const |
returns the allocator used by the internal apriori
|
pure virtual |
returns the type of the apriori
Implemented in gum::learning::AprioriDirichletFromDatabase< ALLOC >, gum::learning::AprioriBDeu< ALLOC >, gum::learning::AprioriNoApriori< ALLOC >, and gum::learning::AprioriSmoothing< ALLOC >.
|
pure virtual |
indicates whether the apriori is potentially informative
Basically, only the NoApriori is uninformative. However, it may happen that, under some circonstances, an apriori, which is usually not equal to the NoApriori, becomes equal to it (e.g., when the weight is equal to zero). In this case, if the apriori can detect this case, it shall inform the classes that use it that it is temporarily uninformative. These classes will then be able to speed-up their code by avoiding to take into account the apriori in their computations.
Implemented in gum::learning::AprioriDirichletFromDatabase< ALLOC >, gum::learning::AprioriBDeu< ALLOC >, gum::learning::AprioriNoApriori< ALLOC >, and gum::learning::AprioriSmoothing< ALLOC >.
|
pure virtual |
indicates whether an apriori is of a certain type
Implemented in gum::learning::AprioriDirichletFromDatabase< ALLOC >, gum::learning::AprioriBDeu< ALLOC >, gum::learning::AprioriNoApriori< ALLOC >, and gum::learning::AprioriSmoothing< ALLOC >.
|
protected |
copy operator
|
protected |
move operator
|
virtual |
sets the weight of the a priori (kind of effective sample size)
Reimplemented in gum::learning::AprioriDirichletFromDatabase< ALLOC >, gum::learning::AprioriBDeu< ALLOC >, gum::learning::AprioriK2< ALLOC >, and gum::learning::AprioriNoApriori< ALLOC >.
double gum::learning::Apriori< ALLOC >::weight | ( | ) | const |
returns the weight assigned to the apriori
|
protected |
|
protected |
|
protected |