## 1 Introduction
Therefore, in this study, we will use the Whale Optimization Algorithm (WOA) from the swarm intelligence optimization algorithm to find the best hyperparameter combination for LSTM in order to improve the accuracy and stability of trajectory prediction. The WOA algorithm [33] is a global optimization algorithm based on bionics, which is inspired by the feeding behavior of whales and simulates natural behavior to solve optimization problems. In recent years, the WOA algorithm has been widely used in the field of neural network optimization. [PERSON] et al. [34] proposed using WOA to optimize ship paths in complex marine environments and compared it with GWO and PSO algorithms. The results show that WOA has better performance and a very high ability to avoid local optima. [PERSON] et al. [35] used an improved WOA algorithm to optimize GRU and demonstrated the effectiveness of the proposed model on three datasets. [PERSON] et al. [36] used an improved WOA (IWOA) to establish an IWOA-LSTM for prediction and compared it with 11 models, demonstrating the effectiveness of the proposed model. In summary, most of the existing ship trajectory prediction models rely on manual experience to set parameters, which can easily fall into local optima. Meanwhile, there are limitations in the long-term information extraction capability of traditional recurrent neural networks that need to be optimized. In this paper, we propose a WOA-Attention-BILSTM model for ship trajectory prediction. Compared to existing methods, our model can selectively utilize valuable features in historical trajectories, allowing the LSTM unit to retain more contextual information from past trajectories. At the same time, it has excellent parameter design ability, avoiding the disadvantage of human-set parameters easily falling into local optima. The main contribution of this paper can be summarized as follows:  
* In this paper, we employ a bidirectional LSTM structure to enhance the correlation between motion states at different time points in ship trajectory prediction tasks. * As the impact of the ship's motion behavior on future trajectories varies during the sailing process, an attention mechanism is introduced into the model to better capture important information in trajectory sequences and preserve more historical context information. * In order to reduce the influence of manually setting parameters on model accuracy and avoid falling into local optima, we utilize the powerful optimization ability of WOA to optimize the model's hyperparameters. * The designed model aims to improve the ship's safety awareness and perceive collision risks in advance, leaving enough time for the driver to make decisions and reducing the occurrence of collision accidents. Through experiments on a real AIS dataset near the coast, the proposed model is shown to have high accuracy and strong parameter design capabilities, effectively providing information support for intelligent ship navigation. The paper is organized as follows: The first part introduces the background, significance, and literature review of the research. The second part describes the trajectory prediction problem and introduces the models and methods involved in this paper. The third part establishes the WOA-Attention-BILSTM model and introduces its process and principle of it. The fourth part presents the analysis of experiments and results, which begins by detailing the processing method used for the AIS dataset, followed by a comparison of WOA-Attention-BILSTM with Attention-BILSTM, BILSTM, LSTM, BP, and CNN-LSTM. The part also includes visualizations of the prediction trajectory and distance error for a more comprehensive performance analysis of the model. Finally, the fifth part concludes the paper and suggests future directions for improvement.