This function performs similar operations to xgboost::xgb.cv, but with the
operations performed in a memory efficient manner. Unlike xgboost::xgb.cv,
this version does not load all folds into memory from the start. Rather it
loads each fold into memory sequentially, and trains trains each fold using
xgboost::xgb.train. This allows larger datasets to be cross-validated.
The main disadvantage of this function is that it is not possible to perform
early stopping based the results of all folds. The function does accept an
early stopping argument, but this is applied to each fold separately. This
means that different folds can (and should be expected to) train for a
different number of rounds.
This function also allows for a train-test split (as opposed to multiple)
folds. This is done by providing a value of less than 1 to nfold, or a list
of 1 fold to folds. This is not possible with xgboost::xgb.cv, but can be
desirable if there is downstream processing that depends on an
xgb.cv.synchromous object (which is the return object of both this function
and xgboost::xgb.cv).
Otherwise, where possible this function tries to return the same data
structure as xgboost::xgb.cv, with the exception of callbacks (not supported
as a field within the return object). To save models, use the save_models
argument, rather than the cb.cv.predict(save_models = TRUE) callback.