## 3 Methodology
### TRFM Trajectory Prediction Model
#### 3.3.5 Loss Function
The methodology employs differential latitude and longitude values as both model inputs and outputs, facilitating the derivation of predicted trajectories through latitude and longitude regression. This technique ensures greater prediction generalization and accuracy. Experimental comparisons with leading-edge methods reveal that the proposed approach yields superior precision and reduced errors, generating predictions that closely mirror actual ship trajectories. These findings affirm the feasibility and effectiveness of the proposed algorithm, suggesting its potential to provide more accurate reference data for the navigation of future smart vessels, thereby enhancing maritime safety and operational efficiency. Despite its innovative contributions, the trajectory prediction model based on TRFM presents certain limitations. The analysis is confined to historical AIS data, omitting external variables such as water currents and weather conditions. Predictions are limited to the geographical positions (latitude and longitude) of ships, without considering other navigational details. Moreover, the model's applicability is constrained by the requirement for a lengthy historical data series, limiting its use for datasets with shorter time series lengths. Future research could enhance the model's comprehensiveness and accuracy by incorporating external environmental factors and extending predictions to include additional navigational parameters. Such advancements would refine the model's applicability and precision for maritime navigation forecasting. Conceptualization, Y.X. ; methodology, Y.X. ; validation, Y.X., T.W. and X.L. ; formal analysis, Y.X. ; writing--original draft preparation, X.L. and Z.Z. ; writing--review and editing, Y.X. and T.W. ; visualization, X.L. and Z.Z. ; supervision, Y.X. and T.W. ; project administration, T.W. ; funding acquisition, T.W. All authors have read and agreed to the published version of the manuscript. This research was funded by the National Key R&D Program of China (grant number 2021 YFB1600400), Hubei Natural Science Foundation (grant number 2021 CFB324), and National Natural Science Foundation of China (grant number 52101403). Not applicable. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline  & & **LSTM** & **ATT-LSTM** & **CNN-LSTM** & **Bi-LSTM** & **TRFM (DEC)** &
\begin{tabular}{c} **TRFM** \\ **(ENC-DEC)** \\ \end{tabular} \\ \hline \multirow{2}{*}{N = 10 (5 min)} & LON & 0.00443 & 0.00455 & 0.00372 & 0.00282 & 0.00171 & 0.00135 \\  & LAT & 0.00410 & 0.00418 & 0.00335 & 0.00254 & 0.00153 & 0.00129 \\  & \(FDE\) (km) & 0.696 & 0.713 & 0.574 & 0.436 & 0.262 & 0.215 \\ \hline \multirow{2}{*}{N = 20 (10 min)} & LON & 0.00725 & 0.00681 & 0.00576 & 0.00410 & 0.00275 & 0.00205 \\  & LAT & 0.00663 & 0.00616 & 0.00510 & 0.00373 & 0.00244 & 0.00201 \\  & \(FDE\) (km) & 1.126 & 1.053 & 0.881 & 0.634 & 0.420 & 0.331 \\ \hline \multirow{2}{*}{N = 30 (15 min)} & LON & 0.00931 & 0.00816 & 0.00725 & 0.00518 & 0.00361 & 0.00265 \\  & LAT & 0.00829 & 0.00761 & 0.00652 & 0.00470 & 0.00322 & 0.00254 \\ \cline{1-1}  & \(FDE\) (km) & 1.420 & 1.278 & 1.116 & 0.799 & 0.553 & 0.423 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Experimental results for different models under various prediction sequence lengths. **Informed Consent Statement:** Not applicable. **Data Availability Statement:** The raw data supporting the conclusions of this article will be made available by the authors on request. **Conflicts of Interest:** The authors declare no conflicts of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.