Skip to content

Commit

Permalink
Fix stochastic optimization (#328)
Browse files Browse the repository at this point in the history
* Fix incompatibility with scipy>1.5

* Modified CHANGELOG
  • Loading branch information
hpesonen authored Jul 29, 2020
1 parent 2f049aa commit ec1418e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
6 changes: 5 additions & 1 deletion elfi/methods/bo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit ec1418e

Please sign in to comment.