I'm training a random forest model to predict a categorical outcome. Is there any way I can make the model apply four methods of sampling without having to write four separate codes (one for each sampling method)?
My code is as follows:
set.seed(17) ctrl = trainControl(method = "repeatedcv", number=10, repeats=3, sampling = "down", classProbs = TRUE, savePredictions=TRUE, summaryFunction = twoClassSummary) grid = expand.grid(.mtry=c(1:12)) m.rf = train(fast11 ~ ., data = fast11.inp.1, method = "rf", metric = "ROC", trControl=ctrl, tuneGrid=grid) m.rf
I wanted to use "down, up, smote, rose" in the same code, instead of writing three identical codes just replacing "down" for "up", "rose" and "smote".