Go to TogaWare.com Home Page. Data Science Desktop Survival Guide
by Graham Williams
Duck Duck Go



CLICK HERE TO VISIT THE UPDATED SURVIVAL GUIDE

Decision Tree Performance

Here we plot the performance of the decision tree, showing a risk chart. The areas under the recall and risk curves are also reported.

predict_te <- predict(model, ds[te, vars], type="prob")[,2]
riskchart(predict_te, actual_te, risk_te)

\includegraphics[width=\textwidth]{figures/onepager/dtrees:rpart_riskchart-1}

An error matrix shows, clockwise from the top left, the percentages of true negatives, false positives, true positives, and false negatives.

predict_te <- predict(model, ds[te, vars], type="class")
sum(actual_te != predict_te)/length(predict_te) # Overall error rate
## [1] 0.1616943

actual_te %>%
  table(predict_te, dnn=c("Actual", "Predicted")) %>%
  '*'(100/(length(predict_te))) %>%
  round()
##       Predicted
## Actual No Yes
##    No  77   3
##    Yes 13   7


Support further development by purchasing the PDF version of the book.
Other online resources include the GNU/Linux Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 2000-2020 Togaware Pty Ltd. . Creative Commons ShareAlike V4.