`StopIteration: Queue is empty` error in optimizer.maximize()
See original GitHub issueI am running into the error StopIteration: Queue is empty, no more objects to retrieve
when I run optimizer.maximize(...)
. Specifically, the traceback is as follows (with pieces referring to my code removed).
Traceback (most recent call last):
File "/mnt/mesos/sandbox/.local/lib/python3.8/site-packages/bayes_opt/bayesian_optimization.py", line 179, in maximize
x_probe = next(self._queue)
File "/mnt/mesos/sandbox/.local/lib/python3.8/site-packages/bayes_opt/bayesian_optimization.py", line 25, in __next__
raise StopIteration("Queue is empty, no more objects to retrieve.")
StopIteration: Queue is empty, no more objects to retrieve.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
[ ... ]
File "/mnt/mesos/sandbox/.local/lib/python3.8/site-packages/bayes_opt/bayesian_optimization.py", line 182, in maximize
x_probe = self.suggest(util)
File "/mnt/mesos/sandbox/.local/lib/python3.8/site-packages/bayes_opt/bayesian_optimization.py", line 131, in suggest
suggestion = acq_max(
File "/mnt/mesos/sandbox/.local/lib/python3.8/site-packages/bayes_opt/util.py", line 55, in acq_max
res = minimize(lambda x: -ac(x.reshape(1, -1), gp=gp, y_max=y_max),
File "/mnt/mesos/sandbox/.local/lib/python3.8/site-packages/scipy/optimize/_minimize.py", line 617, in minimize
return _minimize_lbfgsb(fun, x0, args, jac, bounds,
File "/mnt/mesos/sandbox/.local/lib/python3.8/site-packages/scipy/optimize/lbfgsb.py", line 294, in _minimize_lbfgsb
raise ValueError("LBFGSB - one of the lower bounds is greater than an upper bound.")
ValueError: LBFGSB - one of the lower bounds is greater than an upper bound.
I found another instance of this issue on StackOverflow. As a commenter mentioned, I am usually able to solve this problem by tweaking the values of pbounds
, but it’s not a robust solution.
Thanks in advance!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:17
Top Results From Across the Web
python - Queue is empty while using Bayesian optimization
StopIteration : Queue is empty, no more objects to retrieve. My code is as following: from bayes_opt import BayesianOptimization import time # ...
Read more >bayesian-optimization 1.2.0 - PythonFix.com
The target value in the logs is wrong; How to code discrete bounds of parameters? StopIteration: Queue is empty error in optimizer.maximize().
Read more >Complete Guide to Python StopIteration - eduCBA
Guide to Python StopIteration. Here we discuss how StopIteration works in python and how to avoid StopIteration exceptions with examples.
Read more >Change history — Kombu 5.2.4 documentation - Celery
Add possibility to optimize lookup for queue in direct exchange set. ... This allows calling celery.bin.celery.main() to revive a worker in the same...
Read more >tf.keras.utils.GeneratorEnqueuer | TensorFlow v2.11.0
Builds a queue out of a data generator. ... provided generator can be finite in which case the class will throw a StopIteration...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I also faced this problem and solved this problem by downgrading
scipy==1.7.3
. But there were some difference. My “another exception” was:Tracing back to bayes-opt package, I found that
minimize
func fromscipy.optimize
package was used: see here. The latestscipy.optimize.minimize
object returnsfun
(referred tores.fun
in this line in bayes-opt pkg) as string (seen in scipy official doc) which caused my “another exception”.Try downgrading
scipy==1.7.3
might help.Ugh, and now the problem is back. No idea why.