View source: R/feature_selection.R
| recursive_feature_elimination | R Documentation |
Performs recursive feature elimination on a data matrix.
recursive_feature_elimination(
datamat,
samples.class,
functions = caret::rfFuncs,
method = "cv",
repeats = 5,
number = 10,
subsets = 2^(2:4)
)
datamat |
Data matrix with features in rows and samples in columns. |
samples.class |
Sample class labels. |
functions |
Caret RFE functions list. |
method |
Resampling method passed to |
repeats |
Number of repeats for resampling. |
number |
Number of resampling folds or iterations. |
subsets |
Subset sizes to evaluate. |
An rfe object.
if (requireNamespace("randomForest", quietly = TRUE)) {
datamat <- matrix(
rnorm(20),
nrow = 4,
dimnames = list(paste0("x", 1:4), paste0("s", 1:5))
)
classes <- factor(c("A", "A", "B", "B", "A"))
recursive_feature_elimination(datamat, classes, caret::rfFuncs)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.