I recently created a decision tree model in R using the Party package (Conditional Inference Tree, ctree model).
I generated a visual representation of the decision tree, to see the splits and levels.
I also computed the variables importance using the Caret package.
fit.ctree <- train(formula, data=dat,method='ctree')
ctreeVarImp = varImp(fit.ctree)
I was under the impression that the order of the splits in the tree was related to the variable importance. i.e. the variable at the first split is the most important and so on. When I reviewed the importance of each variable it did not match up to the order of the splits.
Is it possible that the ctree model generated directly using Party is not the same as the one using Caret?
Is the order of importance of the variables in decision trees related to the order of the splits?
ctreeVarImp$model
will tell you the method applied usingtrain()
. You can also simply printctreeVarImp
. $\endgroup$