aGrUM  0.16.0
scoreBIC.h
Go to the documentation of this file.
1 
29 #ifndef GUM_LEARNING_SCORE_BIC_H
30 #define GUM_LEARNING_SCORE_BIC_H
31 
32 #include <string>
33 
34 #include <agrum/agrum.h>
35 #include <agrum/core/math/math.h>
38 
39 namespace gum {
40 
41  namespace learning {
42 
51  template < template < typename > class ALLOC = std::allocator >
52  class ScoreBIC : public Score< ALLOC > {
53  public:
55  using allocator_type = ALLOC< NodeId >;
56 
57  // ##########################################################################
59  // ##########################################################################
61 
63 
84  const Apriori< ALLOC >& apriori,
85  const std::vector< std::pair< std::size_t, std::size_t >,
86  ALLOC< std::pair< std::size_t, std::size_t > > >&
87  ranges,
88  const Bijection< NodeId, std::size_t, ALLOC< std::size_t > >&
89  nodeId2columns =
90  Bijection< NodeId, std::size_t, ALLOC< std::size_t > >(),
91  const allocator_type& alloc = allocator_type());
92 
93 
95 
110  const Apriori< ALLOC >& apriori,
111  const Bijection< NodeId, std::size_t, ALLOC< std::size_t > >&
112  nodeId2columns =
113  Bijection< NodeId, std::size_t, ALLOC< std::size_t > >(),
114  const allocator_type& alloc = allocator_type());
115 
117  ScoreBIC(const ScoreBIC< ALLOC >& from);
118 
120  ScoreBIC(const ScoreBIC< ALLOC >& from, const allocator_type& alloc);
121 
123  ScoreBIC(ScoreBIC< ALLOC >&& from);
124 
126  ScoreBIC(ScoreBIC< ALLOC >&& from, const allocator_type& alloc);
127 
129  virtual ScoreBIC< ALLOC >* clone() const;
130 
132  virtual ScoreBIC< ALLOC >* clone(const allocator_type& alloc) const;
133 
135  virtual ~ScoreBIC();
136 
138 
139 
140  // ##########################################################################
142  // ##########################################################################
143 
145 
148 
151 
153 
154 
155  // ##########################################################################
157  // ##########################################################################
159 
161 
170  virtual std::string isAprioriCompatible() const final;
171 
173 
183  virtual const Apriori< ALLOC >& internalApriori() const final;
184 
186 
194  double N(const IdSet< ALLOC >& idset);
195 
197 
198 
200 
202  static std::string isAprioriCompatible(const std::string& apriori_type,
203  double weight = 1.0f);
204 
206 
207  static std::string isAprioriCompatible(const Apriori< ALLOC >& apriori);
208 
209 
210  protected:
212 
215  virtual double _score(const IdSet< ALLOC >& idset) final;
216 
217 
218 #ifndef DOXYGEN_SHOULD_SKIP_THIS
219 
220  private:
222  AprioriNoApriori< ALLOC > __internal_apriori;
223 
224 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
225  };
226 
227  } /* namespace learning */
228 
229 } /* namespace gum */
230 
231 
232 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
233 extern template class gum::learning::ScoreBIC<>;
234 #endif
235 
236 
237 // always include the template implementation
239 
240 #endif /* GUM_LEARNING_SCORE_BIC_H */
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
double N(const IdSet< ALLOC > &idset)
returns the size of the database w.r.t. a given idset
virtual ScoreBIC< ALLOC > * clone() const
virtual copy constructor
The base class for all the scores used for learning (BIC, BDeu, etc)
Definition: score.h:52
ScoreBIC< ALLOC > & operator=(const ScoreBIC< ALLOC > &from)
copy operator
virtual ~ScoreBIC()
destructor
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
STL namespace.
A class for storing a pair of sets of NodeIds, the second one corresponding to a conditional set...
Definition: idSet.h:48
the base class for all a priori
Definition: apriori.h:50
virtual std::string isAprioriCompatible() const final
indicates whether the apriori is compatible (meaningful) with the score
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
ALLOC< NodeId > allocator_type
type for the allocators passed in arguments of methods
Definition: score.h:55
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
virtual double _score(const IdSet< ALLOC > &idset) final
returns the score for a given IdSet
const std::vector< std::pair< std::size_t, std::size_t >, ALLOC< std::pair< std::size_t, std::size_t > > > & ranges() const
returns the current ranges
ScoreBIC(const DBRowGeneratorParser< ALLOC > &parser, const Apriori< ALLOC > &apriori, const std::vector< std::pair< std::size_t, std::size_t >, ALLOC< std::pair< std::size_t, std::size_t > > > &ranges, 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
ALLOC< NodeId > allocator_type
type for the allocators passed in arguments of methods
Definition: scoreBIC.h:55
the class for computing BIC scores
Definition: scoreBIC.h:52
Set of pairs of elements with fast search for both elements.
Definition: bijection.h:1805
virtual const Apriori< ALLOC > & internalApriori() const final
returns the internal apriori of the score
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
the class used to read a row in the database and to transform it into a set of DBRow instances that c...
Size NodeId
Type for node ids.
Definition: graphElements.h:98
the no a priori class: corresponds to 0 weight-sample