相关疑难解决方法(0)

理解python xgboost cv

我想使用xgboost cv函数来查找我的训练数据集的最佳参数.api我很困惑.我如何找到最佳参数?这与sklearn grid_search交叉验证功能类似吗?如何max_depth确定参数([2,4,6])的哪个选项最佳?

from sklearn.datasets import load_iris
import xgboost as xgb
iris = load_iris()
DTrain = xgb.DMatrix(iris.data, iris.target)
x_parameters = {"max_depth":[2,4,6]}
xgb.cv(x_parameters, DTrain)
...
Out[6]: 
   test-rmse-mean  test-rmse-std  train-rmse-mean  train-rmse-std
0        0.888435       0.059403         0.888052        0.022942
1        0.854170       0.053118         0.851958        0.017982
2        0.837200       0.046986         0.833532        0.015613
3        0.829001       0.041960         0.824270        0.014501
4        0.825132       0.038176         0.819654        0.013975
5        0.823357       0.035454         0.817363        0.013722
6        0.822580       0.033540         0.816229        0.013598
7        0.822265       0.032209         0.815667        0.013538
8        0.822158       0.031287         0.815390        0.013508
9        0.822140       0.030647 …
Run Code Online (Sandbox Code Playgroud)

python cross-validation xgboost

15
推荐指数
4
解决办法
3万
查看次数

标签 统计

cross-validation ×1

python ×1

xgboost ×1