Exemple #1
0
 def test_lower_must_be_less_than_upper(self):
     with raises(ValueError):
         Bound(lower=1.0, upper=0.0)
Exemple #2
0

# Now we'll set up the main BO object. First we need to create a surrogate model.
# We'll use a GPyGPSurrogate with an RBF kernel. See the GPyGPSurrogate class for
# why we have to create this slightly funky initializer function first.
def gp_initializer(x, y):
    return GPy.models.GPRegression(x,
                                   y,
                                   kernel=GPy.kern.RBF(input_dim=1),
                                   noise_var=1e-10,
                                   normalizer=True)


surrogate = GPyGPSurrogate(gp_initializer=gp_initializer)
acquistion_function = LCB(surrogate=surrogate)
bounds = Bounds(bounds=[Bound(lower=0.0, upper=1.0)])
optimizer = DirectOptimizer(acquisition_function=acquistion_function,
                            bounds=bounds,
                            maxf=100)

# Now we create the BO object...
bo = BayesOpt(
    objective_function=forrester,
    surrogate=surrogate,
    acquisition_function=acquistion_function,
    optimizer=optimizer,
    bounds=bounds,
    initial_design=SobolSequenceInitialDesign(),
    callbacks=[PlottingCallback()],
)
Exemple #3
0
 def bounds(self, lowers, uppers):
     return Bounds(
         bounds=[Bound(lower=l, upper=u) for l, u in zip(lowers, uppers)])
Exemple #4
0
def bounds():
    return Bounds(bounds=[Bound(lower=0.0, upper=1.0)])