Ship motion dynamic regression prediction method and system fused with moving average mechanism
Through the neural network model integrating the moving average mechanism, it explicitly separates long and short-term features, and solves the problem of medium-long and short-term features coupling of ship motion forecasts, realizes high-precision forecasts of complex nonlinear and non-stationary data, and improves forecast performance.
Patent Information
- Application Number
- CN202510436251.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2025-08-08
AI Technical Summary
Existing extremely short-term forecasting technologies for ship motion are facing the problem of long-term feature coupling, and it is difficult to take into account the prediction capabilities of long-term trends and short-term fluctuations. Traditional models have limited performance when dealing with complex nonlinear and non-stationary time-date data, and LSTM models may experience information loss or excessive smoothing when processing extreme data.
A neural network model that integrates the moving average mechanism is used to explicitly separate long and short-term features through the autoregressive attention mechanism (AR Attention) and moving average attention mechanism (MA Attention), model long-term trends and short-term fluctuations respectively, and optimize model parameters using sliding windows and loss functions to achieve effective processing of complex nonlinear and non-stationary data.
It significantly improves the duration and accuracy of ship motion forecasting, can accurately model long-term trends and delicately capture short-term fluctuations, solves the problem of long-term and short-term feature coupling, and improves the model's processing ability of complex nonlinear and non-stationary data.
Smart Images

Figure CN120449117A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of ship and ocean engineering, and in particular relates to a ship motion dynamic regression prediction method and system integrating a moving average mechanism. Background Art
[0002] When ships navigate the ocean, they are affected by complex environmental factors such as wind, waves, and currents, resulting in complex six-degree-of-freedom oscillations. Furthermore, as sea conditions worsen, the impact of these environmental factors intensifies, and ship motion becomes more random and nonlinear, posing a serious threat to navigation and operations. Ship motion prediction can estimate a ship's motion over the next few seconds to tens of seconds, providing decision-making information for precise control of maritime operations and optimal timing, thereby improving the safety and efficiency of maritime operations.
[0003] Current ship motion forecasting technologies, such as the LSTM model, face the problem of coupling short- and long-term characteristics in time series prediction when performing long-term forecasts. This means that it is difficult to separate the interference between short-term fluctuations and long-term trends. This means that the model struggles to predict short-term fluctuations while also accounting for long-term trends. Traditional AR models only consider the impact of historical data on current data, ignoring the interference of short-term fluctuations on long-term trend modeling. This limits their performance when processing ship motion data with strong nonlinearities and nonstationarity. Models based on the exponential moving average (EMA) smooth historical data to capture short-term fluctuations, but this approach weakens the model's ability to model long-term trends, resulting in reduced performance. Long short-term memory neural networks (LSTMs), designed to simultaneously model short- and long-term characteristics, have shown difficulty capturing the necessary information in real-world testing due to their relatively simple long-term memory modeling mechanism, leading to reduced overall forecasting performance. This problem of coupling long-term and short-term characteristics causes coupling interference between short-term fluctuations and long-term trends in the characteristic space, highlighting the huge limitations of existing forecasting models.
[0004] In summary, current very short-term ship motion forecasting technologies face the problem of coupled long-term and short-term characteristics. This means that models struggle to simultaneously account for both long-term trends and short-term fluctuations. As sea conditions improve, the nonlinearity and nonstationarity of ship motions increase significantly, resulting in complex multi-timescale characteristics in ship motion. This complexity often results in poor forecasting performance when models focus solely on either long-term trends or short-term fluctuations. Traditional AR models rely solely on historical data to predict current data, ignoring the impact of short-term fluctuations on long-term trend modeling. This limits their performance when dealing with highly nonlinear and nonstationary data. Furthermore, models based on the exponential moving average (EMA) smooth historical data to capture short-term fluctuations, but this weakens their ability to model long-term trends, resulting in reduced performance when predicting long-term trends. While long-short-term memory (LSTM) neural networks, designed to simultaneously model both long-term and short-term characteristics, can capture both characteristics to a certain extent, they often struggle to achieve an ideal balance due to limitations in their internal mechanisms. LSTMs manage the flow of information through gating mechanisms, but when processing extremely nonlinear and non-stationary data, they can suffer from information loss or oversmoothing, resulting in inaccurate capture of long-term trends or insensitive response to short-term fluctuations, leading to a decline in overall forecasting performance. These issues make it difficult for existing models to effectively separate long-term and short-term features in the feature space, limiting improvements in forecast accuracy and duration.
[0005] Through the above analysis, the problems and defects of the existing technology are as follows:
[0006] (1) The current technology for extremely short-term ship motion prediction faces the problem of coupling long-term and short-term characteristics. It is difficult for the model to take into account the prediction capabilities of long-term trends and short-term fluctuations. The complex multi-time scale characteristics of ship motion make it difficult for the model to predict only long-term trends or short-term fluctuations, and its prediction effect is poor.
[0007] (2) Traditional AR models rely solely on historical data to predict current data, ignoring the interference of short-term fluctuations on long-term trend modeling. This results in limited performance when dealing with strongly nonlinear and non-stationary historical data. Existing models based on exponential moving averages (EMAs) capture short-term fluctuations by smoothing historical data, but weaken the ability to model long-term trends, resulting in decreased performance when predicting long-term trends. This makes it difficult for existing models to effectively separate long-term and short-term features in the feature space, limiting improvements in forecast accuracy and duration.
[0008] (3) Although the Long Short-Term Memory (LSTM) neural network, which aims to simultaneously model long-term and short-term features, can capture the characteristics of both to a certain extent, it is often difficult to achieve an ideal balance due to the limitations of its internal mechanism. LSTM manages the flow of information through a gating mechanism, but when processing extremely nonlinear and non-stationary data, it may suffer from information loss or over-smoothing problems, resulting in inaccurate capture of long-term trends or insensitive response to short-term fluctuations, leading to a decline in overall forecasting performance. Summary of the Invention
[0009] To overcome the problems existing in the related art, the embodiments disclosed in the present invention provide a ship motion dynamic regression prediction method and system integrating a moving average mechanism. The technical solution is as follows:
[0010] The present invention is implemented as follows: a ship motion dynamic regression prediction method integrating a moving average mechanism comprises the following steps:
[0011] S1, segment the ship motion time history data to obtain the training set D of time history forecast tr and the test set D te ;
[0012] S2, build a neural network model based on ARMA Attention architecture, set the prediction step ahead of the historical input step back; according to the obtained training set D tr and the test set D te , using the sliding window method to build the model training input data set X tr And the model test input dataset X te And the label dataset Y tr and Y te ;
[0013] S3, train the input dataset X based on the obtained model tr And the model test input dataset X te , perform preprocessing operations on the data;
[0014] S4, input the preprocessed input data into the AR component and MA component of the ARMA Attention model in sequence, and superimpose the prediction results of the two components to obtain the final prediction result;
[0015] S5, repeat steps S3 and S4, and input the model training data set X tr Each input fragment Input into the ARMA Attention model in sequence to generate prediction results Model comparison prediction results and the true label Use the loss function to adjust the network structure parameter settings, and obtain a trained model after multiple iterations;
[0016] S6, input the model test data set X te Input the model trained in step S5 and repeat step S4. The input into the ARMA Attention model passes through the AR component and the MA component in sequence and is superimposed to finally obtain the ship motion history forecast result.
[0017] In step S1, the ship motion history data is segmented to obtain the training set D of the history forecast tr and the test set D te ,include:
[0018] The ship's historical motion history data is:
[0019] D=[d1,d2…d T ]
[0020] Where, d T The amount of data on the ship's historical movement history;
[0021] Divide the ship's historical motion history data into training set D tr =[d1,d2…d n ] and test set D te =d n+1 ,d n+2 …d T ], n is the number of data in the training set, and T is the number of data in the test set.
[0022] In step S2, the model training input data set X is constructed using the sliding window method. tr And the model test input dataset X te And the label dataset Y tr and Y te ,include:
[0023] The AR component based on the autoregressive attention mechanism and the MA component based on the moving average attention mechanism are coupled and superimposed to obtain the final result; the training set D of the segmented time-history forecast is tr =[d1,d2…d n ] and test set D te =[d n+1 ,d n+2 …d T ] Perform sliding window processing respectively, and obtain the historical input data of the training set of the model The set of input data sets and label data The collection is a labeled dataset And the test set historical input data The set of input data sets and label data The collection is a labeled dataset Among them, T is the total amount of data set, n is the amount of data in the training data set, back is the length of the historical window, and ahead is the length of the prediction window.
[0024] In step S3, the input dataset X is trained according to the obtained model tr And the model test input dataset X te , perform preprocessing operations on the data, including:
[0025] The input time series x i =[d i ,d i+1 …d i+back-1 ] into multiple non-overlapping segments x i =[L i ,L2…L N ], each segment is L i =[d i ,d i+1 …d p ]; where N is the number of non-overlapping segments, p is the length of each segment, and for the time series x i =[d i ,d i+1 …d i+back-1 ] The part with insufficient length is padded with zero at the end;
[0026] For each segment L i After standardization, the expression is:
[0027]
[0028] Where, μ(L i ) is the mean of the segment, σ(L i ) is the variance of the segment;
[0029] Perform a linear projection on each segment and add a learnable position embedding Among them, P Emb It encodes the position information and finally forms the model input sequence.
[0030] In step S4, the pre-processed input data is sequentially input into the AR component and the MA component of the ARMA Attention model, and the prediction results of the two components are superimposed to obtain the final forecast result, including:
[0031] Input the obtained input data into the AR component to obtain the predicted value at time t:
[0032]
[0033] Where Y t+1 is the predicted value of AR component, W t,i is the attention weight, X t is the input data, r t is the error term of the AR component;
[0034] Decompose the error term and introduce the MA term to capture short-term fluctuations to obtain the MA component:
[0035]
[0036] Where θ t-1,j is the weight of the MA component, ε j is the moving average of the past t-1 time error, ε t is the error after the introduction of MA term;
[0037] Overlay the AR component and the MA component:
[0038]
[0039] Where, is the predicted value, is the attention weight of the AR component, X t For input data, is the weight of the MA component;
[0040] The final prediction result is obtained through the iteration time t.
[0041] In step S5, the loss function is used to adjust the network structure parameter settings, and a trained model is obtained after multiple iterations, including:
[0042] For the model training history input data obtained in step S3 Input data for each training segment Perform the operation of step S4 to obtain the corresponding prediction results
[0043] Use the loss function to adjust the parameter settings of the internal network structure so that the prediction results With training label dataset Y tr Input snippet The error between them is continuously reduced, and a trained model is obtained after multiple iterations. The loss function used in the iterative process is the root mean square loss, and the formula is:
[0044]
[0045] Where Leng is the total length of the sequence.
[0046] In step S6, the model test input data set X te Input the model trained in step S5 and repeat step S4. The input to the ARMA Attention model passes through the AR component and the MA component in sequence and is superimposed to finally obtain the ship motion history forecast result, including:
[0047] For the obtained model test input data set Input data for each history Input the model trained in step S5 and repeat the operation of step S4 to obtain the corresponding set of prediction results
[0048] Another object of the present invention is to provide a ship motion dynamic regression prediction system integrating a moving average mechanism, the system being used to control the ship motion dynamic regression prediction method integrating a moving average mechanism, the system comprising:
[0049] The ship motion time history data segmentation module is used to segment the ship motion time history data and obtain the training set D for time history forecast. tr and the test set D te ;
[0050] The neural network model building module is used to build a neural network model based on the ARMA Attention architecture and set the prediction step size ahead of the historical input step size back; according to the obtained training set D tr and the test set D te , using the sliding window method to build the model training input data set X tr And the model test input dataset X te And the label dataset Y tr and Y te ;
[0051] Data preprocessing module, used to train the input data set X according to the obtained model tr And the model test input dataset X te , perform preprocessing operations on the data;
[0052] The initial ship motion history prediction module is used to input the pre-processed input data into the AR component and MA component of the ARMAAttention model in sequence, superimpose the prediction results of the two components to obtain the final prediction result;
[0053] Model optimization module, used to train the model input data set X tr Each input fragment Input into the ARMAAttention model in sequence to generate prediction results Model comparison prediction results and the true label Use the loss function to adjust the network structure parameter settings, and obtain a trained model after multiple iterations;
[0054] The final ship motion history prediction module is used to input the model test data set X te Input the trained model, each input fragment The input into the ARMA Attention model passes through the AR component and the MA component in sequence and is superimposed to finally obtain the ship motion history forecast result.
[0055] Another object of the present invention is to provide a computer-readable storage medium storing instructions, which, when executed on a computer, enables the computer to apply the ship motion dynamic regression prediction method using the fused moving average mechanism.
[0056] Another object of the present invention is to provide an information data processing terminal, which is used to implement the ship motion dynamic regression prediction method based on the fusion moving average mechanism.
[0057] In combination with all the above technical solutions, the beneficial effects of the present invention are as follows:
[0058] First, in view of the technical problems existing in the above-mentioned prior art and the difficulty of solving the problems, this paper closely combines the technical solutions to be protected by the present invention and the results and data during the research and development process, and analyzes in detail and in depth how the technical solutions of the present invention solve the technical problems, and some creative technical effects brought about by solving the problems, which are specifically described as follows:
[0059] Previous studies have shown that ship motion forecasting models often exhibit significant deviations from true values when used for long-term forecasts due to the influence of complex multi-timescale patterns in time series. Traditional AR models, relying solely on historical data, struggle to effectively address the interference of short-term fluctuations on long-term trends. While models based on the exponential moving average (EMA) can capture short-term fluctuations, they lack the ability to model long-term trends, limiting their performance when dealing with strongly nonlinear and nonstationary ship motion data. Long-short-term memory (LSTM) neural networks, designed to model both long-term and short-term characteristics, can capture both to a certain extent, but due to limitations in their internal mechanisms, they often struggle to achieve an ideal balance. LSTMs manage the flow of information through gating mechanisms, but when dealing with extremely nonlinear and nonstationary data, they can suffer from information loss or oversmoothing, resulting in inaccurate capture of long-term trends or insensitive response to short-term fluctuations, ultimately reducing overall forecasting performance.
[0060] In order to improve the performance of the ship motion prediction model, the present invention proposes a neural network model that explicitly separates long-term and short-term features, and models long-term trends and short-term fluctuations respectively through two channels: the autoregressive attention mechanism (AR Attention) and the moving average attention mechanism (MAAttention). Among them, the autoregressive attention mechanism uses its powerful self-attention ability to accurately capture the long-term dependencies in the time series, and deeply analyzes the complex interactions between data points across a long time span, thereby significantly improving the modeling accuracy of long-term trends; the moving average attention mechanism, by considering the cumulative effect of prediction errors, delicately captures short-term fluctuations and random noise in the time series, and effectively optimizes the accuracy of prediction details. Through explicit decoupling and collaborative modeling, the model significantly enhances the ability to handle complex nonlinear and non-stationary data, thereby greatly improving the forecast duration and accuracy of ship motion history data.
[0061] The neural network model of the present invention, which explicitly separates long-term and short-term features, can accurately model long-term trends and delicately capture short-term fluctuations. It avoids the coupling problem of long-term and short-term features through a dual-channel design, and adapts to complex and changeable ship motion data, providing a more accurate and reliable solution for ship motion forecasting.
[0062] Second, considering the technical solution as a whole or from the perspective of the product, the technical effects and advantages of the technical solution to be protected by the present invention are described in detail as follows:
[0063] In response to the long-term and short-term feature coupling problem existing in the existing ship motion time series prediction model, the present invention proposes a neural network model that explicitly separates long-term and short-term features, namely, focusing on long-term trends through the autoregressive attention mechanism (AR Attention) and focusing on short-term fluctuations through the moving average attention mechanism (MA Attention). By designing two feature extraction channels, the autoregressive attention mechanism (AR Attention) and the moving average attention mechanism (MA Attention), the explicit decoupling and collaborative modeling of different time scale features in the ship motion time series data are achieved. At the same time, the present invention solves the long-term and short-term feature coupling problem existing in ship motion prediction, improves the model's processing ability for time series data with complex nonlinearities and non-stationarities, and thus effectively improves the prediction duration and prediction accuracy of ship motion time series data.
[0064] The present invention solves the problem that traditional models have difficulty distinguishing and modeling long-term trends and short-term fluctuations when processing complex time series data. Previous models often only model long-term trends or short-term fluctuations. Although the LSTM model that considers both can capture the characteristics of both to a certain extent, it is often difficult to achieve an ideal balance due to the limitations of its internal mechanism. LSTM manages the flow of information through a gating mechanism, but when processing extremely nonlinear and non-stationary data, it may suffer from information loss or over-smoothing problems, resulting in inaccurate capture of long-term trends or insufficient response to short-term fluctuations. The method proposed in this patent not only explicitly separates long-term trends and short-term fluctuations, but also deeply models the two through autoregressive attention mechanisms and moving average attention mechanisms, thereby ensuring accurate capture of long-term trends while also delicately reflecting short-term fluctuations, effectively improving the overall performance and accuracy of the model in complex time series data forecasting.
[0065] The present invention innovatively introduces a dual-channel architecture of autoregressive attention mechanism (AR Attention) and moving average attention mechanism (MA Attention) to explicitly separate the long-term trend and short-term fluctuation characteristics in time series data, effectively overcoming the technical bias of traditional models in coupling long-term and short-term characteristics when processing such data, thereby significantly improving the model's ability to handle complex nonlinear and non-stationary data, and achieving a significant improvement in the forecast duration and accuracy of ship motion history data. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure;
[0067] Figure 1This is a schematic diagram of a ship motion prediction method provided by an embodiment of the present invention;
[0068] Figure 2 This is a diagram of ship model swaying motion data obtained from a towing tank ship motion measurement test provided by an embodiment of the present invention;
[0069] Figure 3 A comparison chart of 15-second results of ship motion roll history extraction and prediction provided by an embodiment of the present invention;
[0070] Figure 4 A comparison chart of 30-second results of ship motion roll history extraction and prediction provided by an embodiment of the present invention;
[0071] Figure 5 A comparison chart of the 45-second results of the ship's rolling history extraction and prediction provided by an embodiment of the present invention;
[0072] Figure 6 A comparison chart of the 60-second results of the ship's rolling history extraction and prediction provided by an embodiment of the present invention;
[0073] Figure 7 A graph showing the root mean square error of predictions at different lead times between different models provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0074] To make the above-mentioned objects, features, and advantages of the present invention more readily apparent, specific embodiments of the present invention are described in detail below with reference to the accompanying drawings. The following description sets forth numerous specific details to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways than those described herein, and those skilled in the art may make similar modifications without departing from the scope of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0075] The innovation of the present invention lies in that it proposes a neural network model that explicitly separates long-term and short-term features, and focuses on long-term trends and short-term fluctuations through two channels: the autoregressive attention mechanism (AR Attention) and the moving average attention mechanism (MA Attention). The autoregressive attention mechanism focuses on the impact of historical data on current values. Through its powerful self-attention mechanism, it can effectively capture and model long-term dependencies in time series, enabling the model to deeply understand the complex interactions between data points across a long time span; while the moving average attention mechanism focuses on the cumulative effect of prediction errors. By considering the weighted average of previous prediction deviations, it can delicately capture short-term fluctuations and random noise in the time series, thereby optimizing the accuracy of the prediction in detail, so as to achieve explicit decoupling and collaborative modeling of different time scale features in ship motion time series data. This solution effectively solves the problem of long-term and short-term feature coupling, improves the model's ability to handle complex nonlinear and non-stationary data, and thus significantly improves the forecast duration and accuracy of ship motion time series data.
[0076] The present invention can explicitly separate and predict the long-term and short-term characteristics of ship motion data through a neural network, constructs adaptive AR and MA components to capture and learn the long-term and short-term characteristics of ship motion, and effectively solves the problem of declining forecast accuracy under the coupling of long-term and short-term characteristics.
[0077] The present invention builds a ship motion prediction model based on the autoregressive moving average attention mechanism (ARMA Attention) architecture. The key points are:
[0078] (1) By introducing the autoregressive attention mechanism (AR Attention), we can effectively capture and model long-term dependencies in time series and gain a deep understanding of the complex interactions between data points over a long time span.
[0079] (2) Combining the Moving Average Autoregressive Model to Optimize Forecast Performance: In the proposed model, the autoregressive attention mechanism (AR Attention) is combined with the moving average attention (MA Attention). The MA component can delicately capture short-term fluctuations and random noise in the time series by considering the weighted average of previous forecast deviations. This fusion allows the model to explicitly separate long-term trends and short-term features in the data, thereby improving the forecast performance of the ship motion forecast model.
[0080] Example 1, as Figure 1 As shown, the ship motion prediction method provided by the embodiment of the present invention specifically includes the following steps:
[0081] S1, segment the ship motion time history data to obtain the training set D of time history forecast tr and the test set Dte ;
[0082] The specific method of step S1 of the present invention is: the known historical motion history data of a certain degree of freedom of the ship is:
[0083] D=[d1,d2…d T ]
[0084] Where T is the number of data on the ship's historical movement history; the ship's historical movement history data is divided into training sets: D tr =[d1,d2…d n ] and test set D te =[d n+1 ,d n+2 …d T ], n is the number of data in the training set, T is the number of data in the test set, and the number of data in the training set and test set is set according to actual needs.
[0085] S2, build a neural network model based on ARMA Attention architecture, set the prediction step ahead of the historical input step back; according to the obtained training set D tr and the test set D te , using the sliding window method to build the model training input data set X tr And the model test input dataset X te And the label dataset Y tr and Y te ;
[0086] The specific method of step S2 of the present invention is: establishing a neural network based on the ARMA Attention architecture, the specific structure of which includes:
[0087] The AR component based on the autoregressive attention mechanism and the MA component based on the moving average attention mechanism are coupled and superimposed to obtain the final result; the LSTM model and GRU model are established according to the traditional method, and the training set D of the segmented time history forecast is used. tr =[d1,d2…d n ] and test set D te =[d n+1 ,d n+2 …d T ] Perform sliding window processing respectively, and obtain the historical input data of the training set of the model The set of input data sets and label data The collection is a labeled dataset And the test set historical input data The set of input data sets and label data The collection is a labeled dataset Among them, T is the total amount of data set, n is the amount of data in the training data set, back is the length of the historical window, and ahead is the length of the prediction window.
[0088] S3, train the input dataset X based on the obtained model tr And the model test input dataset X te , perform preprocessing operations on the data;
[0089] The specific method of the preprocessing operation in step S3 of the present invention is: input time series x i =[d i ,d i+1 …d i+back-1 ] into multiple non-overlapping segments x i =[L i ,L2…L N ], each segment is L i =[d i ,d i+1 ...d p ]; where N is the number of non-overlapping segments, p is the length of each segment, and for the time series x i =[d i ,d i+1 …d i+back-1 ] The part with insufficient length is padded with zero at the end;
[0090] For each segment L i After standardization, the expression is:
[0091]
[0092] Where, μ(L i ) is the mean of the segment, σ(L i ) is the variance of the segment;
[0093] Perform a linear projection on each segment and add a learnable position embedding Among them, P Emb It encodes the position information and finally forms the model input sequence.
[0094] S4, input the preprocessed input data into the AR component and MA component of the ARMA Attention model in sequence, and superimpose the prediction results of the two components to obtain the final prediction result;
[0095] The input data obtained in step S3 is input into the AR component to obtain the predicted value at time t:
[0096]
[0097] Where Y t+1 is the predicted value of AR component, W t,i is the attention weight, X t is the input data, r t is the error term of the AR component;
[0098] Decompose the error term and introduce the MA term to capture short-term fluctuations to obtain the MA component:
[0099]
[0100] Where θ t-1,j is the weight of the MA component, ε j is the moving average of the past t-1 time error, ε t is the error after the introduction of MA term;
[0101] Overlay the AR component and the MA component:
[0102]
[0103] Where, is the predicted value, is the attention weight of the AR component, X t For input data, is the weight of the MA component;
[0104] The final prediction result is obtained through the iteration time t.
[0105] S5, repeat steps S3 and S4, and input the model training data set X tr Each input fragment Input into the ARMA Attention model in sequence to generate prediction results Model comparison prediction results and the true label Use the loss function to adjust the network structure parameter settings, and obtain a trained model after multiple iterations;
[0106] Generating prediction results in LSTM and GRU models The model will continuously compare the prediction results and the true label In order to reduce the difference, the loss function is used to continuously adjust the parameter settings of the internal network structure, so that the difference between the prediction results and the label data set of the model training is gradually reduced, and a trained model is obtained after multiple iterations.
[0107] The specific method of step S5 of the present invention is: for the model training history input data obtained in step S3 Input data for each training segment Perform the operation of step S4 to obtain the corresponding prediction results
[0108] Use the loss function to adjust the parameter settings of the internal network structure so that the prediction results With training label dataset Y tr Input snippet The error between them is continuously reduced, and a trained model is obtained after multiple iterations. The loss function used in the iterative process is the root mean square loss, and the formula is:
[0109]
[0110] Where Leng is the total length of the sequence.
[0111] S6, input the model test data set X te Input the model trained in step S5 and repeat step S4. The input into the ARMA Attention model passes through the AR component and the MA component in sequence and is superimposed to finally obtain the ship motion history forecast result.
[0112] For the obtained model test input data set Input data for each history Input the model trained in step S5 and repeat the operation of step S4 to obtain the corresponding set of prediction results
[0113] The prediction results of the ARMA Attention model, LSTM model and GRU model are compared.
[0114] In embodiment 2, a ship motion prediction system provided by an embodiment of the present invention includes:
[0115] The ship motion time history data segmentation module is used to segment the ship motion time history data and obtain the training set D for time history forecast. tr and the test set D te ;
[0116] The neural network model building module is used to build a neural network model based on the ARMA Attention architecture and set the prediction step size ahead of the historical input step size back; according to the obtained training set D tr and the test set D te , using the sliding window method to build the model training input data set Xtr And the model test input dataset X te And the label dataset Y tr and Y te ;
[0117] Data preprocessing module, used to train the input data set X according to the obtained model tr And the model test input dataset X te , perform preprocessing operations on the data;
[0118] The initial ship motion history prediction module is used to input the pre-processed input data into the AR component and MA component of the ARMAAttention model in sequence, superimpose the prediction results of the two components to obtain the final prediction result;
[0119] Model optimization module, used to train the model input data set X tr Each input fragment Input into the ARMAAttention model in sequence to generate prediction results Model comparison prediction results and the true label Use the loss function to adjust the network structure parameter settings, and obtain a trained model after multiple iterations;
[0120] The final ship motion history prediction module is used to input the model test data set X te Input the trained model, each input fragment The input into the ARMA Attention model passes through the AR component and the MA component in sequence and is superimposed to finally obtain the ship motion history forecast result.
[0121] In order to further demonstrate the positive effects of the above embodiment, the present invention conducts the following experiments based on the above technical solution: the data is selected from the ship model swaying motion data obtained from the ship motion measurement test in the towing tank of a university in Dalian, such as Figure 2 shown.
[0122] Step 1: Split the known ship's one-degree-of-freedom motion history data to obtain the training set and test set for the history prediction. The specific method of step 1 is: the known ship's one-degree-of-freedom motion history data is D = [d1, d2…d T ], where T is the number of data on the ship's historical movement history; the ship's historical movement history data is divided into training sets: D tr =[d1,d2…d n ], test set D te =[d n+1 ,d n+2 …d T]; where n is the number of data in the training set, and T is the number of data in the test set. The number of data in the training set and the test set is set according to actual needs.
[0123] Step 2: Establish a neural network model based on ARMA Attention architecture and LSTM, GRU neural network model, set the prediction step ahead of the historical input step back, and according to the training set D in step 1 tr and the test set D te Using the sliding window method, build a model to train the input data set X tr and X te And the label dataset Y tr and Y te The specific method of step 2 is to establish a neural network based on the ARMA Attention architecture. Its specific structure includes: an AR component based on the autoregressive attention mechanism and an MA component based on the moving average attention mechanism. Finally, the outputs of the two components are coupled and superimposed to obtain the final result. The LSTM model and GRU model are established according to the traditional method. The training set D of the segmented time-history forecast is tr =[d1,d2…d n ] and test set D te =[d n+1 ,d n+2 …d T ] Perform sliding window processing respectively, and obtain the historical input data of the training set of the model The set of input data sets and label data The collection is a labeled dataset And the test set historical input data The set of input data sets and label data The collection is a labeled dataset Among them, T is the total amount of data set, n is the amount of data in the training data set, back is the length of the historical window, and ahead is the length of the prediction window.
[0124] Step 3: Train the input dataset X according to the model obtained in step 2 tr And the model test input dataset X tr , perform preprocessing operations on the data. The specific method of the preprocessing operation in step 3 is: the specific method of the preprocessing operation in step S3 of the present invention is: input time series x i =[d i ,d i+1 …di+back-1 ] into multiple non-overlapping segments x i =[L i ,L2…L N ], each segment is L i =[d i ,d i+1 …d p ], where N is the number of non-overlapping segments, p is the length of each segment, for the time series x i =[d i ,d i+1 …d i+back-1 ] The part with insufficient length is padded with zero at the end. i Standardize Where, μ(L i ) is the mean of the segment, σ(L i ) is the variance of the segment, linearly project each segment, and add a learnable position embedding Among them, P Emb It encodes the position information and finally forms the model input sequence.
[0125] Step 4: Input the input data preprocessed in step 3 into the ARMA Attention model, LSTM model and GRU model in sequence to obtain the final prediction result. The specific method of prediction by the ARMA Attention model in step 4 is: input the input data obtained in step S3 into the AR component to obtain the predicted value at time t Among them, Y t+1 is the predicted value of AR component, W t,i is the attention weight, X t is the input data, r t is the error term of the AR component. Decompose the error term and introduce the MA term to capture short-term fluctuations to obtain the MA component Among them, θ t-1,j is the weight of the MA component, ε j is the moving average of the past t-1 time error, ε t is the error after the introduction of MA term. Finally, the AR component and MA component are superimposed in, is the predicted value, is the attention weight of the AR component, X t For input data, is the weight of the MA component, and the final forecast result is obtained through the iteration time t.
[0126] Step 5: Repeat steps 3 and 4 to train the model on the input dataset Xtr Each input fragment Input the ARMAAttention model, LSTM model and GRU model in turn to generate prediction results The model will continuously compare the prediction results and the true label The difference between the two is to reduce the difference. The loss function is used to continuously adjust the parameter settings of the internal network structure so that the difference between the prediction results and the label data set of the model training is gradually reduced. After multiple iterations, a trained model is obtained. The specific method of step 5 is: for the model training history input data obtained in step S3 Where n represents the amount of training data, back represents the length of the historical window, and ahead represents the length of the prediction window. Perform the operation of step S4 to obtain the corresponding prediction results The model uses the loss function to adjust the parameter settings of the internal network structure so that the prediction results With training label dataset Y tr Input snippet The error between iterations is continuously reduced, and a trained model is obtained after multiple iterations. The loss function used in the iterative process is the root mean square loss, and its formula is: Where Leng represents the total length of the sequence.
[0127] Step 6: Test the model with the dataset X te Input the multiple models trained in step 5, repeat step 4, and input each segment Input the ARMA Attention model, LSTM model and GRU model, and finally get the ship motion history forecast result. The specific method of step 6 is: for the model test input data set obtained in step S3 Where T represents the total amount of data set, n represents the amount of data in the training data set, back represents the length of the historical window, and ahead represents the length of the prediction window. Input the model trained in step S5 and repeat the operation of step S4 to obtain the corresponding set of prediction results Finally, the prediction results of the ARMA Attention model, LSTM model and GRU model are compared.
[0128] Figure 3-Figure 6 The variation of ship roll angle with time for different models and different forecast times is shown in Figure 3 Comparison of 15s prediction results of ship motion rolling history extraction, Figure 4 Comparison of 30s prediction results of ship motion rolling history extraction, Figure 5 Comparison of 45s prediction results of ship motion rolling history extraction, Figure 6 Comparison of 60-second prediction results for ship motion roll history extraction. In each figure, the black curve represents the true value, while the other colored curves represent the predictions using ARMA Attention, LSTM, and GRU, respectively. Table 1 shows the statistical error calculation results for ship motion history predictions for all time periods using different models.
[0129] Table 1 Statistics of ship rolling motion history prediction errors
[0130] Advance forecast time / second ARMAAttention LSTM GRU 15 0.2555 1.0553 1.0679 30 0.2527 1.2481 1.2757 45 0.2544 1.2990 1.3191 60 0.3241 1.3029 1.3081
[0131] Figure 7 The figure shows the root mean square error (RMSE) of forecasts for different models at different lead times. It shows that while the overall error trend of the ARMA Attention model continues to increase, it remains relatively low and stable compared to the commonly used LSTM and GRU models. For most of the time, the RMSE value remains between 0.22 and 0.28, significantly lower than the forecast errors of the other two models, which approach 1.3 in the later stages. The prediction results are relatively stable and effective. A comparison of the ship's rolling motion history shows that the ARMA model outperforms the LSTM and GRU models at 15, 30, 45, and 60 seconds. Even at 60 seconds, the forecast remains very close to the true value. The model also accurately predicts short-term fluctuations in the time series curve.
[0132] The above description is only a preferred specific implementation method of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications, equivalent substitutions and improvements made by any technician familiar with this technical field within the technical scope disclosed by the present invention and within the spirit and principles of the present invention should be covered by the scope of protection of the present invention.
Claims
1. A ship motion dynamic regression prediction method integrating a moving average mechanism, characterized in that: The method comprises the following steps: S1, segment the ship motion time history data to obtain the training set D of time history forecast tr and the test set D te ; S2, build a neural network model based on ARMA Attention architecture, set the prediction step ahead of the historical input step back; according to the obtained training set D tr and the test set D te , using the sliding window method to build the model training input data set X tr And the model test input dataset X te And the label dataset Y tr and Y te ; S3, train the input dataset X based on the obtained model tr And the model test input dataset X te , perform preprocessing operations on the data; S4, input the preprocessed input data into the AR component and MA component of the ARMA Attention model in sequence, and superimpose the prediction results of the two components to obtain the final prediction result; S5, repeat steps S3 and S4, and input the model training data set X tr Each input fragment Input into the ARMAAttention model in sequence to generate prediction results Model comparison prediction results and the true label Use the loss function to adjust the network structure parameter settings, and obtain a trained model after multiple iterations; S6, input the model test data set X te Input the model trained in step S5 and repeat step S4. The input into the ARMA Attention model passes through the AR component and the MA component in sequence and is superimposed to finally obtain the ship motion history forecast result.
2. The ship motion dynamic regression prediction method integrating the moving average mechanism according to claim 1 is characterized in that: In step S1, the ship motion history data is segmented to obtain the training set D of the history forecast tr and the test set D te ,include: The ship's historical motion history data is: D=[d1,d2…d T ] Where, d T The amount of data on the ship's historical movement history; Divide the ship's historical motion history data into training set D tr =[d1,d2…d n ] and test set D te =[d n+1 ,d n+2 …d T ], n is the number of data in the training set, and T is the number of data in the test set.
3. The ship motion dynamic regression prediction method integrating the moving average mechanism according to claim 1 is characterized in that: In step S2, the model training input data set X is constructed using the sliding window method. tr And the model test input dataset X te And the label dataset Y tr and Y te ,include: The AR component based on the autoregressive attention mechanism and the MA component based on the moving average attention mechanism are coupled and superimposed to obtain the final result; the training set D of the segmented time-history forecast is tr =[d1,d2…d n ] and test set D te =[d n+1 ,d n+2 …d T ] Perform sliding window processing respectively, and obtain the historical input data of the training set of the model The set of input data sets and label data The collection is a labeled dataset And the test set historical input data The set of input data sets and label data The collection is a labeled dataset Among them, T is the total amount of data set, n is the amount of data in the training data set, back is the length of the historical window, and ahead is the length of the prediction window.
4. The ship motion dynamic regression prediction method integrating the moving average mechanism according to claim 3 is characterized in that: In step S3, the input dataset X is trained according to the obtained model tr And the model test input dataset X te , perform preprocessing operations on the data, including: The input time series x i =[d i ,d i+1 …d i+back-1 ] into multiple non-overlapping segments x i =[L i ,L2…L N ], each segment is L i =[d i ,d i+1 …d p ]; where N is the number of non-overlapping segments, p is the length of each segment, and for the time series x i =[d i ,d i+1 …d i+back-1 ] The part with insufficient length is padded with zero at the end; For each segment L i After standardization, the expression is: Where, μ(L i ) is the mean of the segment, σ(L i ) is the variance of the segment; Perform a linear projection on each segment and add a learnable position embedding Among them, P Emb It encodes the position information and finally forms the model input sequence.
5. The ship motion dynamic regression prediction method integrating the moving average mechanism according to claim 4 is characterized in that: In step S4, the pre-processed input data is sequentially input into the AR component and the MA component of the ARMA Attention model, and the prediction results of the two components are superimposed to obtain the final forecast result, including: Input the obtained input data into the AR component to obtain the predicted value at time t: Where Y t+1 is the predicted value of AR component, W t,i is the attention weight, X t is the input data, r t is the error term of the AR component; Decompose the error term and introduce the MA term to capture short-term fluctuations to obtain the MA component: Where θ t-1,j is the weight of the MA component, ε j is the moving average of the past t-1 time error, ε t is the error after the introduction of MA term; Overlay the AR component and the MA component: Where, is the predicted value, is the attention weight of the AR component, X t For input data, is the weight of the MA component; The final prediction result is obtained through the iteration time t.
6. The ship motion dynamic regression prediction method integrating the moving average mechanism according to claim 5 is characterized in that: In step S5, the loss function is used to adjust the network structure parameter settings, and a trained model is obtained after multiple iterations, including: For the model training history input data obtained in step S3 Input data for each training segment Perform the operation of step S4 to obtain the corresponding prediction results Use the loss function to adjust the parameter settings of the internal network structure so that the prediction results With training label dataset Y tr Input snippet The error between them is continuously reduced, and a trained model is obtained after multiple iterations. The loss function used in the iterative process is the root mean square loss, and the formula is: Where Leng is the total length of the sequence.
7. The ship motion dynamic regression prediction method integrating the moving average mechanism according to claim 6 is characterized in that: In step S6, the model test input data set X te Input the model trained in step S5 and repeat step S4. The input to the ARMA Attention model passes through the AR component and the MA component in sequence and is superimposed to finally obtain the ship motion history forecast result, including: For the obtained model test input data set Input data for each history Input the model trained in step S5 and repeat the operation of step S4 to obtain the corresponding set of prediction results 8. A ship motion dynamic regression prediction system integrating a moving average mechanism, characterized in that: The system is used to control the ship motion dynamic regression prediction method integrating the moving average mechanism as described in any one of claims 1 to 7, and the system comprises: The ship motion time history data segmentation module is used to segment the ship motion time history data and obtain the training set D for time history forecast. tr and the test set D te ; The neural network model building module is used to build a neural network model based on the ARMA Attention architecture and set the prediction step size ahead of the historical input step size back; according to the obtained training set D tr and the test set D te , using the sliding window method to build the model training input data set X tr And the model test input dataset X te And the label dataset Y tr and Y te ; Data preprocessing module, used to train the input data set X according to the obtained model tr And the model test input dataset X te , perform preprocessing operations on the data; The initial ship motion history prediction module is used to input the pre-processed input data into the AR component and MA component of the ARMAAttention model in sequence, superimpose the prediction results of the two components to obtain the final prediction result; Model optimization module, used to train the model input data set X tr Each input fragment Input into the ARMAAttention model in sequence to generate prediction results Model comparison prediction results and the true label Use the loss function to adjust the network structure parameter settings, and obtain a trained model after multiple iterations; The final ship motion history prediction module is used to input the model test data set X te Input the trained model, each input fragment The input into the ARMA Attention model passes through the AR component and the MA component in sequence and is superimposed to finally obtain the ship motion history forecast result.
9. A computer-readable storage medium, characterized in that Instructions are stored, and when the instructions are executed on a computer, the computer is caused to apply the ship motion dynamic regression prediction method integrating the moving average mechanism as described in any one of claims 1 to 7.
10. An information data processing terminal, characterized in that: The information data processing terminal is used to implement the ship motion dynamic regression prediction method integrating the moving average mechanism as described in any one of claims 1 to 7.