Skip to content

Chandrikajoshi123/Sentiment_analysis

Repository files navigation

Sentiment Analysis API

Overview

This project builds a sentiment classifier on Amazon product reviews and serves it as a FastAPI Rest API.

Tech Stack

  • Python
  • Scikit-learn (Naive Bayes Classifier)
  • FastAPI( Rest API)
  • Docker (containerization)

Features

  • Post/Predict -Accepts review text and return sentiment (Positive/negative/neutral)

Project Structure

  • notebooks/ :Model training code
  • app/ : FastAPI app saved model
  • Dockerfile/ : Container for deployment

Example request

curl -x Post http://localhost:8000/predict/ -H "Content-Type: application/json" -d '{"text": This product is amazing!}'

Results

  • Macro ROC-AUC: 0.86
  • Model: TF-IDF + Logistic Regression (class_weight=balanced)
  • confusion matrix:

image

Challenges

  • Dataset highly imbalanced ( Positive reviews dominated)
  • Addressed via class weights

Future Improvements

  • Apply oversampling(SMOTE)
  • Tray transformer model (DistilBERT/BERT)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published