I在GridSearchCV函数中使用
scoring
参数返回MSE分数。
我想知道我是否在
criterion
中使用param_grids
会改变我的模型?哪种正确的方法?
GBR = GradientBoostingRegressor()
param_grids = {
'learning_rate' : [0.01, 0.05, 0.07, 0.1, 0.3, 0.5 ],
'n_estimators' : [50,60,70,80,90,100],
'max_depth' : [1, 2, 3, 4],
'min_samples_leaf' : [1,2,3,5,10,15],
'min_samples_split': [2,3,4,5,10],
#'criterion' : ['mse']
}
kf = KFold(n_splits=3, random_state=42, shuffle=True)
gs = GridSearchCV(estimator=GBR, param_grid = param_grids , cv = kf, n_jobs=-1,
return_train_score=True, scoring='neg_mean_squared_error')
方法评估了整个模型的质量。 如果您想找出它更改模型,为什么不只是对其进行测试呢?这就是GridSearchCV擅长的。默认值是Friedman_mse,因此:
param_grids = {
'learning_rate' : [0.01, 0.05, 0.07, 0.1, 0.3, 0.5 ],
'n_estimators' : [50,60,70,80,90,100],
'max_depth' : [1, 2, 3, 4],
'min_samples_leaf' : [1,2,3,5,10,15],
'min_samples_split': [2,3,4,5,10],
'criterion' : ['friedman_mse', 'mse']
}