Instructions to use neuron-01/emotion_classifier_for_text-roberta-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use neuron-01/emotion_classifier_for_text-roberta-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="neuron-01/emotion_classifier_for_text-roberta-base")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("neuron-01/emotion_classifier_for_text-roberta-base") model = AutoModelForSequenceClassification.from_pretrained("neuron-01/emotion_classifier_for_text-roberta-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
emotion_classifier_for_text-roberta-base
Model Description
This model is a fine-tuned version of roberta-base for multi-class emotion classification. It is designed to classify short text statements into one of six distinct emotional categories:
- Sadness
- Joy
- Love
- Anger
- Fear
- Surprise
The model was fine-tuned using supervised learning on a labeled emotion dataset to identify expressed emotional content with high contextual awareness.
Performance
The model achieves the following performance metrics on the test set:
| Metric | Value |
|---|---|
| Accuracy | 0.936 |
| F1 Score (weighted) | 0.9354 |
| Loss | 0.1994 |
Observations:
- Strong Performance: High reliability across major classes such as joy, sadness, and anger.
- Precision: Improved precision for minority classes compared to standard baseline models.
- Challenges: Some performance trade-offs were observed in low-frequency classes like surprise.
Intended Use
This model is suitable for:
- Emotion detection in text-based data.
- Sentiment-aware application development.
- Enhancing chatbots and conversational AI.
- Social media sentiment and trend analysis.
- Mental health or mood tracking (for non-clinical use).
Limitations
- Class Imbalance: Performance is lower on underrepresented classes (e.g., surprise, love).
- Subjectivity: Emotion classification is inherently subjective and highly context-dependent.
- Complexity: The model may struggle with sarcasm, mixed emotions, or very short/ambiguous inputs.
- Safety: Not suitable for high-stakes or clinical decision-making.
Training Data
The model was fine-tuned on the dair-ai/emotion dataset.
- Samples: Approximately 16,000 training samples.
- Format: Text-based, short-form sentences.
- Distribution: Balanced across common emotions, though some classes have significantly fewer samples.
Training Procedure
Training Hyperparameters
The following hyperparameters were used during training:
- learning_rate: 0.0001
- train_batch_size: 16
- eval_batch_size: 16
- seed: 42
- optimizer: AdamW (fused)
- lr_scheduler_type: linear
- num_epochs: 5
Training Results
| Training Loss | Epoch | Step | Validation Loss | Accuracy | F1 |
|---|---|---|---|---|---|
| 0.5588 | 1.0 | 1000 | 0.3132 | 0.91 | 0.9107 |
| 0.2600 | 2.0 | 2000 | 0.2160 | 0.933 | 0.9327 |
| 0.1894 | 3.0 | 3000 | 0.2041 | 0.931 | 0.9303 |
| 0.1411 | 4.0 | 4000 | 0.1603 | 0.938 | 0.9378 |
| 0.0985 | 5.0 | 5000 | 0.1994 | 0.936 | 0.9354 |
Evaluation Insights
Compared to a DistilBERT baseline, this model provides:
- Improved precision and better balance across all classes.
- Reduced false positives in minority classes.
- Superior handling of nuanced emotional distinctions.
Note: Trade-offs remain between precision and recall for specific emotions due to the nature of the training data.
Future Improvements
- Address class imbalance using weighted loss functions or data augmentation.
- Explore larger architectures (e.g., DeBERTa) for deeper contextual understanding.
- Implement multi-label capabilities to detect mixed emotions.
- Enhance robustness against informal or noisy text (slang, typos).
Disclaimer
This model is intended for research and educational purposes. Predictions should not be used as the sole basis for decisions in sensitive or high-risk domains.
Framework Versions
- Transformers 5.0.0
- Pytorch 2.10.0+cu128
- Datasets 4.0.0
- Tokenizers 0.22.2
- Downloads last month
- 11
Model tree for neuron-01/emotion_classifier_for_text-roberta-base
Base model
FacebookAI/roberta-baseDataset used to train neuron-01/emotion_classifier_for_text-roberta-base
Evaluation results
- Accuracy on emotionself-reported0.936
- F1 (weighted) on emotionself-reported0.935