πŸ“š Amazon Books Sentiment Analysis Model

Model Description

This is a machine learning model for sentiment analysis of book reviews from Amazon. The model classifies reviews into positive, negative, and neutral sentiments.

Model Type: MultinomialNB Accuracy: 85-90% F1 Score: 0.85-0.90

Training Data

The model was trained on the Amazon Books Reviews dataset containing over 700,000 book reviews.

How to Use

from huggingface_hub import hf_hub_download
import joblib

# Download the model
model_path = hf_hub_download(repo_id="your-username/amazon-books-sentiment", filename="model.pkl")
vectorizer_path = hf_hub_download(repo_id="your-username/amazon-books-sentiment", filename="vectorizer.pkl")
label_encoder_path = hf_hub_download(repo_id="your-username/amazon-books-sentiment", filename="label_encoder.pkl")

# Load the components
model = joblib.load(model_path)
vectorizer = joblib.load(vectorizer_path)
label_encoder = joblib.load(label_encoder_path)

# Make predictions
def predict_sentiment(text):
    # Preprocess and vectorize
    features = vectorizer.transform([text])
    prediction = model.predict(features)
    sentiment = label_encoder.inverse_transform(prediction)[0]
    return sentiment

# Example
review = "This book was absolutely amazing!"
print(predict_sentiment(review))  # Output: positive
Downloads last month
11
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using mohammed781234712/amazon-books-sentiment 1