|
--- |
|
library_name: transformers |
|
tags: [] |
|
--- |
|
|
|
#### Overview |
|
|
|
A DistilBERT trained model for sentence sentiment classification. |
|
Classifies sentences into 6 emotions - sadness, joy, love, anger, fear, surprise. |
|
|
|
|
|
#### Dataset used for model |
|
Model trained on [Emotions Dataset](https://www.kaggle.com/datasets/nelgiriyewithana/emotions), which is based on English Twitter messages and has 6 labels. |
|
|
|
#### How the model was created |
|
The model was trained using `DistilBertForSequenceClassification.from_pretrained` with `problem_type="single_label_classification"` for 10 epochs with a learning rate of 5e-5 and weight decay of 0.01. |
|
|
|
#### Inference |
|
```python |
|
from transformers import pipeline |
|
|
|
classifier = pipeline("text-classification", model="entfane/distilbert-emotion-recognition") |
|
|
|
text_to_predict = ["I hate going there, it is so boring", "That's so wonderful!"] |
|
result = classifier(text_to_predict) |
|
print(result) # contains a list of dictionaries (one for each output) |
|
``` |
|
|
|
#### Summary |
|
Evaluation of output using dataset test split gives: |
|
|
|
- Accuracy: 0.942 |
|
- Precision: 0.950 |
|
- Recall: 0.942 |
|
- F1: 0.942 |
|
|