15 lines
445 B
Python
15 lines
445 B
Python
import numpy as np
|
|
from scipy.stats import norm
|
|
|
|
def ConfidenceBound(gp, X, nr_test, nr_weights, lam=1.2, seed=None, lower=-1.0, upper=1.0):
|
|
y_hat = gp.predict(X)
|
|
best_y = max(y_hat)
|
|
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 + lam * sigma
|
|
|
|
idx = np.argmax(cb)
|
|
X_next = X_test[idx, :]
|
|
return X_next
|