## 4 Model Validation and Results Analysis
### Prediction Results Analysis
#### 4.4.2 Prediction Results of WOA-Attention-BILSTM Model  
The ship will go through various states in one trajectory, such as straight ahead, turning, etc. The prediction results are usually better when the prediction is made in a straight navigation state, but the effect of the model becomes poor when it turns. In order to verify the prediction effect of the model under different sailing states in ship navigation, the ship with an MMSI of 563,108,500 is selected in this paper, and its trajectory contains straight ahead and turning, as shown in Figure 11.  
Figure 11: Trajectory of the target ship. The blue lines are the trajectories of other ships in the dataset, and the red line is the target ship’s trajectory. Figure 10: The loss curve of WOA-Attention-BILSTM model. To verify the effectiveness of the proposed WOA-Attention-BILSTM model, we compare it with the Attention-BILSTM, BILSTM, LSTM, BP, and CNN-LSTM. First, the results are visualized and analyzed, and the prediction results of each model are shown in Figure 12. When the ship is moving straight, the models can basically fit the ship's motion trajectory, and the WOA-Attention-BILSTM predicted trajectory is the closest to the target trajectory. BP networks have larger errors at turns and fluctuate substantially, and the predicted trajectory points are discontinuous and unstable. The trajectory points predicted by LSTM, BILSTM, and Attention-BILSTM are continuous but not accurate enough. GRU performs poorly in complex trajectory segments because of its weaker capability in learning long-term dependency relationships in the sequence. The trajectories predicted by CNN-LSTM are better fitted because of better feature extraction, but there are some cases of continuous offset of the predicted trajectory points, resulting in larger errors. At the first turning point, the BP model appears to have the problem of incoherent predicted trajectories, and the prediction error becomes unstable. At the fourth turning point, due to the long prediction step, the trajectory incoherence problem occurs in all models except WOA-Attention-BILSTM. At the end of the trajectory, only the WOA-Attention-BILSTM model still maintains a low error. To further analyze the prediction effect of the WOA-Attention-BILSTM model, we analyze it by the evaluation metrics, as shown in Table 5. The evaluation metrics presented in the table are elaborated in Section 4.2. The Haversine Distance is the primary focus of this paper as it is a more intuitive and comprehensible measure of accuracy. From Table 5, it can be seen that besides the execution time, WOA-Attention-BILSTM has the lowest metrics, and its average Haversine Distance reaches 0.4042 km. Next is the Attention-BILSTM model, which can also get good prediction results with the manual tuning of parameters. The Haversine Distance of GRU also reaches 0.7 km, but it performs worse in the part of complex trajectories, and its error is more unstable at the beginning compared to the other model. The error performance of the CNN-LSTM model is relatively stable, and its Haversine Distance has been around 1 km in several experiments. The difference between the results of BILSTM and LSTM is large. The BILSTM model can learn the information in the ship's historical data better, so the results are good. The Haversine Distance of the BP network is 1.9199 km and is relatively unstable, which performs better  
Figure 12: The visualization and comparison of the models’ prediction results. when the ship is going straight but will have great fluctuations when turning. It can be seen that the optimization of the Attention-BILSTM by WOA is quite obvious, and using the hyperparameters obtained from WOA to construct the Attention-BILSTM can effectively improve the accuracy of the model. The Execution Time in Table 5 is the required time for the trained model to predict \(1100\) steps. The time of BP is the shortest, and the time of WOA-Attention-BILSTM does not increase significantly, only \(0.10165\) s more than Attention-BILSTM, which is in the acceptable range.