Skip to content

Commit e49dc24

Browse files
fmfnfmfn
authored andcommitted
Make optimization faster by simplifying search
This commit makes the whole optimization process considerably faster by simplifying the search steps. Basically less iterations when fitting the gaussian process as well as when optimizing the acquisition function.
1 parent 6e8c608 commit e49dc24

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

bayes_opt/bayesian_optimization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def __init__(self, f, pbounds, random_state=None, verbose=2):
8080
kernel=Matern(nu=2.5),
8181
alpha=1e-6,
8282
normalize_y=True,
83-
n_restarts_optimizer=25,
83+
n_restarts_optimizer=5,
8484
random_state=self._random_state,
8585
)
8686

bayes_opt/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from scipy.optimize import minimize
55

66

7-
def acq_max(ac, gp, y_max, bounds, random_state, n_warmup=100000, n_iter=250):
7+
def acq_max(ac, gp, y_max, bounds, random_state, n_warmup=10000, n_iter=10):
88
"""
99
A function to find the maximum of the acquisition function
1010

tests/test_bayesian_optimization.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,11 @@ def test_set_bounds():
217217
def test_set_gp_params():
218218
optimizer = BayesianOptimization(target_func, PBOUNDS, random_state=1)
219219
assert optimizer._gp.alpha == 1e-6
220-
assert optimizer._gp.n_restarts_optimizer == 25
220+
assert optimizer._gp.n_restarts_optimizer == 5
221221

222222
optimizer.set_gp_params(alpha=1e-2)
223223
assert optimizer._gp.alpha == 1e-2
224-
assert optimizer._gp.n_restarts_optimizer == 25
224+
assert optimizer._gp.n_restarts_optimizer == 5
225225

226226
optimizer.set_gp_params(n_restarts_optimizer=7)
227227
assert optimizer._gp.alpha == 1e-2

0 commit comments

Comments
 (0)