aGrUM  0.14.2
DBRowGeneratorWithBN.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  ***************************************************************************/
26 #ifndef GUM_LEARNING_DBROW_GENERATOR_WITH_BN_H
27 #define GUM_LEARNING_DBROW_GENERATOR_WITH_BN_H
28 
29 #include <vector>
30 
31 #include <agrum/agrum.h>
32 #include <agrum/core/bijection.h>
33 #include <agrum/BN/BayesNet.h>
36 
37 namespace gum {
38 
39  namespace learning {
40 
78  template < typename GUM_SCALAR = double,
79  template < typename > class ALLOC = std::allocator >
80  class DBRowGeneratorWithBN : public DBRowGenerator< ALLOC > {
81  public:
83  using allocator_type = ALLOC< DBTranslatedValue >;
84 
85  // ##########################################################################
87  // ##########################################################################
88 
90 
93  const std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > >
94  column_types,
95  const BayesNet< GUM_SCALAR >& bn,
97  const Bijection< NodeId, std::size_t, ALLOC< std::size_t > >&
98  nodeId2columns =
99  Bijection< NodeId, std::size_t, ALLOC< std::size_t > >(),
100  const allocator_type& alloc = allocator_type());
101 
104 
107  const allocator_type& alloc);
108 
111 
114  const allocator_type& alloc);
115 
118 
120 
121 
122  // ##########################################################################
124  // ##########################################################################
125 
127 
129  virtual void setBayesNet(const BayesNet< GUM_SCALAR >& new_bn);
130 
132  const BayesNet< GUM_SCALAR >& getBayesNet() const;
133 
136 
138 
139 
140  protected:
143 
146 
147 
151 
155  };
156 
157  } /* namespace learning */
158 
159 } /* namespace gum */
160 
161 
162 // always include the template implementation
164 
165 #endif /* GUM_LEARNING_DBROW_GENERATOR_WITH_BN_H */
ALLOC< DBTranslatedValue > allocator_type
type for the allocators passed in arguments of methods
Class representing a Bayesian Network.
Definition: BayesNet.h:76
The base class for all DBRow generators.
DBRowGeneratorGoal
the type of things that a DBRowGenerator is designed for
const BayesNet< GUM_SCALAR > * _bn
the Bayesian network used to fill the unobserved values
Class representing Bayesian networks.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
Implementation of a variable elimination algorithm for inference in Bayesian Networks.
DBRowGeneratorGoal goal() const
returns the goal of the DBRowGenerator
DBTranslatedValueType
The nature of the elements handled by translators (discrete, continuous).
Base class for DBRowGenerator classes that use a BN for computing their outputs.
DBRowGeneratorWithBN< GUM_SCALAR, ALLOC > & operator=(const DBRowGeneratorWithBN< GUM_SCALAR, ALLOC > &from)
copy operator
Bijection< NodeId, std::size_t, ALLOC< std::size_t > > _nodeId2columns
the mapping betwen the BN&#39;s node ids and the database&#39;s columns
Set of pairs of elements with fast search for both elements.
Definition: bijection.h:1803
allocator_type getAllocator() const
returns the allocator used
virtual void setBayesNet(const BayesNet< GUM_SCALAR > &new_bn)
assign a new Bayes net to the generator
DBRowGeneratorWithBN(const std::vector< DBTranslatedValueType, ALLOC< DBTranslatedValueType > > column_types, const BayesNet< GUM_SCALAR > &bn, const DBRowGeneratorGoal goal, 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
const BayesNet< GUM_SCALAR > & getBayesNet() const
returns the Bayes net used by the generator
ALLOC< DBTranslatedValue > allocator_type
type for the allocators passed in arguments of methods
The base class for all DBRow generators.
Size NodeId
Type for node ids.
Definition: graphElements.h:97
Set of pairs of elements with fast search for both elements.
A DBRowGenerator class that returns incomplete rows as EM would do.