Awesome Open Source
Awesome Open Source
Sponsorship

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 [email protected] or tweet me @alihaider907 Thank you

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
java (29,705
algorithm (462
eclipse (72
corpus (51
naive-bayes-classifier (17

Find Open Source By Browsing 7,000 Topics Across 59 Categories