Skip to content

Repository files navigation

🎬 Sentiment Analysis Project

Sentiment Analysis

Welcome to the Sentiment Analysis Project! 🚀 This project predicts whether a movie review is positive or negative using machine learning. It includes model training, evaluation, tracking, and deployment.


📁 Project Organization

Project Organization

├── LICENSE
├── Makefile           <- Makefile with commands like `make data` or `make train`
├── README.md          <- The top-level README for developers using this project.
├── data
│   ├── external       <- Data from third party sources.
│   ├── interim        <- Intermediate data that has been transformed.
│   ├── processed      <- The final, canonical data sets for modeling.
│   └── raw            <- The original, immutable data dump.
│
├── docs               <- A default Sphinx project; see sphinx-doc.org for details
│
├── models             <- Trained and serialized models, model predictions, or model summaries
│
├── notebooks          <- Jupyter notebooks. Naming convention is a number (for ordering),
│                         the creator's initials, and a short `-` delimited description, e.g.
│                         `1.0-jqp-initial-data-exploration`.
│
├── references         <- Data dictionaries, manuals, and all other explanatory materials.
│
├── reports            <- Generated analysis as HTML, PDF, LaTeX, etc.
│   └── figures        <- Generated graphics and figures to be used in reporting
│
├── requirements.txt   <- The requirements file for reproducing the analysis environment, e.g.
│                         generated with `pip freeze > requirements.txt`
│
├── setup.py           <- makes project pip installable (pip install -e .) so src can be imported
├── src                <- Source code for use in this project.
│   ├── __init__.py    <- Makes src a Python module
│   │
│   ├── data           <- Scripts to download or generate data
│   │   └── make_dataset.py
│   │
│   ├── features       <- Scripts to turn raw data into features for modeling
│   │   └── build_features.py
│   │
│   ├── models         <- Scripts to train models and then use trained models to make
│   │   │                 predictions
│   │   ├── predict_model.py
│   │   └── train_model.py
│
└── tox.ini            <- tox file with settings for running tox; see tox.readthedocs.io

Project based on the Cookiecutter Data Science template #cookiecutterdatascience


🌟 Features

  • ✅ Trains a Logistic Regression model on TF-IDF features
  • ✅ Handles text preprocessing: lowercasing, stopwords removal, lemmatization
  • Model versioning & tracking with MLflow & DagsHub
  • REST API deployment using Flask 🐍
  • ✅ Logs metrics: accuracy, precision, recall, F1-score 📊
  • Synchronized vectorizer and model for consistent predictions

🧩 MLflow & DagsHub Integration

  • Models are tracked, versioned, and registered in MLflow
  • Vectorizer & model are synchronized for production deployment
  • Check the current Production model directly from the MLflow dashboard ✅
  • Transition models between Staging and Production stages with MLflow

📊 Metrics Logged

  • Accuracy
  • Precision
  • Recall
  • F1-Score

All metrics are saved to ./reports/model_metrics.json and logged in MLflow.


⚠️ Challenges Faced

  • Feature mismatch between training & inference ❌
  • MLflow versioning confusion ❌
  • Preprocessing inconsistencies ❌
  • Deployment errors due to PyFunc interface ❌

Solutions:

  • Ensured consistent preprocessing for both training and inference
  • Registered models properly in MLflow and transitioned them to Production
  • Synchronized vectorizer and model to avoid feature mismatch

💡 Future Improvements

  • Add more classifiers like Random Forest, XGBoost, or Naive Bayes 🌲
  • Deploy Flask app on Heroku / AWS for public access ☁️
  • Add user authentication and an interactive front-end 🔐
  • Improve preprocessing with word embeddings or deep learning models 🧠

🎉 Enjoy Predicting Sentiments!

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages