## 2 Methodology
### Multi-Task Loss Function Based on Homoscedastic Uncertainty  
The performance of hard parameter sharing is highly dependent on the loss weight of each task, and simply performing a weighted linear sum of the loss for each individual task is usually undertaken to carry out training. Manual tuning of the weights is often troublesome. Thus, a method based on homoscedastic uncertainty of the Bayesian model is used to balance the weights of the loss function of multiple tasks. In Bayesian modeling, there are two main types of uncertainty, i.e., epistemic and aleatoric uncertainty. In a model, the aleatoric uncertainty captures the randomness of the model prediction, which depends on the noise inherent in input observations, and the epistemic uncertainty captures what a model does not know due to lack of training data [37]. Aleatoric uncertainty can again be divided into two subcategories, heteroscedastic uncertainty and homoscedastic uncertainty. Heteroscedastic uncertainty depends on the inputs to the model, with some inputs potentially having more noisy outputs than others. Homoscedastic uncertainty can be described as task dependent, which stays constant for all input data and varies between different tasks [36]. In this paper, we derive a multi-task loss function based on maximizing the Gaussian likelihood with homoscedastic uncertainty. The derivation is as follows:  
Figure 1: Architecture of the multi-task FCRN. Given a dataset \(X=\{x_{1},\ldots,x_{N}\}\), \(Y=\{y_{1},\ldots,y_{N}\}\), we define \(f^{w}(x^{*})\) as the output of a neural network with weights \(w\) on input \(x^{*}\). For regression tasks, we define the likelihood as a Gaussian distribution that takes the model output as the mean:  
\[p(y^{*}|f^{w}(x^{*}))=N\Big{(}f^{w}(x^{*}),\sigma^{2}\Big{)} \tag{1}\]  
where \(\sigma\) is an observation noise scalar capturing how much noise is in the outputs. When \(w\) and \(x^{*}\) are determined, the establishment of a probabilistic model of observation is equivalent to the determination of epistemic uncertainty and heteroscedastic uncertainty. Only homoscedastic uncertainty is considered in this paper. Different tasks have different homoscedastic uncertainties. 2. In maximum likelihood inference, we want to maximize the logarithmic likelihood of the model, that is, to maximize the following equation: \[log\ p(y^{*}|f^{w}(x^{*}))\propto-\frac{1}{2\sigma^{2}}||y^{*}-f^{w}(x^{*})||^ {2}-log\sigma\] (2)
3. Construct the maximum likelihood function for multi-task. There are two tasks in our model: impedance prediction and data reconstruction. We use \(y_{pre}\) and \(y_{rec}\) to denote the outputs of the two tasks and assume that \(y_{pre}\) and \(y_{rec}\) following a Gaussian distribution: \[p\big{(}y_{pre},y_{rec}|f^{w}(x)\big{)}=p\big{(}y_{pre}|f^{w}(x)\big{)}p(y_{ rec}|f^{w}(x))=N\Big{(}y_{pre},f^{w}(x),\sigma_{pre}^{2}\Big{)}\] (3)
4. To maximize the logarithmic likelihood function, that is, to minimize the negative logarithmic likelihood function, then the multi-task loss function is: \[ \begin{array}{l}\mathrm{L}(w,\sigma_{pre},\sigma_{rec})=-log\ p\big{(}y_{ pre},y_{rec}|f^{w}(x)\big{)}\propto\frac{1}{2\sigma_{pre}^{2}}||y_{pre}-f^{w}(x)||^ {2}+\frac{1}{2\sigma_{rec}^{2}}||y_{rec}-f^{w}(x)||^{2}+log\sigma_{pre}\sigma_ {rec}\\ \hskip 142.26378 pt=\frac{1}{2\sigma_{pre}^{2}}L_{pre}(w)+\frac{1}{2\sigma_{ rec}^{2}}L_{rec}(w)+log\sigma_{pre}\sigma_{rec}\end{array} \] (4) the process of minimizing the loss function is to learn the optimal weight of \(L_{pre}(w)\) and \(L_{rec}(w)\) automatically according to the data. As \(\sigma_{pre}\) increases, the weight of task impedance prediction decreases. However, with too great an increase in noise, the data will be ignored, so the last term of the objective function \(log\sigma_{pre}\sigma_{rec}\) is the noise term regularizer. When the loss function reaches its minimum, we can obtain the corresponding \(\sigma_{pre}\) and \(\sigma_{rec}\).