BayesianOptimization: Error with scipy 1.8.0
I am getting an error with scipy 1.8.0
File "/home/brendan/python/TestVenv/lib/python3.8/site-packages/bayes_opt/util.py", line 65, in acq_max
if max_acq is None or -res.fun[0] >= max_acq:
TypeError: 'float' object is not subscriptable
The problem appears to be that in this new version of scipy, res.fun is returned as a number instead of an array. I haven’t yet found exactly where in scipy the change is. A fix may be as simple as adding an if statement to handle this case.
I’ll keep looking into it but for now I suggest limiting scipy installations to 1.7 or less.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 23
- Comments: 18 (1 by maintainers)
Commits related to this issue
- fixed bug related to scipy version https://github.com/fmfn/BayesianOptimization/issues/300 — committed to a19simma/BSc-thesis by a19simma 2 years ago
- fixed bug related to scipy version https://github.com/fmfn/BayesianOptimization/issues/300 — committed to a19simma/BSc-thesis by a19simma 2 years ago
- Set scipy upper bound due to issue with bayesian-optimization (https://github.com/fmfn/BayesianOptimization/issues/300). — committed to bwpriest/MuyGPyS by bwpriest 2 years ago
- Adding Bayesian optimization as an option for hyperparameter optimization. (#46) * Refactored optimization API to take an opt_method arg. * Exposed kwargs to wrapped optimization methods to the ba... — committed to LLNL/MuyGPyS by bwpriest 2 years ago
hey all, just an update on this. I have permissions to manage this repository now and I have merged #303 into the main branch, which should resolve this error. However, I am still not able to release the code through pypi or conda forge. I will keep trying to get these permissions, but for now I would recommend installing directly from the master branch like this:
I have the same problem. I used pip install scipy==1.7 and it seems to work.
I think that this is a different error, unrelated to this package. Either
start_iteration
ornum_boost_round
is a float/np.float64
when it should be of typeint
. Can you please post yourfit_bayesian
function, too?Hi @daeh Thanks! I’m not sure if you already read through #339 - basically the conda package should get updated once the pypi package gets updated, which should happen when I get the rights to it…
@xxl4tomxu98 - either should fix it. if you install scipy version 1.8, install from the master branch here (which will also work with scipy 1.7) if you pip install, make sure you have scipy version <1.8. the most likely explanation as to why it didn’t work when you downgraded to 1.7 is that somehow you hadn’t actually downgraded with 1.7, or you did then it later got updated somehow. you could check:
@bwheelz36 Any update on this after over a month? For a package with 6.1k stars, getting this fix pushed to PyPI/conda would seem to be quite critical.
Came here with the same issue.
pip install scipy==1.7
fixed it for me as well.