prefit xgboost model in xrf_fit()
, allow early stopping
#60
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()
mtry
fromcolsample_bytree
tocolsample_bynode
(and is now thus consistent with parsnip, see mtry maps to wrong parameter for XGBoost parsnip#495)xrf
engine and removesmtry
tests that are now redundant with parsnipIt does so by making use of the
prefit_xgb
argument toxrf::xrf()
—instead of havingxrf
handle the xgboost training, we useparsnip::xgb_train
and 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_control
argument, where all arguments passed toxgb_control
are passed toxgboost::xbg.train()
'sparam
argument—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_rounds
is 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_xgb
toxrf::xrf.formula()
.Related to tidymodels/parsnip#749!