Implementation of Gaussian Naive Bayes in Python from scratch
Learn, Code and Execute…
Naive Bayes is a very handy, popular and important Machine Learning Algorithm especially for Text Analytics and General Classification. It has many different configurations namely:
- Gaussian Naive Bayes
- Multinomial Naive Bayes
- Complement Naive Bayes
- Bernoulli Naive Bayes
- Out-of-core Naive Bayes
In this article, I am going to discuss Gaussian Naive Bayes: the algorithm, its implementation and application in a miniature Wikipedia Dataset (dataset given in Wikipedia).
The Algorithm:
Gaussian Naive Bayes is an algorithm having a Probabilistic Approach. It involves prior and posterior probability calculation of the classes in the dataset and the test data given a class respectively.
Prior probabilities of all the classes are calculated using the same formula.
But, how to obtain the conditional probabilities of the test data features given a class?
This is given by the probability obtained from Gaussian (Normal) Distribution.
Finally, the conditional probability of each class given an instance (test…