Skip to content

Naive Bayes is a learning algorithm commonly applied to text classification.

Notifications You must be signed in to change notification settings

ABIDHUSSAIN686/Generative-Naive-Bayes-Text-Classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Generative-Naive-Bayes-Text-Classifier

Naive Bayes is a learning algorithm commonly applied to text classification.

Output

Vocabulary

['This', 'book', 'is', 'good', 'very', 'bad', 'novel', 'some', 'and', 'little', 'but']

Positive Class

{'This': 2, 'book': 1, 'is': 2, 'good': 3, 'very': 1, 'bad': 0, 'novel': 1, 'some': 0, 'and': 0, 'little': 0, 'but': 0}

Negative Class

{'This': 2, 'book': 1, 'is': 2, 'good': 0, 'very': 1, 'bad': 3, 'novel': 1, 'some': 0, 'and': 0, 'little': 0, 'but': 0}

Neutral Class

{'This': 2, 'book': 1, 'is': 2, 'good': 2, 'very': 0, 'bad': 2, 'novel': 1, 'some': 2, 'and': 1, 'little': 2, 'but': 1}

Printing Prior Probability

Positive_Probability 0.3333333333333333
Negative_Probability 0.3333333333333333
Neutral_Probability 0.3333333333333333

Printing Likelihood Probability

Positive_Likelihood_Probability

{'This': 0.14285714285714285, 'book': 0.09523809523809523, 'is': 0.14285714285714285, 'good': 0.19047619047619047, 'very': 0.09523809523809523, 'bad': 0.047619047619047616, 'novel': 0.09523809523809523, 'some': 0.047619047619047616, 'and': 0.047619047619047616, 'little': 0.047619047619047616, 'but': 0.047619047619047616}

Negative_Likelihood_Probability

{'This': 0.14285714285714285, 'book': 0.09523809523809523, 'is': 0.14285714285714285, 'good': 0.047619047619047616, 'very': 0.09523809523809523, 'bad': 0.19047619047619047, 'novel': 0.09523809523809523, 'some': 0.047619047619047616, 'and': 0.047619047619047616, 'little': 0.047619047619047616, 'but': 0.047619047619047616}

Neutral_Likelihood_Probability

{'This': 0.1111111111111111, 'book': 0.07407407407407407, 'is': 0.1111111111111111, 'good': 0.1111111111111111, 'very': 0.037037037037037035, 'bad': 0.1111111111111111, 'novel': 0.07407407407407407, 'some': 0.1111111111111111, 'and': 0.07407407407407407, 'little': 0.1111111111111111, 'but': 0.07407407407407407}

Result

very little bad little 0

Generative Model Result

book bad and is -

Commands to run this code

- Clone this repository on your machine
  ```
    $ git clone https://github.com/ABIDHUSSAIN686/Generative-Naive-Bayes-Text-Classifier
  ```
- Open terminal in your current Directory
- Type command 'python filename'.
  ```
  $ python Naive_Bayes_Classifier.py
  ```

About

Naive Bayes is a learning algorithm commonly applied to text classification.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages