ActiveBOToytask/AcquistionFunctions/ConfidenceBound.py

13 lines
366 B
Python
Raw Normal View History

2023-02-06 14:43:30 +00:00
import numpy as np
2023-08-17 16:26:23 +00:00
def ConfidenceBound(gp, nr_test, nr_weights, beta=1.2, seed=None, lower=-1.0, upper=1.0):
2023-02-06 14:43:30 +00:00
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)
2023-08-17 16:26:23 +00:00
cb = mu + beta * sigma
2023-02-06 14:43:30 +00:00
idx = np.argmax(cb)
X_next = X_test[idx, :]
return X_next