ecpolley / SuperLearner

Current version of the SuperLearner R package
272 stars 72 forks source link

xgboost: use xgb.cv with early_stopping #147

Closed rdiaz02 closed 5 months ago

rdiaz02 commented 9 months ago

Hi, thanks a lot for SuperLearner!

I wonder if it is possible to leverage on xgb.cv to tune ntrees (nrounds in xgboost doc) without doing an explicit grid search over a set of ntrees. One very nice thing of xgb.cv is that, using early_stopping_rounds , we can stop the tunning of ntrees. Thus, when doing a grid search over parameters, we would not need to search over ntrees: just pass a large enough value of ntrees and use early_stopping_rounds (an example of doing a grid search for other parameters using this approach in https://bradleyboehmke.github.io/HOML/gbm.html#xgb-tuning-strategy).

I have not found anything that does this with SuperLearner. I guess I would need to write my own, following the examples in https://github.com/ecpolley/SuperLearnerExtra/tree/master/SL (e.g., SL.gbmOOB).

Am I missing something obvious?

ck37 commented 9 months ago

Hello, I have a wrapper here that does that: https://github.com/ck37/ck37r/blob/master/R/sl_xgboost_cv.RCheers,Chris-ck.mobileOn Dec 9, 2023, at 9:57 AM, Ramon Diaz-Uriarte @.***> wrote: Hi, thanks a lot for SuperLearner! I wonder if it is possible to leverage on xgb.cv to tune ntrees (nrounds in xgboost doc) without doing an explicit grid search over a set of ntrees. One very nice thing of xgb.cv is that, using early_stopping_rounds , we can stop the tunning of ntrees. Thus, when doing a grid search over parameters, we would not need to search over ntrees: just pass a large enough value of ntrees and use early_stopping_rounds (an example of doing a grid search for other parameters using this approach in https://bradleyboehmke.github.io/HOML/gbm.html#xgb-tuning-strategy). I have not found anything that does this with SuperLearner. I guess I would need to write my own, following the examples in https://github.com/ecpolley/SuperLearnerExtra/tree/master/SL (e.g., SL.gbmOOB). Am I missing something obvious?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

rdiaz02 commented 9 months ago

Thanks a lot!!!

rdiaz02 commented 5 months ago

Closing, since this was never a bug to begin with, and the wrapper by @ck37 worked perfectly (I've been happily using a modified version of it).