Comparative Analysis of Machine Learning Models for Text Emotion Classification
Siyao Xiao · Applied and Computational Engineering · 2025
The categorisation of textual data, an essential Natural Language Processing (NLP) capability, drives practical implementations in domains such as affective computing, user interaction management, and digital content curation. This paper compares three machine learning models to evaluate their effectiveness in text emotion classification: Long Short-Term Memory (LSTM), Random Forest, and Multilayer Perceptron (MLP). The study focuses on identifying the most suitable model for handling sequential data and capturing complex text patterns. The LSTM model processes sequential text by embedding words into vectors, passing them through LSTM layers, and classifying the output, combining high-level semantic features with low-level details. In contrast, the Random Forest model leverages ensemble learning, and the Perceptron model employs a linear classifier. Experiments on a text emotion dataset show that the LSTM model outperforms traditional methods, achieving a test accuracy of 97.46%, compared to 64.88% for Random Forest and 52.85% for the Perceptron model. These results highlight the LSTM model's ability to capture temporal dependencies, making it highly effective for text emotion classification. This research contributes to the field by emphasising LSTM efficacy in handling sequential data, providing a foundation for future developments such as hybrid models and transfer learning applications.