A caret model is trained on training data according to resampling indices specified by the user, and error is calculated on out of sample data. Variable importance is determined by calculating the change in out of sample model performance when a variable is removed relative to baseline out of sample performance when all variables are included.
1 2 | calculate_marginal_vimp(x, y, method, loss_metric, resampling_indices, tuneGrid,
trControl, vars = names(x), allow_parallel = FALSE, ...)
|
x |
data.table containing predictor variables |
y |
vector containing target variable |
method |
character string defining method to pass to caret |
loss_metric |
character. Loss metric to evaluate accuracy of model |
resampling_indices |
a list of integer vectors corresponding to the row indices used for each resampling iteration |
tuneGrid |
a data.frame containing hyperparameter values for caret. Should only contain one value for each hyperparameter. Set to NULL if caret method does not have any hyperparameter values. |
trControl |
trainControl object to be passed to caret train. |
vars |
character vector specifying variables for which to determine marginal importance
Defaults to all predictor variables in |
allow_parallel |
boolean for parallel execution. If set to TRUE, user must specify parallel backend in their R session to take advantage of multiple cores. Defaults to FALSE. |
... |
additional arguments to pass to caret train |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.