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?
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.