Improving Healthcare Communication: AI-Driven Emotion Classification in Imbalanced Patient Text Data with Explainable Models


  • Souaad Hamza-Cherif Biomedical Engineering Laboratory, University of Tlemcen, Tlemcen, Algeria
  • Lamia Fatiha Kazi Tani Biomedical Engineering Laboratory, University of Tlemcen, Tlemcen, Algeria
  • Nesma Settouti LabISEN - Yncréa Ouest, Caen, France



sentiment analysis, data re-sampling, LSTM, BERT, LIME


Sentiment analysis is crucial in healthcare to understand patients’ emotions, automatically identifying the feelings of patients suffering from serious illnesses (cancer, AIDS, or Ebola) with an artificial intelligence model that constitutes a major challenge to help health professionals. This study presents a comparative study on different machine learning (logistic regression, naive Bayes, and LightGBM) and deep learning models: long short-term memory (LSTM) and bidirectional encoder representations from transformers (BERT) for classify health feelings thanks to textual data related to patients with serious illnesses. Considering the class imbalance of the dataset, various resampling techniques are investigated. The approach is complemented by an explainable model, LIME, to understand the shortcomings of the classification results. The results highlight the superior performance of the BERT and LSTM models with an F1-score of 89%.


Y. Madani, M. Erritali, and B. Bouikhalene, “A New Sentiment Analysis Method to Detect and Analyse Sentiments of Covid-19 Moroccan Tweets Using a Recommender Approach,” Multimedia Tools and Applications, vol. 82, no. 18, pp. 27819-27838, July 2023.

K. Chakraborty, S. Bhatia, S. Bhattacharyya, J. Platos, R. Bag, and A. E. Hassanien, “Sentiment Analysis of COVID-19 Tweets by Deep Learning Classifiers—A Study to Show How Popularity is Affecting Accuracy in Social Media,” Applied Soft Computing, vol. 97, part A, article no. 106754, December 2020.

H. Xu, R. Liu, Z. Luo, and M. Xu, “COVID-19 Vaccine Sensing: Sentiment Analysis and Subject Distillation from Twitter Data,” Telematics and Informatics Reports, vol. 8, article no. 100016, December 2022.

N. Azam, T. Ahmad, and N. Ul Haq, “Automatic Emotion Recognition in Healthcare Data Using Supervised Machine Learning,” PeerJ Computer Science, vol. 7, article no. e751, 2021.

S. M. Srinivasan, R. S. Sangwan, C. J. Neill, and T. Zu, “Twitter Data for Predicting Election Results: Insights from Emotion Classification,” IEEE Technology and Society Magazine, vol. 38, no. 1, pp. 58-63, March 2019.

W. Lin and L. C. Liao, “Lexicon-Based Prompt for Financial Dimensional Sentiment Analysis,” Expert Systems with Applications, vol. 244, article no. 122936, June 2024.

R. Catelli, S. Pelosi, C. Comito, C. Pizzuti, and M. Esposito, “Lexicon-Based Sentiment Analysis to Detect Opinions and Attitude Towards COVID-19 Vaccines on Twitter in Italy,” Computers in Biology and Medicine, vol. 158, article no. 106876, May 2023.

D. C. J. W. Wise, S. Ambareesh, P. Babu, D. Sugumar, J. P. Bhimavarapu, and A. S. Kumar, “Latent Semantic Analysis Based Sentimental Analysis of Tweets in Social Media for the Classification of Cyberbullying Text,” International Journal of Intelligent Systems and Applications in Engineering, vol. 12, no. 7s, pp. 26-35, 2024.

R. Bhaskaran, S. Saravanan, M. Kavitha, C. Jeyalakshmi, S. Kadry, H. T. Rauf, et al., “Intelligent Machine Learning with Metaheuristics Based Sentiment Analysis and Classification,” Computer Systems Science and Engineering, vol. 44, no. 1, pp. 235-247, 2023.

Y. Y. Tan, C. O. Chow, J. Kanesan, J. H. Chuah, and Y. L. Lim, “Sentiment Analysis and Sarcasm Detection Using Deep Multi-Task Learning,” Wireless Personal Communications, vol. 129, no. 3, pp. 2213-2237, April 2023.

G. Meena, K. K. Mohbey, S. Kumar, and K. Lokesh, “A Hybrid Deep Learning Approach for Detecting Sentiment Polarities and Knowledge Graph Representation on Monkeypox Tweets,” Decision Analytics Journal, vol. 7, article no. 100243, June 2023.

R. K. Das, M. Islam, M. M. Hasan, S. Razia, M. Hassan, and S. A. Khushbu, “Sentiment Analysis in Multilingual Context: Comparative Analysis of Machine Learning and Hybrid Deep Learning Models,” Heliyon, vol. 9, no. 9, article no. e20281, September 2023.

A. Umair, E. Masciari, and M. H. Ullah, “Vaccine Sentiment Analysis Using BERT + NBSVM and Geo-Spatial Approaches,” The Journal of Supercomputing, vol. 79, no. 15, pp. 17355-17385, October 2023.

G. B. Mohammad, S. Potluri, A. Kumar, R. Kumar, P. Dileep, R. Tiwari, et al., “An Artificial Intelligence-Based Reactive Health Care System for Emotion Detections,” Computational Intelligence and Neuroscience, vol. 2022, article no. 8787023, 2022,

K. Denecke and D. Reichenpfader, “Sentiment Analysis of Clinical Narratives: A Scoping Review,” Journal of Biomedical Informatics, vol. 140, article no. 104336, April 2023.

S. Gohil, S. Vuik, and A. Darzi, “Sentiment Analysis of Health Care Tweets: Review of the Methods Used,” JMIR Public Health and Surveillance, vol. 4, no. 2, article no. e43, April-June 2018.

P. Padmavathy and S. Pakkir Mohideen, “An Efficient Two-Pass Classifier System for Patient Opinion Mining to Analyze Drugs Satisfaction,” Biomedical Signal Processing and Control, vol. 57, article no. 101755, March 2020.

Y. Bhangdia, R. Bhansali, N. Chaudhari, D. Chandnani, and M. L. Dhore, “Speech Emotion Recognition and Sentiment Analysis based Therapist Bot,” Third International Conference on Inventive Research in Computing Applications, pp. 96-101, September 2021.

A. Saranya and R. Subhashini, “A Systematic Review of Explainable Artificial Intelligence Models and Applications: Recent Developments and Future Trends,” Decision Analytics Journal, vol. 7, article no. 100230, June 2023.

M. T. Ribeiro, S. Singh, and C. Guestrin, “‘Why Should I Trust You?’: Explaining the Predictions of Any Classifier,” Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1135-1144, August 2016.

I. Mani and J. Zhang, “kNN Approach to Unbalanced Data Distributions: A Case Study Involving Information Extraction,” Proceedings of Workshop on Learning From Imbalanced Datasets, pp.1-7, August 2003.

A. Fernandez, S. Garcia, F. Herrera, and N.V. Chawla, “Smote for Learning from Imbalanced Data: Progress and Challenges, Marking the 15-year Anniversary,” Journal of Artificial Intelligence Research, vol. 61, pp. 863-905, 2018.

H. He, Y. Bai, E. A. Garcia, and S. Li, “Adasyn: Adaptive Synthetic Sampling Approach for Imbalanced Learning,” IEEE International Joint Conference on Neural Networks (IEEE World Congress on Computational Intelligence), pp. 1322-1328, June 2008.

Y. Zhang, R. Jin, and Z. H. Zhou, “Understanding Bag-of-Words Model: A Statistical Framework,” International Journal of Machine Learning and Cybernetics, vol. 1, no. 1-4, pp. 43-52, December 2010.

G. Salton and M. J. McGill, Introduction to Modern Information Retrieval, International Student ed., Auckland: McGraw-Hill International,1983.

Y. R. Chao and G. K. Zipf, “Human Behavior and the Principle of Least Effort: An Introduction to Human Ecology,” Language, vol. 26, no. 3, pp. 394-401, July-September 1950.

T. Mikolov, K. Chen, G. Corrado, and J. Dean, “Efficient Estimation of Word Representations in Vector Space,”, January 16, 2013.

C. Y. J. Peng, K. L. Lee, and G. M. Ingersoll, “An Introduction to Logistic Regression Analysis and Reporting,” The Journal of Educational Research, vol. 96, no. 1, pp. 3-14, 2002.

C. Sammut and G. Webb, Encyclopedia of Machine Learning and Data Mining, Living ed. Boston: Springer, 2016.

G. Ke, Q. Meng, T. Finley, T. Wang, W. Chen, W. Ma, et al., “LightGBM: A Highly Efficient Gradient Boosting Decision Tree,” Advances in Neural Information Processing Systems 30 (NIPS 2017), pp. 1-9, December 2017.




How to Cite

Souaad Hamza-Cherif, Lamia Fatiha Kazi Tani, and Nesma Settouti, “Improving Healthcare Communication: AI-Driven Emotion Classification in Imbalanced Patient Text Data with Explainable Models”, Adv. technol. innov., vol. 9, no. 2, pp. 129–142, Apr. 2024.