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

Naive Bayes


             Warm          Strong Autumn No

             Warm          None   Summer Yes
             Hot           None   Spring   No
             Hot           Breeze Autumn Yes

             Warm          Breeze Spring   Yes
             Cold          Breeze Winter   No

             Cold          None   Spring   Yes
             Hot           Strong Summer Yes
             Warm          None   Autumn Yes

             Warm          Strong Spring   ?
            So, we wonder how the answer will change with this different data.

            Analysis:
            We may be tempted to use Bayesian probability to calculate the probability of our friend
            playing chess with us in the park. However, we should be careful, and ask whether the
            probability events are independent of each other.
            In the previous example, where we used Bayesian probability, we were given the
            probability variables Temperature, Wind, and Sunshine. These are reasonably independent.
            Common sense tells us that a specific temperature or sunshine does not have a strong
            correlation to a specific wind speed. It is true that sunny weather results in higher
            temperatures, but sunny weather is common even when the temperatures are very low.
            Hence, we considered even sunshine and temperature reasonably independent as random
            variables and applied Bayes' theorem.
            However, in this example, temperature and season are tightly related, especially in a
            location such as the UK, where we stated that the park we are interested in was placed.
            Unlike closer to the equator, temperatures in the UK vary greatly throughout the year.
            Winters are cold and summers are hot. Spring and fall have temperatures in between.

            Therefore, we cannot apply Bayes' theorem here, as the random variables are dependent.
            However, we could still perform some analysis using Bayes' theorem on the partial data. By
            eliminating sufficient dependent variables, the remaining ones could turn out to be
            independent. Since temperature is a more specific variable than season, and the two
            variables are dependent, let us keep only the temperature variable. The remaining two
            variables, temperature and wind, are dependent.


                                                     [ 38 ]
   45   46   47   48   49   50   51   52   53   54   55