A Comparative Study of Machine Learning Models for Stress Level Classification Using Social Media and Lifestyle Data

Authors

  • M. Ikbal Siami Institut Teknologi dan Bisnis STIKOM Ambon
  • Aris Wahyu Murdiyanto Universitas Jenderal Achmad Yani Yogyakarta
  • Sumiyatun Universitas Teknologi Digital Indonesia

DOI:

https://doi.org/10.56705/r4d62a66

Keywords:

Stress Prediction, Machine Learning, Social Media Usage, Sleep Patterns, Digital Well-Being, Health Informatics, Feature Importance

Abstract

The increasing use of social media and digital platforms has raised concerns regarding its potential relationship with sleep patterns, lifestyle behaviors, productivity, and psychological well-being. Stress is a common health-related issue that may be influenced by daily behavioral patterns, including screen time, social media usage, sleep duration, physical activity, and work or study habits. This study aims to develop and evaluate machine learning models for predicting stress levels based on non-invasive digital behavior and lifestyle indicators. The dataset used in this study consisted of 11,000 records with three stress level categories: Low, Medium, and High. The predictor variables included age, daily screen time, social media usage duration, sleep hours, exercise duration, study or work hours, productivity score, and the most frequently used social media platform. Several machine learning algorithms were evaluated, including Logistic Regression, Decision Tree, Random Forest, Support Vector Machine, K-Nearest Neighbors, and Gradient Boosting. Model performance was assessed using accuracy, precision, recall, F1-score, confusion matrix analysis, and 5-fold stratified cross-validation. The experimental results showed that the overall classification performance was modest. The Decision Tree model achieved the best testing performance with an accuracy and macro F1-score of 0.3400, while Gradient Boosting achieved the highest cross-validation performance with a mean accuracy of 0.3480 and a mean macro F1-score of 0.3467. Feature importance analysis using Random Forest indicated that productivity score, sleep hours, study or work hours, social media hours, and daily screen time were the most influential variables. These findings suggest that digital behavior and lifestyle indicators may provide useful exploratory insights for stress-related analysis, although their predictive power remains limited. Therefore, the proposed approach is more suitable as an exploratory digital well-being assessment framework rather than a clinical diagnostic tool.

References

[1] O. Ahmed, E. I. Walsh, A. Dawel, K. Alateeq, D. A. Espinoza Oyarce, and N. Cherbuin, “Social media use, mental health and sleep: A systematic review with meta-analyses,” J. Affect. Disord., vol. 367, pp. 701–712, Dec. 2024, doi: 10.1016/j.jad.2024.08.193.

[2] D. J. Yu, Y. K. Wing, T. M. H. Li, and N. Y. Chan, “The Impact of Social Media Use on Sleep and Mental Health in Youth: a Scoping Review,” Curr. Psychiatry Rep., vol. 26, no. 3, pp. 104–119, Mar. 2024, doi: 10.1007/s11920-024-01481-9.

[3] X. Han, E. Zhou, and D. Liu, “Electronic Media Use and Sleep Quality: Updated Systematic Review and Meta-Analysis,” J. Med. Internet Res., vol. 26, p. e48356, Apr. 2024, doi: 10.2196/48356.

[4] H. Shannon, K. Bush, P. J. Villeneuve, K. G. Hellemans, and S. Guimond, “Problematic Social Media Use in Adolescents and Young Adults: Systematic Review and Meta-analysis,” JMIR Ment. Health, vol. 9, no. 4, p. e33450, Apr. 2022, doi: 10.2196/33450.

[5] R. M. S. Santos et al., “The associations between screen time and mental health in adolescents: a systematic review,” BMC Psychol., vol. 11, no. 1, p. 127, Apr. 2023, doi: 10.1186/s40359-023-01166-7.

[6] M. Chen et al., “Screen viewing patterns and their association with mental wellbeing and psychological distress: a cross-sectional study amongst university students,” BMC Public Health, vol. 24, no. 1, p. 2097, Aug. 2024, doi: 10.1186/s12889-024-19608-1.

[7] L. E. Hartstein et al., “The impact of screen use on sleep health across the lifespan: A National Sleep Foundation consensus statement,” Sleep Health, vol. 10, no. 4, pp. 373–384, Aug. 2024, doi: 10.1016/j.sleh.2024.05.001.

[8] S. Gedam and S. Paul, “A Review on Mental Stress Detection Using Wearable Sensors and Machine Learning Techniques,” IEEE Access, vol. 9, pp. 84045–84066, 2021, doi: 10.1109/ACCESS.2021.3085502.

[9] S. Bauducco, M. Pillion, K. Bartel, C. Reynolds, M. Kahn, and M. Gradisar, “A bidirectional model of sleep and technology use: A theoretical review of How much, for whom, and which mechanisms,” Sleep Med. Rev., vol. 76, p. 101933, Aug. 2024, doi: 10.1016/j.smrv.2024.101933.

[10] T. Fischer, M. Reuter, and R. Riedl, “The Digital Stressors Scale: Development and Validation of a New Survey Instrument to Measure Digital Stress Perceptions in the Workplace Context,” Front. Psychol., vol. 12, p. 607598, Mar. 2021, doi: 10.3389/fpsyg.2021.607598.

[11] A. J. Scott, T. L. Webb, M. Martyn-St James, G. Rowse, and S. Weich, “Improving sleep quality leads to better mental health: A meta-analysis of randomised controlled trials,” Sleep Med. Rev., vol. 60, p. 101556, Dec. 2021, doi: 10.1016/j.smrv.2021.101556.

[12] K. Kaewpradit, P. Ngamchaliew, and N. Buathong, “Digital screen time usage, prevalence of excessive digital screen time, and its association with mental health, sleep quality, and academic performance among Southern University students,” Front. Psychiatry, vol. 16, p. 1535631, Mar. 2025, doi: 10.3389/fpsyt.2025.1535631.

[13] A. Sevic, N. Foldnes, and K. K. Brønnick, “Measuring digital stress in Norway: translation and validation of the Digital Stressors Scale,” Front. Psychol., vol. 15, p. 1297194, Feb. 2024, doi: 10.3389/fpsyg.2024.1297194.

[14] B. M. Booth, H. Vrzakova, S. M. Mattingly, G. J. Martinez, L. Faust, and S. K. D’Mello, “Toward Robust Stress Prediction in the Age of Wearables: Modeling Perceived Stress in a Longitudinal Study With Information Workers,” IEEE Trans. Affect. Comput., vol. 13, no. 4, pp. 2201–2217, Oct. 2022, doi: 10.1109/TAFFC.2022.3188006.

[15] B. Saylam and Ö. D. İncel, “Quantifying Digital Biomarkers for Well-Being: Stress, Anxiety, Positive and Negative Affect via Wearable Devices and Their Time-Based Predictions,” Sensors, vol. 23, no. 21, p. 8987, Nov. 2023, doi: 10.3390/s23218987.

[16] A. A. Al-Atawi et al., “Stress Monitoring Using Machine Learning, IoT and Wearable Sensors,” Sensors, vol. 23, no. 21, p. 8875, Oct. 2023, doi: 10.3390/s23218875.

[17] V. Farrahi and M. Rostami, “Machine learning in physical activity, sedentary, and sleep behavior research,” J. Act. Sedentary Sleep Behav., vol. 3, no. 1, p. 5, Jan. 2024, doi: 10.1186/s44167-024-00045-9.

[18] J. R. Beames et al., “Use of smartphone sensor data in detecting and predicting depression and anxiety in young people (12–25 years): A scoping review,” Heliyon, vol. 10, no. 15, p. e35472, Aug. 2024, doi: 10.1016/j.heliyon.2024.e35472.

[19] H. S. Saad, J. F. W. Zaki, and M. M. Abdelsalam, “Employing of machine learning and wearable devices in healthcare system: tasks and challenges,” Neural Comput. Appl., vol. 36, no. 29, pp. 17829–17849, Oct. 2024, doi: 10.1007/s00521-024-10197-z.

[20] M. Ciharova et al., “Machine-learning detection of stress severity expressed on a continuous scale using acoustic, verbal, visual, and physiological data: lessons learned,” Front. Psychiatry, vol. 16, p. 1548287, Jun. 2025, doi: 10.3389/fpsyt.2025.1548287.

[21] M. Razavi et al., “Machine Learning, Deep Learning, and Data Preprocessing Techniques for Detecting, Predicting, and Monitoring Stress and Stress-Related Mental Disorders: Scoping Review,” JMIR Ment. Health, vol. 11, p. e53714, Aug. 2024, doi: 10.2196/53714.

[22] M. K. Moser, M. Ehrhart, and B. Resch, “An Explainable Deep Learning Approach for Stress Detection in Wearable Sensor Measurements,” Sensors, vol. 24, no. 16, p. 5085, Aug. 2024, doi: 10.3390/s24165085.

[23] L. As. Brautsch, L. Lund, M. M. Andersen, P. J. Jennum, A. P. Folker, and S. Andersen, “Digital media use and sleep in late adolescence and young adulthood: A systematic review,” Sleep Med. Rev., vol. 68, p. 101742, Apr. 2023, doi: 10.1016/j.smrv.2022.101742.

[24] B. Brosnan, J. J. Haszard, K. A. Meredith-Jones, S.-R. Wickham, B. C. Galland, and R. W. Taylor, “Screen Use at Bedtime and Sleep Duration and Quality Among Youths,” JAMA Pediatr., vol. 178, no. 11, p. 1147, Nov. 2024, doi: 10.1001/jamapediatrics.2024.2914.

[25] T. Sanders et al., “An umbrella review of the benefits and risks associated with youths’ interactions with electronic screens,” Nat. Hum. Behav., vol. 8, no. 1, pp. 82–99, Nov. 2023, doi: 10.1038/s41562-023-01712-8.

[26] M. Shanmugasundaram and A. Tamilarasu, “The impact of digital technology, social media, and artificial intelligence on cognitive functions: a review,” Front. Cogn., vol. 2, p. 1203077, Nov. 2023, doi: 10.3389/fcogn.2023.1203077.

[27] A. Pinge, V. Gad, D. Jaisighani, S. Ghosh, and S. Sen, “Detection and monitoring of stress using wearables: a systematic review,” Front. Comput. Sci., vol. 6, p. 1478851, Dec. 2024, doi: 10.3389/fcomp.2024.1478851.

[28] A. S. Hammad, A. Tajammul, I. Dergaa, and M. Al-Asmakh, “Machine learning applications in the analysis of sedentary behavior and associated health risks,” Front. Artif. Intell., vol. 8, p. 1538807, Jun. 2025, doi: 10.3389/frai.2025.1538807.

[29] H. T. Pham, H.-L. Chuang, C.-P. Kuo, T.-P. Yeh, and W.-C. Liao, “Electronic Device Use before Bedtime and Sleep Quality among University Students,” Healthcare, vol. 9, no. 9, p. 1091, Aug. 2021, doi: 10.3390/healthcare9091091.

[30] J.-Z. Xiang, Q.-Y. Wang, Z.-B. Fang, J. A. Esquivel, and Z.-X. Su, “A multi-modal deep learning approach for stress detection using physiological signals: integrating time and frequency domain features,” Front. Physiol., vol. 16, p. 1584299, Apr. 2025, doi: 10.3389/fphys.2025.1584299.

Downloads

Published

2026-05-25