Skip to content

wonderer007/Naive-Bayes-classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Naive-Bayes-classifier

Naive Bayes classifier is classification algorithm. It uses Naive based Bernoulli and Multinomial equation to classify documents(Text) as ham or spam. Currently algorithm is only classifying in two categories but it can be modified to classify a text in N categories.

Project Structure
/jars executable jars if you don't want to run source code
/src/main source code of Naive-Bayes-classifier
/src/corpus contains all data files trainining files and testing files, list of stop words file

you can run project by either importing it in eclipse or using cmd/termianl in java based environment

Using Eclipse

  • Import Project in eclipse ( using Existing Project into Workspace option )
  • run Train.java (main class) to train you corpus using corpus_root_path as run time argument
  • After running Train.java check out Bernouli.out and Multinomail.out files at corpus_root_path. these are model build by bernouli and multinomial calculations
  • Now run Test.java (main class ) with corpus_root_path and path_of_file__you_want_to_classify as run time arguments
  • Test.java will classify your file with results of both Bernouli and Multinomial

Using Command Line

command line option is easy
  • cd jars folder
  • run command java -jar train1.jar path_of_corpus_folder
  • above command will create Bernouli and Multinomial models in corpus folder
  • run command java -jar test.jar path_of_corpus_folder    path_of_file__you_want_to_classify
  • above command will classify your file with results of both Bernouli and Multinomial

Note I will try to push regular updates on algorithm, in case you don't understand anything please hit me out at alihaider907@gmail.com or tweet me @alihaider907 Thank you

About

Naive Bayes classifier is classification algorithm. It uses Naive based Bernoulli and Multinomial equation to classify documents(Text) as ham or spam.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages