Displaying 20 results from an estimated 5000 matches similar to: "rpart subsets"
2002 Jan 28
0
rpart subset fix
(Apparently, I posted this to the wrong place. I am hopefully posting this
is the correct place now. If not, please advise.)
A few weeks back I posted that the subset feature of rpart was not working
when predicting a categorical variable. I was able to figure out a simple
solution to the problem that I hope can be included in future editions of
rpart. I also include a fix for another related
2009 Apr 30
1
unexpected behavior of rpart 3.1-43, loss matrix
Hi,
I just noticed that rpart behaves unexpectecly, when performing
classification learning and specifying a loss matrix.
if the response variable y is a factor and if not all levels of the
factor occur in the observations, rpart exits with an error:
> df=data.frame(attr=1:5,class=factor(c(2,3,1,5,3),levels=1:6))
> rpart(class~attr,df,parms=list(loss=matrix(0,6,6)))
Error in
2002 Mar 13
0
rpart error with 0-frequency factor levels (with partial fix) (PR#1378)
(I'm sending to r-bugs because rpart is one of the recommended packages and
is always installed. I'm also sending it directly to Dr. Ripley, as the
maintainer.)
rpart working as a classifier does not work (produces no splits) when the
class indicator has no instances of one of the factor levels, as long as the
factor level is not the final level. I have at least a partial fix, which I
2011 Jun 21
0
How does rpart computes "improve" for split="information"?? (which seems to be different then the "gini" case)
Hello dear R-help members,
I would appreciate any help in understanding how the rpart function computes
the "improve" (which is given in fit$split) when using the
split='information' parameter.
Thanks to Professor Atkinson help, I was able to find how this is done in
the case that split='gini'. By following the explanation here:
2011 Jun 13
1
In rpart, how is "improve" calculated? (in the "class" case)
Hi all,
I apologies in advance if I am missing something very simple here, but since
I failed at resolving this myself, I'm sending this question to the list.
I would appreciate any help in understanding how the rpart function is
(exactly) computing the "improve" (which is given in fit$split), and how it
differs when using the split='information' vs split='gini'
2005 May 25
0
Error with user defined split function in rpart (PR#7895)
Full_Name: Bill Wheeler
Version: 2.0.1
OS: Windows 2000
Submission from: (NULL) (67.130.36.229)
The program to reproduce the error is below. I am calling rpart with a
user-defined split function for a binary response variable and one continuous
independent variable. The split function works for some datasets but not
others.
The error is:
Error in "$<-.data.frame"(`*tmp*`,
2005 Jan 17
1
rpart
Hi, there:
I am working on a classification problem by using
rpart. when my response variable y is binary, the
trees grow very fast, but if I add one more case to y,
that is making y has 3 cases, the tree growing cannot
be finished.
the command looks like:
x<-rpart(r0$V142~.,data=r0[,1:141],
parms=list(split='gini'), cp=0.01)
changing cp or removing parms does not help.
2002 Mar 29
1
memory error with rpart()
Dear all,
I have a 100 iteration loop. Within each loop, there are some calls
to rpart() like:
ctl <- rpart.control(maxcompete=0, maxsurrogate=0, maxdepth=10)
temp <- rpart(y~., x, w=wt, method="class", parms=list(split="gini"),
control=ctl)
res <- log(predict.rpart(temp, type="prob"))
newres <- log(predict.rpart(temp, newdata=newx,
2008 Oct 27
0
Displaying number of Y/N affected by tree in rule form RE: R question/request on rules from rpart
Hi Prof. Williams,
thanks for your suggestion. The updated code is below.
It turns out it was a matter of displaying the second column in
yval to get the number of N and subtracting it from the n column in the
frame to get the number of Y remaining in a binary example.
once this is added now the function returns the rules along with
Y and N count affected by the resulting rule.
I am ccing
2012 Apr 03
1
rpart error message
Hi R-helpers,
I am using rpart package for decision tree using R.We are invoking R
environment through JRI from our java application.Hence, the result of R
command is returned in REXP and we use geterrMessage() to retrieve the
error.
When we execute the following command,
cnr_model<-rpart(as.factor(Species)~Sepal Length+Sepal Width+Petal Length,
method="class",
2005 Aug 26
1
Help in Compliling user -defined functions in Rpart
I have been trying to write my own user defined function in Rpart.I
imitated the anova splitting rule which is given as an example.In the
work I am doing ,I am calculating the concentration index(ci) ,which
is in between -1 and +1.So my deviance is given by
abs(ci)*(1-abs(ci)).Now when I run rpart incorporating this user
defined function i get the following error message:
Error in
2011 Jan 11
0
Some questions concerning survival tree analysis using the rpart module
All the documentation that I have on survival splitting is found in the
technical report you mention. However, there is both a short form and a
long form of this on our web site, did you get the larger one (52
pages)? I admit it is not a lot.
There are no other split algorithms implimented for survival data. It
would be possible to add your own. Attached is a slightly updated
version of the
2005 Mar 15
0
need help with plot.rpart and text.rpart
Hi,
I am new to R and need help with rpart. I am trying to create a
classification tree using rpart. In order to plot the reults I use the
plot function and the text function to label the plot of the tree
dendrogram with text. The documentation of text.rpart says : "For the
"class" method, label="yval" results in the factor levels being used,
"yprob" results
2011 Jan 26
1
Inconsistencies in the rpart.object help file?
Hello all,
I'm was going through the help for
?rpart.object
And noticed some inconsistencies, Some might be a mistake in the help file
and some might be my misunderstanding.
The help in the section:
value -> frame (first paragraph), states that:
> yval, the fitted value of the response at each node, *and splits, a two
> column matrix of left and right split labels for each node. *
2004 May 07
0
rpart for CART with weights/priors
Hi,
I have a technical question about rpart:
according to Breiman et al. 1984, different costs for misclassification in
CART can be modelled
either by means of modifying the loss matrix or by means of using different
prior probabilities for the classes,
which again should have the same effect as using different weights for the
response classes.
What I tried was this:
library(rpart)
2005 Jan 25
0
Collapsing solution to the question discussed above: Re: multi-class classification using rpart
You could break your 3 class problem into several (2 or 3) 2 class problems,
and then use Andy's suggestion (see the CART book). There are several ways
to break the problem into 2 class problems, and several ways to combine the
resulting classifiers. Tom Dietterich, Jerry Friedman, Trevor Hastie and Rob
Tibshirani, among others, have articles on the question, in places like
Annals of
2006 Nov 20
0
rpart
Dear r-help-list:
I' got a question about the computation of the improve of a split. The following is an extract of an output of the summary of a tree:
Node number 1: 600 observations, complexity param=0.007272727
predicted class=0 expected loss=0.1666667
class counts: 500 100
probabilities: 0.833 0.167
left son=2 (211 obs) right son=3 (389 obs)
Primary splits:
x4
2005 Jun 14
0
bug in rpart?
Dear R-helpers,
Can you help me to see why "code 1" gives error
while "code 2" runs fine? The only difference in
the data is the distribution of age categories.
I am attaching the session after the code.
Many thanks.
XL
library(survival)
library(rpart)
# code 1
n <- 20
age <- rep(1:3, c(2, 3, 15))
eg<- data.frame(rexp(n), rbinom(n,1,prob=.3), age=age)
2005 Jan 25
3
multi-class classification using rpart
Hi,
I am trying to make a multi-class classification tree by using rpart.
I used MASS package'd data: fgl to test and it works well.
However, when I used my small-sampled data as below, the program seems
to take forever. I am not sure if it is due to slowness or there is
something wrong with my codes or data manipulation.
Please be advised !
The data is described as the output from str()
2009 May 21
1
Rpart - best split selection for class method and Gini splitting index
Dear R-users,
I'm working with the Rpart package and trying to understand how the
procedure select the best split in the case the method "class" and the
splitting index "Gini" are used. In particular I'd like to have look to the
source code that works out the best split for un unordered predictor.
Does anyone can suggest me which functions in the sources I should