aGrUM  0.14.2
BNLearner.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}@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 wil 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  ***************************************************************************/
28 #ifndef GUM_LEARNING_BN_LEARNER_H
29 #define GUM_LEARNING_BN_LEARNER_H
30 
31 #include <sstream>
32 #include <algorithm>
33 #include <vector>
34 
35 #include <agrum/BN/BayesNet.h>
36 #include <agrum/agrum.h>
37 #include <agrum/core/bijection.h>
38 #include <agrum/core/sequence.h>
39 #include <agrum/graphs/DAG.h>
40 
42 
43 namespace gum {
44 
45  namespace learning {
46 
47  class BNLearnerListener;
48 
56  template < typename GUM_SCALAR >
57  class BNLearner : public genericBNLearner {
58  public:
59  // ##########################################################################
61  // ##########################################################################
63 
65 
69  BNLearner(const std::string& filename,
70  const std::vector< std::string >& missing_symbols = {"?"});
71  BNLearner(const DatabaseTable<>& db);
72 
96  /*
97  BNLearner(const std::string& filename,
98  const NodeProperty< Sequence< std::string > >& modalities );
99  */
100 
101 
106  BNLearner(const std::string& filename,
107  const gum::BayesNet< GUM_SCALAR >& src,
108  const std::vector< std::string >& missing_symbols = {"?"});
109 
111  BNLearner(const BNLearner&);
112 
114  BNLearner(BNLearner&&);
115 
117  virtual ~BNLearner();
118 
120 
121  // ##########################################################################
123  // ##########################################################################
125 
127  BNLearner& operator=(const BNLearner&);
128 
130  BNLearner& operator=(BNLearner&&);
131 
133 
136 
138 
150  bool take_into_account_score = true);
151 
152  // learns a BN (its parameters) when its structure is known
169  BayesNet< GUM_SCALAR > learnParameters(bool take_into_account_score = true);
170 
171  private:
174  __labelsFromBN(const std::string& filename,
175  const BayesNet< GUM_SCALAR >& src);
176  };
177 
178  } /* namespace learning */
179 
180 } /* namespace gum */
181 
184 
185 #endif /* GUM_LEARNING_BN_LEARNER_H */
Class representing a Bayesian Network.
Definition: BayesNet.h:76
Header file of gum::Sequence, a class for storing (ordered) sequences of objects. ...
A class for generic framework of learning algorithms that can easily be used.
Class representing Bayesian networks.
A pack of learning algorithms that can easily be used.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
BayesNet< GUM_SCALAR > learnParameters(const DAG &dag, bool take_into_account_score=true)
learns a BN (its parameters) when its structure is known
NodeProperty< Sequence< std::string > > __labelsFromBN(const std::string &filename, const BayesNet< GUM_SCALAR > &src)
read the first line of a file to find column names
The class for generic Hash Tables.
Definition: hashTable.h:676
A pack of learning algorithms that can easily be used.
Definition: BNLearner.h:57
virtual ~BNLearner()
destructor
The class representing a tabular database as used by learning tasks.
A pack of learning algorithms that can easily be used.
BayesNet< GUM_SCALAR > learnBN()
learn a Bayes Net from a file (must have read the db before)
BNLearner & operator=(const BNLearner &)
copy operator
BNLearner(const std::string &filename, const std::vector< std::string > &missing_symbols={"?"})
default constructor
Base class for dag.
Definition: DAG.h:99
Set of pairs of elements with fast search for both elements.
Base classes for directed acyclic graphs.