# GAT-ABiGRU Based Prediction Model for AUV Trajectory
## 3 Materials and Methods
### Gat-AbiRgui
The outputs of these K-independent features are then connected to form an output feature representation to combine various levels of relevant information. Where \(\parallel\) denotes splicing and \(\alpha_{ij}^{K}\) is the normalized attention coefficient under the Kth attention mechanism. \(W^{K}\) is the corresponding weight matrix of the linear transformation under the Kth attention mechanism. The sophistication of the bidirectional recurrent neural network (BiRNN) lies in its output layer's ability to capture the complete past and future information for each time point in the input sequence [36; 37]. Furthermore, the bidirectional gated recurrent unit (BiGRU), as a particular type of bidirectional RNN structure, consists of two independently functioning but collaborating components: one component is responsible for forwarding information, capturing the context from the beginning of the sequence to the current time point; while the other component is in charge of backward information transmission, gathering the context from the current time point to the end of the sequence. Through this bidirectional flow of information, BiGRU can more comprehensively understand the dependencies within sequence data, thereby enhancing the accuracy and efficiency in handling complex sequential tasks. The current state of the hidden layer of BiGRU consists of the current input \(x_{t}\), the forward hidden layer state output \(\overset{\rightarrow}{h_{t-1}}\), and the backward hidden layer state output \(\overset{\leftarrow}{h_{t-1}}\). The BiGRU hidden layer state at time t can be obtained by the weighted sum of \(h_{t-1}\) of the forward layer and \(\overset{\leftarrow}{h_{t-1}}\) of the hidden layer, as follows:  
\[\overset{\rightarrow}{h_{t}}=GRU\left(x_{t},\overset{\rightarrow}{h_{t-1}}\right) \tag{12}\]  
\[\overset{\leftarrow}{h_{t}}=GRU\left(x_{t},\overset{\leftarrow}{h_{t-1}}\right) \tag{13}\]  
\[\mathrm{h}_{t}=w_{t}\overset{\rightarrow}{h_{t}}+v_{t}\overset{\leftarrow}{h _{t}}+b_{t} \tag{14}\]  
In the ABiGRU model, we introduce an attention mechanism to enhance BiGRU's ability to process time-series data. The ABiGRU model is shown in Figure 5. With the attention mechanism, the model can adaptively assign weights to past and future information to more refinedly capture the current prediction's essential features. Specifically, the attention mechanism evaluates and selects which information in the forward and backward GRU states is most important at the current time step to adapt and optimize the flow of information. In the ABiGRU architecture, the hidden layer state at each time step is no longer a simple weighted sum of the forward and backward hidden layer states. Instead, it is dynamically computed by an attention-weighting function that considers the forward and backward states of all time steps. This allows ABiGRU to assign different levels of importance to the hidden states at each time step, thus paying more attention to the most critical information for predicting future states. The form of the weighting function is given in Equation:  
Figure 3:0  
where \(\alpha_{t}\) and \(\beta_{t}\) are the forward and backward hidden state weighting coefficients, respectively, determined by the attention mechanism. The GAT-ABiRGU model can provide accurate AUV trajectory prediction in complex marine environments by integrating the spatial analysis capability of GAT and the time-series analysis capability of ABiGRU. The model not only considers the motion characteristics of the AUV itself but also integrates a dynamic analysis of environmental factors to improve the accuracy and robustness of trajectory prediction.