aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
greedyHillClimbing.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 /**
23  * @file
24  * @brief The greedy hill learning algorithm (for directed graphs)
25  *
26  * The GreedyHillClimbing class implements a greedy search in which the only
27  * the graph changes that increase the global score are applied. Those that
28  * increase it the more are applied first. The algorithm stops when no single
29  * change can increase the score anymore.
30  *
31  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
32  */
33 #ifndef GUM_LEARNING_GREEDY_HILL_CLIMBING_H
34 #define GUM_LEARNING_GREEDY_HILL_CLIMBING_H
35 
36 #include <string>
37 #include <vector>
38 
39 #include <agrum/BN/BayesNet.h>
40 #include <agrum/agrum.h>
41 #include <agrum/tools/core/approximations/approximationScheme.h>
42 #include <agrum/tools/graphs/DAG.h>
43 
44 namespace gum {
45 
46  namespace learning {
47 
48  /**
49  * @class GreedyHillClimbing
50  * @brief The greedy hill climbing learning algorithm (for directed graphs)
51  *
52  * The GreedyHillClimbing class implements a greedy search in which the
53  * only the graph changes that increase the global score are applied. Those
54  * that increase it the more are applied first. The algorithm stops when no
55  * single change can increase the score anymore.
56  * @ingroup learning_group
57  */
59  public:
60  // ##########################################################################
61  /// @name Constructors / Destructors
62  // ##########################################################################
63  /// @{
64 
65  /// default constructor
67 
68  /// copy constructor
70 
71  /// move constructor
73 
74  /// destructor
76 
77  /// @}
78 
79  // ##########################################################################
80  /// @name Operators
81  // ##########################################################################
82  /// @{
83 
84  /// copy operator
86 
87  /// move operator
89 
90  /// @}
91 
92  // ##########################################################################
93  /// @name Accessors / Modifiers
94  // ##########################################################################
95  /// @{
96 
97  /// returns the approximation policy of the learning algorithm
99 
100  /// learns the structure of a Bayes net
101  /** @param selector A selector class that computes the best changes that
102  * can be applied and that enables the user to get them very easily.
103  * Typically, the selector is a GraphChangesSelector4DiGraph<SCORE,
104  * STRUCT_CONSTRAINT, GRAPH_CHANGES_GENERATOR>.
105  * @param initial_dag the DAG we start from for our learning */
106  template < typename GRAPH_CHANGES_SELECTOR >
108 
109  /// learns the structure and the parameters of a BN
110  /** @param selector A selector class that computes the best changes that
111  * can be applied and that enables the user to get them very easily.
112  * Typically, the selector is a GraphChangesSelector4DiGraph<SCORE,
113  * STRUCT_CONSTRAINT, GRAPH_CHANGES_GENERATOR>.
114  * @param estimator A estimator.
115  * @param initial_dag the DAG we start from for our learning */
116  template < typename GUM_SCALAR = double,
117  typename GRAPH_CHANGES_SELECTOR,
118  typename PARAM_ESTIMATOR >
121  DAG initial_dag = DAG());
122 
123  /// @}
124  };
125 
126  } /* namespace learning */
127 
128 } /* namespace gum */
129 
130 /// always include templated methods
131 #include <agrum/BN/learning/greedyHillClimbing_tpl.h>
132 
133 #endif /* GUM_LEARNING_GREEDY_HILL_CLIMBING_H */
GreedyHillClimbing(GreedyHillClimbing &&from)
move constructor
GreedyHillClimbing & operator=(GreedyHillClimbing &&from)
move operator
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
BayesNet< GUM_SCALAR > learnBN(GRAPH_CHANGES_SELECTOR &selector, PARAM_ESTIMATOR &estimator, DAG initial_dag=DAG())
learns the structure and the parameters of a BN
ApproximationScheme & approximationScheme()
returns the approximation policy of the learning algorithm
DAG learnStructure(GRAPH_CHANGES_SELECTOR &selector, DAG initial_dag=DAG())
learns the structure of a Bayes net
The greedy hill climbing learning algorithm (for directed graphs)
GreedyHillClimbing()
default constructor
Database(const std::string &filename, const BayesNet< GUM_SCALAR > &bn, const std::vector< std::string > &missing_symbols)
GreedyHillClimbing(const GreedyHillClimbing &from)
copy constructor
GreedyHillClimbing & operator=(const GreedyHillClimbing &from)
copy operator