0
votes

Can a decision tree be forced into a specific degree even if previously discarded?

I tried to build a decision tree with Party Package (ctree) but it is ignored from the parameters/categories that are set up. Is there a way to include a decision tree with all of the set categories (even the results are close)? I want to force the tree to minimum number of nodes.

For example, in the attched plot, there is 7 nodes. I want to force the tree to be with 10 nodes. This is possible?

Thanks!

Optimum tree for iris

1

1 Answers

0
votes

From your question it's not clear what you are trying to achieve. Add reproducible code and describe your issue. Here is an example how you can parameterize number of nodes/trees if needed:

library(caret)
modFit<-train(classifier~., data=training, method="rf", ntree=100, importance=TRUE, maxnodes=3)

More details about tree-based models (with package 'caret'):

http://topepo.github.io/caret/Tree_Based_Model.html