Skip to content

Benchmark multiple models for simple Sentiment analysis task with IMDB dataset

Notifications You must be signed in to change notification settings

nivethithanm/benchmark_sentiment_analysis_task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

IMDB Sentiment Analysis Benchmarking

Benchmark multiple models for simple Sentiment analysis task with IMDB dataset

Demo

Overview

This project benchmarks Logistic Regression, CNN, DistilBERT, and BERT for sentiment analysis on the IMDB dataset (51.2% negative, 48.8% positive). It evaluates performance (accuracy, F1 score) and compute efficiency (training/inference time, CPU/GPU memory, CO2 emissions) using Hugging Face, scikit-learn, PyTorch, and Weights & Biases (W&B). A Gradio app provides interactive predictions with training (accuracy, training time) and evaluation (F1 score, inference time) metrics.

Key Features

  • Models: Logistic Regression, multi-kernel CNN, DistilBERT, BERT.
  • Metrics: Accuracy, F1 score, training/inference time, CPU/GPU memory, CO2 emissions.
  • Tools: W&B for logging, CodeCarbon for emissions, Gradio for demo.
  • Dataset: IMDB (subset of 1000 samples for efficiency).

Usage

  • Run Sentiment_Analysis_Benchmarking.ipynb in a Jupyter environment (e.g., Colab).
  • View metrics/plots in W&B dashboard (sentiment_benchmarking project).
  • Test predictions via Gradio demo with sample inputs (e.g., "This movie was fantastic!").
  • Check emissions in model-specific CSV files (e.g., emissions_Logistic_Regression.csv).

Requirements

  • Python 3.10+
  • Libraries: transformers, datasets, scikit-learn, torch, psutil, pynvml, codecarbon, pandas, matplotlib, seaborn, gradio, wandb
  • Optional: GPU for faster training

About

Benchmark multiple models for simple Sentiment analysis task with IMDB dataset

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published