Optimizing Mental Stress Detection via Heart Rate Variability Feature Selection

Sensors (Basel). 2025 Jul 3;25(13):4154. doi: 10.3390/s25134154.

Abstract

The increasing prevalence of stress-related disorders necessitates accurate and efficient detection methods for timely intervention. This study explored the potential of heart rate variability as a biomarker for detecting mental stress using a publicly available dataset. A total of 93 heart rate variability features extracted from electrocardiogram signals were analyzed to differentiate stress from non-stress conditions. Our methodology involved data preprocessing, feature computation, and three feature selection strategies-filter-based, wrapper, and embedded-to identify the most relevant heart rate variability features. By leveraging Recursive Feature Elimination combined with Nested Leave-One-Subject-Out Cross-Validation, we achieved a peak F1 score of 0.76. The results demonstrate that two heart rate variability features-the median absolute deviation of the RR intervals (the time elapsed between consecutive R-waves on an electrocardiogram), which is normalized by the median, and the normalized low frequency power-consistently distinguished the stress states across multiple classifiers. To assess the robustness and generalizability of our best-performing model, we evaluated it on a completely unseen dataset, which resulted in an average F1 score of 0.63. These findings emphasize the value of targeted feature selection in optimizing stress detection models, particularly when handling high-dimensional datasets with potentially redundant features. This study contributes to the development of efficient stress monitoring systems, paving the way for improved mental health assessment and intervention.

Keywords: electrocardiogram; feature selection; heart rate variability; machine learning; mental stress detection; recursive feature elimination.

MeSH terms

  • Adult
  • Algorithms
  • Electrocardiography / methods
  • Female
  • Heart Rate* / physiology
  • Humans
  • Male
  • Signal Processing, Computer-Assisted
  • Stress, Psychological* / diagnosis
  • Stress, Psychological* / physiopathology