GridSearchCV中的标准和评分有啥区别

Posted

技术标签:

【中文标题】GridSearchCV中的标准和评分有啥区别【英文标题】:what is difference between criterion and scoring in GridSearchCVGridSearchCV中的标准和评分有什么区别 【发布时间】:2021-02-16 21:31:30 【问题描述】:

我创建了一个 GradientBoostingRegressor 模型。

我在 GridSearchCV 函数中使用 scoring 参数来返回 MSE 分数。

我想知道如果我在 param_grids 中使用 criterion 会改变我的模型吗?哪个才是真道?

谢谢

GBR = GradientBoostingRegressor() 参数网格 = '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], #'标准':['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=真,评分='neg_mean_squared_error')

【问题讨论】:

【参考方案1】:

criterion 方法评估树中的拆分。 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']
    

【讨论】:

以上是关于GridSearchCV中的标准和评分有啥区别的主要内容,如果未能解决你的问题,请参考以下文章

如何使用 sklearn 中的 GridSearchCV 设置自己的评分以进行回归?

GridSearchCV 的 sklearn 中的自定义“k 精度”评分对象

在 Gridsearchcv 中评分

如何确定 GridSearchCV 中每个评分指标的最佳参数和最佳分数

H2O 和 Scikit-Learn 指标评分之间有啥区别?

将 OneClassSVM 与 GridSearchCV 结合使用