import numpy as np
import matplotlib.pyplot as plt
import profit
from profit.sur.gaussian_process import GPySurrogate
xtrain = np.array(
[[0.5 , 0.33333333],
[0.25 , 0.66666667],
[0.75 , 0.11111111],
[0.125 , 0.44444444],
[0.625 , 0.77777778],
[0.375 , 0.22222222],
[0.875 , 0.55555556],
[0.0625 , 0.88888889],
[0.5625 , 0.03703704],
[0.3125 , 0.37037037],
[0.8125 , 0.7037037 ],
[0.1875 , 0.14814815],
[0.6875 , 0.48148148],
[0.4375 , 0.81481481],
[0.9375 , 0.25925926],
[0.03125 , 0.59259259],
[0.53125 , 0.92592593],
[0.28125 , 0.07407407],
[0.78125 , 0.40740741],
[0.15625 , 0.74074074]])
ytrain = np.array(
[-0.10316614, 0.16585917, -0.29220324, 0.15771768,
0.06451588, -0.13031895, -0.12112112, 0.43093146,
-0.34623426, -0.01752642, -0.03618134, -0.11282839,
-0.08835435, 0.15300116, -0.26063376, 0.45675513,
0.19451957, -0.23697354, -0.14697874, 0.26922018])
fig, ax = plt.subplots()
ax.plot(xtrain[:,0], xtrain[:,1], 'x')
ax.set_xlabel('x1')
ax.set_ylabel('x2')
plt.show()
gp = GPySurrogate()
gp.train(xtrain, ytrain.reshape([-1,1]))
Initial hyperparameters:
length_scale: [0.24748612]
sigma_n: [7.45834073e-155]
sigma_f: [7.45834073e-155]
Optimized hyperparameters:
length_scale: [0.24748612]
sigma_n: [7.45834073e-155]
sigma_f: [7.45834073e-155]
gp.plot()