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
0
votes
0 answers

R rpart how to change predicting FALSE vs TRUE

I am new to decision trees. I am testing rpart function to create a decision tree for a logical variable using continuous as well as factor variables. The variable I am trying to predict is FALSE 88% of the times. Is it possible to tell rpart to…
NewML
  • 1
0
votes
0 answers

rpart - mysterious parameter of rpart? that leads to no split at level 1 (while 2 splits are done with level 2 !!)

I was doing a simple test on how to create a regression tree with rpart and I found out a suprising behaviour of R with my hand made data: - when growing a tree with maxdepth = 1 --> no split is done ! - when growing a tree with maxdepth = 2 --> 2…
chapelon
  • 133
  • 2
  • 8
0
votes
1 answer

Machine learning in R is slow with decisiontree

I'm trying to predict the type of a vehicle (model) based on the vehicle identification number (VIN). The first 10 positions of the VIN says something about the type, so I use them as variables. See an example of the data below: positie_1_tm_3…
Donald
  • 145
  • 2
  • 4
  • 14
0
votes
2 answers

Creating a formula using 'rpart' with multiple variables before the ~ symbol

I'm pretty sure my question doesn't totally make sense, but I'm trying to create a classification tree in R using 'rpart' and initially had the fit as something like: fit <- rpart(success ~ A + B + C) I have now realised 'success' might also be…
dsnOwhiskey
  • 141
  • 1
  • 12
0
votes
1 answer

How to get percentages using rpart

So I'm working on a project with decision trees, and I need to know how to get the percentages for each of the nodes. Here is my approximate code: fit <- rpart(Y ~ a + b + c, method = "class", data = example, control = rpart.control(minsplit=5)) My…
J Kang
  • 1
  • 5
0
votes
1 answer

asRules(tree) R save rules

I do have next trouble: I created a decision tree with R based on rpart library, and since I have a broad list of variables, rules are and endeless list. By using asRules(tree) from rattle library, result is nicer than by just running tree once tree…
0
votes
1 answer

Convert party object to pmml

I am currently trying to convert a decision tree created using the R package partykit (party object) to a pmml-format. Are there packages that allow for this conversion? I am aware of the existance of the pmml-package, but this only supports rpart…
Niels
  • 1
  • 1
0
votes
1 answer

Effective pruning limit for regression tree, before collapsing to root-only?

I've been learning R over the past couple of years and am attempting to create a regression tree for an analysis at work. I have a dataset of roughly 750K records, a target variable that's numeric, and a corresponding vector of weights. There are…
0
votes
1 answer

How to specify number of branch in decision tree in R

I'am using decision tree to predict future behavior of my dataset.It contains decision variable called "rate" That I want to predict.I have many characteristics that influences on the rate column but when I apply decision tree algorithm. I gave only…
Manel Chaabene
  • 187
  • 1
  • 3
  • 14
0
votes
1 answer

rpart execution in R Studio

I am working on Titanic dataset. I am trying to fill in blanks in CABIN column. I have extracted first letter from CABIN column values, then put those in CABIN_NEW column. After that I use rpart for prediction, but somehow every time I run the code…
Abhishek
  • 1,585
  • 2
  • 12
  • 15
0
votes
0 answers

Getting different performance measures from a rpart model using caret. Why?

I've been using caret to build a decision tree model using the "rpart2" method and 10-fold cross-validation repeated 5 times in R. set.seed(888) DT_up_rpart <-train(DiagDM1~., data = training, method = "rpart2", trControl = ctrl2,metric = "ROC",…
0
votes
1 answer

How to get properties of rpart (CART) decision tree in R?

I have the following rpart: library("partykit") library("rpart") res = rpart(Species ~., data = iris) pres <- as.party(res) > pres Model formula: Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width Fitted party: [1] root | [2]…
Avi
  • 2,247
  • 4
  • 30
  • 52
0
votes
1 answer

How to use a function to produce confusion matrices using the Caret package from nested subsets in a master-list

I want to incorporate the function confusionMatrix() in the caret packageinto the function shuffle100 to produce confusion matrices from subsets (dataframes) of a master-list produced from classification tree models. My aim is to produce confusion…
Alice Hobbs
  • 1,021
  • 1
  • 15
  • 31
0
votes
1 answer

Node depth rpart

I am growing a classification tree using rpart. I need the depth of each node in order to identify the nodes that are more isolated (more distant from the parent node) and the nodes that are closer to the parent node. Does anybody know how can I get…
Dani
  • 11
  • 2
0
votes
1 answer

Using rpart package on large dataset

I have a large dataset of almost 10000 rows and 10 columns. I want to do classification on this dataset using rpart package. But each columns has many (more than 50) classes. So the R just hangs. What are my options to limit the scope of data or…
Sim101011
  • 305
  • 1
  • 13