Sleep disorders including insomnia and sleep apnea affect millions of individuals worldwide and remain significantly underdiagnosed due to limited accessibility to comprehensive sleep studies and medical facilities. This research presents an intelligent web-based sleep disorder detection system leveraging machine learning algorithms to provide preliminary diagnosis using demographic and lifestyle parameters. The proposed system employs a Decision Tree Classifier trained on health metrics including age, gender, occupation, sleep duration, stress levels, body mass index category, physical activity, heart rate, and blood pressure measurements. The system achieves robust classification accuracy in distinguishing between no disorder, insomnia, and sleep apnea conditions. Implemented as an interactive Streamlit application, the system provides real-time predictions accompanied by personalized sleep hygiene recommendations and comprehensive data analytics. Experimental results demonstrate the effectiveness of the decision tree approach in capturing non-linear relationships between lifestyle factors and sleep disorders. The system addresses the critical need for accessible, cost-effective preliminary screening tools while maintaining clinical relevance through evidence-based feature selection. This work contributes to preventive healthcare by enabling early detection and promoting timely medical intervention for sleep-related conditions.
Introduction
Sleep disorders affect 50–70 million adults worldwide and are strongly linked to major health risks including cardiovascular disease, diabetes, obesity, depression, and cognitive decline. Despite their prevalence, diagnosis remains limited due to reliance on costly, time-consuming sleep studies such as polysomnography. To address this gap, the study proposes a machine-learning-based sleep disorder detection system that offers accessible, rapid, and interpretable risk assessments using simple demographic, lifestyle, and physiological inputs.
The research builds on existing literature in machine learning–based sleep disorder classification, feature engineering, and web-based health applications. Prior works have explored sensor-based diagnostics, support vector machines, random forests, deep learning models, and clinical questionnaires, but these approaches often lack affordability, interpretability, or scalability. Decision tree classifiers, known for transparency and clinical relevance, are therefore adopted as the core model.
The system architecture includes preprocessing, model training, real-time prediction, and web deployment using Python, scikit-learn, and Streamlit. The dataset contains twelve features spanning demographic characteristics, lifestyle habits, physiological measurements, and sleep-quality indicators, enabling multi-class classification into no disorder, insomnia, or sleep apnea. Feature engineering involves label encoding of categorical variables and MinMax scaling of numerical attributes to ensure consistent model behavior.
A Decision Tree Classifier (CART) is trained using optimized hyperparameters and evaluated with accuracy, precision, recall, F1-score, and confusion matrix analysis. Results indicate strong, balanced performance across all classes, with sleep duration, sleep quality, stress levels, BMI category, and heart rate emerging as key predictors. The accompanying web application provides an intuitive interface for user input, real-time predictions, visual analytics, and personalized health recommendations tailored to each disorder type.
Conclusion
This research presents a comprehensive machine learning based sleep disorder detection system addressing critical gaps in accessible preliminary screening capabilities. The developed solution successfully integrates predictive modeling with user-friendly web interfaces, enabling real-time risk assessment based on readily available demographic and lifestyle parameters. The Decision Tree Classifier demonstrates robust performance in distinguishing between no disorder, insomnia, and sleep apnea categories, achieving accuracy levels suitable for practical screening applications.
The system architecture emphasizes interpretability, scalability, and clinical relevance while maintaining computational efficiency. The incorporation of personalized health recommendations enhances practical utility beyond classification, empowering users to implement evidence-based interventions. The analytics dashboard provides educational value, increasing awareness regarding sleep health determinants and facilitating data-driven insights.
Future research directions include expansion to additional disorder categories, integration of wearable sensor data streams, implementation of ensemble methods and deep learning architectures, development of mobile application variants, incorporation of temporal patterns through longitudinal data analysis, and validation studies using polysomnography-confirmed diagnoses. The incorporation of explainable AI techniques such as SHAP values would further enhance model transparency and clinical acceptance.
The system represents a significant step toward democratizing access to sleep health screening, particularly benefiting underserved populations with limited healthcare infrastructure. By enabling early detection and promoting timely medical intervention, such tools contribute meaningfully to preventive healthcare initiatives. The open-source nature of the implementation facilitates community contributions and adaptation to diverse healthcare contexts, potentially amplifying the system\'s impact on global sleep health outcomes.
References
[1] C. M. Morin and C. A. Espie, The Oxford Handbook of Sleep and Sleep Disorders, Oxford University Press, 2012.
[2] T. Young, M. Palta, J. Dempsey, J. Skatrud, S. Weber, and S. Badr, \"The occurrence of sleep-disordered breathing among middle-aged adults,\" New England Journal of Medicine, vol. 328, no. 17, pp. 1230-1235, Apr. 1993.
[3] S. Redline and P. V. Tishler, \"The genetics of sleep apnea,\" Sleep Medicine Reviews, vol. 4, no. 6, pp. 583-602, Dec. 2000.
[4] A. Rechtschaffen and A. Kales, A Manual of Standardized Terminology, Techniques and Scoring System for Sleep Stages of Human Subjects, U.S. National Institute of Neurological Diseases and Blindness, Neurological Information Network, 1968.
[5] M. Sharma, D. Acharya, and U. R. Acharya, \"Automatic detection of sleep stages using energy-based features of EEG signals,\" in Proc. IEEE EMBS International Conference on Biomedical and Health Informatics, 2016, pp. 217-220.
[6] H. Phan, F. Andreotti, N. Cooray, O. Y. Chen, and M. De Vos, \"Joint classification and prediction CNN framework for automatic sleep stage classification