aGrUM  0.14.2
aprioriK2.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
25 #ifndef GUM_LEARNING_A_PRIORI_K2_H
26 #define GUM_LEARNING_A_PRIORI_K2_H
27 
28 #include <vector>
29 
30 #include <agrum/agrum.h>
32 
33 namespace gum {
34 
35  namespace learning {
36 
48  template < template < typename > class ALLOC = std::allocator >
49  class AprioriK2 : public AprioriSmoothing< ALLOC > {
50  public:
53 
55  using allocator_type = ALLOC< NodeId >;
56 
57 
58  // ##########################################################################
60  // ##########################################################################
62 
64 
75  AprioriK2(const DatabaseTable< ALLOC >& database,
76  const Bijection< NodeId, std::size_t, ALLOC< std::size_t > >&
77  nodeId2columns =
78  Bijection< NodeId, std::size_t, ALLOC< std::size_t > >(),
79  const allocator_type& alloc = allocator_type());
80 
82  AprioriK2(const AprioriK2< ALLOC >& from);
83 
85  AprioriK2(const AprioriK2< ALLOC >& from, const allocator_type& alloc);
86 
89 
91  AprioriK2(AprioriK2< ALLOC >&& from, const allocator_type& alloc);
92 
94  virtual AprioriK2< ALLOC >* clone() const;
95 
97  virtual AprioriK2< ALLOC >* clone(const allocator_type& alloc) const;
98 
100  virtual ~AprioriK2();
101 
103 
104 
105  // ##########################################################################
107  // ##########################################################################
109 
112 
115 
117 
118 
119  // ##########################################################################
121  // ##########################################################################
123 
125  virtual void setWeight(const double weight) final;
126 
128  };
129 
130  } /* namespace learning */
131 
132 } /* namespace gum */
133 
136 
137 #endif /* GUM_LEARNING_A_PRIORI_K2_H */
virtual void setWeight(const double weight) final
dummy set weight function: in K2, weights are always equal to 1
AprioriK2(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
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
virtual AprioriK2< ALLOC > * clone() const
virtual copy constructor
the smooth a priori: adds a weight w to all the countings
virtual ~AprioriK2()
destructor
AprioriK2< ALLOC > & operator=(const AprioriK2< ALLOC > &from)
copy operator
double weight() const
returns the weight assigned to the apriori
Set of pairs of elements with fast search for both elements.
Definition: bijection.h:1803
the internal apriori for the K2 score = Laplace Apriori
The class representing a tabular database as used by learning tasks.
ALLOC< NodeId > allocator_type
type for the allocators passed in arguments of methods
Definition: aprioriK2.h:55
the internal apriori for the K2 score = Laplace AprioriK2 is a BD score with a Laplace apriori (i...
Definition: aprioriK2.h:49
the smooth a priori: adds a weight w to all the countings
ALLOC< NodeId > allocator_type
type for the allocators passed in arguments of methods
Definition: apriori.h:50
Size NodeId
Type for node ids.
Definition: graphElements.h:97