Bayesian Classifier
Given the training data set, use naive Boryes algorithms to classify a particular species if its features are (slow, rarely, no).
| s.no | Swim | Fly | Crowl | Class |
| 1 | Fast | No | No | Fish |
| 2 | Fast | No | Yes | Animal |
| 3 | Slow | No | No | Animal |
| 4 | Fast | No | No | Animal |
| 5 | No | Short | No | Bird |
| 6 | No | Short | No | Bird |
| 7 | No | Rarely | No | Animal |
| 8 | Slow | No | Yes | Animal |
| 9 | Slow | No | No | Fish |
| 10 | Slow | No | Yes | Fish |
| 11 | No | Large | No | Bird |
| 12 | Fast | No | No | Bird |
The class Labels are
Construct the frequency table which summaries the data [Not the part of algo]
| Class | Swim (F1) | Fly (F2) | Crowl (F3) | Total | ||||||||
| Fast | Swim | No | Long | Short | Rarely | No | Yes | No | ||||
| Animal | 2 | 2 | 1 | 0 | 0 | 1 | 4 | 2 | 3 | 8 | ||
| Bird | 1 | 0 | 3 | 1 | 2 | 0 | 1 | 0 | 4 | 4 | ||
| Fish | 1 | 2 | 0 | 0 | 0 | 0 | 3 | 1 | 2 | 3 | ||
| Total | 4 | 4 | 4 | 1 | 2 | 1 | 8 | 3 | 9 | 12 |
Step 1: Compute the probability
Step 2: Constructing Table of Conditional Propability
| Class | Swim Fast Slow No | Fly Long Short Rarely No | Crowl Yes No | Total |
| Animal | 2/5 2/5 1/5 | 0/5 0/5 1/5 4/5 | 2/5 3/5 | 5 |
| Bird | 1/4 0/4 3/4 | 1/4 2/4 0/4 1/4 | 0/4 4/4 | 4 |
| Fish | 1/3 2/3 0/3 | 0/3 0/3 0/3 3/3 | 1/3 2/3 | 3 |
The conditional probability are calculated as
Step 3: we now calculate the following numbers
Step 4: Find Maximum
Step 5: The maximum is as it corresponds to class
so we assign the class Label "Animal" to the test instance

