Hello, I am learning caret package, and I want to use the RFE to reduce the feature. I want to use RFE coupled Random Forest (RFE+FR) to complete this task. As we know, there are a number of pre-defined sets of functions, like random Forest(rfFuncs), however,I want to tune the parameters (mtr) when RFE, and then I write code below, but there is something wrong message, How can I deal with it? > rfGrid<-expand.grid(.mtry=c(1:2)) > rfectrl<-rfeControl(functions=caretFuncs,method="cv",verbose=F,returnResamp="final",number=10) > subsets<-c(3,4) > set.seed(2) > rf.RFE<-rfe(trx,try,sizes=subsets,rfeControl=rfectrl,method="rf",tuneGrid=rfGrid) Loading required package: class
Attaching package: 'class' The following object(s) are masked from package:reshape : condense Fitting: mtry=1 Fitting: mtry=2 Error in varImp.randomForest(object$finalModel, ...) : subscript out of bounds In addition: Warning message: package 'e1071' was built under R version 2.10.1 At the same time, If I want to use RFE+SVM, RFE+nnet, and so on ,how can I do? I have try RFE+SVM, also wrong message:> set.seed(1) > svmProfile<-rfe(trx,try,sizes=c(1:3), + rfeControl=rfeControl(functions=caretFuncs,method="cv", + verbose=F,returnResamp="final",number=10), + method="svmRadial",tuneLength=5) Fitting: sigma=0.009246713, C=0.1 Fitting: sigma=0.009246713, C=1 Fitting: sigma=0.009246713, C=10 Fitting: sigma=0.009246713, C=100 Fitting: sigma=0.009246713, C=1000 Error in rfeControl$functions$rank(fitObject, .x, y) : need importance columns for each class thank you! -- View this message in context: http://n4.nabble.com/caret-package-how-can-I-deal-with-RFE-SVM-wrong-message-tp1678800p1678800.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.