本文整理汇总了Python中sklearn.linear_model.RidgeCV.optimize方法的典型用法代码示例。如果您正苦于以下问题:Python RidgeCV.optimize方法的具体用法?Python RidgeCV.optimize怎么用?Python RidgeCV.optimize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.linear_model.RidgeCV
的用法示例。
在下文中一共展示了RidgeCV.optimize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MAE
# 需要导入模块: from sklearn.linear_model import RidgeCV [as 别名]
# 或者: from sklearn.linear_model.RidgeCV import optimize [as 别名]
elif args.model == 'mlp':
k = GPy.kern.MLP(X.shape[1], ARD=args.ard)
if args.bias:
k = k + GPy.kern.Bias(X.shape[1])
#if args.label_preproc == "warp":
# model = GPy.models.WarpedGP(X_train, Y_train, kernel=k)
# model['warp_tanh.psi'] = np.random.lognormal(0, 1, (3, 3))
#else:
#model = GPy.models.GPRegression(X_train, Y_train, kernel=k)
icmk = GPy.util.multioutput.ICM(input_dim=X.shape[1], num_outputs=6,
kernel=k, W_rank=args.rank)
model = GPy.models.GPCoregionalizedRegression(X_train_list,
Y_train_list,
kernel=icmk)
model.optimize(messages=True, max_iters=100)
print model
# Get predictions
info_dict = {}
preds_list = []
vars_list = []
if args.model == 'ridge' or args.model == 'svr':
preds = model.predict(X_test)
if args.label_preproc == 'scale':
preds = Y_scaler.inverse_transform(preds)
elif args.label_preproc == 'warp':
preds += 50
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())