Classification of Anemia Severity Using Random Forest and SHAP Analysis on Complete Blood Count Data
DOI:
https://doi.org/10.35870/ijsecs.v6i1.7199Keywords:
Anemia Severity Classification, Random Forest, SHAP, Explainable Artificial Intelligence, Complete Blood CountAbstract
Anemia remains a major global public health challenge, requiring accurate severity classification to support early diagnosis and clinical decision-making, particularly in resource-limited settings. This study aimed to develop an accurate and interpretable multiclass model for classifying anemia severity according to the 2011 WHO hemoglobin thresholds. A Random Forest model combined with SHAP (SHapley Additive exPlanations) analysis was developed and evaluated using a Complete Blood Count (CBC) dataset comprising 364 samples categorized into four classes: Normal, Mild Anemia, Moderate Anemia, and Severe Anemia. Data preprocessing included Interquartile Range (IQR) capping, label encoding, and StandardScaler standardization. The model was optimized through Grid Search Cross-Validation using 432 hyperparameter combinations and five-fold Stratified K-Fold validation. On the test set, the model achieved an accuracy of 95.89%, macro-precision of 96.61%, macro-recall of 97.14%, and macro-F1-score of 96.85%. The Moderate and Severe Anemia classes achieved F1-scores of 100%, although the result for Severe Anemia should be interpreted cautiously because of the limited number of test samples. Mild Anemia was the most challenging class, particularly for samples near the hemoglobin classification thresholds. SHAP analysis identified HGB, PCV, and RBC as the most influential features. However, the SHAP results should be interpreted in light of the correlations among these variables and the use of HGB as the basis for WHO severity labeling. The findings indicate that Random Forest combined with SHAP can accurately reproduce anemia severity classifications based on the applied labeling criteria while providing interpretable predictions. Further external and clinical validation is required before the model can be considered for use in a clinical decision support system.
Downloads
References
Ahmad, M. H., Bormon, S., & Hossain, M. A. (2026). Expert-labeled clinical dataset for anemia detection (Version 2) [Data set]. Mendeley Data. https://doi.org/10.17632/8sycpbhzn7.2
Amalia, I. (2025). Anemia classification with clinical feature engineering and SHAP interpretation. Journal of Applied Informatics and Computing (JAIC), 9(5), 2195–2201. https://doi.org/10.30871/jaic.v9i5.10912
Aziz, N. A., Manzoor, A., Mazhar Qureshi, M. D., Qureshi, M. A., & Rashwan, W. (2024). Unveiling explainable AI in healthcare: Current trends, challenges, and future directions [Preprint]. medRxiv. https://doi.org/10.1101/2024.08.10.24311735
Breiman, L. (2001). Random forests. Machine Learning, 45(1), 5–32. https://doi.org/10.1023/A:1010933404324
Chaddad, A., Peng, J., Xu, J., & Bouridane, A. (2023). Survey of explainable AI techniques in healthcare. Sensors, 23(2), Article 634. https://doi.org/10.3390/s23020634
Darshan, B. S. D., Sampathila, N., Bairy, G. M., Prabhu, S., Belurkar, S., Chadaga, K., & Nandish, S. (2025). Differential diagnosis of iron deficiency anemia from aplastic anemia using machine learning and explainable artificial intelligence utilizing blood attributes. Scientific Reports, 15(1), Article 505. https://doi.org/10.1038/s41598-024-84120-w
Farhan, K., & Dhanny, D. R. (2021). Anemia ibu hamil dan efeknya pada bayi. Muhammadiyah Journal of Midwifery, 2(1), 27–33. https://doi.org/10.24853/myjm.2.1.27-33
Gómez, J. G., Parra Urueta, C., Álvarez, D. S., Hernández Riaño, V., & Ramirez-Gonzalez, G. (2025). Anemia classification system using machine learning. Informatics, 12(1), Article 19. https://doi.org/10.3390/informatics12010019
Karagül Yıldız, T., Yurtay, N., & Öneç, B. (2021). Classifying anemia types using artificial learning methods. Engineering Science and Technology, an International Journal, 24(1), 50–70. https://doi.org/10.1016/j.jestch.2020.12.003
Liu, J., Gou, Y., Yang, W., Wang, H., Zhang, J., Wu, S., Liu, S., Tao, T., Tang, Y., Yang, C., Chen, S., Wang, P., Feng, Y., Zhang, C., Liu, S., Peng, X., & Zhang, X. (2025). Development and application of machine learning models for hematological disease diagnosis using routine laboratory parameters: A user-friendly diagnostic platform. Frontiers in Medicine, 12, Article 1605868. https://doi.org/10.3389/fmed.2025.1605868
Lundberg, S. M., & Lee, S.-I. (2017). A unified approach to interpreting model predictions. In I. Guyon, U. von Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, & R. Garnett (Eds.), Advances in neural information processing systems (Vol. 30, pp. 4765–4774). Curran Associates, Inc.
Nugraha, G. (2023). Mengenal anemia: Patofisiologi, klasifikasi, dan diagnosis. Penerbit BRIN. https://doi.org/10.55981/brin.906.c799
Pullakhandam, S., & McRoy, S. (2024). Classification and explanation of iron deficiency anemia from complete blood count data using machine learning. BioMedInformatics, 4(1), 661–672. https://doi.org/10.3390/biomedinformatics4010036
Ramzan, M., Sheng, J., Saeed, M. U., Wang, B., & Duraihem, F. Z. (2024). Revolutionizing anemia detection: Integrative machine learning models and advanced attention mechanisms. Visual Computing for Industry, Biomedicine, and Art, 7(1), Article 18. https://doi.org/10.1186/s42492-024-00169-4
Rivera, A. K. B., Latorre, A. A. E., Nakamura, K., & Seino, K. (2023). Using complete blood count parameters in the diagnosis of iron deficiency and iron deficiency anemia in Filipino women. Journal of Rural Medicine, 18(2), 79–86. https://doi.org/10.2185/jrm.2022-047
Sadeghi, Z., Alizadehsani, R., Cifci, M. A., Kausar, S., Rehman, R., Mahanta, P., Bora, P. K., Almasri, A., Alkhawaldeh, R. S., Hussain, S., Alatas, B., Shoeibi, A., Moosaei, H., Hladík, M., Nahavandi, S., & Pardalos, P. M. (2024). A review of explainable artificial intelligence in healthcare. Computers and Electrical Engineering, 118, Article 109370. https://doi.org/10.1016/j.compeleceng.2024.109370
Salih, A. M., Raisi-Estabragh, Z., Galazzo, I. B., Radeva, P., Petersen, S. E., Lekadir, K., & Menegaz, G. (2025). A perspective on explainable artificial intelligence methods: SHAP and LIME. Advanced Intelligent Systems, 7(1), Article 2400304. https://doi.org/10.1002/aisy.202400304
Saputra, D. C. E., Sunat, K., Ratnaningsih, T., Ma’arif, A., & Suwarno, I. (2025). SmartForest: Optimizing anemia diagnosis with enhanced random forest and XGBoost integration. Results in Engineering, 27, Article 106442. https://doi.org/10.1016/j.rineng.2025.106442
Srinivasu, P. N., Sandhya, N., Jhaveri, R. H., & Raut, R. (2022). From black box to explainable AI in healthcare: Existing tools and case studies. Mobile Information Systems, 2022, Article 8167821. https://doi.org/10.1155/2022/8167821
Vohra, R., Hussain, A., Dudyala, A. K., Pahareeya, J., & Khan, W. (2022). Multi-class classification algorithms for the diagnosis of anemia in an outpatient clinical setting. PLOS ONE, 17(7), Article e0269685. https://doi.org/10.1371/journal.pone.0269685
World Health Organization. (2011). Haemoglobin concentrations for the diagnosis of anaemia and assessment of severity (WHO/NMH/NHD/MNM/11.1). https://iris.who.int/handle/10665/85839
Zam, N. W., & Irwan, M. (2025). Klasifikasi machine learning untuk anemia menggunakan metode support vector machine dan random forest. Jurnal Edukasi dan Sains Matematika (JES-MAT), 11(1), 62–76. https://journal.uniku.ac.id/index.php/JESMath/article/view/11694
Zemariam, A. B., Yimer, A., Abebe, G. K., Wondie, W. T., Abate, B. B., Alamaw, A. W., Yilak, G., Melaku, T. M., & Ngusie, H. S. (2024). Employing supervised machine learning algorithms for classification and prediction of anemia among youth girls in Ethiopia. Scientific Reports, 14(1), Article 9080. https://doi.org/10.1038/s41598-024-60027-4.
Downloads
Published
Issue
Section
License
Copyright (c) 2026 Tira Julia Indah Sari, Andreas Perdana

This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors who publish with this journal agree to the following terms:
1. Copyright Retention and Open Access License
Authors retain copyright of their work and grant the journal non-exclusive right of first publication under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
This license allows unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
2. Rights Granted Under CC BY 4.0
Under this license, readers are free to:
- Share — copy and redistribute the material in any medium or format
- Adapt — remix, transform, and build upon the material for any purpose, including commercial use
- No additional restrictions — the licensor cannot revoke these freedoms as long as license terms are followed
3. Attribution Requirements
All uses must include:
- Proper citation of the original work
- Link to the Creative Commons license
- Indication if changes were made to the original work
- No suggestion that the licensor endorses the user or their use
4. Additional Distribution Rights
Authors may:
- Deposit the published version in institutional repositories
- Share through academic social networks
- Include in books, monographs, or other publications
- Post on personal or institutional websites
Requirement: All additional distributions must maintain the CC BY 4.0 license and proper attribution.
5. Self-Archiving and Pre-Print Sharing
Authors are encouraged to:
- Share pre-prints and post-prints online
- Deposit in subject-specific repositories (e.g., arXiv, bioRxiv)
- Engage in scholarly communication throughout the publication process
6. Open Access Commitment
This journal provides immediate open access to all content, supporting the global exchange of knowledge without financial, legal, or technical barriers.
