Perbandingan Metode KNN dan Naïve Bayes dalam Deteksi Tingkat Stres Berdasarkan Ekspresi Wajah - Alamsyah, Malik Fajar; Wijaya, Ardi (Politeknik Harapan Bersama, 2025)
Stress is a feeling in which a person feels under pressure, overwhelmed, and has difficulty in dealing with a problem. Stress can be caused by various factors, such as academic pressure, work, personal problems, or social environment. If not addressed immediately, stress can have adverse effects on an individual's health, such as causing high blood pressure, heart disease, sleep disturbances, and a decreased immune system, which makes a person more vulnerable to various diseases. Therefore, monitoring stress levels is very important to prevent more serious negative impacts. Generally, stress detection is done through consultation with a psychologist, but this method has a subjective nature and requires a lot of time and money. Therefore, this research develops a computer vision-based stress detection system using OpenCV and Dlib, with K-Nearest Neighbors and Naïve Bayes algorithms. The data of 500 samples is divided into 80% training data and 20% test data. Features were extracted, and stress was classified into three levels: low, medium and high. Evaluation using k-fold cross-validation (n_split=10, random_state=42) based on accuracy, precision, recall, and F1-score. The results showed that K-Nearest Neighbors with k=5 excelled with 74% accuracy, 73% precision, 73% recall, and 73% F1-score. Meanwhile, Naïve Bayes only achieved 52% accuracy, 51% precision, 48% recall, and 41% F1-score. This shows that KNN is more effective in stress level classification. However, the accuracy of the model is still limited due to the small amount of training data. Parameter optimization and dataset addition are required to improve the overall system performance.