Dear Max,
first of all thank you for this brilliant package and your effort to answer all questions around it. I love caret! It is build so that even I (a surgeon by trade) am able to understand and use it.
According to konradino's code I changed rfFuncs to:
#up rfe
new_rf_up <- rfFuncs
new_rf_up$summary <- twoClassSummary
new_rf_up$fit <- function(x, y, first, last, ...){
attach(loadNamespace("randomForest"))
df_up <- caret::upSample(x, y)
randomForest::randomForest(
df_up[ , names(df_up) != "Class"],
df_up$Class,
importance = (first | last),
...)
}
RNGversion("3.4.0")
set.seed(test)
control.up <- rfeControl(functions=new_rf_up, method="cv", repeats=10, verbose = FALSE,seeds=NULL)
rfe.unbal.silver.up <- rfe(unbal_train_silver[,c(1:41,43:57)], unbal_train_silver[,42], sizes=c(1:57), metric = "Spec", summary=twoClassSummary, rfeControl=control.up, trainControl = fitControl)
As mentioned by you here: https://stackoverflow.com/questions/21088825/feature-selection-in-caret-rfe-sum-with-roc
I can change the formula to use ROC as performance measure. Then I wanted to use metric="Spec", which should work when specifying twoClassSummary.
However I get following error message:
Error in { : task 1 failed - "argument is of length zero"
What is wrong?
Thank you again!
Yours
Markus Schoenberg