R/ResurvcvIndividualData.R
ReSurvCV.IndividualDataPP.RdThis function computes a K fold cross-validation of a pre-specified ReSurv model for a given grid of parameters.
# S3 method for class 'IndividualDataPP'
ReSurvCV(
IndividualDataPP,
model,
hparameters_grid,
folds,
random_seed,
continuous_features_scaling_method = "minmax",
print_every_n = 1L,
nrounds = NULL,
early_stopping_rounds = NULL,
epochs = NULL,
parallel = FALSE,
ncores = 1,
num_workers = 0,
verbose = FALSE,
verbose.cv = FALSE
)IndividualDataPP object to use for the ReSurv fit cross-validation.
character, machine learning for cross validation.
list, grid of the hyperparameters to cross-validate.
integer, number of folds (i.e. K).
integer, random seed for making the code reproducible.
character, method for scaling continuous features.
integer, specific to the XGB approach, see xgboost::xgb.train documentation.
integer, specific to XGB, max number of boosting iterations.
integer, specific to the XGB approach, see xgboost::xgb.train documentation.
integer, specific to the NN approach, epochs to be checked.
logical, specific to the NN approach, whether to use parallel computing.
integer, specific to NN, max number of cores used.
numeric, number of workers for the NN approach, multi-process data loading with the specified number of loader worker processes.
logical, whether messages from the machine learning models must be printed.
logical, whether messages from cross-validation must be printed.
Best ReSurv model fit. The output is different depending on the machine learning approach that is required for cross-validation. A list containing:
out.cv: data.frame, total output of the cross-validation (all the input parameters combinations).
out.cv.best.oos: data.frame, combination with the best out of sample likelihood.
For XGB the columns in out.cv and out.cv.best.oos are the hyperparameters booster, eta, max_depth, subsample, alpha, lambda, min_child_weight. They also contain the metrics train.lkh, test.lkh, and the computational time time. For NN the columns in out.cv and out.cv.best.oos are the hyperparameters num_layers, optim, activation, lr, xi, eps, tie, batch_size, early_stopping, patience, node train.lkh test.lkh. They also contain the metrics train.lkh, test.lkh, and the computational time time.