topepo / caret

caret (Classification And Regression Training) R package that contains misc functions for training and plotting classification and regression models
http://topepo.github.io/caret/index.html
1.61k stars 634 forks source link

in XGBoost: iteration_range should be used instead of ntree_limit #1371

Open shainova opened 2 weeks ago

shainova commented 2 weeks ago

I get error: [11:52:40] WARNING: src/c_api/c_api.cc:935: ntree_limit is deprecated, use iteration_range instead.

Running:

train_control <- trainControl(
  method = "cv",           # Cross-validation
  number = 5,              # 5-fold CV
  summaryFunction = balancedAccuracy,  # Use balanced accuracy to evaluate models
  savePredictions = "final"
)

xgb_model <- train(
  y ~ .,
  data = train_data,
  method = "xgbTree",
  trControl = train_control,
  tuneLength = 3  # Number of hyperparameter combinations to try
)