Skip to content

Commit

Permalink
Merge pull request #10 from ziatdinovmax/dev
Browse files Browse the repository at this point in the history
Update default coef values in acq func
  • Loading branch information
ziatdinovmax authored Apr 9, 2020
2 parents 648e4fa + f25fa6a commit f630806
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
12 changes: 4 additions & 8 deletions gpim/gpbayes/acqfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ def confidence_bound(gpmodel, X_full, **kwargs):
**beta (float):
:math:`\\beta` coefficient in :math:`\\alpha \\mu + \\beta \\sigma`
"""
if kwargs.get("alpha") is None:
alpha = 0
if kwargs.get("beta") is None:
beta = 1
alpha = kwargs.get("alpha", 0)
beta = kwargs.get("beta", 1)
mean, sd = gpmodel.predict(X_full)
return alpha * mean + beta * sd

Expand All @@ -47,8 +45,7 @@ def expected_improvement(gpmodel, X_full, X_sparse, **kwargs):
**xi (float):
xi constant value
"""
if kwargs.get("xi") is None:
xi = 0.01
xi = kwargs.get("xi", 0.01)
mean, sd = gpmodel.predict(X_full)
mean_sample, _ = gpmodel.predict(X_sparse)

Expand All @@ -73,8 +70,7 @@ def probability_of_improvement(gpmodel, X_full, X_sparse, **kwargs):
**xi (float):
xi constant value
"""
if kwargs.get("xi") is None:
xi = 0.01
xi = kwargs.get("xi", 0.01)
mean, sd = gpmodel.predict(X_full)
mean_sample = gpmodel.predict(X_sparse)

Expand Down
15 changes: 12 additions & 3 deletions gpim/gpbayes/boptim.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ class boptimizer:
iterations (int): Number of SVI training iteratons for GP model
seed (int):
for reproducibility
**alpha (float or int):
alpha coefficient in the 'confidence bound' acquisition function
(Default: 0)
**beta (float or int):
beta coefficient in the 'confidence bound' acquisition function
(Default: 1)
**xi (float):
xi coefficient in 'expected improvement'
and 'probability of improvement' acquisition functions
**use_gpu (bool):
Uses GPU hardware accelerator when set to 'True'.
Notice that for large datasets training model without GPU
Expand Down Expand Up @@ -136,9 +145,9 @@ def __init__(self,
self.exploration_steps = exploration_steps
self.batch_update = batch_update
self.batch_size = batch_size
self.alpha = kwargs.get("alpha", None)
self.beta = kwargs.get("beta", None)
self.xi = kwargs.get("xi", None)
self.alpha = kwargs.get("alpha", 0)
self.beta = kwargs.get("beta", 1)
self.xi = kwargs.get("xi", 0.01)
self.lscale = kwargs.get("lscale", None)
self.indices_all, self.vals_all = [], []
self.target_func_vals_all = [y_seed.copy()]
Expand Down

0 comments on commit f630806

Please sign in to comment.