Comparative Analysis of K-Nearest Neighbors and Support Vector Machine for Student Stress Prediction

Authors

  • Lutfi Khoirul Umam Universitas PGRI Semarang
  • Setyoningsih Wibowo Universitas PGRI Semarang
  • Agung Handayanto Universitas PGRI Semarang

DOI:

https://doi.org/10.30871/jaic.v10i4.13224

Keywords:

K-Nearest Neighbors, Support Vector Machine, Machine Learning, Student Stress Prediction

Abstract

Student stress has emerged as an important issue because it can negatively affect both academic achievement and mental well-being. The growing development of machine learning techniques has enabled the creation of predictive models that can classify stress levels using various student-related factors. This research evaluates and compares the effectiveness of the K-Nearest Neighbors (KNN) and Support Vector Machine (SVM) algorithms in predicting student stress categories. The dataset was sourced from Kaggle and contains questionnaire-based data, including variables such as sleep quality, frequency of headaches, academic achievement, study workload, participation in extracurricular activities, and stress level classifications. The study followed several stages, including data preprocessing, feature normalization, model development, and performance assessment. Model evaluation was conducted using accuracy, precision, recall, F1-score, and confusion matrix metrics. To validate the practical implementation of the models, both algorithms were incorporated into a web-based application built with the Flask framework and supported by a MySQL database. The experimental results revealed that the KNN algorithm delivered superior classification performance compared to SVM. KNN obtained an accuracy score of 88.46% and a weighted F1-score of 0.89, whereas SVM achieved 46.15% accuracy with a weighted F1-score of 0.41. These findings suggest that KNN is more effective in identifying patterns within the student survey data. In addition, the successful deployment of the prediction system demonstrates that conventional machine learning methods can be utilized to provide real-time assessments of student stress levels and support mental health monitoring efforts.

Downloads

Download data is not yet available.

References

[1] R. Ahmed, M. Bibi, and S. Syed, “Improving Heart Disease Prediction Accuracy Using a Hybrid Machine Learning Approach: A Comparative study of SVM and KNN Algorithms,” Int. J. Comput. Inf. Manuf. IJCIM, vol. 3, no. 1, pp. 49–54, Jun. 2023, doi: 10.54489/ijcim.v3i1.223.

[2] R. Tariq, M. G. Orozco-del-Castillo, M. T. Zamir, M. S. Ramírez-Montoya, and T. Wilberforce, “Explainable artificial intelligence for predictive modeling of student stress in higher education,” Sci. Rep., vol. 15, no. 1, p. 38375, Nov. 2025, doi: 10.1038/s41598-025-22171-3.

[3] S. Anisa, A. Komarudin, and E. Ramadhan, “Sistem Klasifikasi Untuk Menentukan Tingkat Stress Mahasiswa Secara Umum Menggunakan Metode K-Nearest Neighbors,” J. Inform. Teknol. Dan Sains Jinteks, vol. 6, no. 3, pp. 568–578, Aug. 2024, doi: 10.51401/jinteks.v6i3.4317.

[4] Asri Mulyani, Sarah Khoerunisa, and Dede Kurniadi, “Perbandingan Kinerja Algoritma KNN dan SVM Menggunakan SMOTE untuk Klasifikasi Penyakit Diabetes,” J. Nas. Tek. Elektro Dan Teknol. Inf., vol. 14, no. 1, pp. 25–34, Feb. 2025, doi: 10.22146/jnteti.v14i1.15198.

[5] S. Wiyono, D. S. Wibowo, M. F. Hidayatullah, and D. Dairoh, “Comparative Study of KNN, SVM and Decision Tree Algorithm for Student’s Performance Prediction,” Int. J. Comput. Sci. Appl. Math., vol. 6, no. 2, p. 50, Aug. 2020, doi: 10.12962/j24775401.v6i2.4360.

[6] A. Daza, N. Saboya, J. I. Necochea-Chamorro, K. Zavaleta Ramos, and Y. D. R. Vásquez Valencia, “Systematic review of machine learning techniques to predict anxiety and stress in college students,” Inform. Med. Unlocked, vol. 43, p. 101391, 2023, doi: 10.1016/j.imu.2023.101391.

[7] M. Marjanović, M. Kovačević, B. Bajat, and V. Voženílek, “Landslide susceptibility assessment using SVM machine learning algorithm,” Eng. Geol., vol. 123, no. 3, pp. 225–234, Nov. 2011, doi: 10.1016/j.enggeo.2011.09.006.

[8] C. Eklund, A. Söderlund, and M. L. Elfström, “Evaluation of a Web-Based Stress Management Program for Persons Experiencing Work-Related Stress in Sweden (My Stress Control): Randomized Controlled Trial,” JMIR Ment. Health, vol. 8, no. 12, p. e17314, Dec. 2021, doi: 10.2196/17314.

[9] U. Madububambachu, A. Ukpebor, and U. Ihezue, “Machine Learning Techniques to Predict Mental Health Diagnoses: A Systematic Literature Review,” Clin. Pract. Epidemiol. Ment. Health, vol. 20, no. 1, p. e17450179315688, Jul. 2024, doi: 10.2174/0117450179315688240607052117.

[10] M. Fadhilla, R. Wandri, A. Hanafiah, P. R. Setiawan, Y. Arta, and S. Daulay, “Analisis Performa Algoritma Machine Learning Untuk Identifikasi Depresi Pada Mahasiswa,” vol. 5, no. 1, 2025.

[11] S. Gedam, S. Dutta, and R. Jha, “Analyzing mental stress in Indian students through advanced machine learning and wearable technologies,” Sci. Rep., vol. 15, no. 1, p. 20610, Jul. 2025, doi: 10.1038/s41598-025-06918-6.

[12] N. Hafidhoh, A. P. Atmaja, G. N. Syaifuddiin, I. B. Sumafta, S. M. Pratama, and H. N. Khasanah, “Machine Learning untuk Prediksi Kegagalan Mesin dalam Predictive Maintenance System,” J. Masy. Inform., vol. 15, no. 1, pp. 56–66, May 2024, doi: 10.14710/jmasif.15.1.63641.

[13] P. Lialiou and I. Maglogiannis, “Students’ Burnout Symptoms Detection Using Smartwatch Wearable Devices: A Systematic Literature Review,” AI Sens., vol. 1, no. 1, p. 2, May 2025, doi: 10.3390/aisens1010002.

[14] M. Mustaqim, A. Gunawan, Y. B. Pratama, and I. Zaliman, “Pengembangan Chatbot Layanan Publik Menggunakan Machine Learning Dan Natural Languange Processing,” J. Inf. Technol. Soc., vol. 1, no. 1, pp. 1–4, Jun. 2023, doi: 10.35438/jits.v1i1.16.

[15] M. S. I. Ovi, J. Hossain, M. R. A. Rahi, and F. Akter, “Protecting Student Mental Health with a Context-Aware Machine Learning Framework for Stress Monitoring,” Aug. 01, 2025, arXiv: arXiv:2508.01105. doi: 10.48550/arXiv.2508.01105.

[16] E. H. Aldian Karim, “Implementasi Machine Learning untuk Prediksi Harga Mobil Bekas dengan Algoritma Regresi Linear berbasis Web,” J. Ilm. Komputasi, vol. 21, no. 4, pp. 595–602, Dec. 2022, doi: 10.32409/jikstik.21.4.3327.

[17] P. P. P. A. N. W. F. I. R.H. Zer, B. H. Hayadi, and A. R. Damanik, “Pendekatan Machine Learning Menggunakan Algoritma C4.5 Berbasis Pso Dalam Analisa Pemahaman Pemrograman Website,” J. Inform. Dan Tek. Elektro Terap., vol. 10, no. 3, pp. 150–156, Aug. 2022, doi: 10.23960/jitet.v10i3.2700.

[18] D. I. Sumantiawan, S. Amaliyah, S. Narulita, M. Kholilurrahman, and A. Y. Suharmanto, “Analisis Faktor Status Depresi Kehidupan Mahasiswa Menggunakan Machine Learning,” Digit. Transform. Technol., vol. 4, no. 1, pp. 705–713, Aug. 2024, doi: 10.47709/digitech.v4i1.4577.

[19] A. Ramadhani, N. Iriadi, and R. Hidayat, “Implementasi Teknologi Rest API Dengan Node Js Untuk Aplikasi Rekomendasi Destinasi Wisata,” vol. 4, no. 1, pp. 22–29, 2025.

[20] A. Y. Shdefat, N. Mostafa, Z. Al-Arnaout, Y. Kotb, and S. Alabed, “Optimizing HAR Systems: Comparative Analysis of Enhanced SVM and k-NN Classifiers,” Int. J. Comput. Intell. Syst., vol. 17, no. 1, p. 150, Jun. 2024, doi: 10.1007/s44196-024-00554-0.

[21] M. Zeidan, R. Ballout, N. Al-Akl, and S. A. Kharroubi, “Exploring the relationship between extracurricular activities and stress levels among university students: A cross-sectional study,” PLOS One, vol. 20, no. 8, p. e0329888, Aug. 2025, doi: 10.1371/journal.pone.0329888.

[22] E. Wijayanti, A. Eka Yuliani, and S. Bulut, “The Relationship Between Sleep Quality and Stress Level in Biology Education Students,” Indones. J. Sci. Educ., vol. 9, no. 1, pp. 49–57, Apr. 2025, doi: 10.31002/ijose.v9i1.1703.

[23] F. N. Zahrah and M. Muljono, “Machine Learning untuk Deteksi Stres Pelajar: Perceptron sebagai Model Klasifikasi Efektif untuk Intervensi Dini,” Edumatic J. Pendidik. Inform., vol. 8, no. 2, pp. 764–773, Dec. 2024, doi: 10.29408/edumatic.v8i2.28011.

[24] G. Barbayannis, M. Bandari, X. Zheng, H. Baquerizo, K. W. Pecor, and X. Ming, “Academic Stress and Mental Well-Being in College Students: Correlations, Affected Groups, and COVID-19,” Front. Psychol., vol. 13, p. 886344, May 2022, doi: 10.3389/fpsyg.2022.886344.

Downloads

Published

2026-08-08

How to Cite

[1]
L. K. Umam, S. Wibowo, and A. Handayanto, “Comparative Analysis of K-Nearest Neighbors and Support Vector Machine for Student Stress Prediction”, JAIC, vol. 10, no. 4, pp. 3311–3317, Aug. 2026.

Similar Articles

1 2 3 4 5 > >> 

You may also start an advanced similarity search for this article.