View source: R/caretRFRepeatedCV.R
| caretRFRepeatedCV | R Documentation |
Random Forest with Repeated Cross Validation
x |
|
features |
Features to use for RF model. |
sample_group |
Variable in |
folds |
Repeated hold-out to apply. Default is '5' |
repeats |
Number of repeats. Default is '100' |
seed |
Variable in |
metric |
See |
print_final |
Logical. Default is TRUE. Prints the final model output |
... |
Additional arguments passed on to |
Performs a Random forest with repeated Cross-validation. The function
as the name suggests uses caret under the hood. Make sure to cite the
original caret package with correct version number.
A list is returned of class train. See train
Sudarshan A. Shetty
train
library(biomeStats)
library(microbiome)
library(biomeUtils)
ps <- FuentesIliGutData |>
microbiome::transform("compositional") |>
biomeUtils::mutateTaxaTable(FeatureID = taxa_names(FuentesIliGutData)) |>
biomeUtils::filterSampleData(ILI != "L2")
# select features reduced for speed in example
features.to.use <- core_members(ps, 0.01, 25/100)
# for example reduce folds and repeats
rf.fit <- caretRFRepeatedCV(ps,
sample_group = "ILI",
features = features.to.use,
folds = 3,
repeats = 5,
set.seed = 1819,
metric = "Accuracy",
print_final=TRUE)
print(rf.fit)
#Check splits for each fold
#table(rf.fit$pred$Resample, rf.fit$pred$obs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.