## 5 Discussion
Similarly, misclassification of SS as SB or TR will lead to hyperglycemia due to reduction of insulin injection by the AP, while misclassification of SB or TR as SS is dangerous since AP will not reduce insulin infusion during PA leading to hypoglycemia or potentially severe hypoglycemia. A few of the EAS inducement samples were misclassified as NS, as shown in the confusion matrix of APS classification Figure 5(i.e., EAS recall = 98.43% as indicated in Table 10). The main reason that some APS samples are predicted as non-stressful episodes can be caused by over-smoothing the biosignals, especially BVP, since the variation of IBI is the main biosignal conveying the information on psychological stress. Additionally, the experiments were conducted under the review and monitoring of the IRB to ensure the safety and welfare of the subjects. As a result, the APS experiments are limited to mild APS inducement; consequently, some of the physiological variables during EAS resemble NS events. Classification of different APS is a challenging task: for one reason, different classes, in particular, milder MS and EAS, can be misclassified interchangeably. Another factor in our data is the difference in data sizes, the number of samples in EAS dominates other class labels (NS and MS). Usually, handling imbalance labels in the training split improves the performance of the model with unseen data. Yet, intervention between NS and EAS indicates a low signal-to-noise ratio in some collected samples. The noise in the data causes estimation of the probability of each class close to the threshold value. Hence, the trained model results in estimating samples with low confidence. Similarly, during SB sessions, the variation of the 3D accelerometer signals can be similar to the SS condition and therefore, other biosignals such as BVP become rather important to distinguish between SS and SB. SB and TR samples are readily distinguishable from each other. Figures 5(a)-5(a) and 10(a) show no misclassification between SB and TR, because the TR experiments do not contain high magnitude measurements from the three-axis ACC which distinguishes the SB experiments. Overall F1 scores for classification of PA types (SS, SB, TR) are higher than classification of APS types (NS, EAS, MS) for all models considered. The 3-axis accelerometer signal is the main signal contributing only to discrimination of PA types while the 3-axis accelerometer signal is not correlated with APS types. Sympathetic activation stimulates the sweat glands. Hence, EDA is an indicator of sweating rate, and is strongly correlated with PA intensity as well as APS level. The magnitude of the physiological variables such as HR in response to PA is more pronounced compared to APS. The multi-task LSTM RNN model for classification of APS types (NS, EAS, MS) and PA types (SS, SB, TR) with weighted training had F1 scores of 99.8% for PA and 99.3% for APS. On the other hand, the multi-task LSTM RNN model for classification of APS types (NS, EAS, MS) types and PA types (SS, SB, TR) with ADYSN had F1 scores of 99.69% for PA and 98.83% for APS. A comparison between Figures 6 and 7 reveals that adding synthetic samples based on the density and similarity between samples does not efficiently address the issue of imbalanced samples. Adding synthetic samples using ADYSN assumes the observations with high similarity will have similar labels. Although this assumption in many applications is valid, different types of APS often show similar behavior and these three classes are not simply separable. Therefore, some synthetic samples with their labels are considered as the main reason for the increased number of misclassified samples in comparison to the weighted training technique for handling the imbalanced classes. Similarly, comparison of the performance of models trained by ADYSN-balanced samples and weighted classes were performed for the independent model architectures. As expected, the ADYSN technique is not the optimal solution for addressing the problem of imbalanced samples in the data.