# A Ship Trajectory Prediction Method Based on an Optuna-BILSTM Model
## 3 Visual Analysis of Trajectory Prediction
The selection of parameters within these prediction models is pivotal, yet achieving optimal parameters through personal expertise or manual experimentation is challenging and time-consuming. On average, the Optuna-BILSTM model predicts 7% better than other models; therefore, the Optuna \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{**MMSI**} & **Evaluation** & \multirow{2}{*}{**BP**} & \multirow{2}{*}{**LSTM**} & \multirow{2}{*}{**BILSTM**} & **Optuna-** \\  & **Indicators** & & & & **BILSTM** \\ \hline \multirow{4}{*}{413380410} & MAPE & 0.035 & 0.016 & 0.0056 & 0.0087 \\  & RMSE & 0.026 & 0.0112 & 0.0068 & 0.0089 \\  & R\({}^{2}\) & 0.8566 & 0.9132 & 0.9893 & 0.9979 \\ \hline \multirow{4}{*}{413456950} & MAPE & 0.034 & 0.0089 & 0.0091 & 0.0028 \\  & RMSE & 0.023 & 0.0091 & 0.0098 & 0.0024 \\  & R\({}^{2}\) & 0.8465 & 0.9347 & 0.9413 & 0.9997 \\ \hline \multirow{4}{*}{413457220} & MAPE & 0.023 & 0.0053 & 0.0043 & 0.0026 \\  & RMSE & 0.012 & 0.0054 & 0.0041 & 0.0030 \\  & R\({}^{2}\) & 0.8756 & 0.9884 & 0.9945 & 0.9969 \\ \hline \multirow{4}{*}{414400930} & MAPE & 0.033 & 0.012 & 0.0089 & 0.0032 \\  & RMSE & 0.018 & 0.0129 & 0.0091 & 0.0033 \\  & R\({}^{2}\) & 0.8726 & 0.9291 & 0.9347 & 0.9946 \\ \hline \multirow{4}{*}{Average value} & MAPE & 0.031 & 0.011 & 0.0069 & 0.0043 \\  & RMSE & 0.020 & 0.0096 & 0.0074 & 0.0044 \\  & R\({}^{2}\) & 0.8628 & 0.9413 & 0.9649 & 0.9972 \\ \hline \multirow{2}{*}{\(p\)-value} & MAPE & 0.006 & 0.189 & 0.131 & - \\  & RMSE & 0.006 & 0.028 & 0.066 & - \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Prediction errors of trajectories of four ships with different models. BILSTM model is identified as the most suitable model for prediction. Predicting the course of a ship is an important issue in ensuring navigational safety. Currently, numerous prediction methodologies leverage diverse models, including LSTM, RNN, and GRU, to forecast outcomes. To enhance the precision of the prediction model, this research employs Optuna for the optimal configuration of the BILSTM model's parameters. Subsequently, a deep learning model is trained on four distinct trajectories. The Optuna framework's efficient parameter search capability markedly boosts the model's computational efficiency by swiftly pinpointing the optimal network parameters and structure. This optimization significantly diminishes the duration needed for model training and prediction. Secondly, from testing on multiple datasets, the model shows good generalization ability, which means that it not only performs well on the training set, but is also able to adapt and accurately predict unseen data, demonstrating its strong adaptability in dealing with the problem of predicting ship trajectories in different sea areas and weather conditions. In addition, the Optuna-BILSTM model also demonstrates excellent anti-noise capability, which can effectively deal with noise and outliers in the AIS data, ensuring the stability and reliability of the prediction results. In conclusion, the model excels not only in its prediction accuracy, but also in its efficient computational performance, powerful generalization capability, and excellent anti-noise properties, making it a powerful tool in the field of maritime ship trajectory prediction. Figure 8: Trajectory prediction chart for four vessels.