EmoC
Emotion Intelligence System — real-time emotion recognition and prediction.
Overview
EmoC is an end-to-end emotion intelligence system that classifies text into emotional categories and provides interactive prediction capabilities. The system combines transformer-based classification with a user-facing interactive demo.
Problem
Emotion detection in text is fundamental to understanding human communication. However, existing solutions are either too broad (positive/negative only), too slow for interactive use, or lack interpretability. EmoC addresses all three gaps.
Architecture
`
Input Text → Tokenizer → Transformer Encoder → Classification Head → Emotion Label
↓
Attention Weights
↓
Interpretation Layer
`
Emotion Categories
The system classifies text into 7 distinct emotions based on dimensional affect theory:
| Category | Description | Valence-Arousal |
| ---------- | ------------- | ----------------- |
| Joy | Positive, high-arousal | +1, +1 |
| Sadness | Negative, low-arousal | -1, -1 |
| Anger | Negative, high-arousal | -1, +1 |
| Fear | Negative, low-to-medium arousal | -1, +0.5 |
| Surprise | Neutral, high-arousal | 0, +1 |
| Disgust | Negative, medium arousal | -1, 0 |
| Neutral | Low arousal, neutral valence | 0, 0 |
Model Architecture
Training Configuration
| Parameter | Value |
| ----------- | ------- |
| Base Model | bert-base-uncased |
| Optimizer | AdamW (lr=2e-5, weight_decay=0.01) |
| Scheduler | Linear warmup (10%) + linear decay |
| Epochs | 5 |
| Batch Size | 32 |
| Max Sequence Length | 128 |
| Dropout | 0.3 |
| Hardware | Single NVIDIA T4 (Google Colab) |
| Training Time | ~2.5 hours |
Dataset
Primary Dataset: GoEmotions (Google Research)
Preprocessing:
Augmentation:
Emotion Classification
Classification Head
The classification head is a simple feed-forward network:
`
Pooled Output (768) → Dense(256) → ReLU → Dropout(0.3) → Dense(7) → Softmax
`
Multi-Label Extension
While the primary task is single-label classification, the system also supports multi-label outputs where text can express blended emotions. This is achieved through a secondary sigmoid-based head.
Interpretability
EmoC provides attention-based explanations:
Training
Training Process
Loss Function
Label-smoothed cross-entropy with smoothing parameter ε=0.1. This prevents the model from becoming overconfident and improves generalization to unseen emotional expressions.
Evaluation
Results
| Metric | Value |
| -------- | ------- |
| Accuracy | 72.4% |
| Macro F1 | 68.1% |
| Weighted F1 | 71.8% |
| Per-Class F1 (avg) | 66.3% |
| Confusion Matrix | See below |
Per-Class Performance
| Emotion | Precision | Recall | F1 |
| --------- | ----------- | -------- | ----- |
| Joy | 0.78 | 0.71 | 0.74 |
| Sadness | 0.69 | 0.74 | 0.71 |
| Anger | 0.73 | 0.68 | 0.70 |
| Fear | 0.64 | 0.62 | 0.63 |
| Surprise | 0.71 | 0.75 | 0.73 |
| Disgust | 0.68 | 0.66 | 0.67 |
| Neutral | 0.74 | 0.73 | 0.73 |
Error Analysis
Applications
Interactive Prediction Demo
The system includes a live demo where users can:
The demo is powered by a fast inference server with cached model embeddings for sub-100ms response times.