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

Decision Trees


                   4.  Mary and temperature preferences. Let us take the example from the Chapter 1,
                      Classification Using K Nearest Neighbors, about the temperature preferences of
                      Mary.

             Temperature in degrees Celsius   Wind speed in kmph      Mary's perception
             10                               0                       Cold
             25                               0                       Warm
             15                               5                       Cold
             20                               3                       Warm
             18                               7                       Cold
             20                               10                      Cold
             22                               5                       Warm
             24                               6                       Warm
            We would like to use decision trees to decide if our friend Mary would feel warm or cold in
            the room with the temperature 16 degrees Celsius with the fan of the wind speed 3km/h.

            Can you please explain how a decision tree algorithm could be used here and how good it
            would be to use it for this example?

            Analysis:

                   1.  Here are entropies of the multisets:

                          a) E({1,2})=-(1/2)*log (1/2)-(1/2)*log (1/2)=1
                                            2
                                                         2
                          b) E({1,2,3})=-(1/3)*log (1/3)-(1/3)*log (1/3)-(1/3)*log (1/3)=1.5849625
                                              2
                                                                        2
                                                           2
                          c) E({1,2,3,4})=-(1/4)*log (1/4)-(1/4)*log (1/4)-(1/4)*log (1/4)-(1/4)*log (1/4)=2
                                                                                      2
                                                            2
                                                                         2
                                               2
                          d) E({1,1,2,2})=-(2/4)*log (2/4)-(2/4)*log (2/4)=1
                                                            2
                                               2
                          e) E({1,1,2,3})=-(2/4)*log (2/4)-(1/4)*log (1/4)-(1/4)*log (1/4)=1.5
                                                                         2
                                                            2
                                               2













                                                     [ 72 ]
   79   80   81   82   83   84   85   86   87   88   89