aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
aprioriK2_tpl.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /** @file
23  * @brief the internal apriori for the K2 score = Laplace Apriori
24  *
25  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
26  */
27 #ifndef DOXYGEN_SHOULD_SKIP_THIS
28 
29 namespace gum {
30 
31  namespace learning {
32 
33 
34  /// default constructor
35  template < template < typename > class ALLOC >
36  INLINE AprioriK2< ALLOC >::AprioriK2(
37  const DatabaseTable< ALLOC >& database,
39  const typename AprioriK2< ALLOC >::allocator_type& alloc) :
42  }
43 
44 
45  /// copy constructor with a given allocator
46  template < template < typename > class ALLOC >
48  const typename AprioriK2< ALLOC >::allocator_type& alloc) :
51  }
52 
53 
54  /// copy constructor
55  template < template < typename > class ALLOC >
58 
59 
60  /// move constructor with a given allocator
61  template < template < typename > class ALLOC >
63  const typename AprioriK2< ALLOC >::allocator_type& alloc) :
66  }
67 
68 
69  /// move constructor
70  template < template < typename > class ALLOC >
73 
74 
75  /// virtual copy constructor with a given allocator
76  template < template < typename > class ALLOC >
77  AprioriK2< ALLOC >*
78  AprioriK2< ALLOC >::clone(const typename AprioriK2< ALLOC >::allocator_type& alloc) const {
81  try {
83  } catch (...) {
85  throw;
86  }
87 
88  return apriori;
89  }
90 
91 
92  /// virtual copy constructor
93  template < template < typename > class ALLOC >
94  INLINE AprioriK2< ALLOC >* AprioriK2< ALLOC >::clone() const {
95  return clone(this->getAllocator());
96  }
97 
98 
99  /// destructor
100  template < template < typename > class ALLOC >
103  }
104 
105 
106  /// copy operator
107  template < template < typename > class ALLOC >
110  return *this;
111  }
112 
113 
114  /// move operator
115  template < template < typename > class ALLOC >
118  return *this;
119  }
120 
121 
122  /// dummy set weight function: in K2, weights are always equal to 1
123  template < template < typename > class ALLOC >
124  INLINE void AprioriK2< ALLOC >::setWeight(const double weight) {}
125 
126 
127  } /* namespace learning */
128 
129 } /* namespace gum */
130 
131 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
Database(const std::string &filename, const BayesNet< GUM_SCALAR > &bn, const std::vector< std::string > &missing_symbols)