## 1 Introduction  
Chronic diseases, such as diabetes, require frequent adjustments to treatment decisions to tailor and personalize the treatment to individual patients for improved outcomes. More frequent assessment of the instantaneous state and conditions of the subject can further enable and enhance precision diabetes treatment. People with Type 1 diabetes (T1D) can keep their blood glucose values in a desired range by incorporating their physical activity (PA) and acute psychological stress (APS) information in their insulin dosing decisions. The type and intensity of PA and the nature of APS experienced by an individual affect a range of endocrine and metabolic pathways. Frequently measuring the variations in biological analytes in free-living conditions and throughout daily life is not practical, which necessitates different modalities for noninvasive sensing to infer information on PA and APS required to adjust the diabetes therapy [1]. The need to assess PA and APS information from noninvasive sensors has spurred the development of novel wearable devices with advanced sensors and new algorithms to interpret the raw data. Sensors such as three-axis accelerometers (ACC) and heart rate (HR) monitors based on photoplethysmography that measures blood volume pulse (BVP) enabled noninvasive detection of PA. Detection of APS requires additional biosignals such as electrodermal activity (EDA) measured by galvanic skin response (GSR) sensor, and skin temperature (ST) [2]. The data generated by these sensors need to be cleaned of the noise and artifacts corrupting the signal to enhance the information extracted from the signals. After cleaning the raw data, the signals must be mapped to features that can inform the algorithms on the type and intensity of PA and nature of the APS. Various machine learning algorithms have been developed and trained in the literature to detect PA and APS, including naive Bayes classification, nearest neighbor methods, logistic regression, decision trees, support vector machines, and neural networks (NN) [3, 4, 5]. Novel NN architectures and training algorithms can identify intricate and hidden patterns in the signals to gain information on PA and APS. The use of recurrent neural networks (RNN) with long short-term memory (LSTM) has shown promising results in predicting the type and intensity of PA and the type of APS episode [6, 7]. An issue with the data collected to train the models is the class imbalances, which can bias the performance of the algorithms to favor the majority class at the expense of lower accuracy for the minority class. Although the sizes of the classes may be balanced by either downsampling the majority class or upsampling the minority class, it risks discarding useful information if samples are removed or biasing the algorithms towards the samples that are repeated multiple times when upsampled [8]. Addressing the class imbalances requires more sophisticated upsampling algorithms that generate new data samples or incorporating weighted learning when training the model. Training independent models to predict the type of PA and APS without connecting the shared information between the two tasks can require more training data and longer training time. Exploiting the shared representations in the data by training one model to predict the related tasks jointly can potentially improve data efficiency and reduce the training time. However, learning multiple tasks simultaneously can be challenging [9, 10, 11, 12]. The combination of the tasks must be considered when handling the class imbalances. The tasks also must be partially related with overlapping feature maps to reinforce the join learning of multiple tasks. We showed in previous works that a unified common feature map can encompass the features required to predict the types of PA and APS [6]. The detection of PA and APS, whether they occur alone or simultaneously, can affect the treatment decision for T1D [13].