Swim preference – representing data using a decision tree
We may have certain preferences that determine whether or not we would swim. These can be recorded in a table, as follows:
Swimming suit | Water temperature | Swim preference |
None | Cold | No |
None | Warm | No |
Small | Cold | No |
Small | Warm | No |
Good | Cold | No |
Good | Warm | Yes |
Â
The data in this table can alternatively be presented in the following decision tree:
Figure 3.1: Decision tree for the Swim preference example
At the root node, we ask the question—do you have a swimming suit? The response to the question separates the available data into three groups, each with two rows. If the attribute is swimming suit = none
, then two rows have the swim preference attribute as no
. Therefore, there is no need to ask a question about the temperature of the water, as all the samples with the swimming suit = none
attribute would be classified as no
. This is also true for the swimming suit = small
 attribute. In the case of swimming suit = good
, the remaining two rows can be divided into two...