cv <- trainControl(
method = "cv",
number = 5,
classProbs = TRUE,
summaryFunction = prSummary,
seeds = set.seed(123))
turn_grid_xgb <- expand.grid(
eta = c(0.1,0.3,0.5),
max_depth = 5,
min_child_weight = 1,
subsample = 0.8,
colsample_bytree = 0.8,
nrounds = (1:10)*200,
gamma = 0)
set.seed(123)
suppressWarnings({
xgb_1 <- train(label~., data = baked_train,
method = "xgbTree",
tuneGrid = turn_grid_xgb,
trControl = cv,
verbose = FALSE,
metric = "F")
嗨,当我试图运行上面的代码时,在R控制台中显示了以下警告,有人知道如何摆脱它吗?我已经在块设置上尝试了suppressWarnings()
,warning = FALSE
,它仍然存在。
谢谢!
WARNING: amalgamation/../src/c_api/c_api.cc:718: `ntree_limit` is deprecated, use `iteration_range` instead.
[02:15:13] WARNING: amalgamation/../src/c_api/c_api.cc:718: `ntree_limit` is deprecated, use `iteration_range` instead.
[02:15:13] WARNING: amalgamation/../src/c_api/c_api.cc:718: `ntree_limit` is deprecated, use `iteration_range` instead.
1条答案
按热度按时间wljmcqd81#
要摆脱xgboost警告,您可以设置
verbosity = 0
,它将由caret::train
传递给xgboost
调用:当前警告表示xgboost正在更改参数的名称,但插入符号仍提供旧名称。当前它可以工作,但在新的xgboost版本中,参数将被完全替换,如果插入符号函数代码在之前没有更新,则警告将被错误替换。