IMDB Sentiment Classifier (TF-IDF + MLP)

Binary sentiment classifier trained on a balanced 10,000-review IMDB subset.

This repository is generated automatically by GitHub Actions from github.com/GY6010/imdb-sentiment-nn. No files here are edited by hand β€” every push to main retrains the model and publishes a new commit.

Model details

Field Value
Task Binary sentiment classification
Architecture TF-IDF (1-2 grams, 20000 features) β†’ MLP 32 β†’ 16 β†’ 1
Framework PyTorch 2.15.0+cu132
Dataset imdb_balanced_10k.csv (9984 rows)
Train / Val / Test 6988 / 999 / 1997
Best epoch 9 of 21 (last seen 21)
Seed 42

Test metrics

Metric Value
Accuracy 0.9044
Precision 0.8899
Recall 0.9228
F1 score 0.9061
ROC-AUC 0.9663

Confusion matrix

Predicted negative Predicted positive
Actual negative 885 114
Actual positive 77 921

Files

File Description
model.pt PyTorch state_dict plus architecture description
vectorizer.pkl Fitted scikit-learn TfidfVectorizer
config.json Hyper-parameters, label mapping, dataset fingerprint
metrics.json Full evaluation report and per-epoch training history

Usage

import json, joblib, torch, torch.nn as nn

vectorizer = joblib.load("vectorizer.pkl")
ckpt = torch.load("model.pt", map_location="cpu")
# rebuild the network described in ckpt["architecture"] ...

Or simply clone the GitHub repository and run:

pip install -r requirements.txt
python train.py        # regenerates the artefacts
python predict.py "A gripping film from start to finish."
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support