jeudi 23 mars 2017

Variable Importance using Random Forest (Caret)

I am using the caret package to carry out a random forest. I have used the following code:

fitControl <- trainControl(## 10-fold CV
  method = "repeatedcv",classProbs=FALSE, 
  number = 10,
  ## repeated ten times
  repeats = 10)

set.seed(1)
newrf=train(y ~ ., data = traindata , method = "rf", 
            trControl = fitControl)

rf_imp = varImp(newrf)

It works alright and it's a regression model. However, when I use the following to see the importance of the variables I get the following error:

Error in varImp[, "%IncMSE"] : subscript out of bounds

Any help will be appreciated.

Aucun commentaire:

Enregistrer un commentaire