## 2 Materials and Methods
### Signal Processing  
Determining of the label of each event, namely, PA or APS and its type, requires a specific duration of biosignals recorded by the wristband sensor. Signal segmentation enables the trained model to be evaluated frequently. The signal segmentation includes splitting a long duration of biosignals into consecutive and overlapping segments. Recursively estimating the labels of different PA and APS requires information from the current time-window of biosignals as well as several past segments of the signal. Hence, all biosignals are split into segments with a duration of 10 s and each observation of the biosignal is made of 5 overlapped segments of these biosignals. Each two-consecutive time-window of biosignals has a 50% overlap, which accounts for 5 s of mutual samples in biosignals for consecutive time segments. The label of each segment was determined from the label of the last second of the segment. This formation of the data is suited to train NN models that are capable of capturing the time-dependency in the data. Therefore, RNN with LSTM architectures are an ideal choice for this purpose. Figure 2 illustrates this notation for labeling each segment of the signal and demonstrates the process of stacking samples with their chronological order for training a RNN model with LSTM architecture [6]. Due to the sensitivity of the PPG sensor to position on the wrist and movement, Empatica E4 signals are corrupted by noise and motion artifacts. A number of factors, such as sensor detachment or communication loss, may result in missing information in raw signals. Signal processing is used to remove noise and artifacts and to impute missing data. The 3-axis ACC provides the main signal used to capture and discriminate between different types of PA. Since almost all of the human activity frequencies lie between 0 and 10 Hz [37], a low-pass filter or a band-pass filter with a lower frequency close to zero can be used to reject frequencies that are not associated with body movement. We used a 4 th order Butterworth bandpass filter with cutoff frequencies 0.1-10 Hz. \begin{table}
\begin{tabular}{c c c c} \hline \hline \multicolumn{4}{c}{**PA with APS Inducements**} \\ \hline
**PA** & **Number of Experiments** & **Number of Subject** & **Minutes** \\ \hline SS & 89 & 10 & 3172 \\ \hline TR & 57 & 20 & 2164 \\ \hline SB & 61 & 19 & 1713 \\ \hline \multicolumn{4}{c}{**SS with APS Inducement**} \\ \hline
**APS** & **Number of Experiments** & **Number of Subject** & **Minutes** \\ \hline NS & 28 & 6 & 846 \\ \hline EAS & 29 & 9 & 1129 \\ \hline MS & 32 & 6 & 1197 \\ \hline \multicolumn{4}{c}{**TR Experiments with APS Inducement**} \\ \hline
**APS** & **Number of Experiments** & **Number of Subject** & **Minutes** \\ \hline NS & 28 & 20 & 1162 \\ \hline EAS & 12 & 12 & 676 \\ \hline MS & 17 & 8 & 326 \\ \hline \multicolumn{4}{c}{**SB Experiments with APS Inducement**} \\ \hline
**APS** & **Number of Experiments** & **Number of Subject** & **Minutes** \\ \hline NS & 29 & 19 & 891 \\ \hline EAS & 24 & 12 & 585 \\ \hline MS & 8 & 7 & 237 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Experiments Conducted for Data Collection [3]. The variables that are most informative for determining which PA or APS a patient has are the estimation of HR, the variability in HR, and the breath rate. Since HR values can range from 40 to 200 BPM, the values outside of this range are likely to be either high-frequency noise or motion artifacts. Therefore, we passed the BVP signal through a 4 th order Butterworth bandpass filter with cutoff frequencies 0.2-3.3 Hz to remove all oscillation and noises outside of this range. There are two types of information in the EDA signals, tonic skin conductance level (SCL) and phasic skin conductance response (SCR). It is possible to consider SCL as the baseline for evaluating EDA changes.