# VEPO-S2S: A VESsel Portrait Oriented Trajectory Prediction Model Based on S2S Framework
## 4 Definitions and Problem Statement
### VEPO-S2S Model
#### 4.3.2 Feature Fusion and Decoding Module  
Despite incorporating trajectory information and vessel characteristics into the model, the basic Seq2 Seq models still have difficulty efficiently discerning and leveraging. Therefore, the Feature Fusion and Decoding Module was designed to select and integrate the trajectory information with Multi-level Vessel Characteristics, applying a priori and a posteriori mechanisms in the Portrait Selection Component, a Feature Fusion Component, and a Multi-head Decoder Component. The goal of the Portrait Selection Component is to identify and select suitable Multi-level Vessel Characteristics for prediction; hence, we use a prior distribution and a posterior distribution together in the vessel characteristic selection, and the framework is shown in Figure 6. The prior distribution selects the characteristics based on the similarity between the vector \(h^{*}\) from the trajectory encoder and the portrait vector \(por\), which helps to filter out the more relevant characteristics in the early stages of the model, reducing the computational overhead. This process can be expressed as Equation (7)  
\[Z_{prior}(por=por_{i}|h^{*})=\frac{exp(por_{i}*h^{*})}{\sum_{i=1}^{7}exp(por_{i}* h^{*})} \tag{7}\]  
where \(por_{i}\in(por_{1},por_{2},\dots,por_{7})\), \(*\) is the dot product, \(h^{*}\) is the trajectory coding vector, and \(por\) is the portrait vector. Specifically, the model assigns higher weights to vectors with greater similarity by comparing the dot product results of different characteristics, reducing the interference of redundant information and increasing the computational efficiency. However, only relying on the prior distribution can not enable obtaining accurate results, as it is typically based on assumptions or historical data, which do not fully reflect the real situation; hence, it is impossible to select the appropriate characteristics to guide the generation. In contrast, the characteristics used in label \(y\) can be obtained through posterior distribution. Therefore, the posterior distribution, derived by combining the trajectory  
Figure 6: The Portrait Selection Component consists of prior distribution and posterior distribution. Prior distribution expresses the trajectory coding vector \(h^{*}\) and portrait feature \(por\), and the posterior distribution incorporates the label \(y\) to improve the accuracy of selection. Meanwhile, the KLD is designed to bridge the gap between the prior distribution and the posterior distribution, allowing the prior distribution to benefit from the posterior distribution and generate more accurate results. vector \(h^{*}\) and label \(y\), can more effectively guide the selection of the profile, which can be expressed as  
\[Z_{post}(por=por_{i}|h^{*},y)=\frac{exp(por_{i}*MLP([h^{*};y])}{\sum_{i=1}^{7}exp( por_{i}*MLP([h^{*};y])} \tag{8}\]  
where \(MLP\) is a linear layer, \(*\) is the dot product, and ; represents the vector splicing. Simultaneously, there is a significant gap between the prior distribution and the posterior distribution. To address this issue, the Kullback-Leibler Divergence (KLD) loss is employed to compel their proximity. It can effectively correct errors in the prior distribution and guide the profile selection to benefit the model. The stability of the KLD divergence lies in its mathematical properties, ensuring convergence and reliability during training. By minimizing the KLD loss, the system can strike a suitable balance between the prior and posterior distributions. The formula for the KLD divergence is expressed as follows:  
\[D_{\text{KL}}(P\|Q)=\sum_{i}P(i)\log(\frac{P(i)}{Q(i)}) \tag{9}\]  
where \(P\) represents the posterior distribution, which comprises the characteristics required under the guidance of real labels. In general, a straightforward approach to leverage the selected characteristics for result generation is to directly append these characteristics to the encoder's input.