问题描述
我已经创建了GradientBoostingRegressor模型。
我在gridsearchcv函数中使用得分参数来返回MSE得分。
我想知道是否在 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,5,10,15],'min_samples_split': [2,4,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')
解决方法
criterion 方法评估树中的拆分。 评分方法评估整个模型的质量。
如果您想了解如果会更改您的模型,为什么不进行测试?这就是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,5,10,15],'min_samples_split': [2,4,10],'criterion' : ['friedman_mse','mse']
}