Research Article

Comparative Analysis of Machine Learning Models for Text Emotion Classification

Siyao Xiao*
College of Mathematics and Informatics, South China Agricultural University, Guangdong, China

* Corresponding author: [email protected]

Abstract

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.

Keywords: Natural Language Processing; LSTM; Random Forest; Multilayer Perceptron
Published: May 30, 2025
DOI: 10.54254/2755-2721/2025.GL23569
Volume: ACE Vol.155
pp. 228-235
Download PDF

References

  1. Yadollahi, A., Shahraki, A. G., Zaiane, O. R. (2017). Current state of text sentiment analysis from opinion to emotion mining. ACM Computing Surveys (CSUR), 50(2), 1-33.
  2. Pang, B., & Lee, L. (2008). Opinion Mining and Sentiment Analysis. Foundations and Trends in Information Retrieval, 2(1-2), 1-135.
  3. Jiang, T., et al. (2022). Efficiency-Aware Text Classifiers: When Simplicity Undermines Accuracy. NAACL, 112–125.
  4. Chen, Z., & Li, Y. (2021). Interpretable Sentiment Analysis with Tree-Based Ensembles. IEEE Transactions on Affective Computing, 13(4), 2102–2115.
  5. Wang, A., et al. (2020). BERT-LSTM Hybrids for Context-Aware Sentiment Detection. COLING 2020, 3456–3469.
  6. Gupta, R., et al. (2023). Energy-Efficient LSTMs via Dynamic Activation Pruning. AAAI 2023, 8329–8337.
  7. Liu, Y., et al. (2024). RoBERTa-UL: A Lightweight Universal Language Model for Sentiment Tasks. ACL.
  8. Kim, H., & Park, S. (2023). Ensemble Learning with Neural and Symbolic Models for Real-World NLP. NeurIPS.
  9. Frantar, E., Alistarh, D. (2024). QMoE: Sub-1-Bit Compression of Trillion Parameter Models. Proceedings of Machine Learning and Systems, 6, 439-451.
  10. Sarker, I. H. (2022). NLP Model Taxonomies: A Systematic Comparison of Architectures. IEEE Access, 10, 45796–45817.
  11. Shreejit, C. (2023). Text Emotion Recognition. Retried from https://www.kaggle.com/datasets/shreejitcheela/text-emotion-recognition