CoolFace
Modelpublic

YamenRM/Emotion_model

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
1likes5downloads
Model Card

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
  • โ€”Task: Multi-class emotion detection

๐Ÿ“Š Evaluation

ClassPrecisionRecallF1-scoreSupport
0 (sadness)0.990.960.9824,121
1 (joy)0.930.990.9628,220
2 (love)1.000.710.836,824
3 (anger)0.950.940.9511,448
4 (fear)0.900.910.919,574
5 (surprise)0.740.990.853,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}]