3

I'm using Matlab's fitensemble function on a data with 8 features and 5000 samples. With the following command I can train a model:

ada= fitensemble(datafeatures,dataclass,'AdaBoostM1',200,'tree');

My question: How can I create weak learners with one single split (two leafs instead of many leafs)? I know the following command controls the way the trees are created: t = ClassificationTree.template, but I only see minimal parameters for tree depth. How can I set an upper limit?

Leeor
  • 627
  • 7
  • 24

2 Answers2

0

use it:

t = templateTree('minleaf',5);
ens = fitensemble(X,Y,'AdaBoostM2',50,t);

you can see:

http://www.mathworks.com/help/stats/ensemble-methods.html

0

With following three parameters you are able to control depth or leafiness of a tree.

1- MaxNum: Set a large value for MaxNumSplits to get a deep tree

2- MinLeaf: Set small values of MinLeafSize to get deep trees

3- MinParent: Set small values of MinParentSize to get deep trees

And this is a way that you can set them up. Assumed, you use AdaBoost for a multi classification problem.

DTree = templateTree('MinLeaf',1,'MinParent',4);

Ensemble=fitensemble(Train,Respones,'AdaBoostM2',500,DTree);

Check this link for more detail:

http://au.mathworks.com/help/stats/classification-trees-and-regression-trees.html#bsw6baj