Home > decision tree > root node error

# Root Node Error

## Rpart Xerror

vote favorite 13 Does anyone know how to calculate the error rate for a decision tree with R? I am using the rpart() function. r classification decision-tree rpart share|improve this question edited Jan 29 '13 at 9:09 rcs 36.1k10120127 asked Mar 12 '12 at 11:29 teo6389 1431210 add a comment| 1 Answer 1 active oldest votes up vote 38 down vote accepted Assuming you mean computing error rate on how to calculate accuracy of a decision tree the sample used to fit the model, you can use printcp(). For example, using the on-line example, > library(rpart) > fit <- rpart(Kyphosis ~ Age + Number + Start, data=kyphosis) > printcp(fit) Classification tree: rpart(formula = Kyphosis ~ Age + Number + Start, data = kyphosis) Variables actually used in tree construction: [1] Age Start Root node error: 17/81 = 0.20988 n= 81 CP nsplit rel error xerror xstd 1 0.176471 0 1.00000 1.00000 0.21559 2 0.019608 1 0.82353 0.82353 0.20018 3 0.010000 4 0.76471 0.82353 0.20018 The Root node error is used to compute two measures of predictive performance, when considering values displayed in the rel error and xerror column, and depending on the complexity parameter (first column): 0.76471 x 0.20988 = 0.1604973 (16.0%) is the resubstitution error rate (i.e., error rate computed on the training sample) -- this is roughly class.pred <- table(predict(fit, type="class"), kyphosis\$Kyphosis) 1-sum(diag(class.pred))/sum(class.pred) 0.82353 x 0.20988 = 0.1728425 (17.2%) is the cross-validated error rate (using 10-fold CV, see xval in rpart.control(); but see also xpred.rpart() and plotcp() which relies on this kind of measure). This measure is a more objective indicator of predictive accuracy. Note that it is more or less in agreement with classification accuracy from tree: > library(tree) > summary(tre

## Misclassification Error Rate In R

Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of

## How To Calculate Accuracy Of Decision Tree In R

6.3 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Root node error in classification tree model up vote 0 down vote favorite I'm struggling with understanding output http://stackoverflow.com/questions/9666212/how-to-compute-error-rate-from-a-decision-tree of tree classification in rpart. I don't understand how 'root node error' is calculated(one of the output of printcp function). I couldn't find it definition also in rpart package description. On example I loaded titanic data: library(titanic) library(rpart) tt<-titanic_train table(tt\$Survived) So we have 549 people who survived and 342 people who died. Total 891 people. fit<-rpart(Survived ~Pclass+Sex+Age+ SibSp+Parch+Fare+Embarked , data=tt) printcp(dend) Gives result: Regression tree: rpart(formula = Survived ~ Pclass + Sex + http://stackoverflow.com/questions/35626901/root-node-error-in-classification-tree-model Age + SibSp + Parch + Fare + Embarked, data = tt) Variables actually used in tree construction: [1] Age Fare Pclass Sex SibSp Root node error: 210.73/891 = 0.23651 n= 891 CP nsplit rel error xerror xstd 1 0.295231 0 1.00000 1.00538 0.016124 2 0.073942 1 0.70477 0.70896 0.033228 3 0.027124 2 0.63083 0.63570 0.031752 4 0.026299 3 0.60370 0.62105 0.032815 5 0.023849 4 0.57740 0.61154 0.032884 6 0.021091 5 0.55356 0.58294 0.032127 7 0.010000 6 0.53246 0.57097 0.032402 Here root node error mean misclassification error at the beginning before adding any nodes, am I right? So if I assume that everyone survived I will be wrong in 342 cases out of 891, so root node error should be 342/891. And in the output I have 210.73/891. I would be grateful with helping me understand what 210.73 means in Root node error and how it was calculated on example this titanic data. I was searching for it all day and can't find any explanation. Thank you in advance for help. r machine-learning rpart share|improve this question asked Feb 25 at 12:09 michalk 1356 Possible duplicate of How to compute error rate from a decision tree? ... Please search Stack Overflow before posting. –Tim Biegeleisen Feb 25 at 12:13 I s

### Related content

reduced error pruning algorithm
Reduced Error Pruning Algorithm p classify instances Pruning reduces the complexity of the final classifier and hence improves predictive accuracy by the reduction of reduced error pruning example overfitting This article includes a list of references but its sources decision tree pruning tutorial remain unclear because it has insufficient inline citations Please help to improve this article by introducing more pre pruning and post pruning in decision tree precise citations May Learn how and when to remove this template message Contents Introduction Techniques Reduced error pruning Cost complexity pruning See cost complexity pruning also References Further reading External links Introduction

reduced error pruning decision trees examples

reduced error pruning in decision trees
Reduced Error Pruning In Decision Trees p Exercise Advanced Topics Evaluating Decision Trees Exercise Overfitting Pruning Exercise Further Topics pre pruning and post pruning in decision tree Conclusion Software Data Sets Books Papers Sites Feeds About Contact Decision Trees decision tree pruning tutorial Tutorial Pruning Pruning to avoid overfitting The approach to constructing decision trees usually involves using greedy heuristics such as reduced error pruning algorithm Entropy reduction that overfit the training data and lead to poor accuracy in future predictions In response to the problem of overfitting nearly all modern decision tree algorithms adopt a pruning strategy p Cost

reduced error pruning tutorial

reduced error pruning examples
Reduced Error Pruning Examples p Help pages Full-text links Download PDF PostScript license Current browse context cs AI prev next new recent Change to browse by cs References CitationsNASA ADS DBLP - CS p Decision Tree Pruning Tutorial p Bibliography listing bibtex Tapio Elomaa Matti K xE xE ri xE inen Bookmark what is this pessimistic pruning Computer Science Artificial Intelligence Title An Analysis of Reduced Error Pruning Authors T Elomaa M Kaariainen Submitted reduced error pruning algorithm on Jun Abstract Top-down induction of decision trees has been observed to suffer from the inadequate functioning of the pruning phase In

reduced error pruning wiki

reduced error pruning decision trees
Reduced Error Pruning Decision Trees p Exercise Advanced Topics Evaluating Decision Trees Exercise Overfitting Pruning Exercise Further Topics pre pruning and post pruning in decision tree Conclusion Software Data Sets Books Papers Sites Feeds About Contact Decision Trees Tutorial decision tree pruning tutorial Pruning Pruning to avoid overfitting The approach to constructing decision trees usually involves using greedy heuristics such as cost complexity pruning example Entropy reduction that overfit the training data and lead to poor accuracy in future predictions In response to the problem of overfitting nearly all modern decision tree algorithms adopt a pruning strategy of p Reduced

reduced error pruning and rule post pruning
Reduced Error Pruning And Rule Post Pruning p result in improved estimated accuracy Sort the pruned rules by their estimated accuracy and consider them in this sequence when classifying unseen instances Patricia Riddle Fri May NZST p p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn p Pruning Decision Tree In R p more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users decision

resubstitution error decision tree
Resubstitution Error Decision Tree p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn classification error rate decision tree more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags what is root node error Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of million programmers just like you how to calculate accuracy of a decision tree helping each

training error rate decision tree