--- language: - ar license: mit library_name: transformers tags: - arabic - sentiment-analysis - bert - natural-language-processing datasets: - custom-arabic-sentiment metrics: - accuracy - f1 model-index: - name: MARBERTv2 Arabic Sentiment Analysis results: - task: type: text-classification name: Sentiment Analysis dataset: name: Arabic-Sentiment-50K type: custom metrics: - type: accuracy value: 0.8093 - type: f1 value: 0.8069 --- # MARBERTv2 Arabic Sentiment Analysis هذا النموذج مخصص لتصنيف المشاعر في النصوص العربية إلى ثلاث فئات: **إيجابي (Positive)**، **محايد (Neutral)**، و**سلبي (Negative)**. تم بناء النموذج باستخدام بنية `MARBERTv2` وتدريبه على مجموعة بيانات عربية ضخمة ومصنفة. This model is designed for Arabic Sentiment Analysis, classifying text into three categories: **Positive**, **Neutral**, and **Negative**. It is based on the `MARBERTv2` architecture and was fine-tuned on a custom Arabic dataset. ## Model Details | تفاصيل النموذج - **Developed by:** Eng.Rafat Mohammed - **Model type:** BERT-based Sequence Classification - **Language(s):** Arabic (ar) - **License:** MIT - **Finetuned from model:** [UBC-NLP/MARBERTv2](https://huggingface.co/UBC-NLP/MARBERTv2) ## Intended Uses & Limitations | الاستخدامات والقيود ### Intended Use - تحليل آراء العملاء في منصات التواصل الاجتماعي. - تصنيف التعليقات والتقييمات للمنتجات والخدمات العربية. - دراسات تحليل المشاعر العامة للنصوص العربية. ### Limitations - قد يواجه النموذج صعوبة في فهم بعض اللهجات العربية المحلية شديدة الخصوصية. - الأداء الأفضل يكون مع النصوص التي تم تنظيفها من الرموز التعبيرية المبالغ فيها والروابط. ## Training Procedure | طريقة التدريب ### Training Hyperparameters - **Epochs:** 3 - **Learning Rate:** 2e-5 - **Batch Size:** 8 - **Weight Decay:** 0.01 - **Warmup steps:** 300 - **Max Sequence Length:** 256 ### Dataset Split تم تقسيم البيانات بنسبة 80/20: - **Training set:** 40,000 samples - **Evaluation set:** 10,000 samples ## Evaluation Results | نتائج التقييم | Metric | Value | | --- | --- | | Accuracy | 80.93% | | F1 Score | 80.69% | | Eval Loss | 0.7561 | ## Usage Example | مثال على الاستخدام ```python from transformers import AutoTokenizer, AutoModelForSequenceClassification import torch # تحميل النموذج والتوكنايزر model_name = "RafatMohammed/MARBERTv2-sentiment-final" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForSequenceClassification.from_pretrained(model_name) # دالة التوقع def predict_sentiment(text): inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=128) with torch.no_grad(): outputs = model(**inputs) pred_id = outputs.logits.argmax(dim=-1).item() id2label = {0: "negative", 1: "neutral", 2: "positive"} return id2label[pred_id] # تجربة print(predict_sentiment("الخدمة ممتازة وسريعة جداً")) # Output: positive print(predict_sentiment("تأخر الطلب كثيراً ولم يعجبني الطعام")) # Output: negative ``` ## Citation | الاقتباس إذا وجدت هذا النموذج مفيداً في بحثك، يرجى الإشارة إليه. ```bibtex @misc{marbertv2-arabic-sentiment, author = {Rafat Mohammed}, title = {MARBERTv2 Arabic Sentiment Analysis Model}, year = {2026}, publisher = {Hugging Face}, journal = {Hugging Face Model Hub} } ```