elif acq_optimizer == "lbfgs":
best = np.inf
x0 = space.transform(space.rvs(n_samples=n_restarts_optimizer,
random_state=rng))
with warnings.catch_warnings():
warnings.simplefilter("ignore")
jobs = (delayed(fmin_l_bfgs_b)(
gaussian_acquisition_1D, x,
args=(gp, np.min(yi), acq_func, xi, kappa),
bounds=space.transformed_bounds,
approx_grad=False,
maxiter=20) for x in x0)
results = parallel(jobs)
cand_xs = np.array([r[0] for r in results])
cand_acqs = np.array([r[1] for r in results])
best_ind = np.argmin(cand_acqs)
a = cand_acqs[best_ind]
if a < best:
next_x, best = cand_xs[best_ind], a
// lbfgs should handle this but just in case there are precision errors.
next_x = np.clip(
After Change
next_x = X[np.argmin(values)]
elif acq_optimizer == "lbfgs":
x0 = X[np.argsort(values)[:n_restarts_optimizer]]
with warnings.catch_warnings():
warnings.simplefilter("ignore")
jobs = (delayed(fmin_l_bfgs_b)(