Last active
January 23, 2021 21:36
-
-
Save ShuaiGuo16/395df7fad92813de946872abf301c554 to your computer and use it in GitHub Desktop.
one dimensional testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def Test_1D(X): | |
"""1D Test Function""" | |
y = (X*6-2)**2*np.sin(X*12-4) | |
return y | |
# Training data | |
X_train = np.array([0.0, 0.1, 0.2, 0.4, 0.5, 0.6, 0.8, 1], ndmin=2).T | |
y_train = Test_1D(X_train) | |
# Testing data | |
X_test = np.linspace(0.0, 1, 100).reshape(-1,1) | |
y_test = Test_1D(X_test) | |
# GP model training | |
GP = GaussianProcess(n_restarts=10, optimizer='L-BFGS-B') | |
GP.fit(X_train, y_train) | |
# GP model predicting | |
y_pred, y_pred_SSqr = GP.predict(X_test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment