本文整理汇总了Python中sklearn.linear_model.RidgeCV.predict_noiseless方法的典型用法代码示例。如果您正苦于以下问题:Python RidgeCV.predict_noiseless方法的具体用法?Python RidgeCV.predict_noiseless怎么用?Python RidgeCV.predict_noiseless使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.linear_model.RidgeCV
的用法示例。
在下文中一共展示了RidgeCV.predict_noiseless方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MAE
# 需要导入模块: from sklearn.linear_model import RidgeCV [as 别名]
# 或者: from sklearn.linear_model.RidgeCV import predict_noiseless [as 别名]
model = GPy.models.GPRegression(X_train, Y_train, kernel=k)
model.optimize(messages=True, max_iters=100)
# Get predictions
info_dict = {}
if args.model == 'ridge' or args.model == 'svr':
preds = model.predict(X_test)
if args.label_preproc == 'scale':
preds = Y_scaler.inverse_transform(preds)
info_dict['mae'] = MAE(preds, Y_test.flatten())
info_dict['rmse'] = np.sqrt(MSE(preds, Y_test.flatten()))
info_dict['pearsonr'] = pearsonr(preds, Y_test.flatten())
else:
# TODO: check if this makes sense
#preds, vars = model.predict(X_test)
preds, vars = model.predict_noiseless(X_test)
if args.label_preproc == 'scale':
preds = Y_scaler.inverse_transform(preds)
info_dict['mae'] = MAE(preds, Y_test)
info_dict['rmse'] = np.sqrt(MSE(preds, Y_test))
info_dict['pearsonr'] = pearsonr(preds.flatten(), Y_test.flatten())
nlpd = model.log_predictive_density(X_test, Y_test)
info_dict['nlpd'] = np.mean(nlpd)
# Get parameters
if args.model == 'ridge':
info_dict['coefs'] = list(model.coef_)
info_dict['intercept'] = model.intercept_
info_dict['regularization'] = model.alpha_
elif args.model == 'svr':
info_dict['regularization'] = model.best_params_['C']