I'm working with classification and regression trees – I can define them, prune them, and even view the pruned tree with the predictor variable names displayed using the view() function. However, for an optimally pruned tree, I want to know which of the 6 predictor variables are actually being used. I can see this in the view(Tree) display, but I need some sort of index to be returned in my code, so I don't have to manually open a tree, assess the variables, and store which ones ended up being significant every time. Is there a way to do this?
To reiterate – for a classregtree and a given pruning level, how can I extract the predictor variables (either a name or index) that are being used? My optimally pruned trees tend to disregard at least one of my 6 predictor variables, and I want to know which are actually used without manually viewing the tree.
I'm using Matlab 7.12.0.635 win64 Thank you very much!
Best Answer