library(randomForest)
data(iris)
fit <- randomForest(Species ~ ., data=iris, importance=TRUE);
fit.imp<-importance(fit)
fit.imp
columns 1-3 show the class-specific variable importance for the Mean Decrease Acuracy measure. Note that for Sepal.Length, the class-specific VIs are lower than the Mean VI values for Accuracy.
I have two questions about the implementation of RandomForest in R:
1) How are the class-specific importances calculated (i.e., how is it possible for the class means to be lower than the total mean?)? I understand the theory of how permutation accuracy is calculated, but I am not a mathematician so reading the raw equations doesn't help me much. Any quick explanation would be much appreciated before I dive into the RF package source code.
2) Is there a way to calculate class-specific Gini metrics, not class-specific Accuracy metrics (the default)? I really want to do this. I was about to start trying to code a way to do it, but thought I would ask here first.
fit.imp2 = importance(fit, scale=FALSE)
it is clear. Any help with my second question, though, would be much appreciated! $\endgroup$