GridSearchCV 中的标准和评分有什么区别
what is difference between criterion and scoring in GridSearchCV
我已经创建了一个 GradientBoostingRegressor 模型。
我在 GridSearchCV 函数中使用 scoring 参数来 return MSE 分数。
我想知道如果我在 param_grids 中使用 criterion 会改变我的模型吗?哪个才是正道?
谢谢
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')
标准 方法评估树中的拆分。 scoring 方法评估模型的整体质量。
如果您想知道如果它改变了您的模型,为什么不直接测试一下呢?这就是 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']
}
我已经创建了一个 GradientBoostingRegressor 模型。
我在 GridSearchCV 函数中使用 scoring 参数来 return MSE 分数。
我想知道如果我在 param_grids 中使用 criterion 会改变我的模型吗?哪个才是正道?
谢谢
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')
标准 方法评估树中的拆分。 scoring 方法评估模型的整体质量。
如果您想知道如果它改变了您的模型,为什么不直接测试一下呢?这就是 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']
}