Open bappa10085 opened 2 years ago
Hello, I also encountered this problem. How did you solve it?
You can follow this. Just add verbosity = 0
within train
function.
As suggested by missuse "The current warning means xgboost is changing the name of an argument, but caret is still supplying the old name. Currently it works but with new xgboost versions the argument will be completely replaced, if carets function code is not updated by then the warning will be replaced by an error." So, it would be better if carets function code is updated.
Agreed. I am teaching a class using caret and I think these warnings are confusing for students.
@topepo Any plans to change this please? Seems a simple one-liner?
The warning comes when using the predict()
-function with the ntreelimit
-parameter. See code chunk below,
So yes, @Jon77Ruler, this is an easy fix if ntreelimit
is changed with iteration_range
. I have posted a reprex
below to demonstrate the issue using {xgboost}.
However, I am not sure what the repository rules are for these kind of "simple" bug-fixes. @topepo wrote that {caret} is on the "backburner", see issue https://github.com/topepo/caret/issues/1365 - so it might be a while before we get a fix. Its not breaking "issue" yet, but it might be in the future.
library(xgboost)
data(
agaricus.train,
package = 'xgboost'
)
data(
agaricus.test,
package = 'xgboost'
)
# + estimate model
simple_model <- xgboost(
data =agaricus.train$data,
label = agaricus.train$label,nrounds = 2
)
#> [1] train-rmse:0.350593
#> [2] train-rmse:0.246082
# + in caret
first <- predict(
simple_model,
agaricus.test$data,
# in caret
ntreelimit = 2
)
#> [10:44:28] WARNING: src/c_api/c_api.cc:935: `ntree_limit` is deprecated, use `iteration_range` instead.
second <- predict(
simple_model,
agaricus.test$data,
# in xgboost
iteration_range = 2
)
setequal(
first,
second
)
#> [1] TRUE
Created on 2024-07-19 with reprex v2.1.0
Running
xgboost
model usingcaret
package gives following warningMinimal, reproducible example:
I have tried to use
warning = FALSE
andmessage = FALSE
in the chunk setting. But still, it appears in the knit document. How to remove this warning?Session Info: