I am trying to get the permutation importance of my variables from the random forest model I am currently working on.
I am using caret and ranger.
I have tried reading the documentation for ranger, but I still cant see where I am going wrong here.
My code:
set.seed(40)
control.data <- trainControl(method="cv", number=5, sampling ="up", VerboseIter= TRUE, classProbs=TRUE)
rfGrid <- expand.grid(
.mtry=2:6,
.splitrule="gini",
.min.node.size=c(500))
fit.dataup <- train(mort_30 ~ C_SEX+V_AGE+Hemoglobin+Thrombocytes+Leukocytes+CRP,
data=data.train,
method="ranger",
max.depth=5,
num.trees=500,
trControl=control.data,
tuneGrid=rfGrid,
importance="permutation",
local.importance=TRUE,
verbose=TRUE)
But then, when I run this line of code
fit.dataup$variable.importance.local
All I get returned from the console is "NULL".
No error, warning or anything else.
Why can't I get it to work?