Understanding Textual Emotions by Evaluating NLP Model Performance
摘要
This research investigates the effectiveness of transformer-based models, particularly DistilBERT, in emotion classification compared to traditional machine learning and deep learning approaches. A dataset of 20,000 labeled text samples across 6 emotion categories was utilized, divided into training (16,000 samples), validation (2,000), and test (2,000) sets. Performance was evaluated using accuracy, precision, recall, and F1-score. DistilBERT achieved superior accuracy (92%), outperforming models like Random Forest (86–88%), SVM (87%), and LSTM (88%), demonstrating its ability to capture contextual language patterns through self-attention and pre-training. While excelling in detecting Joy (94% precision, 96% recall) and Sadness, the model struggled with Love and Surprise (test F1-scores of 72% and 85% precision, respectively), highlighting challenges in recognizing nuanced or under-represented emotions. The results underscore DistilBERT’s efficiency and scalability for emotion detection tasks, though imbalances in class distribution and contextual ambiguity in certain emotions warrant further optimization.