Skip to main content

Questions tagged [rpart]

`rpart` is an R package that provides a number of routines related to regression trees and recursive partitioning algorithms. This package is frequently used for classification problems.

Filter by
Sorted by
Tagged with
0 votes
0 answers
15 views

How does the rpart package get the "improve" when there is “ missing”?

...
Apai's user avatar
  • 19
0 votes
1 answer
27 views

Understanding rpart Tree Splits: Why Did a Node Remain Terminal Despite Potential Split?

Setup Consider two trees grown with rpart() from the rpart R package, in which the only thing that changes is the minbucket ...
Ewen Gallic's user avatar
0 votes
0 answers
26 views

Manually calculating partial dependence plots rpartscore tree

I am trying to generate partial dependence plots for my rpartscore model but I am not succeeding so far. I have previously tried to use the package dpd but cant make it run with the probability ...
Sofia's user avatar
  • 1
1 vote
1 answer
63 views

Making a decision tree with numeric data

Working with decision tree and I have couple of questions: Should I always do random forest before or I can just do the decision tree, skip the random forest part? Should I always have a training ...
Sisi's user avatar
  • 61
1 vote
1 answer
144 views

Rendering the decision tree as a step function [closed]

I am trying to fit a decision tree on a data with only one explanatory variable and both explanatory and response variables are continuous. I believe in such case the result tree is almost like a step ...
ok12345's user avatar
  • 13
0 votes
1 answer
67 views

How to compute the decrease in impurity in tree regression?

I fitted a regression tree using rpart function. The summary of this model is provided below. I need to know how to calculate the decrease in impurity in each node. For example, in the node number 1, ...
ebrahimi's user avatar
  • 291
0 votes
0 answers
156 views

Why `adaboost` using `gbm` package will not produce exact binary prediction values such as `{1,0}`?

My input data contains a response variable is_disease which is obviously a Factor(Yes,...
nobodyishere's user avatar
2 votes
1 answer
194 views

Pre-Data processing categorical variables in decision tree in R (rpart)

I am new to decision trees, there are several things confused me a lot. The first thing is that should we convert all categorical variables (Such as: gender, ...
nobodyishere's user avatar
1 vote
0 answers
133 views

Treating missing values in decision trees for prediction

I am new to decision tress, just fyi. I understand how decision tress can handle missing data when model building; like surrogate splits or multiple imputation. My question has to do with missing ...
user18897379's user avatar
0 votes
0 answers
148 views

How to do pruning and set class weights using RPART on unbalanced data?

I'm trying to work on this heart disease dataset by doing binary classification using RPART trees on data that has a hard unbalance, only 8% of the instances are positives. When it comes to pruning I ...
cZeph's user avatar
  • 1
1 vote
1 answer
73 views

Using ML model and decision tree to create a new risk classification

The idea of this project was to use a Machine Learning model to find the best variables to include in a decision tree algorithm. After evaluating with caret a number of different models I found the ...
fb95's user avatar
  • 31
1 vote
0 answers
70 views

Honest causal decision trees

Is there anyone who is familiar with honest causal decision trees? What is the purpose of the same and how can I implement it in my code in R? I am looking into the predictors (cognitive, non-...
Tannya Kumar's user avatar
1 vote
1 answer
262 views

Interpretation of mean absolute error in rpart

I ran rpart on my dataset (3000x9) to predict adolescent GPA (continuous), made predictions on test data, and found the mean absolute error to be in the range of 0.45-0.48. Does this mean that the ...
Tannya Kumar's user avatar
0 votes
0 answers
232 views

Parameter Optimization in RF and rpart

I am using rpart and random forest in R to predict GPA (regression tree). On what basis do I decide the value of cp, minsplit, and minbucket? And on what basis do I decide the values of mtry and ntree ...
Tannya Kumar's user avatar
2 votes
1 answer
551 views

Exploratory analysis : Regression trees without splitting train-test data

I am analyzing a small dataset of 76 observations and I want to explore how 9 environmental predictors explain my response variable. For this I have decided to use regression trees because I am ...
Anna Antonatou -Pappaioannou's user avatar
1 vote
0 answers
130 views

prediction error measures for Poisson regression in rpart

My question is about an alternative prediction error measure besides the default deviance-based error that is implemented but not documented. The vignette (section 8.1) states that: Prediction error: ...
balabux's user avatar
  • 11
1 vote
0 answers
32 views

Issue poisson method rpart

I tried to use the rpart package to deal with observations count of crop pests, but I realized that there was overfitting with poisson method. In the vignette of the package, it said that it is ...
Ricoco's user avatar
  • 11
0 votes
0 answers
152 views

Splitting algorithm for survival tree in rpart package

I'm modeling Survival Tree using the package $\fbox{rpart}$ in R. Do you know which splitting criterion is used in this package to build the tree ? I tried to look at its document but it seems that ...
InTheSearchForKnowledge's user avatar
0 votes
0 answers
773 views

Plot a tree from RandomForest object

I trained a randomforest using the RandomForest package on R. I am interested in how the most useful variables are split into the classes, So i would like to visualize a tree that is somehow an ...
c_R's user avatar
  • 1
1 vote
0 answers
1k views

Interpreting Rpart.plot() for a Regression tree

I generally understand the CART algorithm but the rpart.plot values are confusing me a bit. Below is a picture of my plot. What exactly is the root node value ...
Coldchain9's user avatar
3 votes
1 answer
337 views

Why does rpart not produce a perfect prediction when forced to?

I am trying to understand rpart all the details in rpart package. I am aware of the complexity parameter cp, which prevents a split if the improvement is less than <...
D1X's user avatar
  • 763
3 votes
1 answer
448 views

Different results using randomForest::randomForest with one tree vs rpart

I am wondering what randomForest package handles differently for each individual tree. If I build a random forest with a single tree, no resampling, and allow the usage of all features in a dataset, I ...
D1X's user avatar
  • 763
1 vote
1 answer
561 views

glmertree to fit logistic regression with two-column y

With both glm and glmer, if I wanted to fit a proportion, I could do it as either: ...
Ramon Diaz-Uriarte's user avatar
1 vote
0 answers
111 views

How to interpret output of rpart model with survival object as response?

What do the numbers in terminal nodes represent? And how to interpret the predicted value for new observation obtained from function predict() ?
pikachu's user avatar
  • 753
3 votes
1 answer
384 views

GLMERTREE with reponse in [0, 1] and multilevel design

I have multilevel data (with nested random effects: (1 | cluster-of-cluster/cluster) in lme4 syntax) where the response is a continuous variable between $[0, 1]$ (i....
Ramon Diaz-Uriarte's user avatar
1 vote
1 answer
302 views

Why is the error rate from bagging trees much higher than that from a single tree?

I'm running the classification method Bagging Tree (Bootstrap Aggregation) and compare the misclassification error rate with one from one single tree. We expect that the result from bagging tree is ...
Akira's user avatar
  • 433
0 votes
1 answer
45 views

Regression trees with geepack package

I can’t run regression trees without geeglm. I have longitudinal data so rpart wouldn’t work. Is there a way to get regression trees with geeglm?
user avatar
3 votes
1 answer
239 views

How does decision tree decide which variable to use in next split?

The CART (or RPART) algorithm uses gini index to find a threshold value for a variable in each split. But how does it choose which variable will it use for splitting ?
pikachu's user avatar
  • 753
2 votes
2 answers
526 views

Does it make sense to use bayesian optimization for tuning of hyperparameters of decision tree model?

Does it make sense to use bayesian optimization for tuning of hyperparameters of decision tree model? I have not found any article or anything related to this, as BO is usually used for black-box ...
pikachu's user avatar
  • 753
1 vote
0 answers
88 views

R: rpart or random forest for datasets with multiple rows per subject [closed]

I have some fundamental understanding problem with rpart or train(method="rf") in R. My data is currently structured as follows: Around 100 subjects, each has 2048 rows (so around 204,800 rows) with ...
Str1atum's user avatar
0 votes
1 answer
164 views

When does OLS Regression outperform regression tree in term of out of sample prediction?

In my Master thesis i compare ols regression to regression tree to predict wages. I thought that i will get better prediction with the regression tree because it cathes more interactions. But now i ...
MasterStudent1992's user avatar
1 vote
0 answers
234 views

Rpart and subsets

I am getting unexpected results from an rpart model, where the model selects two variables, one of which is a subset of the other. This in itself is not unexpected, but the seemingly odd thing is that ...
hawkaterrier's user avatar
1 vote
0 answers
956 views

Why do RMSE values increase on a smaller tree (RPART)

AIM: I want to understand why does RMSE increase on a smaller tree. CONTEXT: I am learning the rpart algorithm. I had some data,...
delcast's user avatar
  • 227
0 votes
0 answers
1k views

Metrics in rpart decision trees

I am currently working with decision trees in R, I am using caret library. Source code of rpart can be found here: https://github.com/cran/rpart/blob/master/R/rpart.R I understand how decision trees ...
JacobJacox's user avatar
0 votes
2 answers
461 views

classification tree with rpart()

I'm using the rpart() to build a classification tree using R. I have no experience in this topic... Anyway, I started with the full model, and then I used the varImp() from "caret" to drop some ...
wnoise's user avatar
  • 1
1 vote
0 answers
304 views

Performance of Conditional Inference regression Trees updating the influence function at each node

My goal is to compare the performance of $2$ models of trees using the Conditional Inference tree framework described in (ctree: Conditional Inference Trees), I am following the Partykit 2018. ...
Ismael's user avatar
  • 33
2 votes
1 answer
809 views

Test statistics used for a conditional inference regression tree?

Following the question asked previously about the interpretation of the Test Statistic used for Conditional Inference Trees (What is the test statistics used for a conditional inference regression ...
Ismael's user avatar
  • 33
2 votes
0 answers
125 views

Is rpart randomizing the variables it tries as splits?

I am fitting a decision with rpart on R. I have many variables and it seems to me that it would take a long time for rpart to try them all at every step, to determine what the next best split is. ...
Ben's user avatar
  • 121
4 votes
1 answer
2k views

Are decision trees sensitive to log translations in feature space?

This question was partially answered on Are decision trees sensitive to translations in feature space?, but no references were provided for "Gini impurity and entropy measures are translation ...
Data Science Officer's user avatar
5 votes
0 answers
32k views

Interpretation of Rpart for Decision Trees

I recently used rpart for an R-decision tree, but am confused on how to read the results.... ...
jrdunson's user avatar
  • 151
2 votes
0 answers
8k views

Decision Tree in R: rpart on categorical variables

Introduction: I would like to build a classifier which distinguishes between buyers and non-buyers based on user behavior. This data is highly imbalanced (0.009% for positive class), and I'm ...
GRS's user avatar
  • 187
1 vote
1 answer
64 views

Classification in R - seperate category for uncertain classifications

I am constructing classification trees for the first time, so I'm quite new to this use of R. I have observations of behaviours and incoming data that has to be classified as one of these behaviours. ...
Nina's user avatar
  • 11
0 votes
0 answers
2k views

discretization to create intervals for continuous variables

I am new to R and have basic stats understanding. Please excuse me if my questions are basic in nature. I am learning and having these questions and your answers would help me in updating my knowledge....
user1412's user avatar
  • 101
1 vote
1 answer
633 views

Use decision tree to learn precise classification rules: need accuracy of 1

I'm trying to use a decision tree algorithm to learn how general ledger transactions (10 digit code) are classified into revenue, expense, G&A et cetera without actually scripting every ...
Taraas's user avatar
  • 113
2 votes
0 answers
4k views

How to interpret variable.importance for an rpart object

How can I interpret the values for the variable.importance in an rpart object? ...
sha's user avatar
  • 21
2 votes
1 answer
1k views

How can I use estimated probabilities of a class from rpart to identify the top N classes?

Using the rpart library, I'm trying to predict which class each observation belongs to. Here is a reproducible example explaining the steps I am taking: ...
celenius's user avatar
  • 1,542
4 votes
1 answer
385 views

Disrepencies between Information Gain and Tree Growth

I was wondering if someone can explain to me why in my decision tree some of the variable with the highest importance (highest information - script shown below) do not appear into my tree at all, ...
ALEX.VAMVAS's user avatar
1 vote
1 answer
78 views

What does a decision tree with both GOOD outcome means?

I have a decision tree built in R using rpart() from rpart package. However, when following the nodes, we have one condition leading to both outcomes as GOOD. This is weird for me. What does that ...
trder's user avatar
  • 660
2 votes
1 answer
2k views

Handle missing value in continuous variable in Decision Tree without losing its meaning

I want to train a Decision Tree model with a dataset, of which some of the continuous variables contain missing values. I want to preserve the meaning of missing value while training, meaning that ...
Richard Li's user avatar
1 vote
1 answer
827 views

Understanding rpart package - unexpected behavior when swaping two columns in explanatory varaibles table

I have a problem understanding the behavior of rpart function of R. Here is the r code part : ...
TheBridge's user avatar
  • 207