Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

run_optimization ERROR; ValueError: too many values to unpack (expected 2) #321

Open
swapchavan opened this issue Jun 5, 2020 · 1 comment

Comments

@swapchavan
Copy link

swapchavan commented Jun 5, 2020

I am trying to optimize my RNN model using GPyOpt. I have successfully ran my script step by step in jupyter notebook. But when I am trying to run it using python script via command line, I am getting following error for "run_optimization(max_iter = 5)".
What am I doing wrong?

reconstraining parameters GP_regression.rbf
reconstraining parameters GP_regression.Gaussian_noise.variance
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\opt_params.py", line 208, in find_params
    myBopt.run_optimization(max_iter = 5)
  File "C:\Users\AppData\Local\Continuum\anaconda3\envs\my-rdkit-env-py37\lib\site-packages\GPyOpt\core\bo.py", line 145, in run_optimization
    self.suggested_sample = self._compute_next_evaluations()
  File "C:\Users\AppData\Local\Continuum\anaconda3\envs\my-rdkit-env-py37\lib\site-packages\GPyOpt\core\bo.py", line 236, in _compute_next_evaluations
    return self.space.zip_inputs(self.evaluator.compute_batch(duplicate_manager=duplicate_manager, context_manager= self.acquisition.optimizer.context_manager))
  File "C:\Users\AppData\Local\Continuum\anaconda3\envs\my-rdkit-env-py37\lib\site-packages\GPyOpt\core\evaluators\sequential.py", line 22, in compute_batch
    x, _ = self.acquisition.optimize(duplicate_manager=duplicate_manager)
  File "C:\Users\AppData\Local\Continuum\anaconda3\envs\my-rdkit-env-py37\lib\site-packages\GPyOpt\acquisitions\base.py", line 61, in optimize
    out = self.optimizer.optimize(f=self.acquisition_function, f_df=self.acquisition_function_withGradients, duplicate_manager=duplicate_manager)
  File "C:\Users\AppData\Local\Continuum\anaconda3\envs\my-rdkit-env-py37\lib\site-packages\GPyOpt\optimization\acquisition_optimizer.py", line 73, in optimize
    optimized_points = [apply_optimizer(self.optimizer, a, f=f, df=None, f_df=f_df, duplicate_manager=duplicate_manager, context_manager=self.context_manager, space = self.space) for a in anchor_points]
  File "C:\Users\AppData\Local\Continuum\anaconda3\envs\my-rdkit-env-py37\lib\site-packages\GPyOpt\optimization\acquisition_optimizer.py", line 73, in <listcomp>
    optimized_points = [apply_optimizer(self.optimizer, a, f=f, df=None, f_df=f_df, duplicate_manager=duplicate_manager, context_manager=self.context_manager, space = self.space) for a in anchor_points]
  File "C:\Users\AppData\Local\Continuum\anaconda3\envs\my-rdkit-env-py37\lib\site-packages\GPyOpt\optimization\optimizer.py", line 159, in apply_optimizer
    optimized_x, _ = optimizer.optimize(problem.x0_nocontext, problem.f_nocontext, problem.df_nocontext, problem.f_df_nocontext)
  File "C:\Users\AppData\Local\Continuum\anaconda3\envs\my-rdkit-env-py37\lib\site-packages\GPyOpt\optimization\optimizer.py", line 51, in optimize
    res = scipy.optimize.fmin_l_bfgs_b(_f_df, x0=x0, bounds=self.bounds, maxiter=self.maxiter)
  File "C:\Users\AppData\Local\Continuum\anaconda3\envs\my-rdkit-env-py37\lib\site-packages\scipy\optimize\lbfgsb.py", line 199, in fmin_l_bfgs_b
    **opts)
  File "C:\Users\AppData\Local\Continuum\anaconda3\envs\my-rdkit-env-py37\lib\site-packages\scipy\optimize\lbfgsb.py", line 279, in _minimize_lbfgsb
    bounds = [(None if l == -np.inf else l, None if u == np.inf else u) for l, u in bounds]
  File "C:\Users\AppData\Local\Continuum\anaconda3\envs\my-rdkit-env-py37\lib\site-packages\scipy\optimize\lbfgsb.py", line 279, in <listcomp>
    bounds = [(None if l == -np.inf else l, None if u == np.inf else u) for l, u in bounds]
ValueError: too many values to unpack (expected 2)
@ekalosak
Copy link
Contributor

ekalosak commented Jun 5, 2020

Hey :) Welcome to GPyOpt.

  • Please post the code that you're using to optimize your RNN (no need to share NN architecture or training data, just the files with from GPyOpt import ...)
  • It looks like somehow the bounds are misconfigured, but that's only a hunch - it'll help to see the actual code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants