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
- 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
- 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