Skip to content

A node JS script that develops a Naive Bayes Model for SMS spam detection.

Notifications You must be signed in to change notification settings

vaikzs/naive-bayes-in-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Naive Bayes Machine Learning Model using Node JS

SYNOPSIS

A node JS script that develops a Naive Bayes Model for SMS spam detection.

BACKGROUND

Naive Bayes is a probabilistic model that is based on Bayes Theorem. It is popularly used as a text categorization, whether the given text belongs to specific class or not. For example,

  1. Sports or Politics
  2. Email Spam

IMPORTANT REQUIREMENTS

NodeJS and NPM

FILES PROVIDED

    --- dataset/
        -test.txt
        -train.txt
        -readme.txt (dataset)
    --- classifier.js

INSTRUCTIONS

  1. Make sure you have NodeJS and NPM installed. Test it by entering the following commands in your command prompt/terminal
  • Windows Users (Command Prompt)
node --version
npm --version
  • Linux Users (Terminal)
nodejs -version
npm -version 
  • Mac Users (Terminal)
node -v 
npm -v
  1. Download the files provided to a folder (new folder)
  2. Go to the directory from terminal where you have downloaded the files.
  • All Operating Systems
cd <Downloaded_Directory_Location>/ 
  1. Now install the NPM Packages using the following commands :
  • All Operating Systems
npm install bayes 
npm install line-reader-sync
  1. After you have installed the necessary packages you can now execute the classifier by entering the following commands.
  • Windows/Mac Operating Systems
node classifier.js 
  • Linux Operating Systems
nodejs classifier.js
  1. You can see the results on the console.

References

  1. https://en.wikipedia.org/wiki/Naive_Bayes_classifier
  2. https://nodejs.org/en/
  3. https://archive.ics.uci.edu/ml/datasets/SMS+Spam+Collection#
  4. https://en.wikipedia.org/wiki/Precision_and_recall
  5. https://www.npmjs.com/package/bayes
Copyright © 2015 Vaikunth Sridharan

About

A node JS script that develops a Naive Bayes Model for SMS spam detection.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published