Data Science Desktop Survival Guide
by Graham Williams |
|||||
Decision Trees |
20210103
Representation: | Tree |
---|---|
Method: | Recursive Partitioning |
Measure: | Information Gain |
To build a decision tree we typically use rpart::rpart().
mtype <- "rpart"
mdesc <- "decision tree" ds %>% select(all_of(vars)) %>% slice(tr) %>% rpart(form, ., method="class", control=rpart.control(maxdepth=3)) %T>% print() -> model
Chapter 18 covers decision trees in detail whilst Chapter 12 uses decision trees as the model builder to demonstrate the model template. Examples of decision tree induction are available through the rain, iris, and pyiris packages from MLHub.
|