20.18 Complexity Parameter
We can print a table of optimal prunings based on a complexity
parameter using rpart::printcp(). The data is actually stored as
model$cptable.
##
## Classification tree:
## rpart(formula=form, data=ds[tr, vars], model=TRUE)
##
## Variables actually used in tree construction:
## [1] humidity_3pm wind_gust_speed
##
## Root node error: 41212/192787=0.21377
##
## n= 192787
##
## CP nsplit rel error xerror xstd
## 1 0.154251 0 1.00000 1.00000 0.0043678
## 2 0.035888 1 0.84575 0.84289 0.0040948
## 3 0.033582 2 0.80986 0.81619 0.0040434
## 4 0.010000 3 0.77628 0.77684 0.0039648
Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0