I use function C5imp()
to analyze the variable importance of a C5.0 model built with package {C5.0}
, which is a wrapper around the original C-code by Quinlan. The (unscaled) importance scores for one tree report the "percentage of training set samples that fall into all the terminal nodes after the split". While different from mean decrease in the split criterion typically used for gradient boosted trees (see nice discussion here), this seems to be the same as the "cover" importance metric reported by the xgboost package.
However, for the boosted model (i.e. trials>1
), the output suggests that the importance reports the maximum percentage for any tree, rather than an average over all trees. This results in a lot of variables having an importance score of 100 when the number of trials grows, since many variables end up at the top of a tree at some point.
library(C50)
# Experiment with n = 1 and n = 5
n <- 5
C5boosted <- C5.0(x = iris[, 1:4], y = iris$Species, trials = n)
# Plot importance
# Variable importance for sepal.width is 25...
C5imp(C5boosted, pct = FALSE)
# Plot each of the trees
# ... but sepal.width is only used in one tree
for(i in 0:(n-1)){
plot(C5boosted, trial = i)
}
n <- 20
C5boosted <- C5.0(x = iris[, 1:4], y = iris$Species, trials = n)
C5imp(C5boosted, pct = FALSE)
# Overall
#Sepal.Width 100.00
#Petal.Length 100.00
#Petal.Width 100.00
#Sepal.Length 82.67
Even at 20 trials, the importance for most variables is close to 100, so there is no clear indication that sepal.width is in fact much more important in the trees.
Is there a reason why C5.0 would not average over boosted trees but rather take the maximum coverage to calculate the coverage importance score?