Question

Any idea on how to create a decision tree stump for use with boosting in Matlab? I mean is there some parameter I can send to classregtree to make sure i end up with only 1 level? I tried pruning and it doesn't always give a stump (single cut). Sometimes I was only able to get 2 cuts (unbalanced tree).

I'm aware of the ClassificationTree.template and the fitensemble functions but I want to write my own boosting algorithm to use it with LDA or other classifiers which are not provided by fitensemble.

Thanks

Was it helpful?

Solution

I believe you can just set the minparent parameter equal to your number of observations. Using the iris example data:

>> load fisheriris;
>> t = classregtree(meas,species,...
                 'names',{'SL' 'SW' 'PL' 'PW'}, 'minparent', 150)

t = 

Decision tree for classification
1  if PL<2.45 then node 2 elseif PL>=2.45 then node 3 else setosa
2  class = setosa
3  class = versicolor

Not sure, but it may be quicker to eventually code it manually - especially if you're incorporating other custom code anyway. Good luck!

OTHER TIPS

If t1 is your tree, as returned by classregtree, I think you can create a decision stump t2 with the command

t2 = prune(t1, 'level', max(prunelist(t1)-1));

Does that do what you need?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top