From 22c6032b898bf89dde0aec1836155167d7b95004 Mon Sep 17 00:00:00 2001 From: zhangchuangnankai <30925650+zhangchuangnankai@users.noreply.github.com> Date: Tue, 30 Jan 2018 16:08:43 +0800 Subject: [PATCH 1/2] Update helpers.py May be fail to minimize,the minimize will return res.fun with a array(0.0), and get res.fun will get an Exception --- bayes_opt/helpers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bayes_opt/helpers.py b/bayes_opt/helpers.py index 43ac9a925..326699530 100644 --- a/bayes_opt/helpers.py +++ b/bayes_opt/helpers.py @@ -59,6 +59,10 @@ def acq_max(ac, gp, y_max, bounds, random_state, n_warmup=100000, n_iter=250): bounds=bounds, method="L-BFGS-B") + # See if success + if res.success==False: + continue + # Store it if better than previous minimum(maximum). if max_acq is None or -res.fun[0] >= max_acq: x_max = res.x From 0a2bf853989d23e005ade40e858401e8b83d4795 Mon Sep 17 00:00:00 2001 From: zhangchuangnankai <30925650+zhangchuangnankai@users.noreply.github.com> Date: Wed, 31 Jan 2018 09:45:02 +0800 Subject: [PATCH 2/2] Update helpers.py Thanks to fmfn's advice: Can you change to if not res.success:? This is more pythonic. --- bayes_opt/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bayes_opt/helpers.py b/bayes_opt/helpers.py index 326699530..2275b28f5 100644 --- a/bayes_opt/helpers.py +++ b/bayes_opt/helpers.py @@ -60,7 +60,7 @@ def acq_max(ac, gp, y_max, bounds, random_state, n_warmup=100000, n_iter=250): method="L-BFGS-B") # See if success - if res.success==False: + if not res.success: continue # Store it if better than previous minimum(maximum).