aGrUM  0.16.0
kNML.h
Go to the documentation of this file.
1 
30 #ifndef GUM_LEARNING_K_NML_H
31 #define GUM_LEARNING_K_NML_H
32 
33 #include <vector>
34 
35 #include <agrum/core/math/math.h>
38 
39 namespace gum {
40 
41  namespace learning {
42 
43 
49  template < template < typename > class ALLOC = std::allocator >
50  class KNML : private IndependenceTest< ALLOC > {
51  public:
53  using allocator_type = ALLOC< NodeId >;
54 
55  // ##########################################################################
57  // ##########################################################################
59 
61 
83  KNML(const DBRowGeneratorParser< ALLOC >& parser,
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 
111  KNML(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 
119  KNML(const KNML< ALLOC >& from);
120 
122  KNML(const KNML< ALLOC >& from, const allocator_type& alloc);
123 
125  KNML(KNML< ALLOC >&& from);
126 
128  KNML(KNML< ALLOC >&& from, const allocator_type& alloc);
129 
131  virtual KNML< ALLOC >* clone() const;
132 
134  virtual KNML< ALLOC >* clone(const allocator_type& alloc) const;
135 
137  virtual ~KNML();
138 
140 
141 
142  // ##########################################################################
144  // ##########################################################################
145 
147 
149  KNML< ALLOC >& operator=(const KNML< ALLOC >& from);
150 
153 
155 
156 
157  // ##########################################################################
159  // ##########################################################################
161 
164 
167 
178 
181 
183 
190 
193 
196 
199 
201  virtual void clear();
202 
204  virtual void clearCache();
205 
207  virtual void useCache(const bool on_off);
208 
210 
214 
217 
220 
222 
223 
224  protected:
226 
229  virtual double _score(const IdSet< ALLOC >& idset) final;
230 
231 
232 #ifndef DOXYGEN_SHOULD_SKIP_THIS
233 
234  private:
236  VariableLog2ParamComplexity< ALLOC > __param_complexity;
237 
238 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
239  };
240 
241  } /* namespace learning */
242 
243 } /* namespace gum */
244 
245 
246 // always include the template implementation
248 
249 #endif /* GUM_LEARNING_K_NML_H */
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.
The base class for all the independence tests used for learning.
ALLOC< NodeId > allocator_type
type for the allocators passed in arguments of methods
ALLOC< NodeId > allocator_type
type for the allocators passed in arguments of methods
Definition: kNML.h:53
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
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
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.
virtual void clear()
clears all the data structures from memory, including the C_n^r cache
virtual ~KNML()
destructor
virtual double _score(const IdSet< ALLOC > &idset) final
returns the score for a given IdSet
Set of pairs of elements with fast search for both elements.
Definition: bijection.h:1805
virtual void clearCache()
clears the current C_n^r cache
the class for computing the log2 of the parametric complexity of an r-ary multinomial variableThis cl...
KNML< ALLOC > & operator=(const KNML< ALLOC > &from)
copy operator
the class for computing the NML penalty used by 3off2
Definition: kNML.h:50
virtual void useCache(const bool on_off)
turn on/off the use of the C_n^r cache
virtual KNML< ALLOC > * clone() const
virtual copy constructor
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
KNML(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
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.