emotion-classification-model
This model is a fine-tuned version of distilbert-base-uncased on the dair-ai/emotion dataset. It is designed to classify text into various emotional categories.
It achieves the following results:
- Validation Accuracy: 93.55%
- Test Accuracy: 93.3%
Model Description
This model uses the DistilBERT architecture, which is a lighter and faster variant of BERT. It has been fine-tuned specifically for emotion classification, making it suitable for tasks such as sentiment analysis, customer feedback analysis, and user emotion detection.
Key Features
- Efficient and lightweight for deployment.
- High accuracy for emotion detection tasks.
- Pretrained on a diverse dataset and fine-tuned for high specificity to emotions.
Intended Uses & Limitations
Intended Uses
- Emotion analysis in text data.
- Sentiment detection in customer reviews, tweets, or user feedback.
- Psychological or behavioral studies to analyze emotional tone in communications.
Limitations
- May not generalize well to datasets with highly domain-specific language.
- Performance might degrade with noisy or ambiguous text inputs.
- The model is English-specific and may not perform well on non-English text.
Training and Evaluation Data
Training Dataset
- Dataset: dair-ai/emotion
- Training Set Size: 16,000 examples
- Dataset Description: The dataset contains English sentences labeled with six emotional categories: anger, joy, optimism, sadness, fear, and disgust.
Results
- Training Time: ~190 seconds
- Training Loss: 0.2034
- Validation Accuracy: 93.55%
- Test Accuracy: 93.3%
Training Procedure
Hyperparameters
- Learning Rate: 5e-05
- Batch Size: 16 (train and evaluation)
- Epochs: 3
- Seed: 42
- Optimizer: AdamW (betas=(0.9,0.999), epsilon=1e-08)
- Learning Rate Scheduler: Linear
- Mixed Precision Training: Native AMP
Training and Validation Results
| Epoch | Training Loss | Validation Loss | Validation Accuracy |
|---|---|---|---|
| 1 | 0.2293 | 0.1746 | 93.35% |
| 2 | 0.1315 | 0.1529 | 93.70% |
| 3 | 0.0798 | 0.1554 | 93.55% |
Test Results
- Loss: 0.1642
- Accuracy: 93.3%
Performance Metrics
- Training Speed: ~252 samples/second
- Evaluation Speed: ~1,250 samples/second
Usage Example
from transformers import pipeline
# Load the fine-tuned model
classifier = pipeline("text-classification", model="your-model-path")
# Example usage
text = "I am so happy to see you!"
emotion = classifier(text)
print(emotion)