Page 64 - Data Science Algorithms in a Week
P. 64

Decision Trees


            Swim preference - representing data with

            decision tree

            For example, we may have certain preferences on whether we would swim or not. This can
            be recorded in the 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

            Data in this table can be represented alternatively with the following decision tree, for
            example:
















                                 Figure 3.1.: Decision tree for the swim preference example

            At the root node, we ask the question: does one have a swimming suit? The response to the
            question separates the available data into three groups, each with two rows. If the attribute
            swimming suit = none, then two rows have the attribute swim preference as no.
            Therefore, there is no need to ask a question about the temperature of the water as all the
            samples with the attribute swimming suit = none would be classified as no. This is also
            true for the attribute swimming suit = small. In the case of swimming suit = good,
            the remaining two rows can be divided into two classes: no and yes.





                                                     [ 52 ]
   59   60   61   62   63   64   65   66   67   68   69