def setUp(self): np.random.seed(10) self.tolerance = 0.05 # Tolerance for difference between true and approximated gradients objective = GPyOpt.objective_examples.experiments1d.forrester() self.feasible_region = GPyOpt.Design_space(space = [{'name': 'var_1', 'type': 'continuous', 'domain': objective.bounds[0]}]) n_inital_design = 10 X = samples_multidimensional_uniform(objective.bounds,n_inital_design) Y = objective.f(X) self.X_test = samples_multidimensional_uniform(objective.bounds,n_inital_design) self.model = Mock() self.model.get_fmin.return_value = 0.0 self.model.predict_withGradients.return_value = np.zeros(X.shape), np.zeros(Y.shape), np.zeros(X.shape), np.zeros(X.shape)
def setUp(self): np.random.seed(1) self.tolerance = 0.01 #Tolerance for difference between true and approximated gradients objective = GPyOpt.fmodels.experiments1d.forrester() bounds = objective.bounds input_dim = len(bounds) n_inital_design = 8 X = samples_multidimensional_uniform(bounds,n_inital_design) Y = objective.f(X) self.X_test = samples_multidimensional_uniform(bounds,n_inital_design) self.model = GPy.models.GPRegression(X,Y) self.model.optimize_restarts(10,verbose=False) self.model.Gaussian_noise.constrain_fixed(1e-6, warning=False)
def setUp(self): np.random.seed(1) self.tolerance = 0.01 #Tolerance for difference between true and approximated gradients objective = GPyOpt.objective_examples.experiments1d.forrester() self.feasible_region = GPyOpt.Design_space(space = [{'name': 'var_1', 'type': 'continuous', 'domain': objective.bounds[0]}]) n_inital_design = 10 X = samples_multidimensional_uniform(objective.bounds,n_inital_design) Y = objective.f(X) self.X_test = samples_multidimensional_uniform(objective.bounds,n_inital_design) self.model = GPyOpt.models.GPModel() self.model._create_model(X,Y) self.model.model.optimize_restarts(10,verbose=False) self.model.model.Gaussian_noise.constrain_fixed(1e-6, warning=False)
def setUp(self): np.random.seed(1) self.tolerance = 0.01 # Tolerance for difference between true and approximated gradients objective = GPyOpt.fmodels.experiments1d.forrester() bounds = objective.bounds input_dim = len(bounds) n_inital_design = 8 X = samples_multidimensional_uniform(bounds, n_inital_design) Y = objective.f(X) self.X_test = samples_multidimensional_uniform(bounds, n_inital_design) self.model = GPy.models.GPRegression(X, Y) self.model.optimize_restarts(10, verbose=False) self.model.Gaussian_noise.constrain_fixed(1e-6, warning=False)
def setUp(self): np.random.seed(1) self.tolerance = 0.05 #Tolerance for difference between true and approximated gradients objective = GPyOpt.objective_examples.experiments1d.forrester() self.feasible_region = GPyOpt.Design_space( space=[{ 'name': 'var_1', 'type': 'continuous', 'domain': objective.bounds[0] }]) n_inital_design = 10 X = samples_multidimensional_uniform(objective.bounds, n_inital_design) Y = objective.f(X) self.X_test = samples_multidimensional_uniform(objective.bounds, n_inital_design) self.model = GPyOpt.models.GPModel() self.model._create_model(X, Y) self.model.model.optimize_restarts(10, verbose=False) self.model.model.Gaussian_noise.constrain_fixed(1e-6, warning=False)
def setUp(self): # Override margin for error self.precision = 0.1 ## # -- methods configuration ## model_type = 'GP' initial_design_numdata = None initial_design_type = 'random' acquisition_type = 'EI' normalize_Y = True exact_feval = False acquisition_optimizer_type = 'lbfgs' model_update_interval = 1 evaluator_type = 'sequential' batch_size = 1 num_cores = 1 verbosity = False # stop conditions max_iter = 5 max_time = 999 eps = 1e-8 self.methods_configs = [ { 'name': 'output_normalization', 'model_type' : model_type, 'initial_design_numdata' : initial_design_numdata, 'initial_design_type' : initial_design_type, 'acquisition_type' : acquisition_type, 'normalize_Y' : False, 'exact_feval' : exact_feval, 'acquisition_optimizer_type' : acquisition_optimizer_type, 'model_update_interval' : model_update_interval, 'verbosity' : verbosity, 'evaluator_type' : evaluator_type, 'batch_size' : batch_size, 'num_cores' : num_cores, 'max_iter' : max_iter, 'max_time' : max_time, 'eps' : eps }, { 'name': 'noiseless_evauations', 'model_type' : model_type, 'initial_design_numdata' : initial_design_numdata, 'initial_design_type' : initial_design_type, 'acquisition_type' : acquisition_type, 'normalize_Y' : normalize_Y, 'exact_feval' : True, 'acquisition_optimizer_type' : acquisition_optimizer_type, 'model_update_interval' : model_update_interval, 'verbosity' : verbosity, 'evaluator_type' : evaluator_type, 'batch_size' : batch_size, 'num_cores' : num_cores, 'max_iter' : max_iter, 'max_time' : max_time, 'eps' : eps }, { 'name': 'update_intervals', 'model_type' : model_type, 'initial_design_numdata' : initial_design_numdata, 'initial_design_type' : initial_design_type, 'acquisition_type' : acquisition_type, 'normalize_Y' : normalize_Y, 'exact_feval' : exact_feval, 'acquisition_optimizer_type' : acquisition_optimizer_type, 'model_update_interval' : 2, 'verbosity' : verbosity, 'evaluator_type' : evaluator_type, 'batch_size' : batch_size, 'num_cores' : num_cores, 'max_iter' : max_iter, 'max_time' : max_time, 'eps' : eps }, # { 'name': 'max_iterations', # 'model_type' : model_type, # 'initial_design_numdata' : initial_design_numdata, # 'initial_design_type' : initial_design_type, # 'acquisition_type' : acquisition_type, # 'normalize_Y' : normalize_Y, # 'exact_feval' : exact_feval, # 'acquisition_optimizer_type' : acquisition_optimizer_type, # 'model_update_interval' : model_update_interval, # 'verbosity' : verbosity, # 'evaluator_type' : evaluator_type, # 'batch_size' : batch_size, # 'num_cores' : num_cores, # 'max_iter' : 10, # 'max_time' : max_time, # 'eps' : eps # }, ] # -- Problem setup np.random.seed(1) n_inital_design = 5 input_dim = 5 f_bounds = (-5,5) self.f_inits = samples_multidimensional_uniform([f_bounds]*input_dim,n_inital_design) self.f_inits = self.f_inits.reshape(input_dim, self.f_inits.shape[-1]) self.problem_config = { 'objective': GPyOpt.objective_examples.experimentsNd.gSobol(np.ones(input_dim)).f, 'domain': [{'name': 'var_1', 'type': 'continuous', 'domain': f_bounds, 'dimensionality': input_dim}], 'constraints': None, 'cost_withGradients': None}
def setUp(self): # -- This file was used to generate the test files self.outpath = os.path.join(os.path.dirname(__file__),'test_files') self.is_unittest = True # Test files were generated with this line = False ## # -- methods configuration ## model_type = 'GP' initial_design_numdata = None initial_design_type = 'random' acquisition_type = 'EI' normalize_Y = True exact_feval = False acquisition_optimizer_type = 'lbfgs' model_update_interval = 1 evaluator_type = 'sequential' batch_size = 1 num_cores = 1 verbosity = False # stop conditions max_iter = 5 max_time = 999 eps = 1e-8 self.methods_configs = [ { 'name': 'EI', 'model_type' : model_type, 'initial_design_numdata' : initial_design_numdata, 'initial_design_type' : initial_design_type, 'acquisition_type' : 'EI', 'normalize_Y' : normalize_Y, 'exact_feval' : exact_feval, 'acquisition_optimizer_type' : acquisition_optimizer_type, 'model_update_interval' : model_update_interval, 'verbosity' : verbosity, 'evaluator_type' : evaluator_type, 'batch_size' : batch_size, 'num_cores' : num_cores, 'max_iter' : max_iter, 'max_time' : max_time, 'eps' : eps }, { 'name': 'MPI', 'model_type' : model_type, 'initial_design_numdata' : initial_design_numdata, 'initial_design_type' : initial_design_type, 'acquisition_type' : 'MPI', 'normalize_Y' : normalize_Y, 'exact_feval' : exact_feval, 'acquisition_optimizer_type' : acquisition_optimizer_type, 'model_update_interval' : model_update_interval, 'verbosity' : verbosity, 'evaluator_type' : evaluator_type, 'batch_size' : batch_size, 'num_cores' : num_cores, 'max_iter' : max_iter, 'max_time' : max_time, 'eps' : eps }, { 'name': 'LCB', 'model_type' : model_type, 'initial_design_numdata' : initial_design_numdata, 'initial_design_type' : initial_design_type, 'acquisition_type' : 'LCB', 'normalize_Y' : normalize_Y, 'exact_feval' : exact_feval, 'acquisition_optimizer_type' : acquisition_optimizer_type, 'model_update_interval' : model_update_interval, 'verbosity' : verbosity, 'evaluator_type' : evaluator_type, 'batch_size' : batch_size, 'num_cores' : num_cores, 'max_iter' : max_iter, 'max_time' : max_time, 'eps' : eps } ] # -- Problem setup np.random.seed(1) n_inital_design = 5 input_dim = 5 f_bounds = (-5,5) self.f_inits = samples_multidimensional_uniform([f_bounds]*input_dim,n_inital_design) self.f_inits = self.f_inits.reshape(1, input_dim, self.f_inits.shape[-1]) self.problem_config = { 'objective': GPyOpt.objective_examples.experimentsNd.gSobol(np.ones(input_dim)).f, 'domain': [{'name': 'var_1', 'type': 'continuous', 'domain': f_bounds, 'dimensionality': input_dim}], 'constrains': None, 'cost_withGradients': None}
def setUp(self): # -- This file was used to generate the test files self.outpath = './test_files' self.is_unittest = True # test files were generated with this line =True ## # -- methods configuration ## max_iter = 25 eps = 1e-8 # acquisition type (testing here) acquisition_name = 'EI' acquisition_par = 0.0 # acquisition optimization type acqu_optimize_method = 'fast_random' acqu_optimize_restarts = 25 true_gradients = True # batch type n_inbatch = 1 batch_method = 'predictive' n_procs = 1 # type of inital design numdata_initial_design = 3 type_initial_design = 'random' # model type kernel = None model_optimize_interval = 1 model_optimize_restarts = 2 sparseGP = False num_inducing = None # likelihood type normalize = False exact_feval = True verbosity = False self.methods_configs = [ { 'name': 'stop_condition', 'max_iter':max_iter, 'acquisition_name':acquisition_name, 'acquisition_par': acquisition_par, 'true_gradients': true_gradients, 'acqu_optimize_method':acqu_optimize_method, 'acqu_optimize_restarts':acqu_optimize_restarts, 'batch_method': batch_method, 'n_inbatch':n_inbatch, 'n_procs':n_inbatch, 'numdata_initial_design': numdata_initial_design, 'type_initial_design': type_initial_design, 'kernel': kernel, 'model_optimize_interval': model_optimize_interval, 'model_optimize_restarts': model_optimize_restarts, 'sparseGP': sparseGP, 'num_inducing': num_inducing, 'normalize': normalize, 'exact_feval': exact_feval, 'eps': 0.001, 'verbosity':verbosity, }, { 'name': 'Y_normalization', 'max_iter':max_iter, 'acquisition_name':acquisition_name, 'acquisition_par': acquisition_par, 'true_gradients': true_gradients, 'acqu_optimize_method':acqu_optimize_method, 'acqu_optimize_restarts':acqu_optimize_restarts, 'batch_method': batch_method, 'n_inbatch':n_inbatch, 'n_procs':n_inbatch, 'numdata_initial_design': numdata_initial_design, 'type_initial_design': type_initial_design, 'kernel': kernel, 'model_optimize_interval': model_optimize_interval, 'model_optimize_restarts': model_optimize_restarts, 'sparseGP': sparseGP, 'num_inducing': num_inducing, 'normalize': True, 'exact_feval': exact_feval, 'eps': eps, 'verbosity':verbosity, }, { 'name': 'noisy_evaluations', 'max_iter':max_iter, 'acquisition_name':acquisition_name, 'acquisition_par': acquisition_par, 'true_gradients': true_gradients, 'acqu_optimize_method':acqu_optimize_method, 'acqu_optimize_restarts':acqu_optimize_restarts, 'batch_method': batch_method, 'n_inbatch':n_inbatch, 'n_procs':n_inbatch, 'numdata_initial_design': numdata_initial_design, 'type_initial_design': type_initial_design, 'kernel': kernel, 'model_optimize_interval': model_optimize_interval, 'model_optimize_restarts': model_optimize_restarts, 'sparseGP': sparseGP, 'num_inducing': num_inducing, 'normalize': True, 'exact_feval': False, 'eps': eps, 'verbosity':verbosity, }, { 'name': 'latin_design', 'max_iter':max_iter, 'acquisition_name':acquisition_name, 'acquisition_par': acquisition_par, 'true_gradients': true_gradients, 'acqu_optimize_method':acqu_optimize_method, 'acqu_optimize_restarts':acqu_optimize_restarts, 'batch_method': batch_method, 'n_inbatch':n_inbatch, 'n_procs':n_inbatch, 'numdata_initial_design': 20, 'type_initial_design': 'latin', 'kernel': kernel, 'model_optimize_interval': model_optimize_interval, 'model_optimize_restarts': model_optimize_restarts, 'sparseGP': sparseGP, 'num_inducing': num_inducing, 'normalize': normalize, 'exact_feval': exact_feval, 'eps': eps, 'verbosity':verbosity, }, ] # -- Problem setup np.random.seed(1) f_bound_dim = (-5.,5.) f_dim = 5 n_inital_design = 5 self.f_obj = GPyOpt.fmodels.experimentsNd.gSobol(np.ones(f_dim)).f self.f_bounds = [f_bound_dim]*f_dim self.f_inits = samples_multidimensional_uniform(self.f_bounds,n_inital_design) self.f_inits = self.f_inits.reshape(1, f_dim, self.f_inits.shape[-1])
def setUp(self): ## # -- methods configuration ## model_type = 'GP' initial_design_numdata = None initial_design_type = 'random' acquisition_type = 'EI' normalize_Y = True exact_feval = True acquisition_optimizer_type = 'lbfgs' model_update_interval = 1 evaluator_type = 'sequential' batch_size = 1 num_cores = 1 verbosity = False # stop conditions max_iter = 5 max_time = 999 eps = 1e-8 self.methods_configs = [ { 'name': 'lbfgs', 'model_type' : model_type, 'initial_design_numdata' : initial_design_numdata, 'initial_design_type' : initial_design_type, 'acquisition_type' : acquisition_type, 'normalize_Y' : normalize_Y, 'exact_feval' : exact_feval, 'acquisition_optimizer_type' : 'lbfgs', 'model_update_interval' : model_update_interval, 'verbosity' : verbosity, 'evaluator_type' : evaluator_type, 'batch_size' : batch_size, 'num_cores' : num_cores, 'max_iter' : max_iter, 'max_time' : max_time, 'eps' : eps }, # { 'name': 'DIRECT', # 'model_type' : model_type, # 'initial_design_numdata' : initial_design_numdata, # 'initial_design_type' : initial_design_type, # 'acquisition_type' : acquisition_type, # 'normalize_Y' : normalize_Y, # 'exact_feval' : exact_feval, # 'acquisition_optimizer_type' : 'DIRECT', # 'model_update_interval' : model_update_interval, # 'verbosity' : verbosity, # 'evaluator_type' : evaluator_type, # 'batch_size' : batch_size, # 'num_cores' : num_cores, # 'max_iter' : 1, # 'max_time' : max_time, # 'eps' : eps # }, # { 'name': 'CMA', # 'model_type' : model_type, # 'initial_design_numdata' : initial_design_numdata, # 'initial_design_type' : initial_design_type, # 'acquisition_type' : acquisition_type, # 'normalize_Y' : normalize_Y, # 'exact_feval' : exact_feval, # 'acquisition_optimizer_type' : 'CMA', # 'model_update_interval' : model_update_interval, # 'verbosity' : verbosity, # 'evaluator_type' : evaluator_type, # 'batch_size' : batch_size, # 'num_cores' : num_cores, # 'max_iter' : max_iter, # 'max_time' : max_time, # 'eps' : eps # } ] # -- Problem setup n_inital_design = 5 input_dim = 5 f_bounds = (-5,5) np.random.seed(1) self.f_inits = samples_multidimensional_uniform([f_bounds]*input_dim,n_inital_design) self.f_inits = self.f_inits.reshape(input_dim, self.f_inits.shape[-1]) self.problem_config = { 'objective': GPyOpt.objective_examples.experimentsNd.gSobol(np.ones(input_dim)).f, 'domain': [{'name': 'var_1', 'type': 'continuous', 'domain': f_bounds, 'dimensionality': input_dim}], 'constraints': None, 'cost_withGradients': None}