- Practical Predictive Analytics
- Ralph Winters
- 104字
- 2025-04-04 19:02:43
An alternative decision tree
Let's say we arbitrarily selected another simple decision tree model; this time we will predict whether or not a passenger survived based upon the passenger class variable:

This is a slightly more complex tree, since it has four branches and three terminal nodes. Now, let's calculate the correct classification rate for the model by adding up the correct classification numbers for the three nodes and dividing this by the total number of rows, as we did before:
> (270+90+122) / nrow(titanic)
This is the following output:
[1] 0.67507
>
This simple model is even better, with a 67% correct classification.