示例#1
0
#optimal value
#[-0.53699102]

# --- Acquisition optimizer
acq_opt = GPyOpt.optimization.AcquisitionOptimizer(optimizer='CMA',
                                                   inner_optimizer='lbfgs2',
                                                   space=space)

# --- Acquisition function
#acquisition = uEI_noiseless(model, space, optimizer=acq_opt, utility=U)
acquisition = uPI(model, space, optimizer=acq_opt, utility=U)

# --- Evaluator
evaluator = GPyOpt.core.evaluators.Sequential(acquisition)

# --- Run CBO algorithm
max_iter = 50
for i in range(1):
    filename = './experiments/test5_PI_h_noiseless_' + str(i) + '.txt'
    print(filename)
    bo_model = cbo.CBO(model,
                       space,
                       objective,
                       acquisition,
                       evaluator,
                       initial_design,
                       expectation_utility=expectation_U)
    bo_model.run_optimization(max_iter=max_iter,
                              parallel=False,
                              plot=False,
                              results_file=filename)
示例#2
0

best_val_found = np.inf

for x0 in starting_points:
    res = scipy.optimize.fmin_l_bfgs_b(func, x0, approx_grad=True, bounds=bounds)
    if best_val_found > res[1]:
        best_val_found = res[1]
        x_opt = res[0]
print('optimum')
print(x_opt)
print('h(optimum)')
print(h(x_opt))
print('optimal value')
print(-best_val_found)

# --- Acquisition optimizer
acq_opt = GPyOpt.optimization.AcquisitionOptimizer(optimizer='lbfgs2', inner_optimizer='lbfgs2', space=space)

# --- Acquisition function
acquisition = uEI_noiseless(model, space, optimizer=acq_opt, utility=U)

# --- Evaluator
evaluator = GPyOpt.core.evaluators.Sequential(acquisition)

# --- Run CBO algorithm
max_iter = 50
for i in range(1):
    filename = './experiments/test4_EIh_noiseless_' + str(i) + '.txt'
    bo_model = cbo.CBO(model, space, objective, acquisition, evaluator, initial_design)
    bo_model.run_optimization(max_iter=max_iter, parallel=False, plot=False, results_file=filename)