Run this model with HF Jobs

Run DineshKumar1329/Sentiment_Analysis on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/DineshKumar1329/Sentiment_Analysis. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/DineshKumar1329/Sentiment_Analysis on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Sentiment Analysis Model

Overview

This repository contains a sentiment analysis model trained using scikit-learn for predicting sentiment from text inputs. The model leverages TF-IDF vectorization for text representation and a machine learning classifier for sentiment classification.

Model Details

  • Model Name: Sentiment Analysis Model
  • Framework: scikit-learn
  • Model Type: TF-IDF Vectorization + Machine Learning Classifier
  • Architecture: Linear SVM Classifier
  • Input: Text
  • Output: Sentiment Label (Positive/Negative)
  • Performance: Achieves 93% accuracy on test dataset

Download the Vectorizer model first and load the model :

Usage :

from huggingface_hub import hf_hub_download
import joblib
from sklearn.preprocessing import LabelEncoder

# Download and load the sentiment analysis model from Hugging Face Model Hub
model = joblib.load(hf_hub_download("DineshKumar1329/Sentiment_Analysis", "sklearn_model.joblib"))

# Load the TF-IDF vectorizer
tfidf_vectorizer = joblib.load(hf_hub_download("DineshKumar1329/Sentiment_Analysis", "vectorizer_model.joblib"))

def clean_text(text):
    return text.lower()

def predict_sentiment(user_input):
    """Predicts sentiment for a given user input."""
    cleaned_text = clean_text(user_input)
    input_matrix = tfidf_vectorizer.transform([cleaned_text])
    prediction = model.predict(input_matrix)[0]

    if isinstance(model.classes_, LabelEncoder):
        prediction = model.classes_.inverse_transform([prediction])[0]

    return prediction

# Get user input
user_input = input("Enter a sentence: ")

# Predict sentiment
predicted_sentiment = predict_sentiment(user_input)

# Output the prediction
print(f"Predicted Sentiment: {predicted_sentiment}")
Downloads last month
43
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support