Example #1
0
 def __init__(self,
              model,
              constraint_model,
              space,
              optimizer=None,
              cost_withGradients=None,
              num_samples=10,
              exploration_weight=40):
     self.model = model
     self.constraint_model = constraint_model
     self.optimizer = optimizer
     super(constrained_LCB, self).__init__(model, space, optimizer)
     self.num_samples = num_samples
     self.LCB = AcquisitionLCB(model, space, optimizer, cost_withGradients)
     self.exploration_weight = exploration_weight
     self.xall = np.empty((1, 13))
     self.yall = np.empty((1, 1))
Example #2
0
objective = GPyOpt.core.task.SingleObjective(func.f)

space = GPyOpt.Design_space(space=[{
    'name': 'var_1',
    'type': 'continuous',
    'domain': (-5, 10)
}, {
    'name': 'var_2',
    'type': 'continuous',
    'domain': (1, 15)
}])

model = GPyOpt.models.GPModel(optimize_restarts=5, verbose=False)

aquisition_optimizer = GPyOpt.optimization.AcquisitionOptimizer(space)

initial_design = GPyOpt.experiment_design.initial_design('random', space, 5)

acquisition = AcquisitionLCB(model, space, optimizer=aquisition_optimizer)

evaluator = GPyOpt.core.evaluators.Sequential(acquisition)

bo = GPyOpt.methods.ModularBayesianOptimization(model, space, objective,
                                                acquisition, evaluator,
                                                initial_design)

max_iter = 10
bo.run_optimization(max_iter=max_iter)
# bo.plot_acquisition()
bo.plot_convergence()