Studi Perbandingan Algoritma Random Forest dan K-Nearest Neighbors (KNN) dalam Klasifikasi Gangguan Tidur

Authors

  • Nurul Khasanah Universitas Nusa Mandiri
  • Daniati Uki Eka Saputri Universitas Nusa Mandiri
  • Faruq Aziz Universitas Nusa Mandiri
  • Taopik Hidayat Universitas Nusa Mandiri

DOI:

https://doi.org/10.31294/coscience.v5i1.5522

Keywords:

Classification, Sleep Disorders, Random Forest, KNN

Abstract

Sleep disorders such as insomnia and sleep apnea can significantly affect quality of life and increase the risk of chronic diseases. Early identification and classification of sleep disorders are crucial in preventing further impacts. This study aims to compare the performance of the Random Forest and K-Nearest Neighbors (KNN) algorithms in classifying sleep disorders using the Sleep Health and Lifestyle Dataset from Kaggle, which contains health and lifestyle data relevant to sleep patterns. The Random Forest and KNN algorithms were applied to classify sleep disorders into the categories 'None', 'Sleep Apnea', and 'Insomnia'. Based on the study results, the Random Forest algorithm achieved an accuracy of 89.69%, with the best performance in the 'None' category, reaching a recall of 96.08%. Meanwhile, KNN achieved an accuracy of 87.02% with K=5. Although Random Forest demonstrated superior results, challenges were still found in detecting the 'Sleep Apnea' category, where recall only reached 74.55%, likely due to data imbalance. This study shows that the Random Forest algorithm is more effective in classifying sleep disorders compared to KNN. Future research steps include data balancing and exploring other algorithms such as XGBoost to improve the performance of sleep disorder detection.

Downloads

Published

2025-01-31