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

Party Tree

The party package can be used to draw rpart decision trees using as.party() from partykit which can be installed from R-Forge:

install.packages("partykit", repos="http://R-Forge.R-project.org")
library(partykit)

class(model)
## [1] "rpart"

plot(as.party(model))

\includegraphics[width=\textwidth]{figures/onepager/unnamed-chunk-43-1}

The textual presentation of an rpart decision tree can also be improved using party.

print(as.party(model))
## 
## Model formula:
## rain_tomorrow ~ rain_today + temp_3pm + temp_9am + cloud_3pm + 
##     cloud_9am + pressure_3pm + pressure_9am + humidity_3pm + 
##     humidity_9am + wind_speed_3pm + wind_speed_9am + wind_dir_3pm + 
##     wind_dir_9am + wind_gust_speed + wind_gust_dir + sunshine + 
##     evaporation + rainfall + max_temp + min_temp
## 
## Fitted party:
## [1] root
## |   [2] humidity_3pm < 72.5: No (n=105547, err=14.1%)
## |   [3] humidity_3pm >= 72.5
## |   |   [4] humidity_3pm < 83.5
## |   |   |   [5] rainfall < 2.7
## |   |   |   |   [6] wind_gust_speed < 47: No (n=5118, err=33.8%)
....


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.