SobanHM commited on
Commit
cbea9fe
Β·
verified Β·
1 Parent(s): 80ec385

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +246 -0
README.md CHANGED
@@ -1,3 +1,249 @@
1
  ---
 
 
2
  license: mit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - en
4
  license: mit
5
+ library_name: transformers
6
+ pipeline_tag: text-classification
7
+ tags:
8
+ - emotion-classification
9
+ - natural-language-processing
10
+ - roberta
11
+ - transformers
12
+ - pytorch
13
+ - goemotions
14
+ - ekman-emotions
15
+ - sentiment-analysis
16
+ - text-classification
17
+ datasets:
18
+ - go_emotions
19
+ metrics:
20
+ - accuracy
21
+ - precision
22
+ - recall
23
+ - f1
24
+ model-index:
25
+ - name: EmotionSense
26
+ results:
27
+ - task:
28
+ type: text-classification
29
+ name: Emotion Classification
30
+ dataset:
31
+ name: Customized GoEmotions (Ekman Mapping)
32
+ type: go_emotions
33
+ metrics:
34
+ - type: Accuracy
35
+ value: 0.903
36
+ - type: Precision
37
+ value: 0.901
38
+ - type: Recall
39
+ value: 0.894
40
+ - type: Weighted F1
41
+ value: 0.891
42
  ---
43
+
44
+ # 🧠 EmotionSense
45
+ ### Fine-Grained Emotion Classification using RoBERTa
46
+
47
+ <p align="center">
48
+
49
+ πŸ€— <b>Hugging Face</b> β€’ πŸ”₯ <b>RoBERTa</b> β€’ πŸ’¬ <b>Emotion AI</b> β€’ πŸš€ <b>Production Ready</b>
50
+
51
+ </p>
52
+
53
+ EmotionSense is a **RoBERTa-base** model fine-tuned for **emotion classification**. The model predicts **seven human emotions** from English text using a cleaned and simplified version of the GoEmotions dataset.
54
+
55
+ Unlike the original GoEmotions dataset containing 28 fine-grained emotion labels, this work reorganizes emotions according to the **Ekman Emotion Framework**, improving interpretability while maintaining strong predictive performance.
56
+
57
+ ---
58
+
59
+ # ✨ Highlights
60
+
61
+ - πŸ”₯ Fine-tuned **RoBERTa-base**
62
+ - 🧠 Context-aware emotion recognition
63
+ - πŸ“Š Class-balanced training using Weighted Cross Entropy Loss
64
+ - ⚑ Early stopping for improved generalization
65
+ - 🎯 Optimized using Weighted F1 Score
66
+ - πŸ€— Compatible with Hugging Face Transformers Pipeline
67
+
68
+ ---
69
+
70
+ # 🎯 Supported Emotion Classes
71
+
72
+ | Label | Description |
73
+ |--------|------------|
74
+ | πŸ˜€ Joy | Positive emotions, happiness, gratitude, love |
75
+ | 😒 Sadness | Grief, disappointment, remorse |
76
+ | 😑 Anger | Anger, annoyance, disapproval |
77
+ | 😨 Fear | Fear and nervousness |
78
+ | 🀒 Disgust | Disgust |
79
+ | 😲 Surprise | Surprise, curiosity, realization |
80
+ | 😐 Neutral | Emotionally neutral statements |
81
+
82
+ ---
83
+
84
+ # πŸ“š Dataset
85
+
86
+ The model was trained using a **customized version of the GoEmotions dataset**.
87
+
88
+ The original dataset contains approximately **58,000 Reddit comments** annotated with **28 fine-grained emotion labels**.
89
+
90
+ To improve annotation quality:
91
+
92
+ - βœ” Majority Voting was applied.
93
+ - βœ” Samples without annotator agreement were removed.
94
+ - βœ” Multi-label ambiguity was eliminated.
95
+ - βœ” Fine-grained emotions were mapped into **Ekman's seven universal emotion categories**.
96
+
97
+ ### Emotion Mapping
98
+
99
+ | Ekman Category | Original GoEmotions Labels |
100
+ |---------------|----------------------------|
101
+ | Anger | anger, annoyance, disapproval |
102
+ | Disgust | disgust |
103
+ | Fear | fear, nervousness |
104
+ | Joy | joy, amusement, admiration, approval, caring, desire, excitement, gratitude, love, optimism, pride, relief |
105
+ | Sadness | sadness, disappointment, embarrassment, grief, remorse |
106
+ | Surprise | surprise, realization, curiosity, confusion |
107
+ | Neutral | neutral |
108
+
109
+ ---
110
+
111
+ # πŸ— Model Architecture
112
+
113
+ | Property | Value |
114
+ |----------|------|
115
+ | Base Model | RoBERTa-base |
116
+ | Framework | Hugging Face Transformers |
117
+ | Language | English |
118
+ | Task | Emotion Classification |
119
+ | Max Sequence Length | 128 |
120
+ | Batch Size | 16 |
121
+ | Learning Rate | 2e-5 |
122
+ | Epochs | 5 |
123
+ | Optimizer | AdamW |
124
+ | Loss Function | Weighted Cross Entropy |
125
+ | Early Stopping | Enabled |
126
+
127
+ ---
128
+
129
+ # πŸ“ˆ Performance
130
+
131
+ EmotionSense achieved the best performance among all evaluated models.
132
+
133
+ | Model | Accuracy | Weighted F1 |
134
+ |-------|---------:|------------:|
135
+ | Logistic Regression | 0.59 | 0.57 |
136
+ | Random Forest | 0.61 | 0.59 |
137
+ | Linear SVM | 0.63 | 0.61 |
138
+ | DistilBERT | 0.68 | 0.67 |
139
+ | **EmotionSense (RoBERTa)** | **0.903** | **0.891** |
140
+
141
+ ### Final Evaluation
142
+
143
+ | Metric | Score |
144
+ |---------|------:|
145
+ | Accuracy | **90.3%** |
146
+ | Precision | **90.1%** |
147
+ | Recall | **89.4%** |
148
+ | Weighted F1 | **89.1%** |
149
+
150
+ ---
151
+
152
+ # πŸš€ Quick Start
153
+
154
+ Install Transformers
155
+
156
+ ```bash
157
+ pip install transformers torch
158
+ ```
159
+
160
+ Load the model
161
+
162
+ ```python
163
+ from transformers import pipeline
164
+
165
+ classifier = pipeline(
166
+ "text-classification",
167
+ model="SobanHM/EmotionSense"
168
+ )
169
+
170
+ classifier("I finally got my dream job today!")
171
+ ```
172
+
173
+ Example Output
174
+
175
+ ```python
176
+ [
177
+ {
178
+ "label": "joy",
179
+ "score": 0.997
180
+ }
181
+ ]
182
+ ```
183
+
184
+ ---
185
+
186
+ # πŸ’‘ Applications
187
+
188
+ - Conversational AI
189
+ - Emotion-aware Chatbots
190
+ - Mental Health Support Systems
191
+ - Customer Feedback Analysis
192
+ - Social Media Analytics
193
+ - Human-Computer Interaction
194
+ - Intelligent Virtual Assistants
195
+
196
+ ---
197
+
198
+ # ⚠ Limitations
199
+
200
+ - Supports English language only.
201
+ - Performance may decrease on domain-specific text.
202
+ - Sarcasm and irony remain challenging.
203
+ - Emotion recognition is probabilistic and should not be used for clinical diagnosis or psychological assessment.
204
+
205
+ ---
206
+
207
+ # πŸ‘¨β€πŸ’» About the Author
208
+
209
+ **Soban Hussain**
210
+
211
+ AI Engineer β€’ Machine Learning Researcher β€’ Computer Vision & NLP
212
+
213
+ πŸ€— **Hugging Face:** https://huggingface.co/SobanHM
214
+
215
+ πŸ’Ό **LinkedIn:** https://www.linkedin.com/in/sobanhussain
216
+
217
+ πŸ’» **GitHub:** https://github.com/SobanHM
218
+
219
+ ---
220
+
221
+ # πŸ™Œ Acknowledgements
222
+
223
+ This project was built using:
224
+
225
+ - Hugging Face Transformers
226
+ - PyTorch
227
+ - GoEmotions Dataset
228
+ - RoBERTa
229
+
230
+ Special thanks to the open-source AI community for providing exceptional tools and resources.
231
+
232
+ ---
233
+
234
+ # πŸ“– Citation
235
+
236
+ If you use this model in your research, please cite both this repository and the GoEmotions dataset.
237
+
238
+ ```bibtex
239
+ @inproceedings{demszky2020goemotions,
240
+ title={GoEmotions: A Dataset of Fine-Grained Emotions},
241
+ author={Demszky, Dorottya and others},
242
+ booktitle={Proceedings of ACL},
243
+ year={2020}
244
+ }
245
+ ```
246
+
247
+ ---
248
+
249
+ ## ⭐ If you find this model useful, consider giving it a Like on Hugging Face and sharing your feedback!