Analisis Perbandingan Algoritma Random Forest dan K-Nearest Neighbors pada Klasifikasi Tingkat Stres Pekerja
Abstract
Work stress has become a prominent concern in the modern professional landscape, as it can lead to reduced productivity, diminished work quality, and decreased mental well-being among employees. This study aims to evaluate and compare the performance of two machine learning algorithms, namely Random Forest and K-Nearest Neighbors (KNN), in classifying levels of work stress. The data were obtained through an online questionnaire completed by 212 respondents from various employment sectors in Indonesia. The responses were converted from Likert scale to numerical values, grouped using the K-Means clustering method, and categorized into five levels of stress, ranging from no stress to very high stress. To address data imbalance, the Synthetic Minority Over-sampling Technique (SMOTE) was applied. The modeling process was conducted using three different data split scenarios, namely 90:10, 80:20, and 70:30, and evaluated using metrics such as accuracy, precision, recall, f1-score, and cross-validation. The findings indicate that the Random Forest algorithm consistently outperformed KNN across all scenarios. After applying SMOTE, both algorithms showed improved performance, with the Balanced Random Forest model achieving the highest accuracy and f1-score of 92 percent in the 70:30 scenario. These results suggest that combining Random Forest with SMOTE offers an effective and reliable solution for classifying work stress levels and could be developed as an objective and efficient early detection system.
Downloads
References
J. Heruwanto, R. Wahyuningsih, R. Rasipan, and E. Nurpatria, “Pengaruh Lingkungan Kerja dan Stres Kerja terhadap Kinerja Karyawan pada PT Nusamulti Centralestari Tangerang,” Jurnal Manajemen Kewirausahaan, vol. 17, no. 1, pp. 69–78, Jun. 2020, doi: 10.33370/jmk.v17i1.391.
A. A. A. P. Mangkunegara, Manajemen Sumber Daya Manusia. Bandung: PT. Remaja Rosdakarya, 2017.
N. Azizah, F. P. Idris, and A. Asrina, “Hubungan Umur dengan Stres Kerja pada Pedagang New Makassar Mall Kota Makassar,” Window of Public Health Journal, vol. 4, no. 2, pp. 297–304, Apr. 2023, doi: 10.33096/woph.v4i4.765.
A. D. Nurtika, A. Deli, and N. Juliaviani, “Pengaruh Stress Kerja Terhadap Kinerja Karyawan Pada PT Perkebunan Nusantara I Kebun Baru Kota Langsa (The Influence of Work Stress on Employee Performance at PT Perkebunan Nusantara I Kebun Baru Langsa City),” Jurnal Ilmiah Mahasiswa Pertanian, vol. 9, no. 3, pp. 165–172, Aug. 2024, doi: 10.17969/jimfp.v9i3.31588.
H. Akbar et al., “Hubungan Umur, Masa Kerja dan Tuntutan Kerja dengan Stres Kerja Pada Karyawan PDAM di Kabupaten X,” Promotif : Jurnal Kesehatan Masyarakat, vol. 14, no. 1, pp. 1–6, Jun. 2024, doi: 10.56338/promotif.v14i1.5518.
I. Amri, Ashar, and I. Lagat, “Analisis Tingkat Stres Kerja Pada Karyawan di Toko Jawa Timur Kota Sorong,” Metode Jurnal Teknik Industri, vol. 6, no. 2, pp. 46–54, Oct. 2020, doi: 10.33506/mt.v6i2.1642.
D. F. Astari, Y. H. Chrisnanto, and Melina, “Klasifikasi Tingkat Stres Saat Tidur Menggunakan Algoritma Random Forest,” Jurnal Mahasiswa Teknik Informatika, vol. 7, no. 5, pp. 3676–3684, Oct. 2023, doi: 10.36040/jati.v7i5.7750.
S. Anisa, A. Komarudin, and E. Ramadhan, “Sistem Klasifikasi untuk Menentukan Tingkat Stress Mahasiswa secara Umum Menggunakan Metode K-Nearest Neighbors,” Jurnal Informatika Teknologi dan Sains (JINTEKS), vol. 6, no. 3, pp. 568–578, Aug. 2024, doi: 10.51401/jinteks.v6i3.4317.
S. Adi and A. Wintarti, “Komparasi Metode Support Vector Machine (SVM), K-Nearest Neighbors (KNN), dan Random Forest (RF) untuk Prediksi Penyakit Gagal Jantung,” MATHunesa: Jurnal Ilmiah Matematika, vol. 10, pp. 258–268, Jul. 2022, doi: 10.26740/mathunesa.v10n2.p258-268.
N. F. Mahing, A. L. Gunawan, A. F. A. Zen, A. B. Fitra, and S. A. Wicaksono, “Klasifikasi Tingkat Stres dari Data Berbentuk Teks dengan Menggunakan Algoritma Support Vector Machine (SVM) dan Random Forest,” Jurnal Teknologi Informasi dan Ilmu Komputer (JTIIK), vol. 11, no. 5, pp. 1067–1076, Oct. 2024, doi: 10.25126/jtiik2024118010.
F. Rahmasari, M. Rifany, T. Priharyanto, and R. Kurniawan, “Perbandingan Algoritma Machine Learning dalam Klasifikasi Status Banjir di Sumatera Utara,” Seminar Nasional Sains Data, vol. 4, no. 1, pp. 307–318, Sep. 2024, doi: 10.33005/senada.v4i1.198.
B. Rahman, F. Fauzi, and S. Amri, “Perbandingan Hasil Klasifikasi Data Iris menggunakan Algoritma K-Nearest Neighbor dan Random Forest,” Journal of Data Insights, vol. 1, no. 1, pp. 19–26, Jun. 2023, doi: 10.26714/jodi.v1i1.135.
M. M. Rofi, F. A. Setiawan, and F. Riana, “Perbandingan Metode K-NN dan Random Forest pada Klasifikasi Mahasiswa Berpotensi Dropout,” INFOTECH journal, vol. 10, no. 1, pp. 84–89, Mar. 2024, doi: 10.31949/infotech.v10i1.8856.
I. K. Hasan, R. Resmawan, and J. Ibrahim, “Perbandingan K-Nearest Neighbor dan Random Forest dengan Seleksi Fitur Information Gain untuk Klasifikasi Lama Studi Mahasiswa,” Indonesian Journal of Applied Statistics, vol. 5, no. 1, p. 58, May 2022, doi: 10.13057/ijas.v5i1.58056.
D. M. Musa et al., “Penerapan Data Mining Untuk Klasifikasi Data Penjualan Pakan Ternak Terlaris Dengan Algoritma C4.5,” Jurnal Teknologi Informatika dan Komputer, vol. 10, no. 1, pp. 172–186, Mar. 2024, doi: 10.37012/jtik.v10i1.1985.
S. P. Robbins and T. A. Judge, Organizational Behavior 16ed. Pearson Education, 2015.
Marselim and I. Fenriana, “Analisis Pola Pembelian Pelanggan Menggunakan Algoritma Apriori serta Metode Pengujian SUS,” bit-Tech(Binary Digital - Technology), vol. 7, no. 3, pp. 705–714, Apr. 2025, doi: 10.32877/bt.v7i3.1769.
J. Dwi Muthohhar and A. Prihanto, “Analisis Perbandingan Algoritma Klasifikasi untuk Penyakit Jantung,” Journal of Informatics and Computer Science, vol. 04, no. 3, pp. 298–304, Jan. 2023, doi: 10.26740/jinacs.v4n03.p298-304.
S. D. K. Wardani, A. S. Ariyanto, M. Umroh, and D. Rolliawati, “Perbandingan Hasil Metode Clustering K-Means, DB Scanner & Hierarchical untuk Analisa Segmentasi Pasar,” JIKO (Jurnal Informatika dan Komputer), vol. 7, no. 2, p. 191, Sep. 2023, doi: 10.26798/jiko.v7i2.796.
L. U. Khasanah, Y. N. Nasution, and F. D. T. Amijaya, “Klasifikasi Penyakit Diabetes Melitus Menggunakan Algoritma Naïve Bayes Classifier,” BASIS: Jurnal Ilmiah Matematika, vol. 1, no. 1, pp. 41–50, Sep. 2022, doi: 10.30872/basis.v1i1.918.
A. Ramadhany, A. Z. Firdausi, and U. Karyani, “Stres Pada Mahasiswa Selama Pandemi Covid-19,” Jurnal Psikologi Insight, vol. 5, no. 2, pp. 130–136, Oct. 2021, doi: 10.17509/insight.v5i2.62774.
A. F. B. Sajiwo, B. Rahmat, and A. Junaidi, “Klasifikasi Indeks Standar Pencemaran Udara (ISPU) Menggunakan Algoritma XGBoost dengan Teknik Imbalanced Data (SMOTE),” Jurnal Informatika dan Teknik Elektro Terapan, vol. 12, no. 3, Aug. 2024, doi: 10.23960/jitet.v12i3.4699.
L. Tanti, B. S. Riza, Y. Y. Thanri, and N. Panjaitan, “Model Klasifikasi Penyakit Kanker Payudara Menggunakan Algoritma Naive Bayes,” Informatic Technique Journal, vol. 12, no. 2, pp. 1–12, Oct. 2024, doi: 10.22303/it.1.1.2021.01-10.
R. Chairunisa, Adiwijaya, and W. Astuti, “Perbandingan CART dan Random Forest untuk Deteksi Kanker berbasis Klasifikasi Data Microarray,” JURNAL RESTI (Rekayasa Sisten dan Teknologi Informasi, vol. 4, no. 5, pp. 805–812, Oct. 2020, doi: 10.29207/resti.v4i5.2083.
A. A. D. Halim and S. Anraeni, “Analisis Klasifikasi Dataset Citra Penyakit Pneumonia Menggunakan Metode K-Nearest Neighbor (KNN),” Indonesian Journal of Data and Science (IJODAS), vol. 2, no. 1, pp. 1–12, Mar. 2021, doi: 10.33096/ijodas.v2i1.23.
I. Riadi, A. Fadlil, and P. Annisa, “Identifikasi Tulisan Tangan Huruf Katakana Jepang Dengan Metode Euclidean,” Jurnal Sains Komputer & Informatika (J-SAKTI, vol. 4, no. 1, pp. 29–37, Mar. 2020, doi: 10.30645/j-sakti.v4i1.184.
A. Yudhana, Sunardi, and A. J. S. Hartanta, “Algoritma K-NN dengan Euclidean Distance untuk Prediksi Hasil Penggergajian Kayu Sengon,” TRANSMISI: Jurnal Ilmiah Teknik Elektro, vol. 22, no. 4, pp. 123–129, Oct. 2020, doi: 10.14710/transmisi.22.4.107-141.
N. S. Rifda, Y. T. S. Sitorus, A. M. Naomi, S. Najwa, A. P. Anindya, and F. Indrayatna, “Penerapan Algoritma K-Nearest Neighbor pada Klasifikasi Penyakit Jantung,” BIAStatistics: Jurnal Statistika Teori dan Aplikasi, vol. 2022, no. Special Issue 1, pp. 222–229, Jan. 2023, doi: 10.1234/bias.v2022i1.192.
Suci Amaliah, M. Nusrang, and A. Aswi, “Penerapan Metode Random Forest Untuk Klasifikasi Varian Minuman Kopi di Kedai Kopi Konijiwa Bantaeng,” VARIANSI: Journal of Statistics and Its application on Teaching and Research, vol. 4, no. 3, pp. 121–127, Dec. 2022, doi: 10.35580/variansiunm31.
E. Tangkelobo, W. Mayaut, H. Listanto, I. Binanto, and N. F. Sianipar, “Perbandingan Algoritma Klasifikasi Random Forest, Gaussian Naive Bayes, dan K-Nearest untuk Data Tidak Seimbang dan Data yang diseimbangkan dengan metode Random Undersampling pada dataset LCMS Tanaman Keladi Tikus,” Seminar Nasional Teknik Elektro, Informatika dan Sistem Informasi (SINTaKS), Aug. 2023, doi: 10.35842/sintaks.v2i1.28.
W. A. Firmansyach, U. Hayati, and Y. A. Wijaya, “Analisa Terjadinya Overfitting dan Underfitting pada Algoritma Naive Bayes dan Decision Tree dengan Teknik Cross Validation,” Jurnal Mahasiswa Teknik Informatika, vol. 7, no. 1, pp. 262–269, Feb. 2023, doi: 10.36040/jati.v7i1.6329.
H. Azis, P. Purnawansyah, F. Fattah, and I. P. Putri, “Performa Klasifikasi K-NN dan Cross Validation Pada Data Pasien Pengidap Penyakit Jantung,” ILKOM Jurnal Ilmiah, vol. 12, no. 2, pp. 81–86, Aug. 2020, doi: 10.33096/ilkom.v12i2.507.81-86.
W. Wijiyanto, A. I. Pradana, S. Sopingi, and V. Atina, “Teknik K-Fold Cross Validation untuk Mengevaluasi Kinerja Mahasiswa,” Jurnal Algoritma, vol. 21, no. 1, May 2024, doi: 10.33364/algoritma/v.21-1.1618.
H. Utami, “Analisis Sentimen dari Aplikasi Shopee Indonesia Menggunakan Metode Recurrent Neural Network,” Indonesian Journal of Applied Statistics, vol. 5, no. 1, p. 31, May 2022, doi: 10.13057/ijas.v5i1.56825.
Bila bermanfaat silahkan share artikel ini
Berikan Komentar Anda terhadap artikel Analisis Perbandingan Algoritma Random Forest dan K-Nearest Neighbors pada Klasifikasi Tingkat Stres Pekerja
Pages: 972-983
Copyright (c) 2025 Syalom Kristian Manurung, Irfan Pratama

This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under Creative Commons Attribution 4.0 International License that allows others to share the work with an acknowledgment of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgment of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (Refer to The Effect of Open Access).





















