From f25fa6a5e4a10d77830acc27584ef9b372389927 Mon Sep 17 00:00:00 2001 From: ziatdinovmax Date: Thu, 9 Apr 2020 00:33:10 -0400 Subject: [PATCH] Update default coef values in acq func --- gpim/gpbayes/acqfunc.py | 12 ++++-------- gpim/gpbayes/boptim.py | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/gpim/gpbayes/acqfunc.py b/gpim/gpbayes/acqfunc.py index 1fb1def..d8dc9e9 100644 --- a/gpim/gpbayes/acqfunc.py +++ b/gpim/gpbayes/acqfunc.py @@ -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 @@ -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) @@ -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) diff --git a/gpim/gpbayes/boptim.py b/gpim/gpbayes/boptim.py index b628499..09da8b2 100644 --- a/gpim/gpbayes/boptim.py +++ b/gpim/gpbayes/boptim.py @@ -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 @@ -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()]