# A Novel Reconstruction Method for Irregularly Sampled Observation Sequences for Digital Twin
## 3 Irregularly Sampled Observation Sequence Reconstruction Method Based on PRN-NCDE
### Weighted Fusion of Latent Features and Weight Calculation  
Sensor data in twin systems can have significant measurement noise covariance due to electromagnetic interference. Existing methods struggle with reconstructing irregular observation sequences with high noise levels. Large measurement noise will heavily contaminate the actual observation data, which means that the real distribution of the measurement information cannot be well learned. An effective means for dealing with this issue is to incorporate reference latent features into the model training and prediction process, and fuse them with latent features from noisy actual observations, thus reducing the impact of noise on reconstruction results. Therefore, we utilize the prediction results of a high-fidelity digital twin model as a reference observation sequence, and construct a PRN with the same network structure to obtain reference latent features. We can assume that the actual and reference observation sequences are mapped to latent states \(\mathbf{x}_{0}^{obs}\) and \(\mathbf{x}_{0}^{ref}\), respectively, through identical neural network structures, with their posterior distributions following normal distributions given by  
\[\begin{array}{l}p_{e}\Big{(}\mathbf{x}_{0}^{obs}\Big{|}\big{\{}\big{(}\mathbf{y}_{n }^{irr},t_{n}\big{)}\big{\}}_{n=0}^{N}\Big{)}=\mathcal{N}\Big{(}\mathbf{x}_{  
\(\text{fnn}(\bullet)\) is the feedforward neural network transforming the initial hidden state \(\mathbf{z}_{0}\) into \(\mathbf{\mu}_{0}\) and \(\sigma_{0}^{2}\), and \(\exp(\bullet)\) denotes the exponential operation which can ensure the covariance matrix is positive definite. By using the reparameterization trick, \(\mathbf{\kappa}_{0}^{abs}\) and \(\mathbf{x}_{0}^{ref}\) can be written as  
\[ \begin{array}{l}\mathbf{x}_{0}^{abs}=\mathbf{\mu}_{0}^{obs}+\sigma_{0}^{obs}\odot \varsigma\\ \mathbf{x}_{0}^{ref}=\mathbf{\mu}_{0}^{ref}+\sigma_{0}^{ref}\odot\varsigma\end{array}  \tag{8}\]  
where \(\varsigma\sim\mathcal{N}(\mathbf{0},\mathbf{I})\) is sampled from the standard normal distribution. Then, we need to determine reasonable weight allocation criteria for the weighted fusion of latent features. By introducing reference latent features, the reconstruction performance under large noise conditions can be improved. Therefore, the noise level of the actual observation sequence can be used for weight allocation. When noise is small, the weight of the actual observation sequence should be increased to capture more of its feature information. Conversely, when noise is large, the weight of the reference latent features should be increased to avoid introducing excessive measurement noise. Assuming the measurement noise follows a Gaussian distribution with mean \(\mathbf{0}\) and covariance \(\mathbf{R}\), we estimate the noise covariance using the reference observation sequence:  
\[\hat{\mathbf{R}}=\frac{1}{N}\sum_{n=0}^{N}\left(\tilde{\mathbf{y}}_{n}^{ irr}-\tilde{\mathbf{y}}_{n}^{ref}\right)\left(\tilde{\mathbf{y}}_{n}^{i\prime r}- \tilde{\mathbf{y}}_{n}^{ref}\right)^{T} \tag{9}\]  
where \(\tilde{\mathbf{y}}_{n}^{i\prime r}\) and \(\tilde{\mathbf{y}}_{n}^{ref}\) are the normalized actual and reference observations. Let \(\hat{R}_{\text{max}}=\max\{\text{diag}(\hat{\mathbf{R}})\}\) be the largest diagonal element of \(\hat{\mathbf{R}}\). The reference feature weight is then calculated by  
\[\left\{ \begin{array}{ll}Q=s_{1}\cdot\hat{R}_{\text{max}}&\hat{R}_{\text{max }}<r_{1}\\ Q=s_{2}\cdot\hat{R}_{\text{max}}+c&r_{1}\leq\hat{R}_{\text{max}}\leq r_{2}\\ Q=q_{2}&\hat{R}_{\text{max}}>r_{2}\end{array} \right. \tag{10}\]  
where \(s_{1}=q_{1}/r_{1}\), \(s_{2}=(q_{2}-q_{1})/(r_{2}-r_{1})\), \(c=q_{1}-s_{2}\cdot r_{1}\). \(r_{1}\), \(r_{2}\), \(q_{1}\) and \(q_{2}\) are the threshold parameters needed to be set properly. If the noise level is smaller than \(r_{1}\), there is no need to increase the weight of the reference observation feature and the model will primarily utilize the actual observation features to realize sequence reconstruction.