Open Mr-Z-W-J opened 2 years ago
How can I compute the MSE ?
The GaussianProcess has been deprecated. You should try using the GaussianProcessregressor
from sklearn.gaussian_process import GaussianProcessRegressor
model = lambda x: x * np.sin(x) xdata = np.array([1, 3, 5, 6, 8]) ydata = model(xdata)
gp = GaussianProcessRegressor() gp.fit(xdata[:, np.newaxis], ydata)
xfit = np.linspace(0, 10, 1000) yfit, dyfit_ori = gp.predict(xfit[:, np.newaxis],return_std=True) dyfit = 2 dyfit_ori # 2sigma ~ 95% confidence region
from sklearn.gaussian_process import GaussianProcess
model = lambda x: x * np.sin(x) xdata = np.array([1, 3, 5, 6, 8]) ydata = model(xdata)
gp = GaussianProcess(corr='cubic', theta0=1e-2, thetaL=1e-4, thetaU=1E-1, random_start=100) gp.fit(xdata[:, np.newaxis], ydata)
xfit = np.linspace(0, 10, 1000) yfit, MSE = gp.predict(xfit[:, np.newaxis], eval_MSE=True) dyfit = 2 np.sqrt(MSE) # 2sigma ~ 95% confidence region