Emotion detection
Teaching a language model to recognize several emotions in the same piece of text.
- Status
- ML experiment
- Year
- 2024
- Role
- Solo
- Area
- Machine learning
In plain English
People often express more than one feeling at once, like sadness and anger in the same sentence. This project trains a model to tag a piece of text with every emotion it expresses. It reads the language only and can't tell how the writer actually feels.
How it works
- Start with text examples labeled with one or more emotions.
- Tokenize the text (split it into pieces a model can read).
- Fine-tune BERT (a widely used pretrained language model) to predict several labels at once.
- Evaluate with measures built for multi-label tasks, such as F1 score (a balance of hits and misses).
What I did
I built it solo in PyTorch, starting from the pretrained BERT model and a public labeled dataset.
What I learned
Emotions overlap, so letting a text carry several labels fits the problem far better than picking one winner.