aGrUM  0.16.0
scoreLog2Likelihood.h
Go to the documentation of this file.
1 
29 #ifndef GUM_LEARNING_SCORE_LOG2_LIKELIHOOD_H
30 #define GUM_LEARNING_SCORE_LOG2_LIKELIHOOD_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 ScoreLog2Likelihood : public Score< ALLOC > {
53  public:
55  using allocator_type = ALLOC< NodeId >;
56 
57  // ##########################################################################
59  // ##########################################################################
61 
63 
84  const DBRowGeneratorParser< ALLOC >& parser,
85  const Apriori< ALLOC >& apriori,
86  const std::vector< std::pair< std::size_t, std::size_t >,
87  ALLOC< std::pair< std::size_t, std::size_t > > >&
88  ranges,
89  const Bijection< NodeId, std::size_t, ALLOC< std::size_t > >&
90  nodeId2columns =
91  Bijection< NodeId, std::size_t, ALLOC< std::size_t > >(),
92  const allocator_type& alloc = allocator_type());
93 
94 
96 
111  const DBRowGeneratorParser< ALLOC >& parser,
112  const Apriori< ALLOC >& apriori,
113  const Bijection< NodeId, std::size_t, ALLOC< std::size_t > >&
114  nodeId2columns =
115  Bijection< NodeId, std::size_t, ALLOC< std::size_t > >(),
116  const allocator_type& alloc = allocator_type());
117 
120 
123  const allocator_type& alloc);
124 
127 
130  const allocator_type& alloc);
131 
133  virtual ScoreLog2Likelihood< ALLOC >* clone() const;
134 
137  clone(const allocator_type& alloc) const;
138 
140  virtual ~ScoreLog2Likelihood();
141 
143 
144 
145  // ##########################################################################
147  // ##########################################################################
148 
150 
154 
157 
159 
160 
161  // ##########################################################################
163  // ##########################################################################
165 
167 
176  virtual std::string isAprioriCompatible() const final;
177 
179 
189  virtual const Apriori< ALLOC >& internalApriori() const final;
190 
191  using Score< ALLOC >::score;
192 
194 
197  double score(const IdSet< ALLOC >& idset);
198 
200 
201 
203 
205  static std::string isAprioriCompatible(const std::string& apriori_type,
206  double weight = 1.0f);
207 
209 
210  static std::string isAprioriCompatible(const Apriori< ALLOC >& apriori);
211 
212 
213  protected:
215 
218  virtual double _score(const IdSet< ALLOC >& idset) final;
219 
220 
221 #ifndef DOXYGEN_SHOULD_SKIP_THIS
222 
223  private:
225  AprioriNoApriori< ALLOC > __internal_apriori;
226 
227 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
228  };
229 
230  } /* namespace learning */
231 
232 } /* namespace gum */
233 
234 
235 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
236 extern template class gum::learning::ScoreLog2Likelihood<>;
237 #endif
238 
239 
240 // always include the template implementation
242 
243 #endif /* GUM_LEARNING_SCORE_LOG2_LIKELIHOOD_H */
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
double score(const IdSet< ALLOC > &idset)
returns the score for a given IdSet
The base class for all the scores used for learning (BIC, BDeu, etc)
Definition: score.h:52
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual ScoreLog2Likelihood< ALLOC > * clone() const
virtual copy constructor
ALLOC< NodeId > allocator_type
type for the allocators passed in arguments of methods
STL namespace.
A class for storing a pair of sets of NodeIds, the second one corresponding to a conditional set...
Definition: idSet.h:48
virtual ~ScoreLog2Likelihood()
destructor
the base class for all a priori
Definition: apriori.h:50
virtual const Apriori< ALLOC > & internalApriori() const final
returns the internal apriori of the score
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
the class for computing Log2-likelihood scores
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
Set of pairs of elements with fast search for both elements.
Definition: bijection.h:1805
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
ScoreLog2Likelihood< ALLOC > & operator=(const ScoreLog2Likelihood< ALLOC > &from)
copy operator
ScoreLog2Likelihood(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
virtual std::string isAprioriCompatible() const final
indicates whether the apriori is compatible (meaningful) with the score
the class used to read a row in the database and to transform it into a set of DBRow instances that c...
virtual double _score(const IdSet< ALLOC > &idset) final
returns the score for a given IdSet
Size NodeId
Type for node ids.
Definition: graphElements.h:98
the no a priori class: corresponds to 0 weight-sample
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.