aGrUM  0.17.2
a C++ library for (probabilistic) graphical models
aprioriBDeu.h
Go to the documentation of this file.
1 
28 #ifndef GUM_LEARNING_A_PRIORI_BDEU_H
29 #define GUM_LEARNING_A_PRIORI_BDEU_H
30 
31 #include <vector>
32 
33 #include <agrum/agrum.h>
35 
36 namespace gum {
37 
38  namespace learning {
39 
53  template < template < typename > class ALLOC = std::allocator >
54  class AprioriBDeu: public Apriori< ALLOC > {
55  public:
58 
60  using allocator_type = ALLOC< NodeId >;
61 
62 
63  // ##########################################################################
65  // ##########################################################################
67 
69 
80  AprioriBDeu(const DatabaseTable< ALLOC >& database,
81  const Bijection< NodeId, std::size_t, ALLOC< std::size_t > >&
82  nodeId2columns =
83  Bijection< NodeId, std::size_t, ALLOC< std::size_t > >(),
84  const allocator_type& alloc = allocator_type());
85 
87  AprioriBDeu(const AprioriBDeu< ALLOC >& from);
88 
90  AprioriBDeu(const AprioriBDeu< ALLOC >& from, const allocator_type& alloc);
91 
94 
96  AprioriBDeu(AprioriBDeu< ALLOC >&& from, const allocator_type& alloc);
97 
99  virtual AprioriBDeu< ALLOC >* clone() const;
100 
102  virtual AprioriBDeu< ALLOC >* clone(const allocator_type& alloc) const;
103 
105  virtual ~AprioriBDeu();
106 
108 
109 
110  // ##########################################################################
112  // ##########################################################################
114 
117 
120 
122 
123 
124  // ##########################################################################
126  // ##########################################################################
128 
130  virtual void setWeight(const double weight) final;
131 
133  void setEffectiveSampleSize(const double weight);
134 
136  virtual bool isOfType(const std::string& type) final;
137 
139  virtual const std::string& getType() const final;
140 
142 
149  virtual bool isInformative() const final;
150 
152 
157  virtual void
158  addAllApriori(const IdCondSet< ALLOC >& idset,
159  std::vector< double, ALLOC< double > >& counts) final;
160 
166  virtual void addConditioningApriori(
167  const IdCondSet< ALLOC >& idset,
168  std::vector< double, ALLOC< double > >& counts) final;
169 
171  };
172 
173  } /* namespace learning */
174 
175 } /* namespace gum */
176 
178 #include <agrum/BN/learning/aprioris/aprioriBDeu_tpl.h>
179 
180 #endif /* GUM_LEARNING_A_PRIORI_BDEU_H */
virtual void addAllApriori(const IdCondSet< ALLOC > &idset, std::vector< double, ALLOC< double > > &counts) final
adds the apriori to a counting vector corresponding to the idset
virtual AprioriBDeu< ALLOC > * clone() const
virtual copy constructor
AprioriBDeu< ALLOC > & operator=(const AprioriBDeu< ALLOC > &from)
copy operator
virtual ~AprioriBDeu()
destructor
virtual const std::string & getType() const final
returns the type of the apriori
virtual void addConditioningApriori(const IdCondSet< ALLOC > &idset, std::vector< double, ALLOC< double > > &counts) final
adds the apriori to a counting vectordefined over the right hand side of the idset ...
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
STL namespace.
the base class for all a priori
Definition: apriori.h:50
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
Definition: agrum.h:25
the internal apriori for the BDeu score (N&#39; / (r_i * q_i)BDeu is a BD score with a N&#39;/(r_i * q_i) apr...
Definition: aprioriBDeu.h:54
virtual void setWeight(const double weight) final
sets the effective sample size N&#39; (alias of setEffectiveSampleSize ())
double weight() const
returns the weight assigned to the apriori
virtual bool isInformative() const final
indicates whether the apriori is potentially informative
Set of pairs of elements with fast search for both elements.
Definition: bijection.h:1805
The class representing a tabular database as used by learning tasks.
virtual bool isOfType(const std::string &type) final
indicates whether an apriori is of a certain type
ALLOC< NodeId > allocator_type
type for the allocators passed in arguments of methods
Definition: aprioriBDeu.h:60
ALLOC< NodeId > allocator_type
type for the allocators passed in arguments of methods
Definition: apriori.h:53
Size NodeId
Type for node ids.
Definition: graphElements.h:98
A class for storing a pair of sets of NodeIds, the second one corresponding to a conditional set...
Definition: idCondSet.h:48
AprioriBDeu(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
void setEffectiveSampleSize(const double weight)
sets the effective sample size N&#39;