prefit xgboost model in xrf_fit(), allow early stopping#60
Merged
Conversation
EmilHvitfeldt
requested changes
Jun 8, 2022
Member
EmilHvitfeldt
left a comment
There was a problem hiding this comment.
Couple of small changes to the tests and I think we are good here!
Contributor
Author
|
Ah, figured it out🙈 Wrapping in |
EmilHvitfeldt
approved these changes
Jun 8, 2022
|
This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR:
xrf::xrf()mtryfromcolsample_bytreetocolsample_bynode(and is now thus consistent with parsnip, see mtry maps to wrong parameter for XGBoost parsnip#495)xrfengine and removesmtrytests that are now redundant with parsnipIt does so by making use of the
prefit_xgbargument toxrf::xrf()—instead of havingxrfhandle the xgboost training, we useparsnip::xgb_trainand pass the pre-fit xgboost model toxrf.Justification for pre-fitting
The pre-fitting makes some parts of wrapping easier for us, but was initially a need for early stopping:xrf::xrf.formula()wraps bothxgboost::xgb.train()andglmnet::glmnet().xrf::xrf.formula()takes in anxgb_controlargument, where all arguments passed toxgb_controlare passed toxgboost::xbg.train()'sparamargument—this is currently the only way one can pass arguments toxgboost::xgb.train()throughxrf::xrf.formula().This is an issue for early stopping, as
early_stopping_roundsis a main argument toxgboost::xgb.train()and cannot be passed throughparam. Thus, if we wanted to implement an interface for early stopping, we'd either:xrf::xrf.formula()as main arguments toxgboost::xbg.train()prefit_xgbtoxrf::xrf.formula().Related to tidymodels/parsnip#749!