Thank you so much! It seems that fit$splits[1,] does not contain the feature ID: "> fit$splits[1,] count ncat improve index adj 124.0000000 -1.0000000 0.3437644 13.5000000 0.0000000 "
However help(rpart.object) says: " splits: a matrix describing the splits. The row label is the name of the split variable,..." I try to get the row label of fit$splits[1,] by "> names(fit$splits[1,]) [1] "count" "ncat" "improve" "index" "adj" " However it has no feature ID. Is this the correct way to get the row label of fit$splits[1,]? Regards, - Tim --- On Fri, 5/8/09, Terry Therneau <thern...@mayo.edu> wrote: From: Terry Therneau <thern...@mayo.edu> Subject: Re: Get (feature, threshold) from Output of rpart() for Stump Tree To: "Tim" <timlee...@yahoo.com> Cc: r-help@r-project.org Date: Friday, May 8, 2009, 8:05 AM --- 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. [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.