Implementing Naive Bayes Classifier from scratch to categorize documents.
Following are the files present in source code:
Backend: MNB.py vocab_build.py app.py
Templates: index.html
- MNB.py - this file has all the functions needed to implement MNB
- vocab_build.py - this file creates a list of vocabulary needed to train MNB classifier. This file will generate the pickle file needed to load in flask application
- App.py - in this file, we load our model and connect it with frontend via Flask
- Index.html - contains styling of the webpage along with displaying the results
The accuracy of the model on test data is: 93.06 % While adding/removing or adjusting word importance, the model takes 15-20 secs to retrain the model and show the updated results. Add/Remove Word Feature:
- These features are available when the user right clicks on the bar chart.
- On right clicking, he will see 2 options, “Add a Word”, “Remove a word”. Click on one of them
- If clicked on add word, pop up window opens asking for word addition and then hit “ADD A WORD”
- If the user just wants to exit the pop up without entering the word, he will do so by clicking on the “ADD A WORD” button.
- Follow the above steps for Remove Word Word Importance Update:
- To increase or decrease the word importance, the user can drag the bar of the respective word whose importance he wishes to change, and then click on the update model button at the bottom of the window.