A short-term ship speed prediction method based on time series random forest
By using the time-series random forest model in ship speed prediction, combined with historical speed and meteorological data, the problem of insufficient data in short-term speed prediction is solved, and higher prediction accuracy and robustness are achieved, which is better than traditional models.
Patent Information
- Application Number
- CN202111658013.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2041-12-30
AI Technical Summary
The existing technology is difficult to predict accurately in short-term ship speed prediction. Due to the lack of real-time engine status data, the model prediction results are uncertain, and the results of traditional methods have large errors and cannot meet actual needs.
A short-term ship speed prediction method based on time-series random forest is adopted. By introducing the ship's historical speed time series data into the random forest learner, a new prediction model is constructed to avoid the direct use of real-time engine monitoring data and use historical data and weather forecast data for prediction.
It improves the accuracy and robustness of the prediction model and can provide higher-accuracy short-term speed prediction results without relying on real-time engine monitoring data. It is better than the traditional model in terms of average absolute error, root mean square error and reliability. In terms of coefficient of determination.
Smart Images

Figure CN114330895B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of ship speed prediction, and in particular to a short-term ship speed prediction method based on time series random forest. Background Art
[0002] The estimation and prediction of ship speed has always been a very important topic in the shipping field. Compared with the speed estimation using observation data or reanalysis data, the prediction of ship speed at a future moment is often more difficult, but it is more in line with actual needs. There are two main reasons why it is difficult to have a high accuracy in speed prediction: First, in the prediction stage, the available data is very limited, usually only weather forecast data, static parameters of the ship and historical navigation data. The real-time monitoring data of the ship engine or propeller cannot be obtained in advance during the prediction, but this type of data is very important for speed estimation. Secondly, the forecast data used for ship speed prediction itself also has a certain degree of uncertainty, and the accuracy of weather forecasts will gradually decrease with time. Compared with long-term ship speed prediction, short-term prediction is less affected by the uncertainty of weather forecasts. Therefore, when some more accurate ship speed prediction values are required, relevant practitioners will give priority to short-term speed prediction. For example, when the data of the ship's automatic identification system cannot be obtained or transmitted in a short period of time due to some reasons, the ship needs to accurately predict the speed during this period to achieve route planning for safety or economic purposes; smart ships are a hot topic at the moment, and their automatic navigation or route planning systems also need short-term ship speed prediction values to provide data support. Therefore, the present invention is committed to proposing a new method to accurately predict the short-term speed of a ship when the available data is limited.
[0003] There are many solutions for short-term ship speed prediction, which are mainly divided into methods based on physical or empirical formulas and methods based on data-driven models, but both have certain defects. First, with the large-scale ships, the tonnage of ships has gradually exceeded the limit range in physical models or empirical formulas, and the results obtained have large errors. With the advent of the big data era, people have developed data-driven models that use relevant environmental data to predict ship speed. However, since many machine learning algorithms need to meet the conditions that the test data set and the training data set are independent and identically distributed, there is a lot of uncertainty in the prediction results of the model for a new data set.
[0004] By consulting the data, it is found that the total resistance encountered by a ship during navigation is mainly composed of the still water resistance related to the state of the ship's engine and the additional resistance related to external environmental factors. Therefore, it is naturally difficult for a data-driven model that only uses environmental factors for prediction to obtain satisfactory results. In order to improve the accuracy of the model, data about the state of the ship's engine needs to be input into the model, but the real-time monitored engine data cannot be easily used. First, the engine state of the ship during navigation is obviously not known in the pre-prediction stage; secondly, for some ships with older onboard equipment, there are also problems with the monitoring and transmission of real-time data, and generally only the daily noon report can be used. However, most of the data in the noon report are estimated values and cannot meet the requirements of the prediction experiment. Therefore, we need an innovative solution to introduce the state of the ship's engine into the model to improve the accuracy of the model. Summary of the invention
[0005] According to the technical problem that most of the data mentioned above are estimated values that cannot meet the experimental requirements, a short-term ship speed prediction method based on time series random forest is provided. The present invention mainly provides a short-term ship speed prediction method based on time series random forest, including the following steps:
[0006] Step S1, obtaining modeling data and performing data preprocessing;
[0007] Step S2, introducing time series data into the random forest learner to build a new prediction model framework;
[0008] Step S3, setting and training relevant parameters of the random forest model;
[0009] Step S4, making predictions using the trained random forest model;
[0010] Specifically, the step S2 further comprises the following steps:
[0011] Step S21, defining data sets and parameters;
[0012] Assume that MT is the preprocessed data set up to time T, where ET, ST and VT represent the ocean meteorological data set, the ship status data set and the water speed data set respectively; et, st and vt correspond to the data of the above data sets at a specific time point t respectively; b is defined as the length of the historical speed data, and p is the length predicted with the current time t as the node;
[0013] Step S22, assuming that A is a hyperrectangular cell corresponding to a node on the decision tree, and NT(A) represents the number of data falling into A; a cut on A is described by a data pair (j, z), where j represents a dimension between 1 and the input feature number, and z represents the position of the cut along j; in addition, assuming that the input feature Xt = (et, st, vt-1, vt-2, ..., vt-b), the output variable Yt = vt; thus, the classification and regression tree principle standard can be obtained by the following formula (1):
[0014]
[0015] in, represents the indicator function, It is the average value of Yt when Xt falls in A. If Xt is not in A, it is 0.
[0016] Next, by finding among all possible cuts such that L T The solution with the largest (j,z) is the optimal cutting solution (j,z) corresponding to A at this time;
[0017] Step S23, when the number of points finally contained in each cell is less than the set number, the construction of a single tree will stop;
[0018] Among them, the regression equation obtained by the i-th tree is As shown in formula (2):
[0019]
[0020] in, Represents the sub-dataset used to build the tree, A t is with X t The corresponding hyper-rectangular cell; the results obtained by constructing k trees are averaged to obtain the final result, as shown in formula (3):
[0021]
[0022] Step S24, taking the current time t as the dividing point, the water velocity v*t+1 at the next moment is determined by the method described in steps S22 and S23;
[0023] v*t+1 is used as the input feature value for the next prediction and re-input into the constructed model; after multiple cycles of iteration, the ship's water speed after a longer period of time is obtained; the specific iterative process is shown in formula (4):
[0024]
[0025]
[0026] Wherein, v*t represents the predicted value of the ship’s water speed corresponding to time t.
[0027] Compared with the prior art, the present invention has the following advantages:
[0028] 1. The present invention introduces the ship's historical speed time series data containing the engine status into the random forest regressor to obtain a new prediction model. Compared with the traditional model, this model has higher accuracy and stronger robustness.
[0029] 2. This model avoids the direct use of real-time monitoring data from the ship's engine. The ship's historical water speed data and weather and sea condition data can be easily obtained through the ship's automatic identification system or midday report and marine meteorological forecast, respectively, and the requirements for shipboard monitoring equipment are not high. The present invention has high accuracy and can predict the short-term speed of the ship in advance, thereby providing data support for subsequent navigation, collision avoidance and other operations, and can also be used for subsequent experimental analysis.
[0030] 3. When comparing the proposed short-term ship speed prediction model based on time series random forest with various classic time series models for ship speed prediction (autoregressive moving average model, Kalman filter model, long short-term memory artificial neural network model), the mean absolute error (MAE), root mean square error (RMSE) and determination coefficient (R^2) of the proposed model are better than those of the above models. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0032] Figure 1 It is a schematic diagram of the overall process of the present invention. DETAILED DESCRIPTION
[0033] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0035] like Figure 1 As shown, the present invention provides a short-term ship speed prediction method based on combining time series random forest, comprising the following steps:
[0036] Step S1, obtaining modeling data and performing data preprocessing. Specifically, the following steps are included:
[0037] Step S11, obtaining the ship's historical navigation data including but not limited to the ship's speed over the ground and the ship's draft through the ship-borne automatic identification system, and obtaining the weather and sea condition data corresponding to the navigation time through the marine meteorological forecast; the weather and sea condition data include but not limited to wind direction, wind speed, wave direction, wave height, swell direction, swell height, current direction, current speed and other data.
[0038] Step S12: Since the data acquired in step S11 includes multiple voyages of the ship, the data when the ship is docked at the port is deleted through the ship schedule and the ship's geographical location information, and the abnormal point data is deleted at the same time; the following data are considered as abnormal point data, specifically: 1. Lack of certain environmental feature data; 2. The wave height is 0m, but the wind speed is greater than 0.2kn; 3. The wave height and wave direction always appear in fixed pairs, such as 0m and 180°; 4. The current ground speed is 0. It can be understood that the abnormal data needs to be eliminated before the next step of processing can be carried out.
[0039] S13. In order to eliminate the influence of ocean current on the ship, the ship's speed over the ground is converted into the ship's speed over the water, as shown in formula (5):
[0040]
[0041] Among them, V stw Indicates the current ship's speed over water, V sog Indicates the ship's ground speed, V current is the velocity of the ocean current over the ground, Indicates the angle between the bow and the current direction;
[0042] S14. Analyze the ship's water speed for each voyage. If the data satisfies formula (6), the data will be considered as an outlier and deleted:
[0043]
[0044] Where erfc represents the complementary error function, Δ i represents the absolute error between the ith data and the mean of the data set, and σ represents the standard deviation of the data set.
[0045] Step S2: Introduce time series data into the random forest learner to build a new prediction model framework. Specifically, step S2 also has the following steps:
[0046] Step S21, define the data set and parameters; let MT be the data set that has been preprocessed up to time T, wherein ET, ST and VT represent the marine meteorological data set, the ship status data set and the water speed data set respectively; et, st and vt correspond to the data of the above data sets at a specific time point t respectively; define b as the length of the historical speed data, and p as the length predicted with the current time t as the node;
[0047] Step S22: There are many independent decision trees in the random forest learner. In the process of building each tree, the nodes on the tree are divided into two parts, and the cutting direction is determined by finding the direction that maximizes the "classification and regression tree principle" standard among all initial directions.
[0048] Specifically, assume that A is the hyperrectangular cell corresponding to a node on the decision tree, and NT(A) represents the number of data falling into A; a cut on A is described by a data pair (j, z), where j represents a dimension from 1 to the number of input features, and z represents the position of the cut along j; in addition, assume that the input feature Xt = (et, st, vt-1, vt-2, ..., vt-b), and the output variable Yt = vt; thus, the classification and regression tree principle standard can be obtained by the following formula (1):
[0049]
[0050] in, represents the indicator function, It is the average value of Yt when Xt falls in A. If Xt is not in A, it is 0.
[0051] Next, by finding among all possible cuts such that L T The solution with the largest (j,z) is the optimal cutting solution (j,z) corresponding to A at this time;
[0052] Step S23, when the number of points finally contained in each cell is less than the set number, the construction of a single tree will stop;
[0053] Among them, the regression equation obtained by the i-th tree is As shown in formula (2):
[0054]
[0055] in, Represents the sub-dataset used to build the tree, A t is with X t The corresponding hyper-rectangular cell; the results obtained by constructing k trees are averaged to obtain the final result, as shown in formula (3):
[0056]
[0057] Step S24, taking the current time t as the dividing point, the water velocity v*t+1 at the next moment is determined by the method described in steps S22 and S23;
[0058] v*t+1 is used as the input feature value for the next prediction and re-input into the constructed model; after multiple cycles of iteration, the ship's water speed after a longer period of time is obtained; the specific iterative process is shown in formula (4):
[0059]
[0060] Wherein, v*t represents the predicted value of the ship’s water speed corresponding to time t.
[0061] Step S3, setting and training relevant parameters of the random forest model. Specifically, step S3 also includes the following steps:
[0062] Step S31, determine the characteristic variables in the input model; in addition to determining the wind speed, wind direction, wave height, wave direction, swell height, swell direction and ship draft, it is also necessary to determine the value of the length b of the historical speed data; in the present application, the value of the length b of the historical speed data is determined by a preliminary experimental method, different b values are input, and the root mean square error between the predicted result and the actual measured value is calculated, and finally the b value corresponding to the minimum prediction error is selected as the final result.
[0063] Step S32, using k-fold cross validation, by minimizing the model prediction error, determine the five hyperparameters of the model, namely: the maximum depth of the tree, the minimum number of data required to split a node, the minimum number of data required to form a node, the number of decision trees contained in the forest, and the number of features to be considered when finding the best split of a node in each decision tree;
[0064] Step S33: According to the determined parameters and input variables, the final random forest model is trained.
[0065] Step S4, making predictions using the trained random forest model; making predictions using the trained random forest model includes single-step predictions and multi-step predictions.
[0066] In the present application, in a single-step prediction, the corresponding input variables in the random forest model are input, that is, the ship's water speed at a certain moment is accurately predicted; when a backward prediction is required, the input variables corresponding to the model are re-entered for the prediction point.
[0067] As a preferred implementation, during multi-step prediction, the corresponding input variables and the prediction step length p in the random forest model are input, and after the speed through the water of the first data point is predicted, there is no need to continue to input the actual measurement data; the random forest model uses the predicted speed as a new input feature, combined with the meteorological forecast data, to predict the speed of the ship through the water for subsequent data points until the set prediction step length is reached.
[0068] Example 1
[0069] The present invention is experimentally compared with the autoregressive moving average model (ARMA), the Kalman filter model (KF), and the long short-term memory artificial neural network model (LSTM) under the same data set, as shown in Table 1 and Table 2. The model of the present invention is superior to the other five models in terms of mean absolute error (MAE), root mean square error (RMSE), and coefficient of determination (R^2) in both single-step prediction and multi-step prediction modes.
[0070] Table 1 Comparison of single-step prediction experimental results
[0071]
[0072] Table 2 Comparison of multi-step prediction experimental results
[0073]
[0074] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0075] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0076] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A short-term ship speed prediction method based on time series random forest, characterized in that: The following steps are involved: S1, obtain modeling data and perform data preprocessing; S2, introduce time series data into random forest learner to build a new prediction model framework; S3, setting and training relevant parameters of the random forest model; S4, making predictions using the trained random forest model; Specifically, the step S2 further comprises the following steps: S21, define the data set and parameters; Assume that MT is the preprocessed data set up to time T, where ET, ST and VT represent the ocean meteorological data set, the ship status data set and the water speed data set respectively; et, st and vt correspond to the data of the above data sets at a specific time point t respectively; b is defined as the length of the historical speed data, and p is the length predicted with the current time t as the node; S22. Assume that A is the hyperrectangular cell corresponding to a node on the decision tree, and NT(A) represents the number of data falling into A; a cut on A is described by a data pair (j, z), where j represents a dimension between 1 and the number of input features, and z represents the position of the cut along j; in addition, assume that the input feature Xt = (et, st, vt-1, vt-2, ..., vt-b), and the output variable Yt = vt; thus, the classification and regression tree principle standard can be obtained by the following formula (1): in, represents the indicator function, It is the average value of Yt when Xt falls in A. If Xt is not in A, the indicator function takes 0; Next, by finding among all possible cuts such that L T The solution with the largest (j,z) is the optimal cutting solution (j,z) corresponding to A at this time; S23. When each cell finally contains less than the set number of points, the construction of a single tree will stop; Among them, the regression equation obtained by the i-th tree is As shown in formula (2): in, Represents the sub-dataset used to build the tree, A t is with X t The corresponding hyperrectangular cell; The final result is obtained by taking the average of the results obtained from the constructed k trees, as shown in formula (3): S24, taking the current time t as the dividing point, the water velocity v*t+1 at the next moment is determined by the method described in step S22 and step S23; v*t+1 is used as the input feature value for the next prediction and re-input into the constructed model; after multiple cycles of iteration, the ship's water speed after a longer period of time is obtained; the specific iterative process is shown in formula (4): Wherein, v*t represents the predicted value of the ship’s water speed corresponding to time t.
2. According to claim 1, a short-term ship speed prediction method based on combining time series random forest is characterized by: The step S1 further comprises the following steps: S11. Obtain historical navigation data of the ship through the ship-borne automatic identification system, and obtain weather and sea condition data corresponding to the navigation time through the marine meteorological forecast; S12. Since the data acquired in step S11 includes multiple voyages of the ship, the data of the ship docking at the port is deleted through the ship schedule and the ship's geographical location information, and the abnormal point data is deleted; S13. In order to eliminate the influence of ocean current on the ship, the ship's speed over the ground is converted into the ship's speed over the water, as shown in formula (5): Among them, V stw Indicates the current ship's speed over water, V sog Indicates the ship's ground speed, V current is the velocity of the ocean current over the ground, Indicates the angle between the bow and the current direction; S14. Analyze the ship's water speed for each voyage. If the data satisfies formula (6), the data will be considered as an outlier and deleted: Where erfc represents the complementary error function, Δ i represents the absolute error between the ith data and the mean of the data set, and σ represents the standard deviation of the data set.
3. The short-term ship speed prediction method based on time series random forest according to claim 1 is characterized by: The step S3 further comprises the following steps: S31, determine the characteristic variables in the input model; in addition to determining the historical navigation data of the ship and the weather and sea conditions data, it is also necessary to determine the value of the length b of the historical speed data; S32. Using k-fold cross validation, the five hyperparameters of the model are determined by minimizing the model prediction error, namely: the maximum depth of the tree, the minimum number of data required to split a node, the minimum number of data required to form a node, the number of decision trees contained in the forest, and the number of features to consider when finding the best split of a node in each decision tree; S33. According to the determined parameters and input variables, the final random forest model is trained.
4. The method for short-term ship speed prediction based on time series random forest according to claim 3 is characterized in that: The length b of the historical speed data is determined by a preliminary experiment method, by inputting different b values, calculating the root mean square error between the predicted result and the actual measured value, and finally selecting the b value corresponding to the minimum predicted error as the final result.
5. The short-term ship speed prediction method based on combining time series random forest according to claim 1 is characterized by: The prediction performed by the trained random forest model includes single-step prediction and multi-step prediction.
6. The short-term ship speed prediction method based on combining time series random forest according to claim 5 is characterized by: In the single-step prediction, the corresponding input variables in the random forest model are input, that is, the ship's water speed at a certain moment is accurately predicted; when backward prediction is required, the input variables corresponding to the model are re-entered for the prediction point.
7. The method for short-term ship speed prediction based on time series random forest according to claim 5 is characterized in that: During the multi-step prediction, the corresponding input variables and the prediction step length p in the random forest model are input, and after the water speed of the first data point is predicted, there is no need to continue to input real measurement data; the random forest model uses the obtained predicted speed as a new input feature, combined with the meteorological forecast data, to predict the water speed of the ship at subsequent data points until the set prediction step length is reached.
Citation Information
Cited By
Bulk cargo ship navigational speed prediction system based on feature engineering and integrated tree model
CN121211408A
Bulk carrier speed prediction system based on feature engineering and ensemble tree model
CN121211408B
