Skip to content
Prev 179697 / 398502 Next

Get (feature, threshold) from Output of rpart() for Stump Tree

--- begin included message --
Hi, 
I have a question regarding how to get some partial information
from the output of rpart, which could be used as the first argument to
predict. For example, in my code, I try to learn a stump tree (decision
tree of depth 2):

?? "fit??????? <- rpart(y~bx, weights = w/mean(w), control = cntrl)

--- end inclusion ---

 1. For stump trees, you can use the depth option in rpart.control to get a 
small tree.  You also might want to set maxsurrogate=0 for speed.
 
 2. Try help(rpart.object) for more information on what is contained in the 
returned rpart object.  In your case fit$splits[1,] would contain all that you 
need.
 
 	Terry T.