Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Latest commit

 

History

History
50 lines (31 loc) · 1.36 KB

README.md

File metadata and controls

50 lines (31 loc) · 1.36 KB

Building an SMS Spam Detector with scikit-learn and Node.js

image

Slides

http://bit.ly/sms-spam-nodejs

Dataset

SMS Spam Collection v.1

Original source: http://www.dt.fee.unicamp.br/~tiago/smsspamcollection/

Training

This trains a classifier using scikit-learn to label messages as 'ham' or 'spam'.

Training is optional, as the model files are already stored under the model/ subfolder.

Download Anaconda, select the Python 3.x version.

conda create -n simple-ml python=3
conda activate simple-ml
conda install pandas jupyter scikit-learn
jupyter notebook

Download dataset from the link above, and extract the files into the data/ sub-folder.

Run through simple-sms-spam-classifier.ipynb. If all goes well, the model files under the model/ subfolder will be updated.

Server

Requires: NodeJS v8 or later

# Run from the simple-ml anaconda environment
npm install
npm start
  1. Open browser to http://localhost:3000
  2. Input a SMS string (up to 160 characters)

input

  1. Click 'Spam or Ham?'

result