commented out skopt in optimizers

This commit is contained in:
titusquah
2020-07-14 17:16:48 -06:00
parent 159a5c8140
commit cab58fda25
2 changed files with 32 additions and 31 deletions

View File

@@ -1,6 +1,6 @@
import scipy.optimize as scipy_opt
from scipy.optimize import minimize
import skopt
# import skopt
def dual_anneal_optimizer(objective, x_guess):
bounds = [(1e-1, 1e1)] * len(x_guess)
@@ -21,19 +21,19 @@ def diff_evo_optimizer(objective, x_guess):
return est_parameters, res.fun
def forest_lbfgsb_optimizer(objective, x_guess):
x_guess = list(x_guess)
bounds = [(1e-1, 1e1)]*len(x_guess)
bounds[1] = (1e-1, 2)
res = skopt.forest_minimize(objective,
bounds,
random_state=1,
acq_func='LCB',
n_random_starts=30,
x0=x_guess,
xi=1e-4)
x_guess = res.x
optimizer_kwargs = {"method": 'l-bfgs-b',
"bounds": bounds}
res = minimize(objective, x_guess, **optimizer_kwargs)
return res.x, res.fun
# def forest_lbfgsb_optimizer(objective, x_guess):
# x_guess = list(x_guess)
# bounds = [(1e-1, 1e1)]*len(x_guess)
# bounds[1] = (1e-1, 2)
# res = skopt.forest_minimize(objective,
# bounds,
# random_state=1,
# acq_func='LCB',
# n_random_starts=30,
# x0=x_guess,
# xi=1e-4)
# x_guess = res.x
# optimizer_kwargs = {"method": 'l-bfgs-b',
# "bounds": bounds}
# res = minimize(objective, x_guess, **optimizer_kwargs)
# return res.x, res.fun