← Selected workNLP / Machine Learning

PROJECT / 02

Sentiment Analysis

A sentiment classification system using the Sentiment140 dataset. Bernoulli Naive Bayes and Logistic Regression were compared, with Logistic Regression selected for production after evaluation.

SYSTEM PATH
01DATA
02MODEL
03EVAL
04API
05CONTAINER
06CI/CD
07CLOUD
1.6MtweetsSentiment140 dataset
40Kbalanced training subsetused for training
76.60%accuracyselected production model
0.840ROC-AUCselected production model
500KTF-IDF max featuresunigrams + bigrams

01 — SYSTEM ARCHITECTURE

How the pieces connect.

The case study keeps architecture data-driven too. Each project can describe a different system path without changing the renderer.

01

Sentiment140 · 1.6M tweets

02

40K balanced training subset

03

NLP preprocessing pipeline

04

TF-IDF · 500K max features

05

Model comparison → Logistic Regression

06

FastAPI → Docker → Docker Hub

02 — PROBLEM

Problem

Turn large-scale short-form text into a deployable sentiment classification service while keeping preprocessing consistent between training and inference.

03 — APPROACH

Solution

Build a reusable NLP preprocessing pipeline covering stopword, URL, punctuation removal, tokenisation, stemming, and lemmatisation, then vectorize text with TF-IDF using unigrams and bigrams.

04 — RESULTS

Results

Logistic Regression was selected for production at 76.60% accuracy and 0.840 ROC-AUC after comparison with Bernoulli Naive Bayes.

05 — IMPLEMENTATION

Built for the path to deployment.

01

Preprocessing is shared between model training and inference to keep input handling consistent.

02

TF-IDF represents unigrams and bigrams with a 500K feature cap.

03

Confusion matrix and ROC curve analysis were used for evaluation.

04

The selected model is exposed with FastAPI and containerized with Docker for Docker Hub publication and AWS EC2 deployment.

06 — STACK & DEPLOYMENT

PythonScikit-learnNLTKTF-IDFFastAPIDocker

FastAPI + Docker + Docker Hub; prepared for AWS EC2 deployment

Back to work