## 2 The Discriminative Training of the Extended Particle-Aided Unscented Kalman Filter
### Discriminative Training of the PAUKF  
This section illustrates the implementation of the discriminative training of the PAUKF based on previous research. Although the parameters in both prediction variances and measurement variances could be trained with the same method, in this work we focus on training the measurement variances. As with most training algorithms, the PAUKF needs to define criteria for evaluating the process. The residual prediction error (RPE) is selected as the evaluation criteria (EC). Not only is it simple to implement but also the performance based on the residual prediction error shows the lowest root mean square (RMS) error according to the work by [PERSON] et al. [17]. To calculate the residual prediction error, ground truth data are needed. Since there is no perfect sensor without any noise, a sensor with high accuracy is needed. The high-accuracy measurement can be regarded as the ground truth value with an added random variable \(\gamma\) with zero mean and variance matrix \(\mathrm{P}\), like Equations (1) and (2) show. The h function is the projection of the estimated value onto the highly accurate measurement value. In this paper, we assume the highly accurate sensor could measure the x, y, \(\theta\) position directly. Since the algorithm is evaluated in the simulation environment, we could actually use the ground truth value directly. However, the ground truth data are not available in the real world. Therefore, we are trying to evaluate the algorithm in a reasonable environment that is similar to the real world. This is the reason why we do not use the ground truth data as the high-accuracy sensor. \[\mathrm{z_{h}}=h\big{(}x_{pankf}\big{)}+\gamma, \tag{1}\]  
\[\gamma\ \sim\ \mathrm{N}(0,\ \mathrm{P}), \tag{2}\]  
The residual prediction error is calculated based on the whole data of the high-accuracy measurement \(\mathrm{z_{h,1:T}}\) and the estimated value of the PAUKF \(\mathrm{x_{pankf,1:T}}\). Since the residual prediction error is based on the estimation result of the PAUKF, it can learn how each variance affects the whole estimation process. Since the purpose of this paper is figuring out the optimal measurement variances \(R_{op}\) of the PAUKF, the residual prediction error should be minimized as Equation (3) shows. In Equation (3), \(y_{t}\) is the measurement value from a highly accurate sensor and \(\mu_{t}\) is the final estimated result of the PAUKF. The numerical value of \(\mu_{t}\) is equal to \(x_{pankf}\) in Equation (1). As mentioned in Equation (1), h is the projection of the PAUKF with a highly accurate measurement value. \[R_{op}=\underset{R}{\mathrm{argmin}}\sum\
olimits_{t=0}^{T}(y_{t}-h(\mu_{t}) )^{T}P^{-1}(y_{t}-h(\mu_{t})), \tag{3}\]  
Since it is assumed that the highly accurate sensor could measure the state x, y, \(\theta\) directly, the measurement variance matrix becomes an identity matrix. Then, Equation (3) can be simplified as Equation (4). Therefore, the training algorithm should decide the appropriate measurement variance matrix \(\mathrm{R}\) to make the residual prediction error as small as possible. Since the \(x_{pankf,t}\) is the final estimated result of the PAUKF, the evaluation criteria are optimized considering the performance in the whole track. \[R_{op}=\underset{R}{\mathrm{argmin}}\sum\
olimits_{t=0}^{T}\big{(}y_{t}-h \big{(}x_{pankf,\ t}\big{)}\big{)}^{2}, \tag{4}\]As the evaluation criteria of the performance of the PAUKF are well-defined as Equation (4), a training method should be defined. The coordinate descent algorithm is used to minimize the evaluation criteria as in previous research. The training process is simple to implement and intuitively straightforward as shown in Figure 1. \(\sigma_{x,y,\theta}\) is the standard deviation of the measurement, and the alphabetical characters a, b and c are the hyper-parameters of the coordinate descent algorithm.