我正在使用 R 中的 Caret 包通过 R 中称为“xgbTree”的方法来训练模型。
绘制训练模型后,如下图所示:调整参数即 'eta' = 0.2 不是我想要的,因为我在训练模型之前在 expand.grid 中也有 eta = 0.1 作为调整参数,这是最好的调整. 所以我想将图中的 eta = 0.2 更改为 plot 函数中的 eta = 0.1 的场景。我怎么能做到?谢谢你。
set.seed(100) # For reproducibility
xgb_trcontrol = trainControl(
method = "cv",
#repeats = 2,
number = 10,
#search = 'random',
allowParallel = TRUE,
verboseIter = FALSE,
returnData = TRUE
)
xgbGrid <- expand.grid(nrounds = c(100,200,1000), # this is n_estimators in the python code above
max_depth = c(6:8),
colsample_bytree = c(0.6,0.7),
## The values below are default values in the sklearn-api.
eta = c(0.1,0.2),
gamma=0,
min_child_weight = c(5:8),
subsample = c(0.6,0.7,0.8,0.9)
)
set.seed(0)
xgb_model8 = train(
x, y_train,
trControl = xgb_trcontrol,
tuneGrid = xgbGrid,
method = "xgbTree"
)