Questions tagged [rpart]

An R package for fitting classification and regression trees.

rpart is an package for fitting and trees ().

Repositories

Vignettes

Other resources

Related tags

445 questions
2
votes
0 answers

How the 'rpart' function does cross validation?

I'm kind of a new R user and i'm trying to use rpart to create a decision tree for me over some data. I then use a plot function (FancyPlot) to plot the tree it made. Each node contains several numbers (the %s of instances in the node and the ration…
Yair stern
  • 21
  • 4
2
votes
1 answer

How to print out a rpart tree result in text in Rshiny

You can easily print out an rpart tree result in text in R console with the following command. fit <- rpart(Kyphosis ~ Age + Number + Start, data = kyphosis) print(fit) And it prints out: n= 81 node), split, n, loss, yval, (yprob) *…
kindadolf
  • 209
  • 1
  • 8
2
votes
0 answers

Error while predicting using rpart object

I trained a model using caret package. while predicting using the function is giving an error. In my model only two variable are in final selection. while predicting on a new dataset(which has only model selected features), giving an error: "object…
Sivaji
  • 164
  • 9
2
votes
1 answer

How do I display proper countries instead of "cegh"?

As a beginner to R, I create a classification tree using the provided "car.test.frame" dataset that predicts mileage based on the country. My commands entered were: > z.auto <- rpart(Mileage ~ Country, car.test.frame, method="class") >…
user64698
2
votes
1 answer

How to get percentages from decision tree for each node

How could I create a table that includes the percentages for each node in the plot below? library(rpart) library(rattle) library(rpart.plot) library(RColorBrewer) fit <- rpart(Species ~ ., data=iris, method="class") fancyRpartPlot(fit) It results…
Tyler
  • 1,050
  • 2
  • 14
  • 24
2
votes
2 answers

R problems using rpart with 4000 records and 13 attributes

I have attempted to email the author of this package without success, just wondering if anybody else has experienced this. I am having an using rpart on 4000 rows of data with 13 attributes. I can run the same test on 300 rows of the same data with…
josh
  • 438
  • 4
  • 10
2
votes
1 answer

rpart not splitting obvious nodes

I am using a data set of about 54K records and 5 classes(pop) of which one class is insignicant. I am using the caret package and the following to run rpart: model <- train(pop ~ pe + chl_small, method = "rpart", data = training) and I get the…
Sanjoy
  • 135
  • 1
  • 3
  • 12
2
votes
0 answers

rpart finding the observations in each node

I have created a decision tree using rpart, and I am wondering how to find exactly which cases of the training data are falling into each terminal node. I followed the answer in this link: How to count the observations falling in each node of a…
Linda
  • 41
  • 1
  • 1
  • 4
2
votes
2 answers

rpart doesn't build a full tree – problems with cp?

I'm trying to build a full tree by setting control to rpart.control(minsplit=2, minbucket = 1,cp=0), but it doesn't work. I think the reason may be that the summary tree with 4 splits has cp = 0, but this tree isn't full, so its cp should be > 0. I…
myszzzzz
  • 21
  • 2
2
votes
2 answers

Issues with predict function when building a CART model via CrossValidation using the train command

I am trying to build a CART model via cross validation using the train function of "caret" package. My data is 4500 x 110 data frame, where all the predictor variables (except the first two, UserId and YOB (Year of Birth) which I am not using for…
user62198
  • 1,744
  • 2
  • 13
  • 17
2
votes
1 answer

what's the meaning of plotcp result in rpart?

Someone know what that means of horizontal line means?I got the explanation in R: minline:whether a horizontal line is drawn 1SE above the minimum of the curve. What's 1SE??
user3172776
  • 211
  • 1
  • 3
  • 5
2
votes
1 answer

rpart.control minsplit not changing tree

I am playing with rpart. I am using a play data set of a bank with 5000 rows, with 7 IVs and the class has 2 factors. the original model is (no control arguments set): UB_rpart <- rpart(UB_tree, method="class", data=UBank_train) I then create a…
mpg
  • 3,679
  • 8
  • 36
  • 45
2
votes
0 answers

Prediction with RPART in R

I've got a list of trainingsets (each with 944 instances) and a list of testsets (each with 188 instances). I want to make a model from my first trainingset and test it on my first testset. I've got the following code: traindata <-…
Silke
  • 177
  • 1
  • 11
2
votes
1 answer

rpart - infinite loop

I'm trying to perform classification with rpart on dataset with 16 variables and 420 observations (the dataset is a subset of http://archive.ics.uci.edu/ml/datasets/Arrhythmia dataset; I only chose certain variables and excluded missing…
1
vote
2 answers

rpart package installation in R

I am trying to install "rpart" package in R. But I am getting the following error. > install.packages('rpart') Warning in install.packages("rpart") : argument 'lib' is missing: using '/home/sandeep/R/i686-pc-linux-gnu-library/2.11' Warning…
Sandeep
  • 663
  • 2
  • 8
  • 18