ActiveBOToytask/AcquistionFunctions/ConfidenceBound.py
2023-08-17 18:26:23 +02:00

13 lines
366 B
Python

import numpy as np
def ConfidenceBound(gp, nr_test, nr_weights, beta=1.2, seed=None, lower=-1.0, upper=1.0):
rng = np.random.default_rng(seed=seed)
X_test = rng.uniform(lower, upper, (nr_test, nr_weights))
mu, sigma = gp.predict(X_test, return_std=True)
cb = mu + beta * sigma
idx = np.argmax(cb)
X_next = X_test[idx, :]
return X_next