Optimasi Hyperparameter Random Forest untuk Klasifikasi Depresi Mahasiswa Menggunakan GridSearchCV dan RandomizedSearchCV


  • Eka Wahyu Utami * Mail Universitas Dian Nuswantoro, Semarang, Indonesia
  • Defri Kurniawan Universitas Dian Nuswantoro, Semarang, Indonesia
  • (*) Corresponding Author
Keywords: Mental Health; Student Depression; Random Forest; Hyperparameter Optimization; Classification

Abstract

Student mental health is an important issue that requires a data-driven approach to support the classification process of student depression. This study aims to analyze the factors that cause depression and optimize the performance of the classification model by applying the Random Forest algorithm. The data used in this research is secondary data from the Student Depression Dataset obtained from the Kaggle platform, with a total of 27,901 data points. The research stages begin with data collection followed by Exploratory Data Analysis (EDA), which includes descriptive statistical analysis and correlation between variables using a heatmap. Data preprocessing involves removing irrelevant features, handling missing values, encoding categorical data, and splitting the data into training and testing sets. Model development is carried out through three scenarios: a baseline model, hyperparameter optimization using GridSearchCV, and RandomizedSearchCV. Model performance evaluation is measured using a Confusion Matrix to analyze accuracy, precision, recall, and F1-score. The results show that all models produce relatively stable accuracy in the range of 0.84–0.85. The model with GridSearchCV optimization provides the best performance with a recall value of 0.8869 and an F1-score of 0.8719. This increase in recall is important to minimize the risk of false negatives in identifying students experiencing depression. It is hoped that these findings can contribute as a decision support system for educational institutions in more accurately detecting and managing students' mental health.

Downloads

Download data is not yet available.

References

A. Jameel, Z. Ma, M. Li, A. Hussain, M. Asif, and Y. Wang, “The effects of social support and parental autonomy support on the mental well-being of university students: the mediating role of a parent–child relationship,” Humanit. Soc. Sci. Commun., vol. 11, no. 1, pp. 1–8, 2024, doi: 10.1057/s41599-024-03088-0.

A. Hussain, Q. Safdar, and A. Khan, “Relationship Of academic motivation & self-efficacy with academic grades of students: Social support as A mediator,” Pakistan Journal of Social Research, vol. 5, no. 02, pp. 803–811, Jun. 2023, doi: 10.52567/pjsr.v5i02.1193.

R. J. Woodman and A. A. Mangoni, “A comprehensive review of machine learning algorithms and their application in geriatric medicine: present and future,” Aging Clin. Exp. Res., vol. 35, no. 11, pp. 2363–2397, 2023, doi: 10.1007/s40520-023-02552-2.

A. Rizal, “Tahapan Desain dan Implementasi Model Machine Learning untuk Sistem Tertanam,” Ultima Computing: Jurnal Sistem Komputer, vol. 12, no. 2, pp. 79–85, 2020, doi: 10.31937/sk.v12i2.1782.

K. Rahayu, V. Fitria, D. Septhya, R. Rahmaddeni, and L. Efrizoni, “Klasifikasi Teks untuk Mendeteksi Depresi dan Kecemasan pada Pengguna Twitter Berbasis Machine Learning,” MALCOM: Indonesian Journal of Machine Learning and Computer Science, vol. 3, no. 2, pp. 108–114, Sep. 2023, doi: 10.57152/malcom.v3i2.780.

U. M. Haque, E. Kabir, and R. Khanam, “Detection of child depression using machine learning methods,” PLoS One, vol. 16, no. 12 December 2021, Dec. 2021, doi: 10.1371/journal.pone.0261131.

M. M. Hossain, M. Asadullah, M. A. Hossain, and M. S. Amin, “Prediction of Depression Using Machine Learning Tools Taking Consideration of Oversampling,” Malaysian Journal of Public Health Medicine, vol. 2022, no. 2, pp. 244–253, 2022, doi: 10.37268/mjphm/vol.22/no.2/art.1564.

A. Y. Pratama, I. S. Maulana, F. K. Sari, S. D. Tiara, and I. Darmawan, “Prediksi Risiko Depresi pada Mahasiswa Menggunakan Algoritma Random Forest Berdasarkan Data Akademik dan Gaya Hidup,” JSITIK: Jurnal Sistem Informasi dan Teknologi Informasi Komputer, vol. 4, no. 1, pp. 1–10, Dec. 2025, doi: 10.53624/jsitik.v4i1.696.

I. Setiawan, I. Yasin, and Y. Desianti, “Komparasi Kinerja Algoritma Random Forest, Decision Tree, Naïve Bayes, dan KNN dalam Prediksi Tingkat Depresi Mahasiswa menggunakan Student Depression Dataset,” Jurnal Ilmu Komputer dan Teknologi, vol. 6, pp. 47–58, Dec. 2025, doi: 10.35960/ikomti.v6i1.1756.

M. Faisti, D. Kusumodestoni, and G. Wibowo, “Mental Health Classification Using Naïve Bayes and Random Forest AlgorithmsMental Health Classification Using Naïve Bayes and Random Forest Algorithms,” Journal of Applied Informatics and Computing, vol. 9, pp. 1740–1750, Dec. 2025, doi: 10.30871/jaic.v9i4.10144.

J.-P. Cheng and S.-C. Haw, “Mental Health Problems Prediction Using Machine Learning Techniques,” International Journal on Robotics, Automation and Sciences, vol. 5, no. 2, pp. 59–72, Sep. 2023, doi: 10.33093/ijoras.2023.5.2.7.

S. Rasheed, K. Ganipalli, D. Rani, M. P. Kantipudi, and A. M, “Heart Disease Prediction Using GridSearchCV and Random Forest,” EAI Endorsed Trans. Pervasive Health Technol., Dec. 2024, doi: 10.4108/eetpht.10.5523.

L. M. Ni’mah and D. Kurniawan, “Model Klasifikasi Cerdas Gangguan Tidur Berbasis Machine Learning Random Forest pada Data Kesehatan dan Perilaku Harian,” Technology and Science (BITS), vol. 7, no. 3, pp. 1717–1729, 2025, doi: 10.47065/bits.v7i3.8631.

S. Utiarahman, H. Dalai, and A. Sabudi, “Optimasi K-Nearest Neighbor dengan Particle Swarm Optimization pada Klasifikasi Pelanggan Listrik Rumah Tangga Bersubsidi,” Jurnal Teknologi dan Manajemen Informatika, vol. 11, pp. 1–13, Dec. 2025, doi: 10.26905/jtmi.v11i1.14661.

L. Oluwaseye Joel, W. Doorsamy, and B. Sena Paul, “A Review of Missing Data Handling Techniques for Machine Learning,” International Journal of Innovative Technology and Interdisciplinary Sciences www.IJITIS.org, vol. 5, no. 3, pp. 971–1005, 2022, doi: 10.15157/IJITIS.2022.5.3.971-1005.

A. Géron, Hands-on Machine Learning with Scikit-Learn, Keras, and TensorFlow Concepts, Tools, and Techniques to Build Intelligent Systems SECOND EDITION, 2nd Edition. Sebastopol: O’Reilly Media, 2019.

H. A. Salman, A. Kalakech, and A. Steiti, “Random Forest Algorithm Overview,” Babylonian Journal of Machine Learning, vol. 2024, pp. 69–79, Dec. 2024, doi: 10.58496/BJML/2024/007.

F. Rohman, F. Farikhin, and B. Surarso, “Hyperparameter Tuning of Random Forest Algorithm for Diabetes Classification,” International Journal of Current Science Research and Review, vol. 08, Dec. 2025, doi: 10.47191/ijcsrr/V8-i1-31.

H. Rosenbusch, F. Soldner, A. Evans, and M. Zeelenberg, “Supervised machine learning methods in psychology: A practical introduction with annotated R code,” Soc. Personal. Psychol. Compass, vol. 15, Dec. 2021, doi: 10.1111/spc3.12579.

I. Muhamad Malik Matin, “Hyperparameter Tuning Menggunakan GridsearchCV pada Random Forest untuk Deteksi Malware,” MULTINETICS, vol. 9, pp. 43–50, Feb. 2023, doi: 10.32722/multinetics.v9i1.5578.

U. Sunarya and T. Haryanti, “Perbandingan Kinerja Algoritma Optimasi pada Metode Random Forest untuk Deteksi Kegagalan Jantung,” Jurnal Rekayasa Elektrika, vol. 18, no. 4, Dec. 2022, doi: 10.17529/jre.v18i4.26981.


Bila bermanfaat silahkan share artikel ini

Berikan Komentar Anda terhadap artikel Optimasi Hyperparameter Random Forest untuk Klasifikasi Depresi Mahasiswa Menggunakan GridSearchCV dan RandomizedSearchCV

Dimensions Badge
Article History
Submitted: 2026-02-08
Published: 2026-03-06
Abstract View: 114 times
PDF Download: 74 times
How to Cite
Utami, E., & Kurniawan, D. (2026). Optimasi Hyperparameter Random Forest untuk Klasifikasi Depresi Mahasiswa Menggunakan GridSearchCV dan RandomizedSearchCV. Building of Informatics, Technology and Science (BITS), 7(4), 2370−2382. https://doi.org/10.47065/bits.v7i4.9366
Issue
Section
Articles

Most read articles by the same author(s)