YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

IMDB Sentiment Analysis β€” Neural Network Classifier

Train & Upload to HuggingFace

Sentiment analysis of IMDB movie reviews using a TF-IDF + Feedforward Neural Network trained automatically via GitHub Actions CI/CD and deployed to Hugging Face Hub.


πŸ—οΈ Architecture

IMDB Review Text
      ↓
Text Cleaning (HTML tags, punctuation, lowercase)
      ↓
TF-IDF Vectorization (10,000 features, unigrams + bigrams)
      ↓
Linear(10000 β†’ 512) + BatchNorm + ReLU + Dropout(0.3)
      ↓
Linear(512 β†’ 128) + BatchNorm + ReLU + Dropout(0.3)
      ↓
Linear(128 β†’ 2) β†’ Softmax
      ↓
Positive 😊 / Negative 😞

πŸ“Š Dataset

  • File: imdb_balanced_10k.csv
  • Size: 10,000 reviews (5,000 positive, 5,000 negative)
  • Source: IMDB movie reviews

πŸš€ CI/CD Pipeline

Every push to main automatically:

  1. βœ… Installs Python dependencies
  2. βœ… Trains the neural network on the full dataset
  3. βœ… Saves model artifacts (model.pt, vectorizer.pkl, config.json, metrics.json)
  4. βœ… Uploads everything to Hugging Face Hub

No manual uploads. Ever.


πŸ“ Project Structure

imdb-sentiment-nn/
β”œβ”€β”€ data/
β”‚   └── imdb_balanced_10k.csv   # Training data
β”œβ”€β”€ model/                       # Generated by train.py
β”‚   β”œβ”€β”€ model.pt                 # PyTorch model weights
β”‚   β”œβ”€β”€ vectorizer.pkl           # TF-IDF vectorizer
β”‚   β”œβ”€β”€ config.json              # Hyperparameters
β”‚   └── metrics.json             # Training metrics
β”œβ”€β”€ train.py                     # Training script
β”œβ”€β”€ predict.py                   # Inference script
β”œβ”€β”€ requirements.txt             # Dependencies
└── .github/
    └── workflows/
        └── train-and-upload.yml # CI/CD pipeline

πŸ”§ Local Usage

Install dependencies

pip install -r requirements.txt

Train the model

python train.py

Run inference

python predict.py "This movie was absolutely fantastic!"
# Sentiment:   positive 😊
# Confidence:  94.23%

python predict.py "Terrible film, complete waste of time."
# Sentiment:   negative 😞
# Confidence:  91.87%

πŸ“ˆ Results

See model/metrics.json after training. Expected accuracy: ~88–92% on the test set.


πŸ€— Hugging Face

Model artifacts are automatically deployed to Hugging Face Hub via GitHub Actions.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support