Naive_Bayes_Classifier
Naive_Bayes_Classifier
Introduction
Naïve Bayes is a probabilistic classifier based on Bayes' Theorem. It assumes that the
features are conditionally independent of each other, which simplifies computation. Despite
its simplicity, Naïve Bayes performs well in many real-world applications, such as spam
filtering, sentiment analysis, and document classification.
1. Bayes’ Theorem
Bayes' Theorem forms the foundation of the Naïve Bayes classifier. It is expressed as:
Where:
- P(A|B): Posterior probability of A given B.
- P(B|A): Likelihood of B given A.
- P(A): Prior probability of A.
- P(B): Probability of B.
- **Gaussian Naïve Bayes**: Assumes that the data follows a Gaussian (normal)
distribution.
- **Multinomial Naïve Bayes**: Suitable for discrete data, commonly used for text
classification.
- **Bernoulli Naïve Bayes**: Designed for binary/boolean data.
Dataset:
| Email | Word1 (offer) | Word2 (win) | Word3 (lottery) | Spam |
|-----------|---------------|-------------|-----------------|------|
| Email1 | 1 |1 |0 | Yes |
| Email2 | 0 |1 |1 | Yes |
| Email3 | 1 |0 |0 | No |
| Email4 | 0 |0 |1 | No |
2. Calculate likelihoods:
If P(Spam | Data) > P(Not Spam | Data), classify as Spam; otherwise, classify as Not Spam.
**Disadvantages:**
5. Applications
- Spam email detection.
- Sentiment analysis.
- Medical diagnosis.
- Document classification.
6. Conclusion
Naïve Bayes is a powerful yet simple classifier widely used in various domains. Its
effectiveness lies in its probabilistic foundation and ability to handle high-dimensional data.
Although its independence assumption may not always hold, it remains a popular choice for
many real-world applications.
References
1. https://scikit-learn.org/stable/modules/naive_bayes.html
2. https://www.geeksforgeeks.org/naive-bayes-classifiers/
3. https://en.wikipedia.org/wiki/Naive_Bayes_classifier