Automated classification of stress and relaxation responses in major depressive disorder, panic disorder, and healthy participants via heart rate variability

Front Psychiatry. 2025 Jan 9:15:1500310. doi: 10.3389/fpsyt.2024.1500310. eCollection 2024.

Abstract

Background: Stress is a significant risk factor for psychiatric disorders such as major depressive disorder (MDD) and panic disorder (PD). This highlights the need for advanced stress-monitoring technologies to improve treatment. Stress affects the autonomic nervous system, which can be evaluated via heart rate variability (HRV). While machine learning has enabled automated stress detection via HRV in healthy individuals, its application in psychiatric patients remains underexplored. This study evaluated the feasibility of using machine-learning algorithms to detect stress automatically in MDD and PD patients, as well as healthy controls (HCs), based on HRV features.

Methods: The study included 147 participants (MDD: 41, PD: 47, HC: 59) who visited the laboratory up to five times over 12 weeks. HRV data were collected during stress and relaxation tasks, with 20 HRV features extracted. Random forest and multilayer perceptron classifiers were applied to distinguish between the stress and relaxation tasks. Feature importance was analyzed using SHapley Additive exPlanations, and differences in HRV between the tasks (ΔHRV) were compared across groups. The impact of personalized longitudinal scaling on classification accuracy was also assessed.

Results: Random forest classification accuracies were 0.67 for MDD, 0.69 for PD, and 0.73 for HCs, indicating higher accuracy in the HC group. Longitudinal scaling improved accuracies to 0.94 for MDD, 0.90 for PD, and 0.96 for HCs, suggesting its potential in monitoring patients' conditions using HRV. The HC group demonstrated greater ΔHRV fluctuation in a larger number of and more significant features than the patient groups, potentially contributing to higher accuracy. Multilayer perceptron models provided consistent results with random forest, confirming the robustness of the findings.

Conclusion: This study demonstrated that differentiating between stress and relaxation was more challenging in the PD and MDD groups than in the HC group, underscoring the potential of HRV metrics as stress biomarkers. Psychiatric patients exhibited altered autonomic responses, which may influence their stress reactivity. This indicates the need for a tailored approach to stress monitoring in these patient groups. Additionally, we emphasized the significance of longitudinal scaling in enhancing classification accuracy, which can be utilized to develop personalized monitoring technologies for psychiatric patients.

Keywords: autonomic nervous system; heart rate variability; machine learning; major depressive disorder; panic disorder; physiological signals; relaxation; stress.