本文整理汇总了Python中sklearn.gaussian_process.GaussianProcessRegressor.optimize_parameters方法的典型用法代码示例。如果您正苦于以下问题:Python GaussianProcessRegressor.optimize_parameters方法的具体用法?Python GaussianProcessRegressor.optimize_parameters怎么用?Python GaussianProcessRegressor.optimize_parameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.gaussian_process.GaussianProcessRegressor
的用法示例。
在下文中一共展示了GaussianProcessRegressor.optimize_parameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dict
# 需要导入模块: from sklearn.gaussian_process import GaussianProcessRegressor [as 别名]
# 或者: from sklearn.gaussian_process.GaussianProcessRegressor import optimize_parameters [as 别名]
params = dict([["l",l],["sigma_0",sigma_0]]),
sigma_eps = sigma_eps)
y_pred, Cov = gp.predict(x_grid)
sigma = ul.fnp(np.sqrt(np.diag(Cov)))
## Plot the results
gl.plot_timeRegression(x_grid, y_pred, sigma,
dates, timeSeries,sigma_eps,
labels = ["GP own implementation","Time","Price"], nf = 1)
optflag = 1
if (optflag):
### Optimize the parameters and do it again ####
xopt = gp.optimize_parameters(sigma_0, l, sigma_eps)
sigma_0, l, sigma_eps = xopt
gp.fit(dates,timeSeries,
kernel = GPown.compute_Kernel,
params = dict([["l",l],["sigma_0",sigma_0]]),
sigma_eps = sigma_eps)
## Generate a Validation set and obtain the regressed values !
y_pred, Cov = gp.predict(x_grid)
sigma = ul.fnp(np.sqrt(np.diag(Cov)))
gl.plot_timeRegression(x_grid, y_pred, sigma,
dates, timeSeries,sigma_eps,
labels = ["GP Estimation (Opt)","Time","Price"], nf = 1)
## Plot realizations !!
# f_s = gp.generate_process(x_grid, N = 20)
# gl.plot(x_grid,f_s, legend = ["Realization"], nf = 0)