Analysis Of Depressive Episode Classification Using Random Forest With Feature Importance
DOI:
https://doi.org/10.24269/mtkind.v20i2.14640Keywords:
Depression, PHQ-9, Random Forest, Feature Importance, ClassificationAbstract
Depressive episode classification using machine learning faces challenges arising from class imbalance and difficulties in distinguishing categories with adjacent score ranges. This study aims to evaluate the performance of the Random Forest model in classifying five depression symptom severity categories based on the Patient Health Questionnaire-9 (PHQ-9) using external predictors and to analyze their relative contributions through feature importance. The dataset was obtained from the National Health and Nutrition Examination Survey (NHANES) 2021–2023, comprising 5,210 respondents. Eight demographic and socioeconomic predictors were employed, while the nine PHQ-9 items used to construct the target variable were excluded from the predictors to prevent target leakage. Model evaluation involved six experimental scenarios, including data splits of 80:20, 70:30, and 60:40, as well as Stratified 5-Fold Cross-Validation with and without ClassBalancer. Performance was assessed using accuracy, precision, recall, and F1-score. The results showed that Random Forest with a 70:30 data split achieved the highest accuracy of 71.65% and a weighted F1-score of 70.0%. Meanwhile, the model using Stratified 5-Fold Cross-Validation without ClassBalancer achieved an accuracy of 70.75% and a weighted F1-score of 68.9%. Per-class evaluation indicated better performance in the Minimal category than in the other categories. Feature importance analysis using average impurity decrease identified sex (RIAGENDR) as the most important predictor, with an importance value of 0.49, while weekday sleep duration (SLD012) and functional difficulty (DPQ100) had the lowest values of 0.30. These findings highlight the challenges of five-category classification and suggest further investigation into class reduction, feature selection, and appropriate class imbalance handling techniques.
Downloads
References
[1] M. Bader, M. Abdelwanis, M. Maalouf, and H. F. Jelinek, “Detecting depression severity using weighted random forest and oxidative stress biomarkers,” Sci. Rep., vol. 14, no. 1, Dec. 2024, doi: 10.1038/s41598-024-67251-y.
[2] V. N. Onaemo, T. O. Fawehinmi, and C. D’Arcy, “Risk of suicide ideation in comorbid substance use disorder and major depression,” PLoS One, vol. 17, no. 12, p. e0265287, Dec. 2022, doi: 10.1371/journal.pone.0265287.
[3] W. Lai et al., “The trajectory of depressive symptoms and the association with quality of life and suicidal ideation in patients with major depressive disorder,” BMC Psychiatry, vol. 25, p. 310, Mar. 2025, doi: 10.1186/s12888-025-06743-1.
[4] T. Vu et al., “Prediction of depressive disorder using machine learning approaches: findings from the NHANES,” BMC Med. Inform. Decis. Mak., vol. 25, no. 1, p. 83, Dec. 2025, doi: 10.1186/s12911-025-02903-1.
[5] J. Zhou et al., “The associations between depressive symptoms, functional impairment, and quality of life, in patients with major depression: undirected and Bayesian network analyses,” Psychol. Med., vol. 53, pp. 6446–6458, 2023, doi: 10.1017/S0033291722003385.
[6] A. M. Arnaud et al., “Impact of Major Depressive Disorder on Comorbidities: A Systematic Literature Review,” Journal of Clinical Psychiatry, vol. 83, no. 6, Nov. 2022, doi: 10.4088/JCP.21r14328.
[7] G. Anindyajati et al., “The Right to Health: COVID-19 Pandemic and the Opportunity to Transform Mental Health Inequalities in Indonesia,” Front. Public Health, vol. 10, p. 844656, Mar. 2022, doi: 10.3389/fpubh.2022.844656.
[8] K. Kroenke, R. L. Spitzer, and J. B. W. Williams, “The PHQ-9 Validity of a Brief Depression Severity Measure,” J. Gen. Intern. Med., vol. 16, no. 9, pp. 606–613, Sep. 2001, doi: 10.1046/j.1525-1497.2001.016009606.x.
[9] Z. F. Negeri et al., “Accuracy of the Patient Health Questionnaire-9 for screening to detect major depression: updated systematic review and individual participant data meta-analysis,” The BMJ, vol. 375, p. n2183, Oct. 2021, doi: 10.1136/bmj.n2183.
[10] K. Kroenke, “PHQ-9: global uptake of a depression scale,” 2021. doi: 10.1002/wps.20821.
[11] A. Faro, J. Tejada, and W. Al-Delaimy, “Severity Classification of Anxiety and Depression Using Generalized Anxiety Disorder Scale and Patient Health Questionnaire: National Cross-Sectional Study Applying Classification and Regression Tree Models,” JMIR Public Health Surveill., vol. 11, p. 72591, 2025, doi: 10.2196/72591.
[12] T. R. Shaha et al., “Feature group partitioning: an approach for depression severity prediction with class balancing using machine learning algorithms,” BMC Med. Res. Methodol., vol. 24, no. 1, p. 123, Dec. 2024, doi: 10.1186/s12874-024-02249-8.
[13] D. Enkhbayar et al., “Explainable Artificial Intelligence Models for Predicting Depression Based on Polysomnographic Phenotypes,” Bioengineering, vol. 12, no. 2, p. 186, Feb. 2025, doi: 10.3390/bioengineering12020186.
[14] S. Albahra et al., “Artificial intelligence and machine learning overview in pathology & laboratory medicine: A general review of data preprocessing and basic supervised concepts,” Semin. Diagn. Pathol., vol. 40, no. 2, pp. 71–87, 2023, doi: 10.1053/j.semdp.2023.02.002.
[15] M. Sivakumar, S. Parthasarathy, and T. Padmapriya, “Trade-off between training and testing ratio in machine learning for medical image processing,” PeerJ Comput. Sci., vol. 10, p. e2245, Sep. 2024, doi: 10.7717/PEERJ-CS.2245.
[16] Q. H. Nguyen et al., “Influence of Data Splitting on Performance of Machine Learning Models in Prediction of Shear Strength of Soil,” Math. Probl. Eng., vol. 2021, Feb. 2021, doi: 10.1155/2021/4832864.
[17] U. Budiyanto, T. Fatimah, and B. A. Pratama, “PREDIKSI TINGKAT DEPRESI (KESEHATAN MENTAL) MENGGUNAKAN PHQ-9, NAÏVE BAYES, RANDOM FOREST DAN SUPPORT VECTOR MACHINE,” Jurnal Teknologi Informasi dan Ilmu Komputer, vol. 13, no. 1, pp. 141–150, Feb. 2026, doi: 10.25126/jtiik.2026131.
[18] S. E. Owusu, O. A. Iddrisu, G. Anugwom, and H. Onyeaka, “Association Between Sleep Duration and Depressive Symptoms Among U.S. Adults: A Cross-Sectional Analysis of National Health and Nutrition Examination Survey 2021-2023,” Cureus, 2026, doi: 10.7759/cureus.114486.
[19] M. Skelton et al., “Genetic overlap between functional impairment and depression and anxiety symptom severity: Evidence from the GLAD Study,” Psychol. Med., vol. 55, 2025, doi: 10.1017/S0033291725101037.
[20] National Center for Health Statistics, “Body Measures,” Centers for Disease Control and Prevention. Accessed: Oct. 21, 2026. [Online]. Available: https://wwwn.cdc.gov/Nchs/Data/Nhanes/Public/2021/DataFiles/BMX_L.htm
[21] National Center for Health Statistics, “Sleep Disorders,” Centers for Disease Control and Prevention. Accessed: Oct. 21, 2026. [Online]. Available: https://wwwn.cdc.gov/Nchs/Data/Nhanes/Public/2021/DataFiles/SLQ_L.htm
[22] National Center for Health Statistics, “Demographic Variables and Related Data,” Centers for Disease Control and Prevention. Accessed: Oct. 21, 2026. [Online]. Available: https://wwwn.cdc.gov/Nchs/Data/Nhanes/Public/2021/DataFiles/DEMO_L.htm
[23] National Center for Health Statistics, “National Health and Nutrition Examination Survey: August 2021–August 2023 Data Documentation, Codebook, and Frequencies – Mental Health: Depression Screener (DPQ_L),” Centers for Disease Control and Prevention. Accessed: Jul. 16, 2026. [Online]. Available: https://wwwn.cdc.gov/Nchs/Data/Nhanes/Public/2021/DataFiles/DPQ_L.htm
[24] W. Tian et al., “Development and validation of a predictive model for depression risk in the U.S. adult population: Evidence from the 2007–2014 NHANES,” BMC Psychol., vol. 11, no. 1, 2023, doi: 10.1186/s40359-023-01278-0.
[25] M. Carvalho, A. J. Pinho, and S. Brás, “Resampling approaches to handle class imbalance: a review from a data perspective,” J. Big Data, vol. 12, no. 1, Dec. 2025, doi: 10.1186/s40537-025-01119-4.
[26] D. Elreedy, A. F. Atiya, and F. Kamalov, “A theoretical distribution analysis of synthetic minority oversampling technique (SMOTE) for imbalanced learning,” Mach. Learn., vol. 113, pp. 4903–4923, Jul. 2024, doi: 10.1007/s10994-022-06296-4.
[27] G. Husain et al., “SMOTE vs. SMOTEENN: A Study on the Performance of Resampling Algorithms for Addressing Class Imbalance in Regression Models,” Algorithms, vol. 18, no. 1, p. 37, Jan. 2025, doi: 10.3390/a18010037.
[28] A. Zafar, B. A. Akram, M. Wasim, Maham, I. M. Pires, and P. J. Coelho, “PERI_DEP: A dataset of mother’s mental health in Pakistan,” Data Brief, vol. 60, p. 111621, May 2025, doi: 10.1016/j.dib.2025.111621.
[29] M. Alwateer, E.-S. Atlam, M. M. A. El-Raouf, O. A. Ghoneim, and I. Gad, “Missing Data Imputation: A Comprehensive Review,” Journal of Computer and Communications, vol. 12, no. 11, pp. 53–75, 2024, doi: 10.4236/jcc.2024.1211004.
[30] S. van Buuren, Flexible Imputation of Missing Data, 1st ed. Boca Raton, Florida: CRC Press, 2012.
[31] L. Breiman, “Random Forests,” Mach. Learn., vol. 45, no. 1, pp. 5–32, 2001, doi: 10.1023/A:1010933404324.
[32] Q. Li and J. Zhou, “A Comparative Analysis of Extreme Gradient Boosting, Decision Tree, Support Vector Machines, and Random Forest Algorithm in Data Analysis of College Students’ Psychological Health,” Informatica, vol. 49, no. 15, pp. 127–134, Jul. 2025, doi: 10.31449/inf.v49i15.7004.
[33] W. M. Loise, J. Mutuguta, and E. Nyarige, “Application of Random Forest in Modeling the Prevalence of Depression among Murang’a University of Technology Students,” Asian Journal of Probability and Statistics, vol. 26, no. 2, pp. 91–100, Feb. 2024, doi: 10.9734/ajpas/2024/v26i2595.
[34] H. R. Maier et al., “On how data are partitioned in model development and evaluation: Confronting the elephant in the room to enhance model generalization,” Environmental Modelling and Software, vol. 167, p. 105779, Jul. 2023, doi: 10.1016/j.envsoft.2023.105779.
[35] M. Sokolova and G. Lapalme, “A systematic analysis of performance measures for classification tasks,” Inf. Process. Manag., vol. 45, no. 4, pp. 427–437, Jul. 2009, doi: 10.1016/j.ipm.2009.03.002.
Downloads
Published
How to Cite
Issue
Section
Citation Check
License
Copyright (c) 2026 Multitek Indonesia : Jurnal Ilmiah

This work is licensed under a Creative Commons Attribution 4.0 International License.
MULTITEK is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License




