Hi All,
I wanted to generate a labelled horizontal barplot using within-class local variable importance. I wondered if it would be possible for someone to demonstrate this using the following code below?
This code was supplied by the author of the 'ranger' package on the following link: variable importance by class · Issue #552 · imbs-hl/ranger · GitHub.
With this in mind, I wondered if it was possible for someone to demonstrate local variable variable importance for one of the classes below.
All help would be appreciated, thanks.
library(ranger)
rf <- ranger(Species ~ ., iris, importance = "permutation",
local.importance = TRUE)
rf$variable.importance.local
colMeans(rf$variable.importance.local[iris$Species == "setosa", ])
colMeans(rf$variable.importance.local[iris$Species == "versicolor", ])
colMeans(rf$variable.importance.local[iris$Species == "virginica", ]