Document Type : Applied Article

Authors

1 Department of Operation Management and Information Technology, Faculty of Management, Kharazmi, Tehran, Iran.

2 Department of Operation Management and Information Technology, Kharazmi University, Tehran, Iran.

3 Department of Business Management, Faculty of Management, Kharazmi, Tehran, Iran.

10.22044/jadm.2026.17616.2911

Abstract

The rapid growth of e-commerce has led to an increasing volume of Persian user reviews containing valuable opinions about products and services. Sentiment analysis enables automatic extraction of sentiment polarity from such data; however, Persian remains underexplored, especially in real-world e-commerce contexts. In addition, class imbalance in sentiment datasets poses a major challenge, often leading to biased models that underperform on minority classes. In this study, we investigate sentiment analysis on Persian e-commerce reviews by comparing classical machine learning models, including Logistic Regression and SVM, with transformer-based models, namely ParsBERT and ParsRoBERTa. To mitigate the impact of class imbalance, we evaluate Focal Loss against the standard Cross-Entropy Loss. Furthermore, we employ Integrated Gradients within an Explainable Artificial Intelligence (XAI) framework to improve model interpretability and analyze feature contributions. Experimental results on the Digikala dataset demonstrate that ParsBERT trained with Focal Loss achieves the best performance, reaching a Balanced Accuracy of 88.64% and an AUC-ROC of 95.91%. The findings highlight the effectiveness of combining imbalance-aware loss functions with transformer-based architectures for improving minority class detection in Persian sentiment analysis.

Keywords

Main Subjects

[1] J. Cui, Z. Wang, S.-B. Ho, and E. Cambria, "Survey on sentiment analysis: Evolution of research methods and topics," Artificial Intelligence Review, vol. 56, no. 8, pp. 8469-8510, 2023.
[2] B. M. D. Abighail, Fachrifansyah, M. Firmanda, M. Anggreainy, Harvianto, and Gintoro, "Sentiment analysis e-commerce review," Procedia Computer Science, vol. 227, pp. 1039-1045, 2023.
[3] Y. Mao, Q. Liu, and Y. Zhang, "Sentiment analysis methods, applications, and challenges: A systematic literature review," Journal of King Saud University - Computer and Information Sciences, vol. 36, no. 4, p. 102048, 2024.
[4] A. Daza, N. D. González Rueda, M. S. Aguilar Sánchez, W. F. Robles Espíritu, and M. E. Chauca Quiñones, "Sentiment analysis on e-commerce product reviews using machine learning and deep learning algorithms: A bibliometric analysis, systematic literature review, challenges and future works," International Journal of Information Management Data Insights, vol. 4, no. 2, p. 100267, 2024.
[5] H. Huang, A. Asemi, and M. Mustafa, "Sentiment analysis in e-commerce platforms: A review of current techniques and future directions," IEEE Access, vol. 11, pp. 90367-90382, 2023.
[6] M. Wankhade, A. C. S. Rao, and C. Kulkarni, "A survey on sentiment analysis methods, applications, and challenges," Artificial Intelligence Review, vol. 55, no. 7, pp. 5731-5780, 2022.
[7] B. Krawczyk, "Learning from imbalanced data: Open challenges and future directions," Progress in Artificial Intelligence, vol. 5, no. 4, pp. 221-232, 2016.
[8] T. Saito and M. Rehmsmeier, "The precision-recall plot is more informative than the roc plot when evaluating binary classifiers on imbalanced datasets," PLoS One, vol. 10, no. 3, p. e0118432, 2015.
[9] M. T. Ribeiro, S. Singh, and C. Guestrin, "Why should I trust you? Explaining the predictions of any classifier," in Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA, 2016, pp. 97-101.
[10] F. Doshi-Velez and B. Kim, "Towards a rigorous science of interpretable machine learning," arXiv preprint arXiv:1702.08608, pp. 1-13, 2017.
[11] P. Akter, S. Hossain, M. Siddique, M. Ayub, A. Nath, P. Nath, M. Rasel, and M. Hassan, "Sentiment analysis of consumer feedback and its impact on business strategies by machine learning," The American Journal of Applied Sciences, vol. 7, no. 1, pp. 6-16, 2025.
[12] A. K. Singh, D. Sharma, M. Dhawan, S. Kumar, A. Chattaraj, and C. Gour, "Amazon kindle review sentiment analysis," in 2024 IEEE Recent Advances in Intelligent Computational Systems, Thiruvananthapuram, India, 2024, pp. 1-6.
[13] K. Taneja, J. Vashishtha, and S. Ratnoo, "Transformer based unsupervised learning approach for imbalanced text sentiment analysis of e-commerce reviews," Procedia Computer Science, vol. 235, pp. 2318-2331, 2024.
[14] M. F. bin Harunasir, N. Palanichamy, S.-C. Haw, and K.-W. Ng, "Sentiment analysis of Amazon product reviews by supervised machine learning models," Journal of Advances in Information Technology, vol. 14, no. 4, pp. 857-862, 2023.
[15] M. Muradi, B. Hussain, E. R. Rhythm, and A. A. Rasel, "A comparative study of ParsBERT and mBERT in emotion recognition for Dari-Farsi text with Explainable AI," in Proceedings of the 3rd International Conference on Computing Advancements, Dhaka, Bangladesh, 2022, pp. 399-405.
[16] F. Ariai, M. Tayefeh Mahmoudi, and A. Moeini, "Enhancing Aspect-based Sentiment Analysis with ParsBERT in Persian Language," Journal of AI and Data Mining, vol. 12, no. 1, pp. 1-14, 2024.
[17] S. Shumaly, M. Yazdinejad, and Y. Guo, "Persian sentiment analysis of an online store independent of pre-processing using convolutional neural network with FastText embeddings," PeerJ Computer Science, vol. 7, p. e422, 2021.
[18] Z. Bokaei, W. Magdy, and B. Webber, "Farsi natural language processing: A survey," Information Processing & Management, vol. 63, no. 8, p. 104912, 2026.
[19] M. Masumi, S. S. Majd, M. Shamsfard, and H. Beigy, "FABERT: Pre-training BERT on Persian blogs," in Proceedings of the Tenth Workshop on Noisy and User-generated Text, Albuquerque, New Mexico, USA, 2024, pp. 85-96.
[20] M. Nooraee, H. Ghaffari, and F. Zarisfi Kermani, "Tiny-ParsBERT: An optimized hybrid model for efficient sentiment analysis in Persian texts," The Journal of Supercomputing, vol. 81, no. 7, p. 862, 2025.
[21] G. Zamaninejad, M. SadraeiJavaheri, F. Aghababaloo, H. Rafiee, M. M. Oskuee, and A. Salehoof, "Tooka-SBERT: Lightweight sentence embedding models for Persian," in Proceedings of the 14th International Joint Conference on Natural Language Processing and the 4th Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics, Mumbai, India, 2024, pp. 2415-2425.
[22] P. Rostami, A. Salemi, and M. J. Dousti, "PersianMind: A cross-lingual Persian-English large language model," arXiv preprint arXiv:2401.06466, pp. 1-13, 2024.
[23] M. Shamsfard, Z. Saaberi, S. M. H. Hashemi, Z. Vatankhah, M. Ramezani, N. Pourazin, T. Zare, M. Azimi, S. Chitsaz, and S. Khoraminejad, "FarsEval-pkbets: A new diverse benchmark for evaluating Persian large language models," arXiv preprint arXiv:2502.10234, pp. 1-15, 2025.
[24] N. Jahan, J. Ahamed, and D. Nandi, "Enhancing e-commerce sentiment analysis with advanced BERT techniques," International Journal of Information Engineering and Electronic Business, vol. 17, no. 3, pp. 49-61, 2025.
[25] M. A. Jahin, M. S. H. Shovon, M. F. Mridha, M. R. Islam, and Y. Watanobe, "A hybrid transformer and attention based recurrent neural network for robust and interpretable sentiment analysis of tweets," Scientific Reports, vol. 14, no. 1, p. 24882, 2024.
[26] K. Kyritsis, C. M. Liapis, I. Perikos, and M. Paraskevas, "Explainable sentiment analysis utilizing deep learning methods and LIME," in Big Data and Data Science Engineering, vol. 7, R. Lee, Ed. Cham, Switzerland: Springer Nature Switzerland, 2025, pp. 65-78.
[27] P. Hosseini, A. A. Ramaki, H. Maleki, M. Anvari, and S. A. Mirroshandel, "SentiPers: A sentiment analysis corpus for Persian," arXiv preprint arXiv:1801.07737, pp. 1-11, 2018.
[28] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin, "Attention is all you need," Advances in Neural Information Processing Systems, vol. 30, pp. 6000-6010, 2017.
[29] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova, "BERT: Pre-training of deep bidirectional transformers for language understanding," in Proceedings of the 2019 conference of the North American chapter of the Association for Computational Linguistics: Human Language Technologies, vol. 1, Minneapolis, MN, USA, 2019, pp. 4171-4186.
[30] Y. Liu, M. Ott, N. Goyal, J. Du, M. Joshi, D. Chen, O. Levy, M. Lewis, L. Zettlemoyer, and V. Stoyanov, "RoBERTa: A robustly optimized BERT pretraining approach," arXiv preprint arXiv:1907.11692, pp. 1-13, 2019.
[31] M. Farahani, M. Gharachorloo, M. Farahani, and M. Manthouri, "ParsBERT: Transformer-based model for Persian language understanding," Neural Processing Letters, vol. 53, no. 6, pp. 3831-3847, 2021.
[32] T. Y. Lin, P. Goyal, R. Girshick, K. He, and P. Dollár, "Focal loss for dense object detection," IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 42, no. 2, pp. 318-327, 2020.
[33] C. E. Shannon, "A mathematical theory of communication," Bell System Technical Journal, vol. 27, no. 3, pp. 379-423, 1948.
[34] M. Sundararajan, A. Taly, and Q. Yan, "Axiomatic attribution for deep networks," in Proceedings of the 34th International Conference on Machine Learning, Sydney, NSW, Australia, 2017, pp. 3319-3328.