# A Ship Trajectory Prediction Method Based on an Optuna-BILSTM Model
## 2 Methods  
### Hyperparametric Tuning Algorithms  
Optuna is by far the most mature and extensible hyperparametric optimization framework. In contrast to the archaic bayes_opt, Optuna is clearly designed specifically for machine learning and deep learning. Optuna is a search space that can be dynamically constructed according to user-specific run-defined principles in a way that previous hyperparametric tuning frameworks cannot. Optuna's combination of efficient search and pruning algorithms greatly enhances the benefits of hyperparametric optimization. It has the following features:  
1. The most concise framework code with a degree of flexibility. 2. The ability to be generalized to multiple deep learning frameworks. 3. The ability to prune trials with no hope of timely tuning. 4. The ability to perform parallelized operations and reduce the total experiment time. The optimization method of this software framework belongs to the Parzen tree optimizer of the Bayesian optimization algorithm and improves the framework. Optuna's tuning process is based on the vector data of the run history to determine the next combination of hyperparameter values to be tested. Based on this data, it selects a region of hyperparameter combinations and performs hyperparameter search trials in this region. As it continues to obtain new results, it also updates this region and continues the search. The process of searching and evaluating updates is repeated over and over again to obtain better performing hyperparameters. This approach relies on Bayesian probabilities to determine which hyperparameter choices are the most promising and iteratively adjusts the search, i.e.,  
\[\mathrm{I}(\theta)=\mathrm{p}(\mathrm{y}<\mathrm{a}\mid\theta,\mathrm{H}) \tag{1}\]  
\[\mathrm{z}(\theta)=\mathrm{p}(\mathrm{y}<\mathrm{a}\mid\theta,\mathrm{H}) \tag{2}\]  
Among these, \(\mathrm{a}=\min\{\mathrm{y}_{1},\ldots,\mathrm{y}_{n}\};\mathrm{H}=\{(\theta_ {1},\mathrm{y}_{1}),(\theta_{2},\mathrm{y}_{2}),\ldots,(\theta_{n},\mathrm{y} _{n})\}\), \(\mathrm{H}\) is the \(y\) objectively evaluated by pairs of \(\mathrm{H}\) is the history vector \(\theta\) consisting of pairs of hyperparameters, \(\mathrm{I}(\theta)\) is the density formed by the observation of different observations \(\{\theta_{n}\}\) and \(\mathrm{z}(\theta)\) is the density formed by the remaining observations. The tree-structured Parzen algorithm scales the running time of each of these iterations linearly for the number of parameters being optimized by observing a sorted list of variables in the history. To maximize improvement, the tree-structured Parzen estimator (TPE) aims to maximize the density ratio \(\mathrm{I}(\theta)/\mathrm{z}(\theta)\). For instance, if the objective function is the validation loss of the model (e.g., mean square error), then the TPE seeks hyperparameters for each trial that yield an evaluation of \(y\) below the best value previously found. It works to maximize \(\mathrm{I}(\theta)\) and minimize \(\mathrm{z}(\theta)\) with each iteration, ultimately returning the parameter that minimizes the loss function. The space for the combinations of hyperparameters is so large that it is almost impossible to cover all the possible combinations by manual trial and error alone, and Optuna can systematically explore this space. Secondly, there may be complex dependencies between hyperparameters, and such dependencies make it possible for the tuning of a single parameter to affect the optimal values of other parameters, whereas Optuna is able to take such dependencies into account. Finally, manual tuning is a time-consuming and inefficient process, especially for large datasets and complex models, whereas Optuna significantly improves the efficiency and effectiveness of tuning through automation. Through its efficient and flexible hyperparameter optimization capability, Optuna is able to find the parameter settings that optimize the performance of the BILSTM network much faster and more accurately than by manual tuning.