YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
IMDB Sentiment Analysis β Neural Network Classifier
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:
- β Installs Python dependencies
- β Trains the neural network on the full dataset
- β
Saves model artifacts (
model.pt,vectorizer.pkl,config.json,metrics.json) - β 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.
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support