File size: 1,984 Bytes
e021743 4966184 4ec7363 4966184 4ec7363 4966184 4ec7363 e021743 4966184 e021743 4966184 e021743 4966184 e021743 4966184 e021743 4966184 e021743 4966184 e021743 4966184 e021743 4966184 e021743 4966184 e021743 4966184 e021743 4966184 e021743 4966184 e021743 4966184 e021743 4966184 4ec7363 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | ---
language: en
tags:
- emotion-detection
- text-classification
- transformers
- distilbert
datasets:
- nelgiriyewithana/emotions
model-index:
- name: DistilBERT Emotion Classifier
results:
- task:
type: text-classification
name: Emotion Detection
dataset:
name: Kaggle Emotions Dataset
type: text
metrics:
- name: Accuracy
type: accuracy
value: 0.94
- name: F1
type: f1
value: 0.94
- name: Precision
type: precision
value: 0.94
- name: Recall
type: recall
value: 0.94
license: apache-2.0
metrics:
- accuracy
- recall
- precision
---
# DistilBERT Emotion Classifier 🎭
This model classifies English text into one of six emotions: **sadness, joy, love, anger, fear, surprise**.
- **Base model**: `distilbert-base-uncased`
- **Framework**: Hugging Face Transformers
- **Dataset**: [Kaggle Emotions Dataset](https://www.kaggle.com/datasets/nelgiriyewithana/emotions)
- **Task**: Multi-class emotion detection
---
## 📊 Evaluation
| Class | Precision | Recall | F1-score | Support |
|-------|-----------|--------|----------|---------|
| 0 (sadness) | 0.99 | 0.96 | 0.98 | 24,121 |
| 1 (joy) | 0.93 | 0.99 | 0.96 | 28,220 |
| 2 (love) | 1.00 | 0.71 | 0.83 | 6,824 |
| 3 (anger) | 0.95 | 0.94 | 0.95 | 11,448 |
| 4 (fear) | 0.90 | 0.91 | 0.91 | 9,574 |
| 5 (surprise) | 0.74 | 0.99 | 0.85 | 3,038 |
**Overall Performance**:
- Accuracy: **94%**
- Macro F1: **0.91**
- Weighted F1: **0.94**
---
## 🧑💻 Usage
```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
model_name = "YamenRM/distilbert-emotion-classifier"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
nlp = pipeline("text-classification", model=model, tokenizer=tokenizer)
print(nlp("I feel so happy and excited today!"))
# [{'label': 'joy', 'score': 0.98}] |