abdelrahmane01 commited on
Commit
cdd3e28
·
verified ·
1 Parent(s): 40bc7cd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +105 -35
README.md CHANGED
@@ -3,65 +3,135 @@ library_name: transformers
3
  license: apache-2.0
4
  base_model: bert-base-uncased
5
  tags:
 
 
 
6
  - generated_from_trainer
7
  metrics:
 
8
  - accuracy
9
  model-index:
10
  - name: SentimentAnalysis-bert-base-uncased-finetuned-emotion
11
- results: []
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  ---
13
 
14
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
15
- should probably proofread and complete it, then remove this comment. -->
16
-
17
  # SentimentAnalysis-bert-base-uncased-finetuned-emotion
18
 
19
- This model is a fine-tuned version of [bert-base-uncased](https://huggingface.co/bert-base-uncased) on an unknown dataset.
20
- It achieves the following results on the evaluation set:
21
- - Loss: 0.2913
22
- - F1 Macro: 0.8801
23
- - Accuracy: 0.9215
 
 
 
 
 
 
 
24
 
25
- ## Model description
 
 
26
 
27
- More information needed
28
 
29
- ## Intended uses & limitations
 
 
30
 
31
- More information needed
 
 
32
 
33
- ## Training and evaluation data
34
 
35
- More information needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  ## Training procedure
38
 
39
- ### Training hyperparameters
 
 
 
 
 
 
 
 
 
 
 
40
 
41
- The following hyperparameters were used during training:
42
- - learning_rate: 1e-05
43
- - train_batch_size: 16
44
- - eval_batch_size: 16
45
- - seed: 42
46
- - optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
47
- - lr_scheduler_type: linear
48
- - num_epochs: 6
49
 
50
  ### Training results
51
 
52
  | Training Loss | Epoch | Step | Validation Loss | F1 Macro | Accuracy |
53
  |:-------------:|:-----:|:----:|:---------------:|:--------:|:--------:|
54
- | 0.7334 | 1.0 | 1000 | 0.2508 | 0.8941 | 0.917 |
55
- | 0.2016 | 2.0 | 2000 | 0.1881 | 0.9096 | 0.933 |
56
- | 0.145 | 3.0 | 3000 | 0.1981 | 0.9119 | 0.9355 |
57
- | 0.1178 | 4.0 | 4000 | 0.2229 | 0.9158 | 0.939 |
58
- | 0.0903 | 5.0 | 5000 | 0.2469 | 0.9161 | 0.9385 |
59
- | 0.0808 | 6.0 | 6000 | 0.2489 | 0.9100 | 0.9355 |
 
 
 
 
60
 
 
 
 
 
 
 
 
 
61
 
62
- ### Framework versions
63
 
64
- - Transformers 4.57.1
65
- - Pytorch 2.8.0+cu126
66
- - Datasets 4.4.1
67
- - Tokenizers 0.22.1
 
3
  license: apache-2.0
4
  base_model: bert-base-uncased
5
  tags:
6
+ - text-classification
7
+ - sentiment-analysis
8
+ - emotion-classification
9
  - generated_from_trainer
10
  metrics:
11
+ - f1_macro
12
  - accuracy
13
  model-index:
14
  - name: SentimentAnalysis-bert-base-uncased-finetuned-emotion
15
+ results:
16
+ - task:
17
+ type: text-classification
18
+ name: Emotion Classification
19
+ dataset:
20
+ name: Emotion Dataset
21
+ type: text
22
+ metrics:
23
+ - type: f1_macro
24
+ value: 0.8801
25
+ name: F1 Macro
26
+ - type: accuracy
27
+ value: 0.9215
28
+ name: Accuracy
29
  ---
30
 
 
 
 
31
  # SentimentAnalysis-bert-base-uncased-finetuned-emotion
32
 
33
+ This model is a **fine-tuned version of `bert-base-uncased`** for **emotion classification** of short English texts such as tweets and social media posts.
34
+
35
+ The model predicts one of **six emotion classes**:
36
+
37
+ - sadness
38
+ - joy
39
+ - love
40
+ - anger
41
+ - fear
42
+ - surprise
43
+
44
+ The model was trained using the 🤗 **Transformers Trainer API**.
45
 
46
+ ---
47
+
48
+ ## Model performance
49
 
50
+ Evaluation results on the test set:
51
 
52
+ - **Loss:** 0.2913
53
+ - **F1 Macro:** 0.8801
54
+ - **Accuracy:** 0.9215
55
 
56
+ **Macro F1** is reported as the primary metric because the dataset is imbalanced and this metric better reflects performance across all emotion classes.
57
+
58
+ ---
59
 
60
+ ## Intended uses
61
 
62
+ This model is suitable for:
63
+
64
+ - Emotion classification of tweets and short social media texts
65
+ - NLP research and academic projects
66
+ - Emotion-aware chatbots
67
+ - Sentiment and emotion analytics dashboards
68
+
69
+ ---
70
+
71
+ ## Limitations
72
+
73
+ - Optimized for **short texts**; performance may degrade on long documents
74
+ - **English-only**
75
+ - May reflect biases present in the training data
76
+ - Not intended for **high-stakes or sensitive decision-making**
77
+
78
+ ---
79
+
80
+ ## Training data
81
+
82
+ The model was trained on an **emotion-labeled dataset of short texts** with six emotion categories.
83
+
84
+ Preprocessing steps included:
85
+
86
+ - Train / validation / test split
87
+ - Tokenization using the BERT tokenizer
88
+ - Padding and truncation to a fixed maximum sequence length
89
+ - Label encoding using Hugging Face `ClassLabel`
90
+
91
+ ---
92
 
93
  ## Training procedure
94
 
95
+ ### Hyperparameters
96
+
97
+ - **Base model:** bert-base-uncased
98
+ - **Learning rate:** 1e-5
99
+ - **Train batch size:** 16
100
+ - **Eval batch size:** 16
101
+ - **Epochs:** 6
102
+ - **Optimizer:** AdamW (Torch fused)
103
+ - betas = (0.9, 0.999)
104
+ - epsilon = 1e-8
105
+ - **Learning rate scheduler:** Linear
106
+ - **Seed:** 42
107
 
108
+ ---
 
 
 
 
 
 
 
109
 
110
  ### Training results
111
 
112
  | Training Loss | Epoch | Step | Validation Loss | F1 Macro | Accuracy |
113
  |:-------------:|:-----:|:----:|:---------------:|:--------:|:--------:|
114
+ | 0.7334 | 1.0 | 1000 | 0.2508 | 0.8941 | 0.9170 |
115
+ | 0.2016 | 2.0 | 2000 | 0.1881 | 0.9096 | 0.9330 |
116
+ | 0.1450 | 3.0 | 3000 | 0.1981 | 0.9119 | 0.9355 |
117
+ | 0.1178 | 4.0 | 4000 | 0.2229 | 0.9158 | 0.9390 |
118
+ | 0.0903 | 5.0 | 5000 | 0.2469 | 0.9161 | 0.9385 |
119
+ | 0.0808 | 6.0 | 6000 | 0.2489 | 0.9100 | 0.9355 |
120
+
121
+ The best model checkpoint was selected based on **macro F1 score**.
122
+
123
+ ---
124
 
125
+ ## Framework versions
126
+
127
+ - **Transformers:** 4.57.1
128
+ - **PyTorch:** 2.8.0+cu126
129
+ - **Datasets:** 4.4.1
130
+ - **Tokenizers:** 0.22.1
131
+
132
+ ---
133
 
134
+ ## Source code
135
 
136
+ Training and evaluation code is available on GitHub:
137
+ https://github.com/Abdelrahmanemam01/Sentiment-Analysis