How can I limit the depth of a decision tree using C4.5 in Weka?

29 Views Asked by At

I am trying to use Weka and the J48 classifier, specifically for the C4.5 algorithm. Specifically, I am looking to limit the depth of the decision tree produced (1 layer, 2 layers, etc.) but I do not need to exclude specific attributes.

Pointedly, this is probably technically "pre-pruning" - can the tree be built "layer by layer" to be better examined?

1

There are 1 best solutions below

0
fracpete On

J48 does not have an explicit option to limit the depth of the tree.

You will need to use another tree algorithm like REPTree (-L) or RandomForest (-depth) in order to get the control that you want.