Understanding decision trees
Video tutorials
A decision tree predicts the class of an object based on the object’s attributes. For example, you can use a decision tree to predict whether a passenger on the Titanic survived, based on the passenger’s gender, age, and number of siblings, as shown in Figure 6‑11. The numbers under each leaf show the probability of survival for a passenger with the specified attributes and the percentage of passengers represented by the leaf. Figure 6‑11 tells us:
*A female passenger had a 0.73 chance of surviving.
*A male passenger over the age of 9 had only a 0.17 chance of surviving.
*For male passengers age 9 or younger, the probability of survival depends on the number of siblings the passenger had. If the passenger had more than two siblings, he had only a 0.05 chance of surviving. If the passenger had two siblings or fewer, he had a 0.89 chance of surviving.
Figure 6‑11 Decision tree showing survival probabilities for passengers on the Titanic
Figure 6‑14 shows a decision tree that predicts whether a worker is low income, medium income, or high income, based on the worker’s occupation and gender.