mlr-org / mlr3tuning

Hyperparameter optimization package of the mlr3 ecosystem
https://mlr3tuning.mlr-org.com/
GNU Lesser General Public License v3.0
55 stars 5 forks source link

Proper implementation of early_stopping_rounds for xgboost #463

Closed chuckgrigsby0 closed 3 weeks ago

chuckgrigsby0 commented 3 weeks ago

I am trying to implement early stopping using the xgboost algorithm. However, I receive an error when I use callbacks = clbk("mlr3tuning.early_stopping").

Error: Element with key 'mlr3tuning.early_stopping' not found in DictionaryCallbacks!

There also seems to be an issue with the early_stopping_set parameter. I have tried following these examples:

https://mlr3tuning.mlr-org.com/reference/mlr3tuning.early_stopping.html. https://mlr-org.com/gallery/optimization/2022-11-04-early-stopping-with-xgboost/

Is there an alternative solution to make early stopping work?

Thanks for anyone's help!

Regards, Chuck

be-marc commented 3 weeks ago

Sorry the API changed recently. See the new book chapter on internal tuning for examples https://829-merge--mlr3book.netlify.app/chapters/chapter15/predsets_valid_inttune.

chuckgrigsby0 commented 3 weeks ago

Thanks for the quick reply. I was able to follow the examples in the link that you provided and solve my problem. In my case, I wanted to use a 'design_points' for a set of sampled points in tnr(). Therefore, I needed to use both the search_space and internal_search_space parameters.

be-marc commented 3 weeks ago

You're welcome. The chapter is now merged to the book -> https://mlr3book.mlr-org.com/chapters/chapter15/predsets_valid_inttune.html