Emotion detection in text data: a comparative study of machine learning algorithms
Main Article Content
Abstract
Emotion detection plays a vital role in understanding human sentiments and behaviors across various applications, including customer feedback analysis and mental health monitoring. This research assesses the efficiency of different algorithms for machine learning in detecting emotions in text data. A meticulously curated dataset is utilized for the study. The research compares conventional models like Logistic Regression (LR), Random Forest (RF), Support Vector Machines (SVM), and Naive Bayes (NB) with deep learning models like Long Short-Term Memory (LSTM), Convolutional Neural Networks (CNN), and Bidirectional Encoder Representations from Transformers (BERT). The performance of each algorithm is assessed using accuracy, precision, recall, and F1 score. BERT exhibits superiority over other models, achieving the maximum accuracy of 0.8867 and F1 Score of 0.8871. CNN and SVM also display commendable performance. While the traditional models perform adequately, they are surpassed by deep learning models, with Naive Bayes showing the lowest metrics. This study underscores the significance of selecting models based on specific application requirements, taking into account factors like interpretability and efficiency. Future research endeavors may explore multimodal approaches, model interpretability, bias reduction, and real-time applications, thereby contributing to the advancement of emotion detection in text.
Article Details

This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See The Effect of Open Access).
References
Azam, N., Ahmad, T. & Haq, N. U. Automatic emotion recognition in healthcare data using supervised machine learning. PeerJ Computer Science 7, e751 (2021). <https://doi.org/10.7717/peerj-cs.751>
Boutet, I., LeBlanc, M., Chamberland, J. A. & Collin, C. A. Emojis influence emotional communication, social attributions, and information processing. Computers in Human Behavior 119, 106722 (2021). <https://doi.org/10.1016/j.chb.2021.106722>
Chowdary, M. K., Nguyen, T. N. & Hemanth, D. J. Deep learning-based facial emotion recognition for human–computer interaction applications. Neural Computing and Applications 35, 23311–23328 (2023). <https://doi.org/10.1007/s00521-021-06012-8>
Doma, V. & Pirouz, M. A comparative analysis of machine learning methods for emotion recognition using EEG and peripheral physiological signals. Journal of Big Data 7, 18 (2020). <https://doi.org/10.1186/s40537-020-00289-7>
Hung, L. P. & Alias, S. Beyond sentiment analysis: A review of recent trends in text based sentiment analysis and emotion detection. Journal of Advanced Computational Intelligence and Intelligent Informatics 27, 84–95 (2023). <https://doi.org/10.20965/jaciii.2023.p0084>
Jadon, A. K. & Kumar, S. A Comparative Study of CNNs and DNNs for Emotion Detection from text using TF-IDF in 2023 International Conference on Advances in Computation, Communication and Information Technology (ICAICCIT) (2023), 1329–1334. <https://doi.org/10.1109/ICAICCIT60255.2023.10465903>
Kushwaha, A. K., Kar, A. K. & Dwivedi, Y. K. Applications of big data in emerging management disciplines: A literature review using text mining. International Journal of Information Management Data Insights 1, 100017 (2021). <https://doi.org/10.1016/j.jjimei.2021.100017>
Lora, S. K., Sakib, N., Antora, S. A. & Jahan, N. A comparative study to detect emotions from tweets analyzing machine learning and deep learning techniques. International Journal of Applied Information Systems 12, 6–12 (2020). <https://dx.doi.org/10.5120/ijais2020451862>
Mehta, D., Siddiqui, M. F. H. & Javaid, A. Y. Recognition of emotion intensities using machine learning algorithms: A comparative study. Sensors 19, 1897 (2019). <https://doi.org/10.3390/s19081897>
Salam, S. A. & Gupta, R. Emotion detection and recognition from text using machine learning. Int. J. Comput. Sci. Eng 6, 341–345 (2018). <http://dx.doi.org/10.26438/ijcse/v6i6.341345>
Wang, Y. et al. A systematic review on affective computing: Emotion models, databases, and recent advances. Information Fusion 83, 19–52 (2022). <https://doi.org/10.1016/j.inffus.2022.03.009>
Zad, S., Heidari, M., James Jr, H & Uzuner, O. Emotion detection of textual data: An interdisciplinary survey in 2021 IEEE World AI IoT Congress (AIIoT) (2021), 0255–0261. <https://doi.10.1109/AIIoT52608.2021.9454192>