## 2 Materials and Methods
### Feature Extraction  
Following the cleaning of the raw data, the signals must be mapped to features that are processed by the algorithms in determining the type and intensity of PA and the type of APS. Calculating features and different fingerprints from biosignals is crucial for two main reasons: First, different biosignals are calculated and streamed at different sampling rates and they need to be fed to the NN model with a similar frequency. Second, raw signals need to be transformed into a new feature space to better represent the target variables  
Figure 3: The pipeline of the signal processing for ROCKET feature extraction.  
Figure 2: The schematic representation of windowing of different physiological variables.  
(i.e., the class labels). The new feature space introduces nonlinearity to the data and hence, more complex patterns between input and the class labels are used to develop and train the model. We utilized random convolutional kernel transformation (ROCKET) [38] to extract 1800 features from the time-series signals [39]. By generating random convolutional kernels of random length, weight, bias, dilation, and padding, ROCKET extracts feature vectors. In addition, deep convolutional LSTM NN models can also be used for this step [40]. Convolution layers incorporated into 1D convolutional LSTM RNN models require a large number of data samples, and GPUs are not yet optimized to run LSTM layers efficiently. ROCKET runs faster, is resistant to dilation, and is more flexible by applying convolutional kernels with different sizes, padding, etc.  
Using Equation (1), we extracted dilated convolutional-based feature map from each segment of signals by calculating the maximum and the proportion of positive values of the filtered signal [38; 39; 40; 41].  
\[F==\sum_{i=0}^{m-1}f(i).x_{D}(s-d.i),\ D\in\left\{BVP,\ Acc_{x},\ Acc_{y},\ Acc_{z},SCR,\ SCL,\ ST\right\} \tag{1}\]  
where 1D signal \(X\in R^{10\times f\ s\ l}\) and the kernel filter \(f\): 0,..., m \(-1\rightarrow\) R. The length m of each kernel filter is selected as 2 \(\times\)\(f\)\(s_{I}\) where \(f\)\(s_{I}\) is the sampling rate of biosignal \(I\). Variable \(d\) is the dilation factor.  
In addition, we transformed the BVP signal into the frequency domain using the fast Fourier transform in order to extract the modified power spectrum peaks orthogonal to the 3-axis ACC signals (Equation (2) [42; 43]).  
\[N_{BVP\perp Acc_{t}}\ =N_{BVP}\prod_{t\in x,y,z}\left({{{{\left({{{{n_{hf}}} \mathord{\left/{\vphantom{{{n_{hf}}}{-{n_{lf}}}}}\right.\kern-1.2 pt}{n_{lf}}} \mathord{\left/{\vphantom{{{n_{lf}}}{-{n_{lf}}}}}\right.\kern-1.2 pt}{n_{lf}}} \mathord{\left/{\vphantom{{{n_{lf}}}{-{n_{lf}}}}}\right.\kern-1.2 pt}{n_{lf}}} \mathord{\left/{\vphantom{{{n_{lf}}}{-{n_{lf}}}}}\right.\kern-1.2 pt}{n_{lf}}} \mathord{\left/{\vphantom{{{n_{lf}}}{-{n_{lf}}}}\right.\kern-1.2 pt}{n_{lf}}} \mathord{  
we selected the 200 features corresponding to the largest variable important for projection (VIP) scores of the PLS-DA (the largest 200 absolute coefficient of the PLS-DA).  
PLS is a cross-decomposition technique. It derives the latent variables (LV) by maximizing the covariance between the features and the output variable; as a result, PLS will ensure that the first LV has the highest degree of correlation with the response variable(s). PLS-DA is an extension of PLS to deal with datasets with categorical target variables (i.e., class labels). PLS-DA is used to determine class separation and to identify the variables containing class-defining information [46].  
A total of 244 features are selected by combining features from APS and the pair-wise mutual features from PA and EE to train the multi-task LSTM RNN model that makes simultaneous classification of APS types (NS, EAS) and PA types (SS, SB, TR) and EE estimation. A total of 296 features are selected by combining features from APS and PA for use in the multi-task LSTM RNN model and multi-task XGBoost for the simultaneous classification of APS types (NS, EAS, MS) and PA types (SS, SB, TR).