aGrUM  0.17.2
a C++ library for (probabilistic) graphical models
BNLearner.h
Go to the documentation of this file.
1 
31 #ifndef GUM_LEARNING_BN_LEARNER_H
32 #define GUM_LEARNING_BN_LEARNER_H
33 
34 #include <sstream>
35 #include <algorithm>
36 #include <vector>
37 
38 #include <agrum/BN/BayesNet.h>
39 #include <agrum/agrum.h>
42 #include <agrum/tools/graphs/DAG.h>
43 
45 
46 namespace gum {
47 
48  namespace learning {
49 
50  class BNLearnerListener;
51 
59  template < typename GUM_SCALAR >
60  class BNLearner: public genericBNLearner {
61  public:
62  // ##########################################################################
64  // ##########################################################################
66 
68 
72  BNLearner(const std::string& filename,
73  const std::vector< std::string >& missing_symbols = {"?"});
74  BNLearner(const DatabaseTable<>& db);
75 
99  /*
100  BNLearner(const std::string& filename,
101  const NodeProperty< Sequence< std::string > >& modalities );
102  */
103 
104 
109  BNLearner(const std::string& filename,
110  const gum::BayesNet< GUM_SCALAR >& src,
111  const std::vector< std::string >& missing_symbols = {"?"});
112 
114  BNLearner(const BNLearner&);
115 
117  BNLearner(BNLearner&&);
118 
120  virtual ~BNLearner();
121 
123 
124  // ##########################################################################
126  // ##########################################################################
128 
130  BNLearner& operator=(const BNLearner&);
131 
133  BNLearner& operator=(BNLearner&&);
134 
136 
139 
141 
153  bool take_into_account_score = true);
154 
155  // learns a BN (its parameters) when its structure is known
172  BayesNet< GUM_SCALAR > learnParameters(bool take_into_account_score = true);
173 
174  private:
177  __labelsFromBN(const std::string& filename,
178  const BayesNet< GUM_SCALAR >& src);
179  };
180 
181  } /* namespace learning */
182 
183 } /* namespace gum */
184 
187 
188 #endif /* GUM_LEARNING_BN_LEARNER_H */
Class representing a Bayesian Network.
Definition: BayesNet.h:78
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
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:679
A pack of learning algorithms that can easily be used.
Definition: BNLearner.h:60
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:102
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.