aGrUM  0.16.0
scorefNML.h
Go to the documentation of this file.
1 
29 #ifndef GUM_LEARNING_SCORE_FNML_H
30 #define GUM_LEARNING_SCORE_FNML_H
31 
32 #include <string>
33 
34 #include <agrum/agrum.h>
35 #include <agrum/core/math/math.h>
39 
40 namespace gum {
41 
42  namespace learning {
43 
44 
53  template < template < typename > class ALLOC = std::allocator >
54  class ScorefNML : public Score< ALLOC > {
55  public:
57  using allocator_type = ALLOC< NodeId >;
58 
59  // ##########################################################################
61  // ##########################################################################
63 
65 
85  ScorefNML(
86  const DBRowGeneratorParser< ALLOC >& parser,
87  const Apriori< ALLOC >& apriori,
88  const std::vector< std::pair< std::size_t, std::size_t >,
89  ALLOC< std::pair< std::size_t, std::size_t > > >&
90  ranges,
91  const Bijection< NodeId, std::size_t, ALLOC< std::size_t > >&
92  nodeId2columns =
93  Bijection< NodeId, std::size_t, ALLOC< std::size_t > >(),
94  const allocator_type& alloc = allocator_type());
95 
96 
98 
113  const Apriori< ALLOC >& apriori,
114  const Bijection< NodeId, std::size_t, ALLOC< std::size_t > >&
115  nodeId2columns =
116  Bijection< NodeId, std::size_t, ALLOC< std::size_t > >(),
117  const allocator_type& alloc = allocator_type());
118 
120  ScorefNML(const ScorefNML< ALLOC >& from);
121 
123  ScorefNML(const ScorefNML< ALLOC >& from, const allocator_type& alloc);
124 
127 
129  ScorefNML(ScorefNML< ALLOC >&& from, const allocator_type& alloc);
130 
132  virtual ScorefNML< ALLOC >* clone() const;
133 
135  virtual ScorefNML< ALLOC >* clone(const allocator_type& alloc) const;
136 
138  virtual ~ScorefNML();
139 
141 
142 
143  // ##########################################################################
145  // ##########################################################################
146 
148 
151 
154 
156 
157 
158  // ##########################################################################
160  // ##########################################################################
162 
164 
173  virtual std::string isAprioriCompatible() const final;
174 
176 
186  virtual const Apriori< ALLOC >& internalApriori() const final;
187 
189 
190 
192 
194  static std::string isAprioriCompatible(const std::string& apriori_type,
195  double weight = 1.0f);
196 
198 
199  static std::string isAprioriCompatible(const Apriori< ALLOC >& apriori);
200 
201 
202  protected:
204 
207  virtual double _score(const IdSet< ALLOC >& idset) final;
208 
209 
210 #ifndef DOXYGEN_SHOULD_SKIP_THIS
211 
212  private:
214  AprioriNoApriori< ALLOC > __internal_apriori;
215 
218 
219 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
220  };
221 
222 
223  } /* namespace learning */
224 
225 
226 } /* namespace gum */
227 
228 
229 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
230 extern template class gum::learning::ScorefNML<>;
231 #endif
232 
233 
234 // always include the template implementation
236 
237 #endif /* GUM_LEARNING_SCORE_FNML_H */
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual std::string isAprioriCompatible() const final
indicates whether the apriori is compatible (meaningful) with the score
The base class for all the scores used for learning (BIC, BDeu, etc)
Definition: score.h:52
virtual ScorefNML< ALLOC > * clone() const
virtual copy constructor
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
STL namespace.
virtual ~ScorefNML()
destructor
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 const Apriori< ALLOC > & internalApriori() const final
returns the internal apriori of the score
ScorefNML(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: score.h:55
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
the class for computing fNML scores
Definition: scorefNML.h:54
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
ScorefNML< ALLOC > & operator=(const ScorefNML< ALLOC > &from)
copy operator
ALLOC< NodeId > allocator_type
type for the allocators passed in arguments of methods
Definition: scorefNML.h:57
Set of pairs of elements with fast search for both elements.
Definition: bijection.h:1805
virtual double _score(const IdSet< ALLOC > &idset) final
returns the score for a given IdSet
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
the class for computing the log2 of the parametric complexity of an r-ary multinomial variableThis cl...
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