首页 > 解决方案 > 为什么即使默认值包含在搜索空间中,网格搜索找到的最佳参数的性能也比默认值差

问题描述

我使用了Analytics Vidhya中给出的步骤。在其中一个步骤中,它具有以下内容:

param_test4 = {'subsample':[i/10.0 for i in range(6,10)],
               'colsample_bytree':[i/10.0 for i in range(6,10)]
                }
gsearch4 = GridSearchCV(estimator = XGBClassifier( learning_rate =0.1, 
                                                   n_estimators=177, 
                                                   max_depth=4,
                                                   min_child_weight=6, 
                                                   gamma=0, 
                                                   subsample=0.8, 
                                                   colsample_bytree=0.8,
                                                   objective= 'binary:logistic', 
                                                   nthread=4, 
                                                   scale_pos_weight=1,seed=27), 
                        param_grid = param_test4, 
                        scoring='roc_auc',
                        n_jobs=4,
                        iid=False, 
                        cv=5)
 gsearch4.fit(train[predictors],train[target])
 gsearch4.grid_scores_, gsearch4.best_params_, gsearch4.best_score_

我已经尝试过这段代码(根据我自己的数据)。在对 中的参数进行网格搜索之前 ,我确实为和param_test4拟合了模型。即使这两个值在 中设置的参数列表中,网格搜索的输出也比直接使用, 和直接使用更差。我想知道是否有人以前见过这个问题/情况。subsample=0.8colsample_bytree=0.8param_test4subsample=0.8colsample_bytree=0.8

谢谢

标签: xgboostgrid-searchgridsearchcv

解决方案


推荐阅读