Does anyone know how to calculate the error rate for a decision tree with R?
I am using the rpart()
function.
相关问题
- R - Quantstart: Testing Strategy on Multiple Equit
- Using predict with svyglm
- Reshape matrix by rows
- Extract P-Values from Dunnett Test into a Table by
- split data frame into two by column value [duplica
相关文章
- How to convert summary output to a data frame?
- How to plot smoother curves in R
- Paste all possible diagonals of an n*n matrix or d
- ess-rdired: I get this error “no ESS process is as
- How to use doMC under Windows or alternative paral
- dyLimit for limited time in Dygraphs
- Saving state of Shiny app to be restored later
- How to insert pictures into each individual bar in
Assuming you mean computing error rate on the sample used to fit the model, you can use
printcp()
. For example, using the on-line example,The
Root node error
is used to compute two measures of predictive performance, when considering values displayed in therel error
andxerror
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
0.82353 x 0.20988 = 0.1728425 (17.2%) is the cross-validated error rate (using 10-fold CV, see
xval
inrpart.control()
; but see alsoxpred.rpart()
andplotcp()
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
:where
Misclassification error rate
is computed from the training sample.