## 4 Model Validation and Results Analysis
### Data Processing  
According to a study by [PERSON], approximately 49% of accidents take place in coastal areas, with 27% near the coast and 22% in narrow channels [38]. Moreover, a study conducted in Japan revealed that approximately 90% of maritime accidents occur within a distance of 37 km (20 nautical miles) from the coast [39]. Since this research can be applied to enhance maritime safety and ship regulations, the coastal data were selected for analysis in this paper. The U.S. Coast Guard (marinecadastre.gov) AIS data in January 2022 were selected as a prediction sample. The data structure is shown in Table 1, while the data ranges used in this paper are listed in Table 2.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Data Items** & **Meaning** & **Data Examples** \\ \hline BaseDateTime & Timestamp & ’2022-01-01T11:44:31’ \\ MMSI & Ship identification code & ’241734000’ \\ LAT & Latitude & 25.39191’ \\ LON & Longitude & \(-\)88.54704’ \\ SOG & Speed over ground & 11.9 knots \\ \hline \hline \end{tabular}
\end{table}
Table 1: Example of AIS data structure.  
Due to the transmission characteristics of AIS equipment, data preprocessing is necessary to address issues such as missing trajectories, data duplication, and too short ship motion trajectories, which can negatively impact the training effectiveness of the model. In this study, we consider the discrete points in the trajectory as a four-dimensional vector consisting of LAT, LON, SOG, and COG. In addition to these features, other information in the AIS data is also used as a basis for data filtering during the preprocessing step. The specific steps of data cleaning are as follows:  
1. Remove unrealistic ship information (For example, ship speed over ground is too high, latitude and longitude are on land);
2. Delete ships with the status of anchored, grounded, moored, or restricted in operation (status 1, 3, 5, 6);
3. Delete ships with records less than 200 characters in length or less than 4 h in duration;
4. Remove ships with too small a mixed variance in latitude and longitude.  
According to the International Maritime Organization (IMO), AIS data should be collected every six minutes when the ship is at rest and a minimum of two seconds and a maximum of three minutes while underway [40]. However, due to physical factors, most of the received AIS data do not meet the standard and cannot be used as standard time-series data. This issue necessitates data interpolation, particularly for missing trajectories, which can significantly affect the accuracy of trajectory prediction. The cubic spline interpolation method has good convergence and smoothness [41; 42; 43]. In this paper, the cubic spline interpolation method is selected to process the missing trajectory of the ship. The data are grouped based on the MMSI number of the ship for interpolation. Data with a time interval of more than 15 min are segmented and treated as two different trajectories. Two adjacent points before and after the missing data point \(t\) are selected, and their times \(t_{i}\), \(  
For the interpolated data set, we performed resampling. Since the ship's speed will not be too fast, we set the time interval to 60 s, and the sampling method is set to average. This preserves the characteristics of the trajectory and reduces the computational effort. Finally, Lon, Lat, SOG, and COG are selected in the data set for prediction. Before inputting into the model, the data need to be normalized, and the normalization formula is shown in Equation (27) and scaled to the interval [0, 1] to ensure the consistency of the magnitudes of each field.  
\[X^{\prime}=\frac{X-X_{min}}{X_{max}-X_{min}}. \tag{27}\]