Simple Naive Bayes

Meeraj Kanaparthi
2 min readNov 26, 2020

--

In statistics, Naive Bayes classifiers are a family of simple “probabilistic classifiers” based on applying Bayes’ theorem with strong (naïve) independence assumptions between the features. They are among the simplest Bayesian network models,[1] but coupled with Kernel density estimation, they can achieve higher accuracy levels.[2][3]

Photo by Possessed Photography on Unsplash

Below is the demo in English, हिंदी (Hindi), తెలుగు(Telugu)

English

हिंदी (Hindi)

తెలుగు (Telugu)

Code:

Simple

Bag of words

The bag-of-words model is a simplifying representation used in natural language processing and information retrieval (IR). In this model, a text (such as a sentence or a document) is represented as the bag (multiset) of its words, disregarding grammar and even word order but keeping multiplicity. The bag-of-words model has also been used for computer vision.[1]

The bag-of-words model is commonly used in methods of document classification where the (frequency of) occurrence of each word is used as a feature for training a classifier.[2]

Implementation

Medium: https://kmeeraj.medium.com/simple-naive-bayes-c50415438bed
github: https://github.com/kmeeraj/machinelearning/tree/develop
Demo 1: https://github.com/kmeeraj/machinelearning/blob/develop/algorithms/Naive_bayes/Simple_Naive_Bayes.ipynb
Colab 1: https://colab.research.google.com/gist/kmeeraj/bdcc5734b8ceba0847a1a50232aa5152/simple_naive_bayes.ipynb
Gist 1: https://gist.github.com/kmeeraj/bdcc5734b8ceba0847a1a50232aa5152
Demo 2: https://github.com/kmeeraj/machinelearning/blob/develop/algorithms/Naive_bayes/Naive_bayes_implementation.ipynb
Colab 2: https://colab.research.google.com/gist/kmeeraj/37712792e1752ddc36a764f2f52144d2/naive_bayes_implementation.ipynb
Gist 2: https://gist.github.com/kmeeraj/37712792e1752ddc36a764f2f52144d2
Reference 1: https://machinelearningmastery.com/naive-bayes-classifier-scratch-python/
Reference 2: https://machinelearningmastery.com/naive-bayes-for-machine-learning/
Wiki: https://en.wikipedia.org/wiki/Naive_Bayes_classifier
Gaussian Naive Bayes: https://en.wikipedia.org/wiki/Naive_Bayes_classifier#Gaussian_na.C3.AFve_Bayes
Multinomial Naive Bayes: https://en.wikipedia.org/wiki/Naive_Bayes_classifier#Multinomial_na.C3.AFve_Bayes
Bernoulli Naive Bayes: https://en.wikipedia.org/wiki/Naive_Bayes_classifier#Bernoulli_na.C3.AFve_Bayes
Bag-of-words model: https://en.wikipedia.org/wiki/Bag-of-words_model#:~:text=The%20bag%2Dof%2Dwords%20model,word%20order%20but%20keeping%20multiplicity.

--

--

No responses yet