27 #ifndef GUM_LEARNING_A_PRIORI_H 28 #define GUM_LEARNING_A_PRIORI_H 33 #include <agrum/agrum.h> 34 #include <agrum/tools/core/bijection.h> 35 #include <agrum/BN/learning/aprioris/aprioriTypes.h> 36 #include <agrum/tools/database/databaseTable.h> 37 #include <agrum/tools/stattests/idCondSet.h> 48 template <
template <
typename >
class ALLOC = std::allocator >
71 Apriori(
const DatabaseTable< ALLOC >& database,
93 virtual void setWeight(
const double weight);
99 virtual bool isOfType(
const std::string& type) = 0;
102 virtual const std::string&
getType()
const = 0;
121 std::vector<
double, ALLOC<
double > >& counts)
130 std::vector<
double, ALLOC<
double > >& counts)
152 Apriori(
const Apriori< ALLOC >& from);
155 Apriori(
const Apriori< ALLOC >& from,
const allocator_type& alloc);
158 Apriori(Apriori< ALLOC >&& from);
161 Apriori(Apriori< ALLOC >&& from,
const allocator_type& alloc);
175 #include <agrum/BN/learning/aprioris/apriori_tpl.h> Apriori(const Apriori< ALLOC > &from, const allocator_type &alloc)
copy constructor with a given allocator
virtual void setWeight(const double weight)
sets the weight of the a priori (kind of effective sample size)
virtual const std::string & getType() const =0
returns the type of the apriori
virtual bool isOfType(const std::string &type)=0
indicates whether an apriori is of a certain type
INLINE void emplace(Args &&... args)
double weight_
the weight of the apriori
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 ...
virtual Apriori< ALLOC > * clone() const =0
virtual copy constructor
Apriori(Apriori< ALLOC > &&from, const allocator_type &alloc)
move constructor with a given allocator
double weight() const
returns the weight assigned to the apriori
Apriori< ALLOC > & operator=(const Apriori< ALLOC > &from)
copy operator
virtual Apriori< ALLOC > * clone(const allocator_type &alloc) const =0
virtual copy constructor with a given allocator
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 ...
virtual bool isInformative() const =0
indicates whether the apriori is potentially informative
allocator_type getAllocator() const
returns the allocator used by the internal apriori
const DatabaseTable< ALLOC > * database_
a reference to the database in order to have access to its variables
Apriori(const Apriori< ALLOC > &from)
copy constructor
Apriori(Apriori< ALLOC > &&from)
move constructor
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
Database(const std::string &filename, const BayesNet< GUM_SCALAR > &bn, const std::vector< std::string > &missing_symbols)
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
virtual ~Apriori()
destructor
Apriori< ALLOC > & operator=(Apriori< ALLOC > &&from)
move operator