Download the attached NaïveBayes Classifier steps and theory. Read through the theoryto understand problem solution manually. Copy the python code given inthesteps document and run the code. The resul

Steps : N aïve Bayer Classifier ( To be programmed) Pla yers playing given weather conditions Naive Bayes classifier calculates the probability of an event in the following steps: • Step 1: Calculate the prior probability for given class labels • Step 2: Find multiplier (likelihood) with each attribute for each class • Step 3: Put these value in Bayes Formula and calculate posterior probability. • Step 4: S ee which class has a higher probability, given the input belongs to the higher probability class. For simplifying prior and posterior probability calculation you can use the two tables frequency and likelihood tables. Both of these tables will help you to calculate the prior and posterior probability. The Frequency table contains the occurrence of labels for all features. There are two likelihood tables.

Likelihood Table 1 is showing prior probabilities of labels and Likelihood Table 2 is showing the poster ior probability. Now suppose you want to calculate the probability of playing when the weather is overcast. Probability of playing: P(Yes | Overcast) = P(Overcast | Yes) P(Yes) / P (Overcast) .....................(1) 1. Calculate Prior Probabilities: P(Overcast) = 4/14 = 0.29 P(Yes)= 9/14 = 0.64 1. Calculate Posterior Probabilities: P(Overcast |Yes) = 4/9 = 0.44 1. Put Prior and Posterior probabilities in equation (1) P (Yes | Overcast) = 0.44 * 0.64 / 0.29 = 0.98(Higher) Similarly, you can calculate the probability of not playing: Probability of not playing: P(No | Overcast) = P(Overcas t | No) P(No) / P (Overcast) .....................(2) 1. Calculate Prior Probabilities: P(Overcast) = 4/14 = 0.29 P(No)= 5/14 = 0.36 1. Calculate Posterior Probabilities: P(Overcast |No) = 0/9 = 0 1. Put Prior and Posterior probabilities in equation (2) P (No | Overcast) = 0 * 0.36 / 0.29 = 0 The probability of a 'Yes' class is higher. So you can determine here if the weather is overcast than players will play the sport.