I've been using the importance() function from the randomForest package in R but I couldn't understand what does the first two variables in the output represent.Currently I'm using the random forest for predicting a binary classification and my output variable's name are 0 and 1. Here's the output of the function:

                       0           1 MeanDecreaseAccuracy MeanDecreaseGini
c_heavi        0.071845686  0.49215788         0.3987539746     0.1841476135
c_meet         1.794639270  0.70902200         1.6953022156     0.3745302757
c_time         0.773390581  0.67278790         0.8795774923     0.8383488173
p_communic    -0.684529840  0.29631260        -0.2075788552     0.0910556260

What does the first two column represent ("0" and "1")? Also what is the unit of measure used in "MeanDecreaseAccuracy"?

Thanks everybody for the help, and sorry if its a dumb question but I've been searching for a while with no results.


Copied from importance function details:

Here are the definitions of the variable importance measures. The first measure is computed from permuting OOB data: For each tree, the prediction error on the out-of-bag portion of the data is recorded (error rate for classification, MSE for regression). Then the same is done after permuting each predictor variable. The difference between the two are then averaged over all trees, and nor- malized by the standard deviation of the differences. If the standard deviation of the differences is equal to 0 for a variable, the division is not done (but the average is almost always equal to 0 in that case). The second measure is the total decrease in node impurities from splitting on the variable, averaged over all trees. For classification, the node impurity is measured by the Gini index. For regression, it is measured by residual sum of squares.

Back to your questions:

For classification, the first two columns are the measures computed as mean descrease in accuracy applying to your “zero” class and your “one” class.

Accuracy is a dimensionless quantity.

Also note that permutation of variables is done because dropping the variable is a false comparison to the method of creating one of the individual trees.

  • $\begingroup$ Thank you, my principal doubt is what "mean decrease in accuracy apply to a class" means. If 0 is my positive class in the confusion matrix, does accuracy applied to class 0 means mean reduction in sensitivity, while 1 means mean reduction in specificity? $\endgroup$
    – user295390
    Sep 1 '20 at 8:37
  • 1
    $\begingroup$ Accuracy is the proportion of correct predictions (both true positives and true negatives) among the total number of cases examined. Sensitivity is true positive rate, specificity is true negative rate. So an increase in accuracy corresponds to an increase In at least one of sensitivity or specificity. You can get an increase in accuracy if both sensitivity and specificity increase, or just one increases and the other is constant or decreases by a relatively small amount. $\endgroup$ Sep 1 '20 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.