Configurable Naive Bayes Classifier for text with cross-validation support
Classify text, analyse sentiments, recognize user intents for chatbot using
wink-naive-bayes-text-classifier. It is a part of wink — a growing family of high quality packages for Statistical Analysis, Natural Language Processing and Machine Learning in NodeJS.
It's API offers a rich set of features:
- Configure text preparation task such as amplify negation, tokenize, stem, remove stop words, and propagate negation using wink-nlp-utils or any other package of your choice.
- Configure Lidstone or Lapalce additive smoothing.
- Configure Multinomial or Binarized Multinomial Naive Bayes model.
- Export and import learnings in JSON format that can be easily saved on hard-disk.
- Evaluate learning to perform n-fold cross validation.
- Obtain comprehensive metrics including confusion matrix, precision, and recall.
Use npm to install:
npm install wink-naive-bayes-text-classifier --save
// Load Naive Bayes Text Classifiervar Classifier = ;// Instantiatevar nbc = ;// Load NLP utilitiesvar nlp = ;// Configure preparation tasksnbc;// Configure behaviornbc;// Train!nbc;nbc;nbc;nbc;nbc;nbc;nbc;nbc;nbc;// Consolidate all the training!!nbc;// Start predicting...console;// -> autoloanconsole;// -> prepay
Check out the Naive Bayes Text Classifier API documentation to learn more.
If you spot a bug and the same has not yet been reported, raise a new issue or consider fixing it and sending a pull request.
Copyright & License
wink-naive-bayes-text-classifier is copyright 2017-18 GRAYPE Systems Private Limited.
It is licensed under the under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License.