Using the following training dataset, apply Naïve Bayes classification algorithm to find the class of an unknown sample X = < Rainy, Cool, High, False >
| S. No | Outlook | Temperature | Humidity | Windy | Play Golf/Class |
| 0 | Rainy | Hot | High | False | No |
| 1 | Rainy | Hot | High | True | No |
| 2 | Overcast | Hot | High | False | Yes |
| 3 | Sunny | Mild | High | False | Yes |
| 4 | Sunny | Cool | Normal | False | Yes |
| 5 | Sunny | Cool | Normal | True | No |
| 6 | Overcast | Cool | Normal | True | Yes |
| 7 | Rainy | Mild | High | False | No |
| 8 | Rainy | Cool | Normal | False | Yes |
| 9 | Sunny | Mild | Normal | False | Yes |
| 10 | Rainy | Mild | Normal | True | Yes |
| 11 | Overcast | Mild | High | True | Yes |
| 12 | Overcast | Hot | Normal | False | Yes |
| 13 | Sunny | Mild | High | True | No |
Naïve Bayes is a probabilistic classifier based on Bayes' theorem, which assumes that the features (attributes) used to describe an object are conditionally independent of each other. This simplifies the calculation of probabilities, as we only need to calculate the probabilities of the individual features independently and then combine them. For the given dataset, we will use the Naïve Bayes classification algorithm to predict the class (Play Golf/No or Yes) of an unknown sample X = <Rainy, Cool, High, False>.
### Step 1: Understand the Dataset
The dataset consists of four features:
1. Outlook: The weather outlook for the day (Rainy, Overcast, Sunny).
2. Temperature: The temperature of the day (Hot, Mild, Cool).
3. Humidity: The humidity level (High, Normal).
4. Windy: Whether it is windy or not (True or False).
The target class, which is what we want to predict, is Play Golf with possible values `Yes` or `No`.
### Step 2: Calculate the Prior Probabilities
The prior probability is the probability of each class occurring in the dataset. We calculate the prior probability of each class (Play Golf = Yes or No) using the frequency of each class in the dataset.
- Total samples: 14
- Play Golf = Yes: 9 samples
- Play Golf = No: 5 samples
Now, calculate the prior probabilities:
- P(Play Golf = Yes) = 9/14
- P(Play Golf = No) = 5/14
### Step 3: Calculate the Likelihood Probabilities
For each feature, we will calculate the likelihood of the feature values given each class (Play Golf = Yes and Play Golf = No). This will be done by counting how often each feature value appears for each class.
#### For Play Golf = Yes:
- Outlook = Rainy: 2 out of 9 samples
- P(Outlook = Rainy | Play Golf = Yes) = 2/9
- Outlook = Cool: 1 out of 9 samples
- P(Outlook = Cool | Play Golf = Yes) = 1/9
- Outlook = High: 5 out of 9 samples
- P(Humidity = High | Play Golf = Yes) = 5/9
- Windy = False: 4 out of 9 samples
- P(Windy = False | Play Golf = Yes) = 4/9
#### For Play Golf = No:
- Outlook = Rainy:
_____ ___ _______ _____ _______.
______ __________ __________ _______ _______ ________ ______.
________ ________ ____ ___ __________ __________ _____.
________ _______ ___ __________ ____ _____ ____ _____ _____ ___ _________ ____.
______ __________ _____ ______ _________.
__________ ______ ________ _________ __________ _____ ____ _____ _____ ____.
__________ _______ _______ ________ _________ ____ ____.
___ ____ ________ _____ _________ _____ _________.
________ _____ ________ ________ ___ ______ ____ _________.
__________ ____ _______ ___ ________ __________ _______ ________ ________ _______.
___ ________ __________ _________ _____ ________ ________.
___ ______ __________ _______ ____ _____ _______ ____ ___ ___ __________.
_______ _________ __________ _______ ______ ____ ___.
________ ___ __________ ______ _______ _________ ___ ____ __________ ________.
__________ ____ ______ _________ ____ ____ _______ ____ ___ _________.
_____ ___ __________ _____ ____ ___ ____ ___ _____ ____.
____ ____ __________ ____ __________ ___ ___.
_______ ______ ________ _____ _______ _______ ___ __________ ________ _________ _____.
_____ ______ ____ ________ ________ ______ ___ _________.
_____ _____ _________ _____ __________ ________ ________ ____ ___.
___ __________ ____ _______ ___ _______ _______ ___ __________.
___ ____ _______ _________ ______ _________ ___.
_____ ________ ______ _______ __________ _____ __________ _________ ______.
____ __________ _______ _________ _____ ___ ___ _____ _______ _____ ______ ________.
_____ ________ ________ _____ ___ ____ _______.
____ _________ _________ _____ ______ _________ ______ _____ ________.
______ ________ ______ ________ ______ _______ ______ __________ ______.
___ _________ ____ ________ ________ _________ _______ ________ ________.
____ _________ _________ _____ ___ _______ _________ ____ ______ ____.
__________ _______ ___ _____ _______ _______.
___ __________ ___ ________ ____ ____ _________.
____ _______ _________ _________ ___ __________ ______ ____.
_______ _____ _________ ________ _________ _______ _______ _____ ___ ___ _______.
_________ ______ _____ ________ __________ ___ ___.
_____ __________ _________ _____ __________.
__________ ____ ___ __________ _________ _________ ______ ____ ___.
________ ________ _______ ______ ___ _______ _____ ______ ____ _______.
__________ _________ __________ ________ __________ __________ ___ _______ __________.
_______ ___ _____ ________ ____.
_______ ____ __________ ______ ___ _____ ___ _______ _______ ___ _____.
______ _______ _________ ___ ____ ___ ________ ____ _________ ___ ___.
_____ _______ ___ ____ ____ __________ ___ _______ __________.
______ _______ _________ __________ _____ _________ _____ ____ _____.
_______ __________ _____ __________ ________ _____.
_______ ________ _________ __________ ____ _______ ______ _________ __________ ____ __________ __________.
________ _________ ________ ____ ______ ______ ______ ________.
_________ _____ __________ ________ _______ _________ ______ _______ ___ _______ ____ _____.
_____ ___ ____ ____ ____ ________ _____ ______ ___ ____ _______.
_____ __________ __________ __________ ________ __________ _____.
_________ ___ ______ _____ ________ ______ ________ _____ ________ ___.
______ _____ _________ ___ _______ ______ ______ __________ _________ ________ _________.
_____ _____ ______ _____ ________ ______ _________ _____ ________ __________ _____.
_______ ______ ____ __________ __________ __________ ____ _______ ___ _____.
_____ _______ _______ _________ ____ _____ ______ ____ ___.
_______ ___ ___ ____ ____.
____ ___ ______ _______ _______ __________ ______ ___ ______ __________.
_________ ___ ___ _______ _________ _______ ___ _____ _______ ___.
____ ______ ______ __________ __________ _________ ______ _________ ______.
____ _________ _____ ___ ___ _____ ______ _____ _______.
______ __________ ___ _______ _____ ________ ____ ______ ___.
______ ___ _________ ____ ________ ______ ______ ___ _________ _____.
______ _______ ____ __________ __________ _________ _______ ______ _________ ____.
________ __________ _____ ______ ___ ___ _________ ____ _____ _______ ______.
______ __________ _____ ______ ___ __________ _______ ________ ________ ________ __________.
_____ ____ _________ _________ ________ _____ ________ ______ _______ ________.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
✓ Unlock up to 60% of the answer
✓ No payment required