Naive Bayes Algorithm in Machine Learning

Image

Naive Bayes is a simple but surprisingly powerful algorithm for predictive modeling.

Naive Bayes is a machine learning model that is used for large volumes of data, even if you are working with data that has millions of data records the recommended approach is Naive Bayes. It gives very good results when it comes to NLP tasks such as sentimental analysis. It is a fast and uncomplicated classification algorithm.

To understand the naive Bayes classifier we need to understand the Bayes theorem. So let’s first discuss the Bayes Theorem. 

Bayes Theorem

It is a theorem that works on conditional probability. Conditional probability is the probability that something will happen, given that something else has already occurred. The conditional probability can give us the probability of an event using its prior knowledge. 

 

Conditional probability:

 

https://lh5.googleusercontent.com/ChHdbSOg1uvNuKwBQgAueG0U3hVnBcobBPf3_E-q4HrTBuFyZsdvHzwYZPfk-vJ6P0ISZGlM0_S9DSKN-3CR_L7mxKNi0MICxd77rQxijiaFN3PZg067NuJgvNBnKwqEVfA5lS-N

Where, 

P(H): The probability of hypothesis H being true. This is known as prior probability.

P(E): The probability of the evidence.

P(E|H): The probability of the evidence given that hypothesis is true.  

P(H|E): The probability of the hypothesis given that the evidence is true.

Naive Bayes Classifier

  • It is a kind of classifier that works on Bayes theorem.
  • Prediction of membership probabilities is made for every class such as the probability of data points associated to a particular class.
  • The class having maximum probability is appraised as the most suitable class.
  • This is also referred as Maximum A Posteriori (MAP). 
  • The MAP for a hypothesis is: 
    • 𝑀𝐴𝑃 (𝐻) = max 𝑃((𝐻|𝐸))  
    • 𝑀𝐴𝑃 (𝐻) = max 𝑃((𝐻|𝐸)  ∗ (𝑃(𝐻)) /𝑃(𝐸))  
    • 𝑀𝐴𝑃 (𝐻) = max(𝑃(𝐸|𝐻) ∗ 𝑃(𝐻))
    • 𝑃 (𝐸) is evidence probability, and it is used to normalize the result. Result will not be affected by removing 𝑃(𝐸).
  • NB classifiers conclude that all the variables or features are not related to each other.
  • Existence or absence of a variable does not impact the existence or absence of any other variable. 

Types Of Naive Bayes Algorithms

  • Gaussian Naïve Bayes
  • Multinomial Naïve Bayes 
  • Bernoulli Naïve Bayes 

Advantages And Disadvantages Of Naive Bayes

Avantages:

  • It is a highly extensible algorithm which is very fast.
  • It can be used for both binary as well as multiclass classification.
  • It has mainly three different types of algorithms that are GaussianNB, MultinomialNB, BernoulliNB.
  • It is a famous algorithm for spam email classification.
  • It can be easily trained on small datasets and can be used for large volumes of data as well.

Disadvantages:

  • The main disadvantage of the NB is considering all the variables independent that contributes to the probability.  

Applications of Naive Bayes Algorithms

  • Real time Prediction
  • MultiClass Classification
  • Text Classification

American Journal of Computer Science and Engineering Survey (IPACSES) is a peer review open access journal publishing the research in computer science and engineering survey. Journal announces papers for the upcoming issue release. Interested can submit your manuscripts through online portal or trough email at computersci@scholarlymed.com

Media contact:

Maegan Smith

Managing Editor

American Journal of Computer Science and Engineering Survey (IPACSES)

Mail ID: computersci@scholarlymed.com

WhatsApp +1 504 6082390