Sleep is an important physiological process that plays a role in maintaining the balance of biological and psychological functions. Lifestyle changes, such as high stress levels and a lack of physical activity, can affect a person’s sleep quality. This study aims to analyze the influence of health and lifestyle factors on sleep quality and to develop a predictive model for sleep quality using the Random Forest algorithm. This study uses the Sleep Health and Lifestyle dataset with a classification approach into two categories, namely Ideal Sleep and Non-Ideal Sleep, determined based on sleep duration parameters referring to the concept of a U-shaped relationship and the sleep duration recommendations from the National Sleep Foundation. The data were processed through preprocessing and class imbalance handling using the SMOTE method, then split into training and testing data. The Random Forest model was built through hyperparameter tuning and evaluated using accuracy and Area Under the Curve (AUC) metrics. The results show that the Random Forest model achieved good classification performance with an Accuracy of 91.26%, Precision of 91.78%, Recall of 91.26%, and F1-Score of 91.30%. In addition, the model obtained an Area Under the Curve (AUC) value of 0.962, indicating very good classification capability. Based on the Feature Importance analysis results, the features with the greatest influence on sleep quality are Heart Rate, Stress Level, Physical Activity, and Daily Steps. The findings indicate that the combination of the SMOTE method and Random Forest is effective for predicting sleep quality based on health and lifestyle factors.
Copyrights © 2026