aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
aprioriK2_tpl.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright 2005-2020 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,
38  const Bijection< NodeId, std::size_t, ALLOC< std::size_t > >&
40  const typename AprioriK2< ALLOC >::allocator_type& alloc) :
43  }
44 
45 
46  /// copy constructor with a given allocator
47  template < template < typename > class ALLOC >
49  const AprioriK2< ALLOC >& from,
50  const typename AprioriK2< ALLOC >::allocator_type& alloc) :
53  }
54 
55 
56  /// copy constructor
57  template < template < typename > class ALLOC >
60 
61 
62  /// move constructor with a given allocator
63  template < template < typename > class ALLOC >
65  AprioriK2< ALLOC >&& from,
66  const typename AprioriK2< ALLOC >::allocator_type& alloc) :
69  }
70 
71 
72  /// move constructor
73  template < template < typename > class ALLOC >
76 
77 
78  /// virtual copy constructor with a given allocator
79  template < template < typename > class ALLOC >
81  const typename AprioriK2< ALLOC >::allocator_type& alloc) const {
84  try {
86  } catch (...) {
88  throw;
89  }
90 
91  return apriori;
92  }
93 
94 
95  /// virtual copy constructor
96  template < template < typename > class ALLOC >
97  INLINE AprioriK2< ALLOC >* AprioriK2< ALLOC >::clone() const {
98  return clone(this->getAllocator());
99  }
100 
101 
102  /// destructor
103  template < template < typename > class ALLOC >
106  }
107 
108 
109  /// copy operator
110  template < template < typename > class ALLOC >
112  AprioriK2< ALLOC >::operator=(const AprioriK2< ALLOC >& from) {
114  return *this;
115  }
116 
117 
118  /// move operator
119  template < template < typename > class ALLOC >
123  return *this;
124  }
125 
126 
127  /// dummy set weight function: in K2, weights are always equal to 1
128  template < template < typename > class ALLOC >
129  INLINE void AprioriK2< ALLOC >::setWeight(const double weight) {}
130 
131 
132  } /* namespace learning */
133 
134 } /* namespace gum */
135 
136 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669
Database(const std::string &filename, const BayesNet< GUM_SCALAR > &bn, const std::vector< std::string > &missing_symbols)