## 4 Model Building
### Map Feature Extraction Sub-Model  
In Section 3, after data preprocessing, three kinds of data are obtained: vehicle trajectory data (represented by traj), road data (map), and the vehicle relationship matrix (mask). Subsequently, traj and map for all scenes will be integrated and input into the VGAE model for training. The main purpose of this training process is to reduce information loss in the graph data feature extraction process. After obtaining a well-performing model through training, traj and map will be input to the generation module of VGAE. This module will use the extraction model obtained in the previous step to generate road feature vectors for vehicles in each scene from their perspective. The output map_feat obtained by the VGAE generation module will replace the original map and will be used as part of the input for the main model. Figure 7 illustrates the detailed processing flow of the sub-model:Map_feat contains the feature matrix \(\mathsf{X}\in\mathbb{R}^{n\times d}\) and the adjacency matrix \(\mathsf{A}\in\mathbb{R}^{n\times n}\) for each scene, where n is the number of nodes and d is the number of features. These two matrices containing the map graph structure information will serve as inputs to the VGAE model. Prior to input, the feature matrix is normalized to scale features of different data sizes into a consistent range, and thereby the model's convergence speed is improved. Additionally, the adjacency matrix is symmetrically normalized to obtain matrix \(\widetilde{\mathsf{A}}\). The implemented VGAE model structure is as shown in Figure 8.  
The model as a whole is divided into two parts: the encoder and the decoder. The encoder is composed of a graph convolutional network (GCN) and the GCN layer computation process is as follows:  
\[\text{GCN}_{n}(X,A)=ReLU\Big{(}\widetilde{A}XW_{n}\Big{)} \tag{9}\]  
\(W_{n}\) represents the parameters learned during the GCN\({}_{n}\) training process. After initial processing by GCN\({}_{1}\), the intermediate tensors are given to both GCN\({}_{2}\) and GCN\({}_{3}\) for parallel processing to obtain the mean \(\mu\) and variance \(\sigma\) of the Gaussian distribution in the latent space. Subsequently, the mean and variance are input into the reparameterize layer,  
Figure 8: Structure of the map feature extraction sub-model based on VGAE.  
Figure 7: The processing flow between the map feature extraction sub-model and the main model.  
which transforms the random sampling operation into a differentiable operation, enabling the effective computation and optimization of gradients through backpropagation. The equation for the reparameterization calculation is as follows:  
\[z=\mu+\varepsilon\times\sigma,\ \ \varepsilon\in\mathcal{N}(0,\ 1) \tag{10}\]  
The low-dimensional feature vector \(z\) will be used as the target output of the VGAE generation module and replace map in the original dataset as map_feat.  
The decoder part first performs a dropout layer for random deactivation to reduce overfitting during training. Finally, the reconstructed adjacency matrix is output through the decoder layer. The decoder layer obtains the adjacency matrix of the reconstructed graph \(A_{r}\) by calculating the similarity between vectors corresponding to different nodes, as shown in Equation (11). It maps the inner product value to the range of [0, 1] through the Sigmoid activation function, which represents the probability of a connection between two nodes:  
\[A_{r}=Sigmoid\Big{(}zz^{T}\Big{)} \tag{11}\]  
The decoder part will only be executed during the VGAE training process. The training process compares the difference between the reconstructed adjacency matrix and the original adjacency matrix, and continuously learns and adjusts the parameters to minimize this difference.