## 1 Introduction
People with T1D must continuously monitor their blood glucose levels using continuous glucose monitors (CGM) and evaluate their insulin requirements based on their glucose levels, meal, PA, and APS information. Incorporating all these diverse sources of information to continuously adjust insulin administration is an arduous process. Artificial pancreas (AP) systems connect a CGM sensor to an insulin pump via an algorithm to calculate and administer insulin accordingly in people with Type 1 diabetes [14]. AP systems developed by our research group have extended the traditional AP structure (based exclusively on CGM and insulin information collected automatically and manual entries of meal and exercise information) by incorporating additional signals from wearable devices, such as wristbands, to provide information on PA and adjust insulin dosing accordingly [15, 16]. Although PA and APS are both similar in their effects on some signals, such as increasing HR, they must be accurately classified to avoid adverse outcomes. Moderate intensity PA usually lowers blood glucose levels, which requires a decrease in the insulin dose to maintain stable blood glucose levels within the safe target range. APS increases blood glucose levels, which may necessitate an increase in the insulin dose to maintain the glucose levels in the target range. Despite their opposing effects on blood glucose levels, the presence of PA and APS can be easily misinterpreted if the classification decision relies on only a limited set of measurements, such as relying solely on HR. Motivated by the above considerations, the main contributions of this work are:  
* _Multi-task learning_ of RNN with LSTM architecture for _simultaneously classifying_ the type and intensity (i.e., energy expenditure) of physical activity events (sedentary state, stationary bike, or treadmill run) and type of acute psychological stress events (non-stress, emotional anxiety stress, or mental stress) using a _common feature map_ and comparing the performance of the multi-task model with the independent models for each task. * Multi-task learning of extreme gradient boosting (XGBoost) for simultaneously classifying the type of PA (sedentary state, stationary bike, or treadmill run) and the type of APS (non-stress, emotional anxiety stress, or mental stress) using a common feature map and comparing the performance of the multi-task XGBoost to the independent XGBoost models for each task. * Simultaneously classifying the type of PA (sedentary state, stationary bike, or treadmill run) and the type of APS (non-stress, emotional anxiety stress, or mental stress) using data collected during daily life activities relying only on the physiological signals measured noninvasively by the Empatica E4 wristband. * Employing random convolutional kernel transformation to extract a large number of features from the time series signals. * Comparatively evaluating two different feature selection techniques to determine the most informative set of features: PLS-DA for the classification tasks and PLS for the regression task. * Evaluating the performance of two different approaches to handle the imbalanced classes: weighted training and adaptive synthetic (ADASYN) sampling approach. Section 2 details the methods for collecting the data, preprocessing the signals, extracting feature maps, selecting the informative features useful for the multi-task learning, handling class imbalances, and the architecture of the trained recurrent NN models and the XGBoost model. Section 3 presents the results of the multitask RNN with LSTM and XGBoost algorithms, and comparatively evaluates their performance against their respective independent models. Section 4 provides a discussion on the advantages of the approach and possible improvements in future works. Finally, Section 5 provides the concluding remarks.