Downloads · 30 days
6
5% of all-time downloads
amitca71/marabert2-levantine-sentiment
marabert2-levantine-sentiment is a text classification model from amitca71. Use it when you need a label for a piece of text.
This model is a fine-tuned version of MARBERTv2, designed to predict the sentiment of Levantine Arabic tweets (Jordanian, Lebanese, Palestinian, Syrian).
Downloads · 30 days
6
5% of all-time downloads
All-time downloads
121
Public
Parameters
163M
1.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors651 MB · 100%
From the Hugging Face model README
This model is a fine-tuned version of MARBERTv2, designed to predict the sentiment of Levantine Arabic tweets (Jordanian, Lebanese, Palestinian, Syrian).
Technical Highlight: This model was trained using an Ordinal Loss Function (Mean Squared Error combined with Cross-Entropy). This makes the model "distance-aware," meaning it heavily penalizes extreme mistakes (like confusing a highly positive tweet for a highly negative one). This makes its predictions far more reliable in edge cases!
| Metric | Score | Description |
|---|---|---|
| Accuracy | 79.25% | Overall correctness on the test set. |
| F1 (Macro) | 0.7635 | The balanced F1 score across all 3 classes. |
| ID | Label | Meaning |
|---|---|---|
| 0 | Negative 😠 | Anger, complaints, sadness, or frustration. |
| 1 | Neutral 😐 | Objective facts, mixed emotions, or ambiguous statements. |
| 2 | Positive 😃 | Joy, praise, excitement, or satisfaction. |
Because this is a standard 3-class model, you can easily load it using Hugging Face's built-in pipeline.
from transformers import pipeline
# 1. Load Pipeline
model_id = "amitca71/marabert2-levantine-sentiment"
classifier = pipeline("text-classification", model=model_id)
def predict_sentiment(text):
# Get the top prediction
result = classifier(text)[0]
# Format the output cleanly
return {"text": text, "label": result['label'], "confidence": round(result['score'], 4)}
# 2. Test Examples
print(predict_sentiment("الجو اليوم بيعقد! طالعين مشوار")) # Should be Positive
print(predict_sentiment("والله طقت روحي من هالزحمة، شي بيقرف")) # Should be Negative
print(predict_sentiment("وصلت عالبيت من شوي.")) # Should be Neutral