IMDB Movie Review Sentiment Classifier

This model classifies English movie reviews into Positive or Negative sentiment using TF-IDF and Logistic Regression trained on the 50,000 IMDB dataset.

  • Accuracy: ~90.95%
  • Algorithm: Logistic Regression with TfidfVectorizer (unigrams + bigrams)

How to Use

Download and run predictions with Python using huggingface_hub:

import os
import joblib
from huggingface_hub import hf_hub_download

# Download model and vectorizer from this repository
REPO_ID = "YOUR-USERNAME/imdb-sentiment-analysis"

model_path = hf_hub_download(repo_id=REPO_ID, filename="sentiment_model.pkl")
vectorizer_path = hf_hub_download(repo_id=REPO_ID, filename="tfidf_vectorizer.pkl")

# Load model and vectorizer
model = joblib.load(model_path)
vectorizer = joblib.load(vectorizer_path)

# Test review
reviews = ["This movie was magnificent!", "Terrible waste of time."]
reviews_tfidf = vectorizer.transform(reviews)

predictions = model.predict(reviews_tfidf)

for review, pred in zip(reviews, predictions):
    sentiment = "Positive" if pred == 1 else "Negative"
    print(f"{review} -> {sentiment}")
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