Stress Detection via Heart Rate Variability Changes Using Machine Learning Algorithms

Document Type : Research Paper

Authors

1 Faculty of Electrical and Computer Engineering, University of Tabriz

2 Faculty of Electrical and Computer Engineering. Semnan University

3 Assistant Professor, Department of Counseling and Guidance, Faculty of Psychology and Educational Sciences

Abstract

Stress is a pervasive issue in contemporary life, originating from various factors such as occupational pressures, personal challenges, and environmental influences. This study was conducted on 25 participants aged 18 to 30 (13 male, 12 female) who performed simulated office tasks (e.g., report writing and responding to emails) under stress induced by time pressure and work interruptions. In this research, Heart Rate Variability (HRV) data was utilized as a reliable physiological indicator to develop a robust stress detection model employing Random Forest Classifier (RFC), Logistic Regression, and Extreme Gradient Boosting (XGBoost) algorithms. The results demonstrated that the RFC model outperformed both Logistic Regression and XGBoost, achieving test accuracy of 96.6% compared to 86.6% for XGBoost and 59.6% for Logistic Regression. RFC’s superiority stems from its bagging mechanism and ensemble of independent decision trees, which effectively manage model variance in the presence of physiological noise and class imbalance, whereas XGBoost’s sequential error-correction strategy renders it more susceptible to overfitting on noisy HRV signals. These findings suggest that combining HRV data with the RFC algorithm holds potential for real-time stress monitoring applications, particularly for wearable devices and smart health systems. However, these results were obtained under controlled laboratory conditions with a small, homogeneous sample, and independent validation in larger, more diverse populations and real-world settings is necessary before clinical deployment can be considered.

Keywords

Main Subjects



Articles in Press, Accepted Manuscript
Available Online from 08 June 2026
  • Receive Date: 17 November 2025
  • Revise Date: 02 May 2026
  • Accept Date: 01 June 2026