BayesOpt
parameters.hpp
Go to the documentation of this file.
1 
2 /*
3 -------------------------------------------------------------------------
4  This file is part of BayesOpt, an efficient C++ library for
5  Bayesian optimization.
6 
7  Copyright (C) 2011-2015 Ruben Martinez-Cantin <rmcantin@unizar.es>
8 
9  BayesOpt is free software: you can redistribute it and/or modify it
10  under the terms of the GNU Affero General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  BayesOpt is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Affero General Public License for more details.
18 
19  You should have received a copy of the GNU Affero General Public License
20  along with BayesOpt. If not, see <http://www.gnu.org/licenses/>.
21 ------------------------------------------------------------------------
22 */
23 
24 
25 #ifndef __BOPT_PARAMETERS_HPP__
26 #define __BOPT_PARAMETERS_HPP__
27 
28 #include <string>
29 #include <boost/numeric/ublas/vector.hpp>
30 
31 #include "bayesopt/parameters.h" // learning_type, score_type
32 
33 typedef boost::numeric::ublas::vector<double> vectord;
34 
38 namespace bayesopt {
40  public:
41  /* Class member variables */
42  std::string name;
43  vectord hp_mean;
44  vectord hp_std;
46  /* Class member functions */
48  };
49 
51  public:
52  /* Class member variables */
53  std::string name;
54  vectord coef_mean;
55  vectord coef_std;
57  /* Class member functions */
59  };
60 
61  class Parameters{
62  public:
63  /*
64  * Class members variables
65  */
66  size_t n_iterations;
68  size_t n_init_samples;
69  size_t n_iter_relearn;
73  size_t init_method;
78  std::string log_filename;
80  size_t load_save_flag;
82  std::string load_filename;
83  std::string save_filename;
85  std::string surr_name;
86  double sigma_s;
88  double noise;
90  double alpha;
92  double beta;
95  score_type sc_type;
96  learning_type l_type;
97  bool l_all;
99  double epsilon;
100  size_t force_jump;
110  std::string crit_name;
111  vectord crit_params;
113  /*
114  * Class member functions
115  */
116  Parameters();
117 
118  /* Constructor to get values from bopt_params */
119  Parameters(bopt_params c_params);
120 
121  /* Generates a bopt_params struct from a Parameters instance */
122  bopt_params generate_bopt_params();
123 
124  /* Allows to change the l_type with a string */
125  void set_learning(std::string name);
126  /* Returns the string that corresponds to the l_type value */
127  std::string get_learning();
128 
129  /* Allows to change the sc_type with a string */
130  void set_score(std::string name);
131  /* Returns the string that corresponds to the sc_type value */
132  std::string get_score();
133 
134  private:
135  /* Encapsulated default values assigment operations */
136  void init_default();
137 
138  void bostrdup (char* d, const char *s);
139  }; //class Parameters
140 } //namespace bayesopt
141 
142 
143 #endif
double epsilon
For epsilon-greedy exploration.
Definition: parameters.hpp:99
KernelParameters kernel
Kernel parameters.
Definition: parameters.hpp:107
bool l_all
Learn all hyperparameters or only kernel.
Definition: parameters.hpp:97
size_t load_save_flag
1-Load data,2-Save data, 3-Load and save data.
Definition: parameters.hpp:80
std::string name
Name of the mean function.
Definition: parameters.hpp:53
vectord coef_std
Basis function coefficients (std)
Definition: parameters.hpp:55
MeanParameters mean
Mean (parametric function) parameters.
Definition: parameters.hpp:108
double sigma_s
Signal variance (if known).
Definition: parameters.hpp:86
vectord hp_mean
Kernel hyperparameters prior (mean, log space)
Definition: parameters.hpp:43
Namespace of the library interface.
Definition: using.dox:1
learning_type l_type
Type of learning for the kernel params.
Definition: parameters.hpp:96
std::string load_filename
Init data file path (if applicable)
Definition: parameters.hpp:82
vectord coef_mean
Basis function coefficients (mean)
Definition: parameters.hpp:54
size_t n_init_samples
Number of samples before optimization.
Definition: parameters.hpp:68
vectord crit_params
Criterion hyperparameters (if needed)
Definition: parameters.hpp:111
size_t n_inner_iterations
Maximum inner optimizer evaluations.
Definition: parameters.hpp:67
double beta
Inverse Gamma prior for signal var.
Definition: parameters.hpp:92
size_t n_iterations
Maximum BayesOpt evaluations (budget)
Definition: parameters.hpp:66
size_t force_jump
If >0, and the difference between two consecutive observations is pure noise, for n consecutive steps...
Definition: parameters.hpp:100
Configuration parameters.
Definition: parameters.h:83
vectord hp_std
Kernel hyperparameters prior (st dev, log space)
Definition: parameters.hpp:44
std::string surr_name
Name of the surrogate function.
Definition: parameters.hpp:85
std::string log_filename
Log file path (if applicable)
Definition: parameters.hpp:78
double alpha
Inverse Gamma prior for signal var.
Definition: parameters.hpp:90
std::string crit_name
Name of the criterion.
Definition: parameters.hpp:110
int verbose_level
Neg-Error,0-Warning,1-Info,2-Debug -> stdout 3-Error,4-Warning,5-Info,>5-Debug -> logfile...
Definition: parameters.hpp:76
size_t init_method
Sampling method for initial set 1-LHS, 2-Sobol (if available), other value-uniformly distributed...
Definition: parameters.hpp:73
double noise
Variance of observation noise (and nugget)
Definition: parameters.hpp:88
std::string name
Name of the kernel function.
Definition: parameters.hpp:42
score_type sc_type
Score type for kernel hyperparameters (ML,MAP,etc)
Definition: parameters.hpp:95
Parameter definitions.
std::string save_filename
Sava data file path (if applicable)
Definition: parameters.hpp:83
int random_seed
>=0 -> Fixed seed, <0 -> Time based (variable).
Definition: parameters.hpp:74
size_t n_iter_relearn
Number of samples before relearn kernel.
Definition: parameters.hpp:69