- y
Response vector. For classification this should be a factor.
- x
Matrix or dataframe of predictors
- method
String specifying which model to use. See caret::train() for
details.
- filterFUN
Filter function, e.g. ttest_filter() or relieff_filter().
Any function can be provided and is passed y and x. Ideally returns a
numeric vector with indices of filtered predictors. The custom function can
return a character vector of names of the filtered predictors, but this
will not work with the penalty.factor argument in nestcv.glmnet().
- filter_options
List of additional arguments passed to the filter
function specified by filterFUN.
- weights
Weights applied to each sample for models which can use
weights. Note weights and balance cannot be used at the same time.
Weights are not applied in filters.
- balance
Specifies method for dealing with imbalanced class data.
Current options are "randomsample" or "smote". See randomsample() and
smote()
- balance_options
List of additional arguments passed to the balancing
function
- modifyX
Character string specifying the name of a function to modify
x. This can be an imputation function for replacing missing values, or a
more complex function which alters or even adds columns to x. The
required return value of this function depends on the modifyX_useY
setting.
- modifyX_useY
Logical value whether the x modifying function makes
use of response training data from y. If FALSE then the modifyX
function simply needs to return a modified x object. If TRUE then the
modifyX function must return a model type object on which predict() can
be called, so that train and test partitions of x can be modified
independently.
- modifyX_options
List of additional arguments passed to the x
modifying function
- outer_method
String of either "cv" or "LOOCV" specifying whether
to do k-fold CV or leave one out CV (LOOCV) for the outer folds
- n_outer_folds
Number of outer CV folds
- n_inner_folds
Sets number of inner CV folds. Note if trControl or
inner_folds is specified then these supersede n_inner_folds.
- outer_folds
Optional list containing indices of test folds for outer
CV. If supplied, n_outer_folds is ignored.
- inner_folds
Optional list of test fold indices for inner CV. This must
be structured as a list of the outer folds each containing a list of inner
folds. Can only be supplied if balancing is not applied. If supplied,
n_inner_folds is ignored.
- pass_outer_folds
Logical indicating whether the same outer folds are
used for fitting of the final model when final CV is applied. Note this can
only be applied when n_outer_folds and the number of inner CV folds
specified in n_inner_folds or trControl are the same and that no
balancing is applied.
- parallel_mode
Either "mclapply", "parLapply" or "future". This
determines which parallel backend to use. The default is
parallel::mclapply on unix/mac and parallel::parLapply on windows.
- cv.cores
Number of cores for parallel processing of the outer loops.
Ignored if parallel_mode = "future".
- metric
A string that specifies what summary metric will be used to
select the optimal model. By default, "logLoss" is used for classification
and "RMSE" is used for regression. Note this differs from the default
setting in caret which uses "Accuracy" for classification. See details.
- trControl
A list of values generated by the caret function
caret::trainControl(). This defines how inner CV training through caret
is performed. Default for the inner loop is 10-fold CV. Setting this
argument overrules n_inner_folds. See
http://topepo.github.io/caret/using-your-own-model-in-train.html.
- tuneGrid
Data frame of tuning values, see caret::train().
- savePredictions
Indicates whether hold-out predictions for each inner
CV fold should be saved for ROC curves, accuracy etc see
caret::trainControl. Default is "final" to capture predictions for
inner CV ROC.
- outer_train_predict
Logical whether to save predictions on outer
training folds to calculate performance on outer training folds.
- finalCV
Logical whether to perform one last round of CV on the whole
dataset to determine the final model parameters. If set to FALSE, the
median of the best hyperparameters from outer CV folds for continuous/
ordinal hyperparameters, or highest voted for categorical hyperparameters,
are used to fit the final model. Performance metrics are independent of
this last step. If set to NA, final model fitting is skipped altogether,
which gives a useful speed boost if performance metrics are all that is
needed.
- na.option
Character value specifying how NAs are dealt with.
"omit" is equivalent to na.action = na.omit. "omitcol" removes cases
if there are NA in 'y', but columns (predictors) containing NA are
removed from 'x' to preserve cases. Any other value means that NA are
ignored (a message is given).
- verbose
Logical whether to print messages and show progress
- ...
Arguments passed to caret::train()