2

Below I have code, in which I am trying to train an XGBoost model in R that early stops after a given number of rounds early_stopping_rounds without improvement.

watchlist <- list(train=dtrain, test=dtest)

param <- list(
  objective = "binary:logistic",
  eta = 0.3,
  max_depth = 8,
  eval_metric="logloss"
)

xgb.train(params = param, data = dtrain, nrounds = 1000, watchlist = watchlist, early_stopping_rounds = 3)

However, instead of fixing the number of rounds, I would like to pass a min_delta value, so the early stopping kicks in when the difference between rounds is below a given tolerance.

Others (here and here) have asked this for Python. However, advances not too long ago have implemented this option for Python.

But how do I work this out in R? Is there something like it?

MJimitater
  • 833
  • 3
  • 13
  • 26

0 Answers0