BayesOpt
parameters.h
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_H__
26 #define __BOPT_PARAMETERS_H__
27 
28 #include <string.h>
29 
30 /* WINDOWS DLLs stuff */
31 #if defined (BAYESOPT_DLL) && (defined(_WIN32) || defined(__WIN32__)) && !defined(__LCC__)
32  #if defined(bayesopt_EXPORTS)
33  #define BAYESOPT_API __declspec(dllexport)
34  #else
35  #define BAYESOPT_API __declspec(dllimport)
36  #endif /* MyLibrary_EXPORTS */
37 #else /* defined (_WIN32) */
38  #define BAYESOPT_API
39 #endif
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45  /*-----------------------------------------------------------*/
46  /* Configuration parameters */
47  /*-----------------------------------------------------------*/
48  typedef enum {
49  L_FIXED,
50  L_EMPIRICAL,
51  L_DISCRETE,
52  L_MCMC,
53  L_ERROR = -1
54  } learning_type;
55 
56  typedef enum {
57  SC_MTL,
58  SC_ML,
59  SC_MAP,
60  SC_LOOCV,
61  SC_ERROR = -1
62  } score_type;
63 
64 
66  typedef struct {
67  char* name;
68  double hp_mean[128];
69  double hp_std[128];
70  size_t n_hp;
72 
73  typedef struct {
74  char* name;
75  double coef_mean[128];
76  double coef_std[128];
77  size_t n_coef;
79 
83  typedef struct {
84  size_t n_iterations;
86  size_t n_init_samples;
87  size_t n_iter_relearn;
91  size_t init_method;
96  char* log_filename;
98  size_t load_save_flag;
103  char* surr_name;
104  double sigma_s;
106  double noise;
108  double alpha;
110  double beta;
113  score_type sc_type;
114  learning_type l_type;
115  int l_all;
117  double epsilon;
118  size_t force_jump;
128  char* crit_name;
129  double crit_params[128];
130  size_t n_crit_params;
131  } bopt_params;
132 
133  /*-----------------------------------------------------------*/
134  /* These functions are added to simplify wrapping code */
135  /*-----------------------------------------------------------*/
136  BAYESOPT_API learning_type str2learn(const char* name);
137  BAYESOPT_API const char* learn2str(learning_type name);
138 
139  BAYESOPT_API score_type str2score(const char* name);
140  BAYESOPT_API const char* score2str(score_type name);
141 
142  BAYESOPT_API void set_kernel(bopt_params* params, const char* name);
143  BAYESOPT_API void set_mean(bopt_params* params, const char* name);
144  BAYESOPT_API void set_criteria(bopt_params* params, const char* name);
145  BAYESOPT_API void set_surrogate(bopt_params* params, const char* name);
146  BAYESOPT_API void set_log_file(bopt_params* params, const char* name);
147  BAYESOPT_API void set_load_file(bopt_params* params, const char* name);
148  BAYESOPT_API void set_save_file(bopt_params* params, const char* name);
149  BAYESOPT_API void set_learning(bopt_params* params, const char* name);
150  BAYESOPT_API void set_score(bopt_params* params, const char* name);
151 
152  BAYESOPT_API bopt_params initialize_parameters_to_default(void);
153 
154 #ifdef __cplusplus
155 }
156 #endif
157 
158 
159 #endif
size_t n_inner_iterations
Maximum inner optimizer evaluations.
Definition: parameters.h:85
double noise
Variance of observation noise (and nugget)
Definition: parameters.h:106
mean_parameters mean
Mean (parametric function) parameters.
Definition: parameters.h:126
size_t force_jump
If >0, and the difference between two consecutive observations is pure noise, for n consecutive steps...
Definition: parameters.h:118
learning_type l_type
Type of learning for the kernel params.
Definition: parameters.h:114
size_t n_iterations
Maximum BayesOpt evaluations (budget)
Definition: parameters.h:84
size_t n_hp
Number of kernel hyperparameters.
Definition: parameters.h:70
int verbose_level
Neg-Error,0-Warning,1-Info,2-Debug -> stdout 3-Error,4-Warning,5-Info,>5-Debug -> logfile...
Definition: parameters.h:94
score_type sc_type
Score type for kernel hyperparameters (ML,MAP,etc)
Definition: parameters.h:113
size_t load_save_flag
1-Load data,2-Save data, 3-Load and save data.
Definition: parameters.h:98
char * load_filename
Init data file path (if applicable)
Definition: parameters.h:100
size_t n_init_samples
Number of samples before optimization.
Definition: parameters.h:86
char * surr_name
Name of the surrogate function.
Definition: parameters.h:103
size_t n_coef
Number of mean funct.
Definition: parameters.h:77
double sigma_s
Signal variance (if known).
Definition: parameters.h:104
kernel_parameters kernel
Kernel parameters.
Definition: parameters.h:125
Configuration parameters.
Definition: parameters.h:83
size_t n_crit_params
Number of criterion hyperparameters.
Definition: parameters.h:130
char * name
Name of the kernel function.
Definition: parameters.h:67
double alpha
Inverse Gamma prior for signal var.
Definition: parameters.h:108
char * crit_name
Name of the criterion.
Definition: parameters.h:128
char * name
Name of the mean function.
Definition: parameters.h:74
char * log_filename
Log file path (if applicable)
Definition: parameters.h:96
double beta
Inverse Gamma prior for signal var.
Definition: parameters.h:110
size_t n_iter_relearn
Number of samples before relearn kernel.
Definition: parameters.h:87
int l_all
Learn all hyperparameters or only kernel.
Definition: parameters.h:115
int random_seed
>=0 -> Fixed seed, <0 -> Time based (variable).
Definition: parameters.h:92
double epsilon
For epsilon-greedy exploration.
Definition: parameters.h:117
size_t init_method
Sampling method for initial set 1-LHS, 2-Sobol (if available), other value-uniformly distributed...
Definition: parameters.h:91
Kernel configuration parameters.
Definition: parameters.h:66
char * save_filename
Sava data file path (if applicable)
Definition: parameters.h:101