A Novel Short-Term Ship Motion Prediction Algorithm Based on EMD and Adaptive PSO–LSTM with the Sliding Window Approach

: Under the inﬂuence of variable sea conditions, a ship will have an oscillating motion comprising six degrees of freedom, all of which are connected to each other. Among these degrees of freedom, rolling and pitching motions have a severe impact on a ship’s maritime operations. An accurate and effective ship motion attitude prediction method that makes the prediction in a short period of time is required to guarantee the safety and stability of the ship’s maritime operations. Traditional methods are based on time domain analysis, such as the autoregressive moving average (ARMA) models. However, these models have limitations when it comes to predicting the nonlinear and nonstationary characteristics of real ship motion attitude data. Many intelligent algorithms continue to be applied in nonlinear and nonstationary ship attitude prediction, such as extreme learning machines (ELMs) and the long short-term memory (LSTM) neural network, as well as other deep learning methods, showing promising results. By using the sliding window approach, the time-varying dynamic characteristics of the ship’s motion attitude can be preserved better. The simulation results demonstrate that the proposed model performs well in terms of predicting the nonlinear and nonstationary ship motion attitude.


Introduction
Under the influence of wind [1], waves [2], and other environmental elements, the six degrees of freedom comprising the swaying motion of large ships can become complicated and uncertain [3].These factors represent a threat to ships' offshore operations, especially in complex environments.Methods for the short-term prediction of a ship's motion attitude have been proposed to predict the offshore motion of ships in the next few seconds in real time.Such methods provide decision-making information for the accurate control of a ship's offshore operations and the selection of the optimal operation time to enhance the safety and efficiency of the offshore operations.In general, there are four types of models for predicting a ship's motion: physical models based on the ship's hydrodynamic coefficients and equations, statistical models based on historical data and future data, intelligent models based on time series analysis and intelligent algorithms [4,5], and hybrid models [6,7].
Methods for the short-term prediction of a ship's motion attitude that were based on linear hydrodynamic motion equations were extensively used in early research.In 1969, Kaplan [8,9] designed a Wiener filter based on the statistical parameters of a ship's motion power spectrum to predict the ship's short-term motion.However, this method has the disadvantages of calculation complexity and low accuracy.With the development of modern control theory, a method for the short-term prediction of a ship's motion attitude based on the Kalman filter was proposed to predict it in real time [10].However, the accuracy and stability of the prediction method based on the Kalman filter cannot meet the necessary requirements, especially in severe sea environments.
The methods for the short-term prediction of a ship's motion attitude are based on the time domain analysis approach, which is a data-driven prediction method.It only requires the historical data of a ship's motion to establish a time series model to predict the ship's extremely short-term attitude.However, methods, such as AR and ARMA, require the ship's motion data to be stationary and linear, which is unsuitable for realizing good prediction results of the nonlinear or nonstationary characteristics of the ship's motion [11].In the past few years, methods for the short-term attitude prediction of a ship's motion based on machine learning (ML) models have become very popular in the context of nonlinear or nonstationary characteristics [12][13][14][15][16][17][18][19].These data-driven prediction methods have gained more attention due to their superior capabilities of learning and modeling complex nonlinear relationships, including artificial neural networks (ANNs) [20], recurrent neural networks (RNNs) [21], support vector machines (SVMs) [22,23], random forest (RF) [24], multi-layer perceptron (MLP) [25], feed-forward neural networks (FNNs), backpropagation neural networks (BPNNs), and extreme learning machines (ELMs) [26][27][28].Of these, RNNs memorize the previously known information and pass this to the input, which ensures the relation among the input information and achieves good prediction results, especially for periodic sequences.However, relying solely on the above intelligent models may not meet the practical requirements for an accurate prediction.Furthermore, there are some limitations and considerations to be aware of when using a single machine learning model to predict a ship's motion: 1.
Due to having less generalization ability, a single neural network encounters the problems of over-fitting, vanishing gradients, and network training explosions when faced with the complex patterns in a ship's motion dataset.

2.
When dealing with huge datasets, simple neural network models may become unstable and have low efficiency.
To overcome the shortcomings of ML methods, researchers have been inspired to develop a promising methodology: deep learning (DL).DL, as a branch of ML, trains the data model by utilizing multiple processing layers at multiple levels [29].The performance of DL models is improved by increasing the number of hidden layers, while the deeper architecture increases the number of parameters to be optimized, which further increases the training time of the model.The potential of DL in applications requiring predictions has been highlighted in the recent literature.For time series forecasting, DNN models, such as long short-term memory (LSTM), gated recurrent units (GRUs), and hybrid models have proven to be both powerful and accurate tools.Currently, researchers are considering hybrid models to enhance the performance of DL models.Qin et al. proposed AR-DWT-EMD to solve the problem of the prediction of the nonlinear and nonstationary motion of ships [30].In [31], the decomposition and the Hilbert spectrum of the inputs (sea waves) were compared with the decomposition and the Hilbert spectrum of the outputs (ship movements, generated by the waves) to study the time-frequency characteristics of the ship's response.However, we mainly focused on the decomposition of the original nonstationary time series to decrease the effect of noise.The decomposition extracts the important features to improve the accuracy of the prediction.EMD can adaptively perform time-frequency localization analysis to effectively extract the characteristic information of the original signal.Wang et al. proposed the Bi-LSTM TPA hybrid model, which extracts the time features from both the forward and reverse roll angle time series to improve the prediction of the ship's roll angle [32].Additionally, hyperparameter inference and optimization procedures in neural networks, such as ant colony optimization [33], PSO [34], and the genetic algorithm [35], are used to improve the prediction performance.Yin et al. proposed a scheme for predicting rolling based on an adaptive sliding window considering the characteristics of the ship's rolling motion.An online experiment on the prediction of the ship's rolling was conducted to verify the effectiveness of the adaptive sliding window [36].
In [37], the simulation results showed that the combination of LSTM and PSO improved the accuracy of the prediction of the ship's motion.Z. Nie et al. conducted a simulation experiment on the prediction results of support vector regression (SVR) algorithms based on four commonly used kernel functions and compared the effectiveness and practicality of these kernel functions in the prediction of the ship's motion [38].Zeguo Zhang et al. proposed a prediction algorithm based on GPSO-ANFIS and applied it to the real-time prediction of the ship's rolling.The simulation results showed the advantage of the method regarding its accuracy, stability, and real-time performance [39].In summary, the following issues need to be noted for the short-term prediction of a ship's motion: 1.
To complete the short-term prediction, a few seconds of ship motion attitude data are derived by the proposed model.

2.
The sliding window technique is introduced to turn time series predictions into supervised learning for ML methods.Each window is utilized to train and update the model.After each computation is completed, the window shifts to a new position by one step.

3.
Because of the nonstationary characteristics of time-series data, the prediction accuracy is affected by the unstable mean and variance of datasets.Therefore, to obtain better prediction results, the present work needs to use a data pre-processing method to reduce the effect of nonstationary characteristics.

4.
Considering the practicality of predictive models, the proposed model needs to guarantee high-accuracy results when faced with multi-step-ahead predictions.
In this paper, aiming to reduce the nonlinear and nonstationary ship motion characteristics and obtain the optimal parameter of the neural network, a hybrid multi-step prediction model is proposed by combining the LSTM model with EMD, and adaptive PSO is proposed to predict ship motion attitude in a few seconds.The EMD method is employed for dealing with nonlinear and nonstationary time series, and the LSTM approach is used for training and predicting the derived ship attitude, while the parameter optimization algorithm based on PSO is utilized to maximize the performance of the prediction model by adjusting the parameters of the LSTM neural network.Additionally, time series datasets can be framed into supervised learning for multi-step predictions by utilizing the sliding window technique.
The rest of this paper is organized as follows.Section 2 gives a brief description of EMD and the sliding window approach.In Section 3, the hybrid ship attitude prediction model is established by EMD and the LSTM neural network with the sliding window approach.In Section 4, the proposed model is implemented in a real-time ship motion attitude data experiment, and the model's performance is tested using at different datasets.Conclusions are derived in Section 5.

Basic Knowledge 2.1. Empirical Mode Decomposition Method
Affected by various random and uncertain factors, noise exists in the measured ship motion data and interferes with the valid signals.It overlays and obscures the bestexpected results when processing the original observation data.Therefore, it is crucial to apply denoising techniques to the raw data prior to the ship motion attitude prediction processing in order to enhance the accuracy of the subsequent forecast.EMD decomposes the signal into a finite number of eigenmode functions (IMFs), discards the noisy IMFs, and reconstructs the remaining IMFs to denoise the raw data.Since EMD is based on the time-scale characteristics of the data itself and does not require a given basis function in advance, it has obvious advantages when dealing with nonsmooth and nonlinear time series.The process of decomposition involves the following steps: • Find all maximum and minimum points of the time series x(t) and then fit a curve with a cubic spline function to obtain the upper and lower envelope of x(t), which can be represented, respectively, as u(t) and l(t).
• Calculate the average of u(t) and l(t) to obtain the mean envelope m x , which is shown as Equation (1): • New time series h x can be calculated as • Judge if h x is satisfied with the condition of IMFs.Repeat Steps (1), (2), and (3) if it is not satisfied until the mean envelope tends to zero.Then, the first intrinsic modal function im f 1 is obtained.• By subtracting im f 1 from the original time series x(t), the new time series r x1 without high frequency is derived.• By repeating the above process, the intrinsic modal function {im f 2 , im f 3 , ..., im f n } is obtained.When the r xn cannot be decomposed, it is represented as the residual of x(t).
After the above steps, the original time series x(t) can be represented as where r xn represents the trend of x(t), and it is without a high-frequency component.
During the whole process of EMD, one of the cyclic processes is the shifting process in which the optimal time of shifting and decomposition needs to be considered.Additionally, the two termination criteria include the component termination condition and the decomposition termination condition.
The shifting is the process of obtaining the IMF component, and the basic method is to continuously find extreme points from the original signal and continue shifting according to the decomposition steps until a certain condition is met.The purpose of this process is to reduce the asymmetry of the signal so that the waveform tends to be symmetric around the zero mean line, so as to meet the basic characteristics of the component.Additionally, the instantaneous frequency can be calculated by transformation.In order to ensure that the components obtained by the decomposition have sufficient original physical significance of frequency modulation (FM) and amplitude modulation (AM), the number of shifting cycles should not be excessive.Too many cycles will over-smooth the component and make it a constant amplitude FM signal, which loses the original physical meaning.On the other hand, too few shifting cycles will make the resulting component not entirely meet the basic characteristics of the component and do not obtain accurate instantaneous and meaningful frequency.

Sliding Window Approach
A sliding window is a fixed-size window that will circle the values around a point in the time series to obtain an interval that is used to calculate statistical indicators for data of a specified length.The sliding window width has an immediate effect on the model prediction.The window length is used to weigh the amount of input data and the length of historical information included.However, too much input data will lead to complex calculations and slow down the training of the neural network.Less input data tend to include less historical information, making it difficult to reflect the cycle pattern.The application of the sliding window technique in multi-steps is shown in Figure 1.
Datasets can be framed into supervised learning for prediction by sliding windows, and data from each window are utilized to train and update the model.After completing each computation, the window shifts to the next new position.
Since the selection of the key parameters of LSTM has a great influence on the accuracy of ship motion attitude forecasting, these parameters need to be selected reasonably.
The particle swarm optimization (PSO) algorithm has the advantages of simple structure, high precision, fast convergence speed, and ability to deal with nonlinear and multivariable problems, which are effective tools for the selection of LSTM model parameters.

One-step
Two-step Sliding window approach for multi-step.

LSTM Neural Network Parameter Optimization for Ship Attitude Prediction
The long short-term memory (LSTM) neural network, which is a novel recurrent neural network, was proposed by Hochreiter and Schmidhuber [40].As a deep learning model, LSTM learns the pattern from historical data accurately by utilizing the selective memory capability of machine learning and digging into the intrinsic patterns of known time series to achieve its short-term forecasting of time series.The advantage of LSTM is to solve the problem of gradient disappearance compared with other types of recurrent neural networks by introducing the concept of state units and gates into the neural network.As a result, it has better adaptability in data analysis compared with the RNN network.The structure of the LSTM unit is shown in Figure 2: Each neural unit contains three gate control structures which are forgotten gate, input gate, and output gate.The selective transmission of data information is controlled by these gates, and the output of the sigmoid layer is a value between zero and one, which describes the ratio of information transmission.The valid information at the last epoch in f t is discarded and retained by the forgotten gate.Current valid information i t is stored in the input gate, which determines the update of the cell state.The output layer determines the information that needs to be output as o t in the LSTM neural unit.The output value of the hidden layer h t and the unit state c t at the current epoch are determined by the output value of the hidden layer at the previous epoch h t−1 , the unit state c t−1 , and the input value at the current epoch x t .
Since the input is determined by the output of the previous epoch h t−1 , the input of the network at the current epoch x t and the activation function sigmoid control the information transfer ratio.The calculation process of the forget gate is shown as follows.
where W f and U f represent the weight matrix, b f denotes the bias term, and σ is the activation function.Since the input of the sigmoid function is determined by the output at the previous epoch h t−1 and the input of the network at the current epoch x t , the calculation process of the input gate is shown as follows.
where i t represents output, W i , U i represent the weight matrix, and b i denotes the bias term.The tanh function is utilized to update the cell state and create a new candidate vector in the input gate.Then, the input of the memory cell ct is obtained as follows: where W c , U c represent the weight matrix, and b c is the bias term.Since the input is determined by the output of the previous moment h t−1 and the input of the network at the current moment x t , the output of gate o t is obtained from the activation function sigmoid.The output gate is calculated as follows.
where W o , U o represent the weight matrix, and b o denotes the bias term.We combine the partial information retained in the forget gate with the input gate to form a new cell unit c t as follows.
Next, c t will be sent to the tanh function through the output gate to determine the output value of the hidden layer at the current epoch h t , which can be derived by h t = o t tanh(c t ), where denotes the element-wise vector product.In general, LSTM includes two kinds of hidden states: a slow state c t to solve the vanishing gradient problem and a fast state h t to make complex decisions over short periods of time.
The PSO algorithm is an appropriate method for parameter selection in the LSTM model, thanks to its benefits, such as straightforward structure, high accuracy, fast convergence rate, and the capacity to address nonlinear and multivariable problems.PSO describes the members of the group as particles, and the fitness of all particles is determined in space through a fitness function.In the early stage of evolution, both the position and speed of each particle are initialized randomly.The particles cooperate with each other during the flight and adjust their speed and positions in time according to the motion state of themselves and their companions in order to land on a better position.However, each particle is a solution of the solution space in PSO.Each particle knows its own position and the information of other particles.It adjusts its position and speed through its optimal position and area of the group, and then the global optimal solution is derived.The speed and position of the PSO are updated as follows: where w is the inertia weight, c 1 and c 2 are learning factors, r 1 and r 2 are independent random numbers distributed between zero and one, and v t i,j , x t i,j , ∧ y t i,j , and * y t j are the velocity component, position component, individual optimal value, and group global optimal value of the i-th particle in the j-th dimension in the t-th iteration, respectively.
The value of w affects the model's optimization ability.In order to avoid premature convergence of the model, an adaptive PSO method is adopted in this paper.It adaptively adjusts the inertia weight as follows.
where w max , w min are maximum and minimum of w, respectively; f is the current fitness value of the particle; f min and f avg represent the current minimum fitness of all particles and the average fitness value, respectively.Since ship motion data have the characteristics of instability, nonlinearity, and periodic uncertainty, an adaptive PSO-LSTM is proposed in this paper.In the novel model, an adaptive PSO is utilized to optimize the network hyperparameters.The whole process of the adaptive PSO-LSTM method is shown as follows.

•
Preprocess the ship historical movement data.

•
Initialize the particle swarm parameters, including the determination of the population size, number of iterations, learning factors, and limited intervals for particle position and velocity.

•
Initialize the LSTM network structure, which refers to the determination of the number of neurons in each layer of the network and the number of hidden layers.It also divides the data into training samples, validation samples, and test samples.• Determine the fitness function and select the optimal particle fitness value by calculating and comparing the fitness value of each particle.The fitness value f it i of population individuals x i with LSTM model parameters is defined as Equation (12).Calculate and evaluate the particle fitness value according to the difference of the particle fitness value.The global optimal position and the local optimal position of the particle are both determined.

•
Update the velocity and position of the particles based on Equations ( 9) and (10).• Determine whether the particles meet the conditions for the iteration termination.If the maximum number of iterations is reached, the optimal parameters are assigned to the LSTM, and the training is performed and outputs the short-term ship motion prediction value.Otherwise, it returns to Step 5 to continue execution until the termination condition is met.

•
The optimal results obtained are assigned to the connection weights of the LSTM network, and this prediction model is trained to output the optimal solution for time series prediction.
The flowchart of the adaptive PSO-LSTM method is shown in Figure 3.Most previous studies have only used the fitting error of the training sample as the fitness value and ignored the effect of the testing sample data, which results in over-fitting in the neural network.This leads to the model prediction result not being optimal.Therefore, the fitting error of the training sample and the verification error of the verification sample should be considered in the fitness function.

EMD-LSTM Model Based on Sliding Window Approach
The ship motion time series is regarded as a nonlinear signal sequence.EMD has certain advantages in dealing with the end effect and reducing the effect of system noise.Therefore, it was selected to decompose the original sequence before prediction, which improves the model's fitting performance.This part of the prediction is based on the LSTM neural network with the sliding window.The adaptive PSO is used to optimize the value of network hyperparameters in the LSTM model, which cannot be selected objectively and scientifically.As a result, the whole process is summarized as follows:

•
Decompose the raw ship motion sequence into multiple specific subsequences by utilizing the EMD algorithm.

Experiment Design and Parameter Settings
Experiments were conducted to verify the effectiveness of the prediction model proposed in this paper.The experimental data used in this study were collected from an inertial measurement unit (IMU) installed on a large ship and divided into two categories in total: static state data set and motion state data set.The "static state" and "motion state" represent the state of the ship when we measured the experimental data of ship attitude."Static state" means that the ship is docked at the port."Motion state" means that the ship is sailing at a certain speed.To ensure the reliability and accuracy of the proposed algorithm, it was necessary to select the datasets in different states and different timestamps.The detailed description of the datasets is shown in Table 1.The sampling frequency of the IMU was 4 Hz.The scene of raw data acquisition is shown in Figure 5.The first 80% of the data was used for training and the rest was used for testing.Figures 6-10 show the different datasets of raw roll angle and pitch angle of the ship.

Prediction Performance Evaluation of Adaptive PSO Algorithm and Hybrid Model
To test the performance of the adaptive PSO algorithm, two standard test functions were chosen for both PSO and adaptive PSO.The two functions are expressed in Table 2.

Name
Test Function Expression The Griewank function has local minima, the number of which is related to the dimensionality of the problem, and the minimum is obtained at (0, 0 . . .0).It is a nonlinear multimodal function with a very wide search space and can be used to test particle swarm algorithms.
The Rosenbrock function is a nonconvex function used to test the performance of the optimization algorithm.Each contour of the Rosenbrock function is roughly parabolic in shape, and its full-domain minimum is also located in a parabolic-shaped valley (a banana-shaped valley).It is easy to find this valley, but it is quite difficult to find the minimum value of the full domain because the values within the valley do not vary much.Its full domain minimum is located at the point (x, y) = (1, 1) with the value f (x, y) = 0. Sometimes, the coefficient of the second term is different, but it does not affect the location of the full domain minimum.
The parameters in PSO and adaptive PSO were set as follows.The maximum population size was 100; the maximum number of iterations was 100; maximum particle velocity V max = 5; learning factors were set as c max = 2.1, c min = 0.8; and inertia weight was w max = 0.9, w min = 0.4, respectively.Figure 11 indicates the optimization results of the above test functions.It is obvious that the adaptive PSO algorithm showed better performance in finding the best individual fitness with less iteration and faster convergence.The ship motion varies greatly due to the environment at sea.Dense and highly fluctuating data may obscure the less fluctuating parts, resulting in missing details.Therefore, the data need to be normalized to eliminate the dimensional difference between different dataset inputs and scale them according to a certain ratio within the set interval.Both the sample set and target set should use the same normalization standard to ensure the consistency of neural network training and prediction.The formula of normalization is as follows: where X N is normalized data, x max and x min represent max and minimum of the data sequence x i , respectively.Here, x i can be set from a to b.It is set in the range from 0 to 1 in this paper.
Once the ship motion prediction is completed, it needs to be de-normalized, as indicated in Equation ( 14): Mean absolute error (MAE), mean absolute percentage error (MAPE), and root mean square error (RMSE) were utilized to evaluate the fitting performance of the established model between the true value and the prediction value, respectively.These three kinds of evaluation indexes are shown as For the purpose of evaluating the prediction performance of this model, the difference between the target sequence and prediction sequence is presented to evaluate the performance of the hybrid model.

Roll Angle Prediction Results and Analysis
To ensure the fairness of the experiment, the initial parameters are set to remain the same, and the detailed model parameter settings are listed in Table 3.In order to prove the effectiveness of the hybrid prediction model proposed in this paper, adaptive PSO-LSTM and EMD-LSTM were selected as comparison models.Additionally, the BP neural network, ELM, LSTM, and its variant neural networks were selected to prove the effectiveness in short-term ship motion attitude prediction.Taking Dataset 1 as an example, different benchmark models of roll angle prediction are shown in Figures 12 and 13.It is obvious that LSTM and its variant neural networks have better performance compared with the BP neural network and ELM, which proves the superiority of the deep learning method and that the LSTM neural network has higher accuracy.The errors between the predicted values and the recorded values for each method are shown in Figures 14 and 15.Additionally, the statistical results of errors in Dataset 1 are shown in Table 4, where LSTM, EMD-LSTM, and the adaptive PSO-LSTM method were selected to make comparisons with the proposed method to prove that EMD and adaptive PSO improved the LSTM neural network and had better adaptability.Although the input of the dataset is changed, the network structure can also be changed at the same time to achieve the best prediction performance.However, the above results are for one-step predictions.In practical engineering applications, short-term prediction of ship motion attitude generally requires multi-step-ahead predictions.This result means the prediction error ahead of different steps is based on the former observed value and current prediction value and has error accumulation, which is inevitable.In this paper, one-step , two-step, and three-step-ahead predictions were set aiming at all the datasets.The roll angle prediction errors of different models are shown in Table 5.As for dataset 1, ELM and the proposed method indicate the obvious error accumulation phenomenon, and the error result shows that almost all the datasets using the selected methods showed error accumulation as the number of predicted steps increases.Theoretically speaking, error accumulation is inevitable, but in practical prediction, not all neural networks demonstrate such situations, especially when using different datasets.Figures 16 and 17 show the error distribution of one-step-ahead, two-step-ahead, and three-step-ahead predictions with different models in a more visual way.The ELM method and BP neural network had a higher error in the three-step-ahead prediction, which may be due to the simple network structures.

Pitching Angle Prediction Results and Analysis
Taking Dataset 1 as an example, different benchmark models for pitching angle prediction results are shown in Figures 18 and 19. Figure 18 indicates prediction results in 200 s, and Figure 19 shows the testing data in 50 s.It can be seen that LSTM and BiLSTM had better fitting performance.In order to prove that EMD and adaptive PSO are both effective methods in improving LSTM for short-term ship attitude prediction, EMD-LSTM and adaptive PSO-LSTM were chosen for comparison, and the statistical results of errors are shown in Table 6.As a whole, adaptive PSO-LSTM had lower MAE and RMSE compared with EMD-LSTM, which means that adaptive PSO improves adaptability by adjusting network parameters dynamically and has more accurate results.Although the MAPE result is different from the MAE and RMSE results, the two method prediction results are similar and can be ignored.EMD is mainly used to reduce the nonstationary characteristic before dividing fixed window length time series data into training and testing datasets.The proposed model had the lowest error results and can further prove the validity of short-term prediction.The error results between the prediction and the recorded values for each method are shown in Figures 20 and 21.Similar to roll angle prediction experiments, pitching angle prediction of all the datasets is shown in Table 7, which shows that the proposed model outperforms the other methods in terms of one-step-ahead, two-step-ahead, and three-step-ahead prediction with the lowest error results.Still, the error accumulation is obvious.
Both Figures 22 and 23 show the error distribution of the one-step-ahead, two-stepahead, and three-step-ahead predictions of pitching angle with different models in a more visual way, and MAPE distribution shows an increasing trend.Compared with the previous model, the BP neural network still had the higher error results in multi-stepahead predictions.It is worth noting that the SAELSTM method also had poor prediction performance, which demonstrates that complex networks do not always result in better predictions.On the contrary, this may cause a long overall prediction time.

Conclusions
To improve the predicted performance of roll and pitch angles in the short term, a novel hybrid EMD-adaptive PSO-LSTM model with the sliding window approach was proposed in this paper.Firstly, in order to solve the problem of nonlinear and nonstationary data affecting the prediction accuracy, an EMD-based denoising method was proposed to smooth the original ship motion time series data.Secondly, an adaptive PSO algorithm was proposed to optimize the number of hidden units in the LSTM neural network to improve the accuracy of ship motion attitude prediction.To properly evaluate the performance of the proposed model, five sets of sea trial data were used for verification.The experimental results show the superiority of the proposed algorithm.
where M and N represent the number of training samples and verification samples, respectively; y m and ∧ y m represent the true value and the prediction value of the training sample, respectively; y n and ∧ y n represent the true value and the prediction value of verification samples, respectively.•

•
Divide the dataset into the training set and the testing set and predict each sub-model component separately with a sliding window and optimized LSTM neural network.• Weight and reconstruct the prediction of each sub-model to obtain the final prediction results.The flowchart is shown in Figure4:

Figure 4 .
Figure 4.The overall structure of the proposed hybrid prediction model.

Figure 5 .Figure 6 .
Figure 5.The scene of raw data acquisition.

Figure 12 .Figure 13 .
Figure 12.Roll angle prediction results in the training set of Dataset 1.

Figure 14 .
Figure 14.Roll angle prediction error results in the training set of Dataset 1.

Figure 15 .
Figure 15.Roll angle prediction error results in the testing set of Dataset 1.

Figure 18 .Figure 19 .
Figure 18.Pitch angle prediction results in the training set of Dataset 1.

Table 1 .
The description of different raw datasets.

Table 2 .
Test functions to test the performance of the adaptive PSO algorithm.

Table 3 .
Settings of different model parameters.

Table 4 .
Statistical results of roll angle prediction errors in Dataset 1.

Table 5 .
The roll angle prediction errors of different models.

Table 6 .
Statistical results of pitch angle prediction errors in Dataset 1.

Table 7 .
The pitch angle prediction errors of different models.