Downloads · 30 days
12
0% of all-time downloads
RinInori/distilbert-restaurant-sentiment
distilbert-restaurant-sentiment is a text classification model from RinInori. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
Model Card for RinInori/distilbert-restaurant-sentiment
Downloads · 30 days
12
0% of all-time downloads
All-time downloads
5.5K
Public
Parameters
67M
268 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors268 MB · 100%
From the Hugging Face model README
Model Card for RinInori/distilbert-restaurant-sentiment
This is a fine-tuned DistilBERT model for sentiment analysis of restaurant reviews. It is designed to classify reviews as either positive or negative. The model was developed as part of a project demonstrating the process of fine-tuning a DistilBERT model using the European Restaurant Reviews dataset, including data loading, model evaluation, handling class imbalance, and preventing overfitting.
Model type: DistilBERTForSequenceClassification
Language(s) (NLP): English
License: Free
Finetuned from model: distilbert-base-uncased
Repository: https://github.com/hennypurwadi/FineTuning_SentimentAnalysis_Restaurant_Review/tree/main
This model can be directly used for classifying the sentiment of restaurant reviews as either positive or negative. It is particularly suited for analyzing text from food/restaurant reviews, given its training data.
Anyone can use this model with:
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
model = DistilBertForSequenceClassification.from_pretrained("RinInori/distilbert-restaurant-sentiment")
tokenizer = DistilBertTokenizer.from_pretrained("RinInori/distilbert-restaurant-sentiment" )
This model can be integrated into larger applications requiring sentiment analysis of customer feedback in the restaurant industry, such as customer service analytics platforms, review aggregation services, or market research tools.
This model is specifically fine-tuned for restaurant review sentiment analysis. Using it for sentiment analysis in other domains (e.g., product reviews, movie reviews, social media posts) without further fine-tuning may lead to inaccurate results. It is also not intended for generating text or performing other NLP tasks beyond sentiment classification.
This model was trained on European restaurant reviews. Therefore, it may exhibit biases present in the training data, such as specific linguistic nuances, cultural references, or common sentiments expressed in European contexts. Its performance might degrade when applied to reviews from vastly different cultural or linguistic backgrounds. The model classifies sentiment into two categories (positive/negative) and does not capture nuanced or mixed sentiments. Overfitting was addressed during training using techniques like early stopping and dropout regularization, but it's always a potential risk with fine-tuned models.
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
Use the code below to get started with the model.
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
model = DistilBertForSequenceClassification.from_pretrained("RinInori/distilbert-restaurant-sentiment")
tokenizer = DistilBertTokenizer.from_pretrained("RinInori/distilbert-restaurant-sentiment")
# Example usage:
text = "The food was absolutely delicious and the service was outstanding!"
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
# Get predicted class and confidence
predicted_class = torch.argmax(predictions, dim=-1).item()
sentiment = "Positive" if predicted_class == 1 else "Negative"
confidence = predictions[0][predicted_class].item()
print(f"Review: {text}")
print(f"Sentiment: {sentiment}")
print(f"Confidence: {confidence:.2%}")
The model was fine-tuned on the European Restaurant Reviews dataset from Kaggle. This dataset contains customer reviews for various restaurants, divided into positive and negative sentiments.
Dataset URL: https://www.kaggle.com/datasets/gorororororo23/european-restaurant-reviews
Preprocessing steps included tokenization using DistilBertTokenizer. The dataset was split into training and validation sets. Class imbalance was addressed using class weighting, and overfitting was prevented using early stopping and dropout regularization.
Training regime: The model was trained using the Hugging Face Trainer API. Key techniques included class weighting to handle imbalance, early stopping to prevent overfitting, and dropout regularization.
Testing Data: The model's performance was evaluated on a held-out test set from the European Restaurant Reviews dataset.
Factors: Sentiment classification (Positive/Negative).
Metrics: The evaluation included standard classification metrics such as accuracy, precision, recall, and F1-score. Confusion matrices were also used to visualize performance.
Fine-Tuned the model with dataset made the model performance become better.
More Information Needed
Hardware Type: GPU, A100 Cloud Provider: Google Colab (implied by notebook)
The model uses the DistilBERT architecture, which is a distilled version of BERT, making it smaller and faster while retaining much of BERT's language capabilities. The objective was to fine-tune this architecture for binary sentiment classification (positive/negative) on restaurant reviews.
Training was performed in a Google Colab environment with GPU
Python, PyTorch, Hugging Face Transformers library, pandas, numpy, scikit-learn, matplotlib, seaborn, nltk.
RinInori. (2024). distilbert-restaurant-sentiment. Hugging Face Hub. Retrieved from https://huggingface.co/RinInori/distilbert-restaurant-sentiment