## 4 Results  
A series of experiments were conducted to classify data into \"no stress\" and \"stress\" categories using classification models based on different implementations of the input feature vector. This made it possible to compare the influence of different combinations of features on the classification results.  
The two most successful feature groups for both the \"no stress\" and \"stress\" phases were identified as follows:  
1. HRV features selected using RF, combined with the number of resistance peaks and their width.
2. HRV features selected using RF, combined with the number of resistance peaks, excluding their width.  
The set of selected HRV features includes MEDFA_alpha1_Delta, SDNN, SD, MFDFA_alpha1_Max, MEDFA_alpha2_Delta, and MSEn. Most of these indices belong to the multifractal spectrum, indicating the nonlinearity and complexity of the data. MFDFA_alpha1_Delta, MEDFA_alpha1_Max, and HRV_MEDFA_alpha2 are powerful tools for analyzing the fractal properties of heart rate variability. They provide deeper insights into the cardiac autonomic function and the inherent complexity of heart dynamics. HRV MSEn, as a multiscale entropy, is a powerful method for assessing the complexity and health of the cardiovascular system through HRV analysis. By examining how entropy values change across different time scales, MSE provides deeper insights into the autonomic nervous system's functionality and the body's adaptive capacities.  
When evaluating a machine learning model, predictions can be classified into four categories: true positives (TPs), false positives (FPs), true negatives (TNs), and false negatives (FNs). To evaluate the classification performance of the model, error metrics such as accuracy, precision, sensitivity(recall), and F1 score have been used [46]. The accuracy was calculated by the formula:  
\[Accuracy=\frac{TP+TN}{TP+TN+FP+FN} \tag{1}\]  
The precision was computed using (2):  
\[Precision=\frac{TP}{TP+FP} \tag{2}\]  
The sensitivity was calculated by (3):  
\[Sensitivity(recall)=\frac{TP}{TP+FN} \tag{3}\]The F1 score was obtained using (4):  
\[F1=\frac{2 TP}{2 TP+FN+FP} \tag{4}\]  
The classification results for the second feature group, which demonstrated the best performance, are presented in Table 6.  
Figure 6 shows the confusion matrix for the k-Nearest Neighbors model, which provided the best classification outcome.  
The confusion matrix consists of 12 values, which corresponds to 16% of the test data set out of a total of 74 variables. The total number 74 is the sum of the two groups, 34 \"no stress\" and 34 \"stress\", meaning that each record contains both phases. The matrix includes five TNs and five TPs, as well as a Type 1 error (i.e., one FP) and a Type 2 error (i.e., on FN).  
The two phases of \"no stress\" and \"stress\" can also be clearly distinguished on the skin resistance curve, which is shown in Figure 7, where the skin resistance signal corresponding to the \"no stress\" phase is shown to the left of the red dotted line and the signal corresponding to the \"stress\" phase is shown to the right of the red dotted line (mark) after the siren is turned on.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**ML Model/Classification Score** & **Accuracy** & **Precision** & **Recall** & **F1** \\ \hline k-Nearest Neighbors & 0.833 & 0.833 & 0.833 & 0.833 \\ Naive Bayes & 0.666 & 0.666 & 0.544 & 0.571 \\ Random Forest & 0.666 & 0.666 & 0.833 & 0.714 \\ Support Vector Machine & 0.636 & 0.625 & 0.801 & 0.661 \\ \hline \hline \end{tabular}
\end{table}
Table 6: Classification results using HRV features and number of resistance peaks.  
Figure 6: Confusion matrix for the kNN model.