Comparative Analysis of Machine Learning and Deep Learning Models for Text Emotion Classification in Federated Learning
Abstract
Text sentiment analysis is an important aspect of natural language processing (NLP), playing an essential role in understanding public opinion, enhancing customer experience, and informing data-driven decisions in sectors such as business and policy-making. This study aims to systematically compare the performance of traditional machine learning models (Support Vector Machine (SVM) and Logistic Regression) with Bidirectional Encoder Representations from Transformers (BERT) with a federated learning framework. To represent text features, SVM and Logistic Regression are implemented using Term Frequency-Inverse Document Frequency (TF-IDF) vectorization. At the same time, the pre-trained BERT model is fine-tuned to leverage its contextualised embeddings. The models are evaluated on the Text Emotion Recognition dataset using accuracy, F1-score, and recall rate metrics. Experimental results show that BERT achieves the highest accuracy (0.9765), significantly outperforming Logistic Regression (0.9570) and SVM (0.4992). However, SVM demonstrates superior training efficiency, 5-10 times faster than BERT, while Logistic Regression provides enhanced interpretability through coefficient analysis. These findings offer valuable insights for practitioners in selecting models based on precision, resource constraints, and deployment speed. This study also highlights potential real-time mental health support applications, social media monitoring, and customer sentiment analysis.
References
- Mohammed, A. H., Ali, A. H. (2021). Survey of bert (bidirectional encoder representation transformer) types. Journal of Physics: Conference Series. IOP Publishing, 1963(1), 012173.
- Wankhade, M., Rao, A. C. S., Kulkarni, C. (2022). A survey on sentiment analysis methods, applications, and challenges. Artificial Intelligence Review, 55(7), 5731-5780.
- Lindemann, B., Maschler, B., Sahlab, N., et al. (2021). A survey on anomaly detection for technical systems using LSTM networks. Computers in Industry, 131, 103498.
- Subakan, C., Ravanelli, M., Cornell, S., et al. (2021). Attention is all you need in speech separation. ICASSP IEEE International Conference on Acoustics, Speech and Signal Processing. IEEE, 21-25.
- Nemkul, K. (2024). Use of bidirectional encoder representations from transformers (BERT) and robustly optimized BERT pretraining approach (RoBERTa) for Nepali news classification. Tribhuvan University Journal, 39(1), 124-137.
- Anwar, Z., Afzal, H., Altaf, N., et al. (2024). Fuzzy ensemble of fined tuned BERT models for domain-specific sentiment analysis of software engineering dataset. Plos one, 19(5), e0300279.
- Khan, Z., Fu, Y. (2021). Exploiting BERT for multimodal target sentiment classification through input space translation. Proceedings of the 29th ACM international conference on multimedia. 3034-3042.
- Das, R., Singh, T. D. (2023). Multimodal sentiment analysis: a survey of methods, trends, and challenges. ACM Computing Surveys, 55(13s), 1-38.
- Kaggle dataset. (2023). Text Emotion Recognition. Retried from https://www.kaggle.com/datasets/shreejitcheela/text-emotion-recognition?resource=download&select=train.csv
- Fu, X., Zhang, B., Dong, Y., et al. (2022). Federated graph machine learning: A survey of concepts, techniques, and applications. ACM SIGKDD Explorations Newsletter, 24(2), 32-47.
- Singh, N. K., Necoara, I. (2024). Unified analysis of stochastic gradient projection methods for convex optimization with functional constraints. European Control Conference, 3600-3605.
- Ji, Y., Zhou, Z., Liu, H., et al. (2021). DNABERT: pre-trained Bidirectional Encoder Representations from Transformers model for DNA-language in genome. Bioinformatics, 37(15), 2112-2120.