diff --git a/CHANGELOG.rst b/CHANGELOG.rst index de97cea4..343bbb7c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,7 @@ Changelog ========= +- Fix incompatibility with scipy>1.5 in bo.utils.stochastic_optimization - Minor improvements to documentation 0.7.5 (2019-12-18) diff --git a/elfi/methods/bo/utils.py b/elfi/methods/bo/utils.py index 9aa32653..d695f137 100644 --- a/elfi/methods/bo/utils.py +++ b/elfi/methods/bo/utils.py @@ -28,8 +28,12 @@ def stochastic_optimization(fun, bounds, maxiter=1000, polish=True, seed=0): tuple of the found coordinates of minimum and the corresponding value. """ + def fun_1d(x): + return fun(x).ravel() + result = differential_evolution( - func=fun, bounds=bounds, maxiter=maxiter, polish=polish, init='latinhypercube', seed=seed) + func=fun_1d, bounds=bounds, maxiter=maxiter, + polish=polish, init='latinhypercube', seed=seed) return result.x, result.fun