You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to follow the github readme for testing out the interactive optimization feature of the GPro package.
Everything as it is mentioned in the front page:
from GPro.kernels import Matern
from GPro.posterior import Laplace
from GPro.acquisitions import UCB
from GPro.optimization import ProbitBayesianOptimization
import numpy as np
3D example. Initialization.
X = np.random.sample(size=(2, 3)) * 10
M = np.array([0, 1]).reshape(-1, 2)
console_opt = gpr_opt.interactive_optimization(bounds=bounds, n_init=100, n_solve=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/GPro/optimization.py", line 118, in interactive_optimization
x_optim = self.bayesopt(bounds, method, n_init, n_solve)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/GPro/preference.py", line 358, in bayesopt
if max_acq is None or -res.fun[0] >= max_acq:
~~~~~~~^^^
TypeError: 'float' object is not subscriptable
Is there something wrong in the example?
The text was updated successfully, but these errors were encountered:
Hello, I have the same problem. Seems like the res.fun returned by scipy.optimize.minimize is a float representing the minimum value of the function being optimised, not an array, so we cannot index it with [0]. I don't know how it compiled in the first place.
Hello,
I'm trying to follow the github readme for testing out the interactive optimization feature of the GPro package.
Everything as it is mentioned in the front page:
from GPro.kernels import Matern
from GPro.posterior import Laplace
from GPro.acquisitions import UCB
from GPro.optimization import ProbitBayesianOptimization
import numpy as np
3D example. Initialization.
X = np.random.sample(size=(2, 3)) * 10
M = np.array([0, 1]).reshape(-1, 2)
GP_params = {'kernel': Matern(length_scale=1, nu=2.5),
'post_approx': Laplace(s_eval=1e-5, max_iter=1000,
eta=0.01, tol=1e-3),
'acquisition': UCB(kappa=2.576),
'alpha': 1e-5,
'random_state': None}
gpr_opt = ProbitBayesianOptimization(X, M, GP_params)
bounds = {'x0': (0, 10), 'x1': (0, 10), 'x2': (0, 10)}
console_opt = gpr_opt.interactive_optimization(bounds=bounds, n_init=100, n_solve=1)
optimal_values, suggestion, X_post, M_post, f_post = console_opt
print('optimal values: ', optimal_values)
console_opt = gpr_opt.interactive_optimization(bounds=bounds, n_init=100, n_solve=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/GPro/optimization.py", line 118, in interactive_optimization
x_optim = self.bayesopt(bounds, method, n_init, n_solve)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/GPro/preference.py", line 358, in bayesopt
if max_acq is None or -res.fun[0] >= max_acq:
~~~~~~~^^^
TypeError: 'float' object is not subscriptable
Is there something wrong in the example?
The text was updated successfully, but these errors were encountered: