# Predicting Vessel Trajectories Using ASTGCN with StemGNN-Derived Correlation Matrix
## 4 Vessel Position Spatio-Temporal Prediction Model  
### Description of the Problem  
AIS-based trajectory prediction is a multivariate time series forecasting problem [37] that aims to predict the future movement of vessels using historical trajectory data. This involves using pre-processed historical trajectory data features as inputs to the model and inferring the position and timing of future vessels from these features. Specifically, this can be described as follows:  
Given the trajectory data of \(T\) position points in the past \(X=(x_{t-T+1},\ldots,x_{t})\), where \(x_{t}\in R^{n}\) represents the eigenvalue \(x_{t}=\left(\textit{vesel}_{\textit{type}},\textit{drangth}_{t},\textit{lot} _{t},\textit{lot}_{t},\textit{sog}_{t},\textit{cot}_{t},\textit{nastatus}, \textit{time}\right)\) of the position point at time \(t\). Input \(X\) into the prediction model to obtain the predicted trajectory \(Y=\left(y_{t+1},\ldots,y_{t+p}\right)\) of position points in the future, where \(y_{t+1}\in R^{n}\) represents the predicted trajectory point information at time \(t+1\). ASTGCN, as a deep learning model specially designed for processing spatiotemporal data, has unique advantages in directly processing time series data, such as trajectory and traffic flow. The core of the model consists of three parts: space-time attention mechanism, space-time graph convolution, and prior matrix determination. 1 The spatio-temporal attention mechanism focuses on learning dynamic spatiotemporal dependencies in trajectory data, where the spatial attention mechanism is used to simulate complex dynamic associations between different features to better understand and capture the internal patterns of the data, while the temporal attention mechanism is used to capture dynamic temporal associations between different time points, which enables the model to better understand the temporal evolution of data. 2 Space-time graph convolution is a kind of convolution operation based on graph structure, which includes graph convolution and time dimension convolution. Graph convolution extracts the correlation of feature nodes from the graph-based trajectory network structure to help the model understand the network structure characteristics of the data. Convolution in the time dimension describes the dependencies between adjacent time segments, allowing the model to better capture the temporal dynamics of the data. 3 The prior matrix is determined to deal with the irregular shape of the graph, and the structure of the graph is constrained by introducing prior knowledge. Since spatiotemporal data usually have irregular forms, a priori matrices need to be introduced to deal with this irregularity to enable the model to better adapt to graph structures of different forms, thereby enhancing the model's generalization ability. The overall ASTGCN network framework is shown in Figure 2.  
Figure 2: ASTGCN network structure. The self-attention matrix output by the StemGNN model (\(\text{StemGNN}-\text{SAM}_{t}\)) is used as the prior matrix input for ASTGCN. properties of the network, the graph convolution based on the spectrogram conclusion is used to directly process the signal, and the signal correlation of the network is used in the spatial dimension. In spectrogram analysis, the structural properties of a graph can be obtained by analyzing the corresponding Laplacian matrix of the graph and its characteristic values. The Laplacian matrix of the graph is defined as \(L=D-A\), and its normalized form is \(L=I_{N}-D^{-\frac{1}{2}}AD^{-\frac{1}{2}}\in\mathbb{R}^{N\times N}\); \(A\) represents the graph adjacency matrix, \(I_{N}\) is the identity matrix, and the degree matrix \(D\) is a diagonal matrix consisting of node degree values \(D_{ii}=\sum\limits_{j}A_{ij}\). Eigenvalue decomposition of the Laplacian matrix:  
\[L=U\Lambda U^{T}. \tag{8}\]  
\(\Lambda=diag([\lambda_{0},...,\lambda_{N-1}])\in R^{N\times N}\) is a diagonal matrix of eigenvalues and \(U\) represents an orthogonal matrix composed of eigenvectors.