02 / NLP / Deep Learning
BERT Emotion Classification
A BERT-based text classifier built with PyTorch and Transformers to distinguish six emotion classes.
Overview
An NLP project using BERT, PyTorch and Transformers to classify text as Sad, Happy, Love, Angry, Fear or Surprise.
Problem
The task is to infer an emotion category from text. Related emotions and ambiguous language make this a multi-class prediction problem rather than a simple positive/negative sentiment task.
Architecture
Text is processed with a BERT-based classification model and mapped to one of six emotion labels.
- TextLanguage input
- BERTTransformer model
- EmotionOne of six classes
Implementation
- Build the emotion-classification workflow in Python using PyTorch and Transformers.
- Evaluate classification with validation accuracy and Matthews correlation coefficient (MCC).
Challenges
Emotion categories can overlap in meaning. Overall accuracy alone does not show which classes are being confused, so class-level evaluation remains important.
Technology
- Python
- PyTorch
- BERT
- Transformers
Outcome
- Validation accuracy
- ≈69%
- MCC
- ≈0.68
Reported validation accuracy is approximately 69%, with MCC approximately 0.68. These are useful results to examine, with clear scope for improvement.
Dataset composition, split details and the full evaluation protocol still need to be documented.
What I learned
A headline score is only part of a classifier's behavior. Looking at errors between individual emotion classes is an important next step in understanding the result.