Emotion Recognition from Text (ML + Transformers)

Comprehensive emotion recognition pipeline combining classical machine learning baselines with transformer-based models, evaluated on a standard emotion dataset.

This project investigates emotion recognition from text using a combination of traditional machine learning models and transformer-based architectures. The goal is to systematically compare classical NLP pipelines against modern deep contextual models under a unified evaluation framework. This study provides a comprehensive comparison between classical and deep learning approaches for text-based emotion recognition under a unified evaluation setting.

Experiments are conducted on the widely used dair-ai/emotion benchmark dataset, with careful attention to preprocessing, feature representations, model selection, and metric-based analysis. The repository is structured to support reproducibility and controlled comparison across approaches.


Pipeline Overview

Two Modeling Paradigms
  1. Classical ML Pipeline: TF-IDF feature extraction followed by classifiers such as Logistic Regression, SVM, and Random Forest.
  2. Transformer-Based Modeling: Fine-tuning pre-trained language models (e.g., BERT) for multi-class emotion classification.
Key Components
  • Text preprocessing and normalization
  • TF-IDF vectorization for classical baselines
  • Transformer fine-tuning with task-specific heads
  • Optional ensemble modeling across classifiers
  • Unified evaluation and comparison framework

Evaluation & Metrics


Results & Analysis

Transformer-based models consistently achieve the strongest overall performance, demonstrating the benefit of contextualized representations for emotion understanding. Classical models remain competitive baselines and provide interpretability and efficiency advantages. Ensemble experiments highlight trade-offs between robustness and peak performance.

Model Comparison

The comparison highlights the performance gap between feature-based classifiers and fine-tuned transformer models, especially under macro-averaged metrics.


Repository

The full implementation, experimental notebooks, and evaluation scripts are available at:
https://github.com/md-naim-hassan-saykat/emotion-recognition-nlp