Port throughput prediction method, model training method, system and device and medium
Through machine learning algorithms and Shapley's interpretation model, filtering key factors, combining stacked long short-term memory networks, a port throughput prediction model is built, which solves the problems of port throughput prediction accuracy and computational burden, and achieves more efficient prediction and better prediction decision support.
Patent Information
- Application Number
- CN202410948137.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2024-11-19
AI Technical Summary
In complex environments, it is difficult for the prior art to accurately predict port throughput, and the calculation burden of the prediction process is high, resulting in accuracy and efficiency problems.
A machine learning algorithm is used to build a port throughput prediction model, combined with the Shapley interpretation model and a stacked long short-term memory network, the key influencing factors are selected, and the prediction model based on these factors is constructed to reduce the amount of prediction operations.
Improves the accuracy of port throughput predictions, while reducing the amount of prediction operations, enhancing the transparency and interpretability of the model, and helping shipping companies optimize routes and resource allocation.
Smart Images

Figure CN118982091A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of port operation, and in particular to a port throughput prediction method, a model training method, a system, a device and a medium. Background Art
[0002] Coastal ports are responsible for the import and export of most goods. The throughput of container ports can indirectly reflect the operating conditions of ports. Accurately predicting the port container throughput can help shipping companies make wise decisions on route optimization and resource allocation, which will help promote the development of the entire shipping industry. In a complex environment, changes in port throughput are affected by many factors. Considering multiple factors to predict the throughput of coastal ports can capture various variables that may affect port operations, which helps to improve the accuracy of the prediction, but it also increases the amount of calculation required for the prediction, resulting in a heavy computational burden. Summary of the invention
[0003] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes a port throughput prediction method, model training method, system, device and medium, which can improve the accuracy of port throughput prediction while reducing the amount of prediction calculation.
[0004] On the one hand, an embodiment of the present invention provides a method for constructing a port throughput prediction model, comprising the following steps:
[0005] Obtain sample data on multiple candidate throughput influencing factors and port throughput time series;
[0006] Using a machine learning algorithm, constructing a machine learning prediction model based on the sample data and the port throughput time series;
[0007] The prediction results of the machine learning prediction model are explained and analyzed by using the Shapley interpretation model to obtain the characteristic contribution value of each candidate throughput influencing factor;
[0008] Selecting at least one target throughput influencing factor from the plurality of candidate throughput influencing factors according to the characteristic contribution value;
[0009] A port throughput prediction model based on a stacked long short-term memory network architecture is constructed according to the characteristic contribution values of the target throughput influencing factors and the port throughput time series.
[0010] In some embodiments, the use of a machine learning algorithm to construct a machine learning prediction model based on the sample data and the port throughput time series includes the following steps:
[0011] Inputting the sample data and the port throughput time series into the XGBoost model for prediction, and obtaining a first throughput prediction value of the decision tree in the XGBoost model;
[0012] Obtaining a loss function of the decision tree according to the first throughput prediction value and the corresponding actual throughput value in the port throughput time series;
[0013] According to the loss function and regularization term of all decision trees, the objective function of the XGBoost model is obtained, wherein the regularization term is used to characterize the complexity of the model;
[0014] In order to minimize the objective function target, by solving the objective function, the optimal leaf node value of the decision tree in the XGBoost model is updated, and the decision tree is subjected to node splitting based on the candidate throughput influencing factors by using a greedy algorithm to update the leaf nodes of the decision tree, and a machine learning prediction model is obtained based on the updated XGBoost model.
[0015] In some embodiments, the explanation and analysis of the prediction results of the machine learning prediction model by using the Shapley interpretation model to obtain the feature contribution value of each candidate throughput influencing factor includes the following steps:
[0016] Calculate a second throughput prediction value of the input sample according to the machine learning prediction model;
[0017] Determine a throughput prediction average value according to the second throughput prediction values of all samples in the sample data;
[0018] Based on the SHAP value distribution formula, the feature contribution value of each candidate throughput influencing factor is determined according to the second throughput prediction value and the throughput prediction average value of the samples.
[0019] In some embodiments, the step of selecting at least one target throughput influencing factor from the plurality of candidate throughput influencing factors according to the characteristic contribution value comprises the following steps:
[0020] Compare the characteristic contribution value of each of the candidate throughput influencing factors with the contribution threshold respectively;
[0021] The candidate throughput influencing factors whose characteristic contribution values are greater than the contribution threshold are determined as target throughput influencing factors.
[0022] In some embodiments, constructing a port throughput prediction model based on a stacked long short-term memory network architecture according to the characteristic contribution values of the target throughput influencing factors and the port throughput time series comprises the following steps:
[0023] Initialize the port throughput prediction model based on the stacked long short-term memory network architecture;
[0024] Inputting the sample data, the characteristic contribution value of the target throughput influencing factor and the port throughput time series into the initialized port throughput prediction model to obtain a third throughput prediction value;
[0025] The port throughput prediction model is continuously updated in reverse according to the third throughput prediction value and the port throughput time series until a preset condition is met, thereby obtaining a constructed port throughput prediction model.
[0026] In some embodiments, the port throughput prediction model includes an input gate, a forget gate, and an output gate;
[0027] The forget gate is used to selectively forget the information in the cell state at the previous moment according to the characteristic contribution value of the target throughput influencing factor;
[0028] The input gate is used to obtain input data, perform feature extraction on the input data, and update the extracted features into the cell state, wherein the input data includes throughput influencing factor data and historical port throughput;
[0029] The output gate is used to obtain the port throughput prediction value according to the information in the updated cell state.
[0030] On the other hand, an embodiment of the present invention further provides a port throughput prediction method, comprising the following steps:
[0031] Obtain data on factors affecting throughput and historical port throughput;
[0032] The throughput influencing factor data and the historical port throughput are input into a port throughput prediction model to obtain a port throughput prediction value, wherein the port throughput prediction model is constructed by the port throughput prediction model construction method described in the above embodiment.
[0033] On the other hand, an embodiment of the present invention further provides a port throughput prediction model construction system, comprising:
[0034] The first module is used to obtain sample data on multiple candidate throughput influencing factors and port throughput time series;
[0035] The second module is used to use a machine learning algorithm to build a machine learning prediction model based on the sample data and the port throughput time series;
[0036] The third module is used to interpret and analyze the prediction results of the machine learning prediction model through the Shapley interpretation model to obtain the feature contribution value of each candidate throughput influencing factor;
[0037] A fourth module is configured to select at least one target throughput influencing factor from the plurality of candidate throughput influencing factors according to the characteristic contribution value;
[0038] The fifth module is used to construct a port throughput prediction model based on a stacked long short-term memory network architecture according to the characteristic contribution values of the target throughput influencing factors and the port throughput time series.
[0039] On the other hand, an embodiment of the present invention also provides an electronic device, including:
[0040] at least one processor;
[0041] at least one memory for storing at least one program;
[0042] When the at least one program is executed by the at least one processor, the at least one processor implements the port throughput prediction model construction method or the port throughput prediction method as described above.
[0043] On the other hand, an embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the port throughput prediction model construction method or port throughput prediction method as described above.
[0044] The above technical solution of the present invention has at least one of the following advantages or beneficial effects: first, sample data and port throughput time series about multiple candidate throughput influencing factors are obtained, and then a machine learning algorithm is used to build a machine learning prediction model based on the sample data and the port throughput time series, and then the prediction results of the machine learning prediction model are interpreted and analyzed by the Shapley interpretation model to obtain the feature contribution value of each candidate throughput influencing factor, and the target throughput influencing factors with greater influence are screened out from the multiple candidate throughput influencing factors according to the feature contribution value, and a port throughput prediction model based on a stacked long short-term memory network architecture is built according to the feature contribution value of the target throughput influencing factor and the port throughput time series, so that the model can focus on the features in the input data that have a great impact on the prediction results according to the feature contribution value of the target throughput influencing factor, and can reduce the prediction calculation amount while improving the accuracy of port throughput prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 is a flow chart of a method for constructing a port throughput prediction model provided by an embodiment of the present invention;
[0046] Figure 2 It is a schematic diagram of the stacked LSTM model architecture provided by an embodiment of the present invention;
[0047] Figure 3 Schematic diagram of a single LSTM network structure provided by an embodiment of the present invention;
[0048] Figure 4 Schematic diagram of the construction process of the port throughput prediction model provided by an embodiment of the present invention;
[0049] Figure 5 is a flow chart of a port throughput prediction method provided by an embodiment of the present invention;
[0050] Figure 6 is a schematic diagram of SHAP values of various throughput influencing factors provided by an embodiment of the present invention;
[0051] Figure 7 It is a schematic diagram comparing the packing throughput predicted by the model provided in an embodiment of the present invention and the actual throughput;
[0052] Figure 8 is a general analysis diagram of characteristic contribution values of various throughput influencing factors provided by an embodiment of the present invention;
[0053] Fig. 9 is a force-directed graph of the SHAP model provided in an embodiment of the present invention;
[0054] Fig.10 is a waterfall chart of the SHAP model provided by an embodiment of the present invention;
[0055] Fig.11 This is a schematic diagram of the distribution of characteristic values and SHAP values of the primary industry GDP factor provided by an embodiment of the present invention;
[0056] Fig.12 It is a schematic diagram of the characteristic value and SHAP value distribution of the secondary industry GDP factor provided by an embodiment of the present invention;
[0057] Fig.13 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0058] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar components or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0059] In the description of the present invention, it should be understood that descriptions involving orientation, such as up, down, left, right, etc., the orientations or positional relationships indicated are based on the orientations or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.
[0060] In the description of the present invention, if there is a description of first, second, etc., it is only for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the sequence of the indicated technical features.
[0061] The embodiment of the present invention provides a method for constructing a port throughput prediction model and a port throughput prediction method implemented by using the port throughput prediction model. The method for constructing a port throughput prediction model and the port throughput prediction method in the embodiment of the present application can be applied to a terminal, can be applied to a server, and can also be software running in a terminal or a server. The terminal can be a tablet computer, a laptop computer, a desktop computer, etc., but is not limited thereto. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0062] Reference Figure 1 As shown, the method for constructing a port throughput prediction model according to an embodiment of the present invention includes but is not limited to steps S110 to S160.
[0063] Step S110, obtaining sample data on a plurality of candidate throughput influencing factors and a port throughput time series;
[0064] Step S120, using a machine learning algorithm to build a machine learning prediction model based on sample data and port throughput time series;
[0065] Step S130, interpreting and analyzing the prediction results of the machine learning prediction model through the Shapley interpretation model to obtain the characteristic contribution value of each candidate throughput influencing factor;
[0066] Step S140, selecting at least one target throughput influencing factor from a plurality of candidate throughput influencing factors according to the characteristic contribution value;
[0067] Step S150, constructing a port throughput prediction model based on a stacked long short-term memory network architecture according to the characteristic contribution values of the target throughput influencing factors and the port throughput time series.
[0068] In some embodiments of step S110, the relevant data of the container throughput of coastal ports are collected and integrated to obtain sample data of multiple candidate throughput influencing factors and port throughput time series, and can be further divided into a training data set and a test data set, the training data set is used to build a port throughput prediction model, and the test data set is used to test the effect of the port throughput prediction model. Exemplarily, the multiple candidate throughput influencing factors of this embodiment may include hinterland economy, port collection and distribution level, industrial development level, weather, statutory holidays and other factors, that is, the sample data of the candidate throughput influencing factors may be hinterland economy data, port collection and distribution level data, industrial development level data, weather conditions, date, etc.
[0069] In some embodiments of step S120, a machine learning algorithm is used to learn the mapping relationship between sample data at a certain moment (i.e., data of multiple candidate throughput influencing factors) and the port throughput at the corresponding moment in the port throughput time series. Thus, a machine learning prediction model that can reflect the mapping relationship is obtained. In some embodiments, the machine learning algorithm used can be logistic regression, decision tree, random forest, etc.
[0070] In some embodiments, step S120 may include but is not limited to the following steps:
[0071] Step S210, inputting the sample data and the port throughput time series into the XGBoost model for prediction, and obtaining the first throughput prediction value of the decision tree in the XGBoost model;
[0072] Step S220, obtaining a loss function of a decision tree according to the first throughput prediction value and the corresponding actual throughput value in the port throughput time series;
[0073] Step S230, obtaining the objective function of the XGBoost model according to the loss functions and regularization terms of all decision trees, wherein the regularization term is used to characterize the complexity of the model;
[0074] Step S240, in order to minimize the objective function target, by solving the objective function, the optimal leaf node value of the decision tree in the XGBoost model is updated, and the node splitting of the decision tree based on the candidate throughput influencing factors is performed using a greedy algorithm to update the leaf nodes of the decision tree, and a machine learning prediction model is obtained based on the updated XGBoost model.
[0075] In this embodiment, the XGBoost model algorithm can be used to build a machine learning prediction model. XGBoost (eXtreme Gradient Boosting) is an optimization algorithm based on gradient boosting trees. It gradually builds multiple decision trees by using gradient boosting, and improves model performance by optimizing the objective function. It has high efficiency and scalability. In gradient boosting, the selected subsequent model will be able to minimize the residual of the previous model. By minimizing the residual, the subsequent model will actually support the correct classification of samples that were misclassified in the previous order (residual modeling). XGBoost can build different branches of each decision tree in parallel, thereby speeding up the model building process; it can handle missing data; and it uses regularization, which can prevent a single predictor variable from having too much influence on the entire prediction.
[0076] Specifically, the process of building a machine learning prediction model is as follows:
[0077] The sample data and port throughput time series are processed to obtain a training data set. There are n training samples in the training data set. Each training sample has D feature values and its corresponding dependent variable, that is, D candidate throughput influencing factor data and the corresponding port throughput. At the tth tree, the first throughput prediction value for the i-th training sample is shown in formula (1):
[0078]
[0079] Among them, f t (x i ) is the prediction contribution of training sample i in the tth tree, x i is the feature vector of training sample i, containing D components, is the first throughput prediction value of training sample i in the (t-1)th round, is the first throughput prediction value of training sample i in round t.
[0080] The eigenvalue indirectly affects the optimization of the loss function by affecting the construction of each decision tree. The loss function of the decision tree is shown in formula (2):
[0081]
[0082] On the basis of formula (2), the regularization term is added to obtain the objective function of the XGBoost model, as shown below:
[0083]
[0084] Where T is the number of leaf nodes, ω jis the value of the leaf node, γ and λ are coefficients. The Taylor second-order expansion of the objective function is performed to obtain the approximate calculation results shown in equations (4) to (6).
[0085]
[0086] in, express The partial derivative of g i and c i are the first and second order derivatives of the loss function, respectively.
[0087] Based on formulas (7) to (8), the objective function after Taylor's second-order expansion is solved. j Contains the index of all data samples that make split decisions on node j, so that the objective function is minimized and the optimal leaf node value is obtained. as follows:
[0088]
[0089] After determining the optimal leaf node value, a greedy algorithm is used to perform node partitioning. For each leaf node, all features and single features are enumerated as splitting points and split, and the splitting benefit is calculated. The splitting benefit calculation method is shown in formula (9).
[0090]
[0091] Where L is the number of samples on the left side of the split node, and R is the number of samples on the right side. L and G R Respectively represent the sum of the gradients of the left node (Left) and the right node (Right) in the decision tree. L and H R Usually represents the sum of the second-order derivatives of the left and right subtree samples, they are used to provide more accurate step size estimates in the update of the model.
[0092] In some embodiments of step S130, Shapley interpretation is also called Shapley Additive exPlanations (SHAP), which is a method for explaining the prediction results of machine learning models. It is based on the Shapley value theory in game theory, and provides global and local interpretability for the model by calculating the contribution of each feature to the prediction results. The core idea of SHAP is to distribute the "value" of the feature, and each feature can get a corresponding contribution in different feature combinations. Specifically, SHAP determines its contribution to the model prediction results by calculating the Shapley value (i.e., feature contribution value) of each feature. Shapley value is a concept in classic game theory, which is used to evenly distribute the total revenue of a team. In SHAP, each feature is regarded as a member of a team, the prediction result of the model is the total revenue of the team, and the Shapley value represents the contribution of each feature to the prediction result in different feature combinations. In this embodiment, the prediction results of the machine learning prediction model are explained and analyzed by the Shapley interpretation model to obtain the feature contribution value of each candidate throughput influencing factor, which is subsequently referred to as the SHAP value.
[0093] In some embodiments, step S130 may include but is not limited to the following steps:
[0094] Step S310, calculating a second throughput prediction value of the input sample according to the machine learning prediction model;
[0095] Step S320, determining a throughput prediction average value according to the second throughput prediction values of all samples in the sample data;
[0096] Step S330 , based on the SHAP value distribution formula, and according to the second throughput prediction value and the throughput prediction average value of the sample, determine the feature contribution value of each candidate throughput influencing factor.
[0097] In this embodiment, after the machine learning prediction model is trained, the SHAP model is used to interpret and analyze the results according to the prediction process. Assume that the i-th training sample is x i , the jth eigenvalue of the training sample is x ij , the machine learning prediction model predicts the second throughput of the i-th training sample as y i , the mean of all samples is y mean , then x ij The SHAP value distribution of follows the following equation:
[0098] y i =y mean +f(x i ,1)+f(x i,2)+L+f(x i ,k); (10)
[0099] Among them, f(x i ,j) is x ij This addition method can eliminate the differences in explanations between models. The feature contribution value of each candidate throughput influencing factor can be calculated by formula (10).
[0100] In this embodiment, in the traditional port throughput prediction, it is easy to ignore the diverse factors that affect the port throughput, or it is impossible to effectively handle the nonlinear relationship between these factors. Although many high-performance prediction models (such as deep learning models) can learn the nonlinear relationship between variables, these models are usually regarded as "black boxes" and cannot explain how various features affect the dependent variables during the model learning process. This embodiment, by combining SHAP and XGBoost models, can identify and quantify the relevant influencing factors of port throughput and the degree of influence of influencing factors on port throughput prediction, and use SHAP values to interpret the XGBoost model to improve the interpretability of the model. The specific contribution of each variable to the prediction result can be intuitively seen, which increases the transparency and credibility of the model.
[0101] Compared with the traditional feature importance evaluation method (such as the built-in FeatureImportance of XGBoost), the SHAP model used in this embodiment of the present invention can not only provide a global view (i.e., the average SHAP value of all data points), but also explain a single prediction result. How the features affect the prediction value (positively or negatively) and the interaction effect between the features can effectively explain how the influencing factors act on the throughput, which is helpful for subsequent port operation optimization and decision-making.
[0102] In some embodiments of step S140, the candidate throughput influencing factor data and throughput time series are imported into the XGBoost model for training, and the model output and feature importance are interpreted by the SHAP model. Then, the feature contribution values calculated by the SHAP model are used to screen out candidate throughput influencing factors that have a greater impact on port throughput as target throughput influencing factors.
[0103] In some embodiments, step S140 may include but is not limited to the following steps:
[0104] Step S410, comparing the characteristic contribution value of each candidate throughput influencing factor with the contribution threshold value respectively;
[0105] Step S420: Determine the candidate throughput influencing factors whose characteristic contribution values are greater than the contribution threshold as target throughput influencing factors.
[0106] In this embodiment, the feature contribution value of each candidate throughput influencing factor can be compared with a contribution threshold preset by the system, and the candidate throughput influencing factor whose feature contribution value is greater than the contribution threshold is determined as the target throughput influencing factor, thereby obtaining the influencing factor features that have a greater impact on the prediction result.
[0107] In another embodiment, the candidate throughput influencing factors may be ranked in descending order according to their feature contribution values, and the top several candidate throughput influencing factors may be determined as target throughput influencing factors, thereby obtaining influencing factor features that have a greater impact on the prediction result.
[0108] In some embodiments of step S150, the target throughput influencing factors and throughput time series are introduced into a stacked LSTM (SLSTM) network architecture for training and learning, thereby obtaining a port throughput prediction model that can achieve multivariate throughput prediction. Figure 2 The stacked LSTM (SLSTM) network architecture uses LSTM (Long Short-Term Memory) units as the basis of the stacked architecture. LSTM is a variant of RNN (Recurrent Neural Network) that can overcome the gradient vanishing and exploding problems in RNN. The LSTM network controls the prior state, current input, and current memory by using three different gates (input gate, forget gate, and output gate). For multi-feature dependent and nonlinear sequence data, a single LSTM network is more difficult to capture the long-distance dependency and multi-feature information between the beginning and end of the sequence. Each layer of the stacked LSTM (Stacked LSTM) can process information from the previous layer, which can more effectively fuse various types of features and capture more complex data patterns, effectively improving the accuracy of predictions.
[0109] In some embodiments, the port throughput prediction model based on the stacked LSTM network architecture includes an input gate, a forget gate, and an output gate. The forget gate is used to selectively forget the information in the cell state at the previous moment according to the feature contribution value of the target throughput influencing factor. The input gate is used to obtain input data, extract features from the input data, and update the extracted features to the cell state, wherein the input data includes throughput influencing factor data and historical port throughput. The output gate is used to obtain the port throughput prediction value according to the information in the updated cell state.
[0110] For details, please refer to Figure 3 , the LSTM neuron structure defines the input as X = (x1, x2, ..., xt ), the output is Y=(y1,y2,…,y t ). The expression of the input gate is as shown in formulas (11) and (12):
[0111] i t (inputgate)=σ(V i x t +U t h t-1 +b i );(11)
[0112] Z t =tanh(V c x t +U c h t-1 +b c ); (12)
[0113] Among them, V i , V c , U t , U c represents the weight of the input gate, b i , b c represents the bias of the input gate, σ and tanh represent the sigmoid function and hyperbolic function respectively, Z t is a candidate hidden state generated by the current input and the previous hidden state. t-1 is the hidden state of the previous time step, x t is the input for the current time step.
[0114] Forgotten goalkeeper x t and the hidden state h at the previous moment t-1 As input, the expression of the forget gate is shown in (13):
[0115] f t (forgetgate)=σ(V f x t +U f h t-1 +b f ); (13)
[0116] Where V f and U f represents the weight of the forget gate, b f is the bias of the forget gate.
[0117] The calculation process of the output gate and the current hidden state is as follows:
[0118] o t (outputgate)=σ(V o xt +U o h t-1 +b o );(14)
[0119]
[0120] Among them, V o , U o represents the weight of the output gate, b o Indicates the output bias. C t Represents the cell state at time step t.
[0121] In the forward transmission process of the port throughput prediction model, after the sample data of throughput influencing factors, the contribution values of the factors with greater influence and the port throughput time series are input into the cascade neural network architecture, in each single LSTM model, the input gate controls the impact of the influencing factor characteristics of the current input high SHAP value on the unit state; the forget gate determines how many previous units to retain; and the output gate determines the content to be output to the next hidden state based on the current unit state.
[0122] In some embodiments, step S150 may include but is not limited to the following steps:
[0123] Step S510, initializing a port throughput prediction model based on a stacked long short-term memory network architecture;
[0124] Step S520, inputting the sample data, the characteristic contribution values of the factors affecting the target throughput, and the port throughput time series into the initialized port throughput prediction model to obtain a third throughput prediction value;
[0125] Step S530, continuously and reversely updating the port throughput prediction model according to the third throughput prediction value and the port throughput time series until a preset condition is met, thereby obtaining a constructed port throughput prediction model.
[0126] In this embodiment, after the architecture of the port throughput prediction model is initialized based on the stacked long short-term memory network architecture, the parameters of the port throughput prediction model are initialized, and then the initialized port throughput prediction model is trained. In the LSTM training phase, after the LSTM model performs forward prediction based on sample data, characteristic contribution values of target throughput influencing factors and port throughput time series, the weight and partial rank value of the network are adjusted through back propagation and gradient descent methods based on the predicted third throughput prediction value and the actual port throughput at the future moment, so as to minimize the difference between the predicted value and the actual value. At the same time, in the case of important related features, LSTM can capture the complex relationship between these features and port throughput, directly affecting the decision of the model at each time step, thereby providing accurate predictions.
[0127] Furthermore, if Figure 2 As shown in the figure, a stacked LSTM architecture is constructed using several LSTM units. Each layer of LSTM has the same hidden nodes, and the output feature vector of each layer is used as the input of the next layer. Each layer of LSTM can capture specific features in the data. As the number of layers increases, the model can learn more and more complex patterns in the data and capture the temporal dynamics of sequence data at different levels, not only limited to capturing recent information, but also including learning and memorizing long-term dependencies.
[0128] According to some embodiments of this application, please refer to Figure 4 The specific construction process of the port throughput prediction model of the embodiment of the present application is described as follows:
[0129] First, analyze the factors affecting port throughput, including the level of port collection and distribution, the level of hinterland economic trade, and other factors such as the level of industrial development. Then obtain the relevant data of the factors affecting port throughput, and input the relevant data of the factors affecting port throughput and the historical port throughput time series into the XGBoost model for training. Combined with the SHAP model, analyze the degree of influence of the factors affecting port throughput on the prediction results of the XGBoost model to obtain the characteristic contribution value of the factors affecting port throughput, and use the characteristic contribution value to screen out important factors. Input the important factors and the port throughput time series into the stacked LSTM model for training, so that the model outputs the prediction results at future moments. Furthermore, the prediction results output by the stacked LSTM model can be evaluated and feature analysis can be performed based on the prediction results output by the model.
[0130] Please refer to Figure 5 The embodiment of the present invention also provides a port throughput prediction method, comprising the following steps:
[0131] Step S610, obtaining throughput influencing factor data and historical port throughput;
[0132] Step S620, inputting the throughput influencing factor data and the historical port throughput into the port throughput prediction model to obtain the port throughput prediction value, wherein the port throughput prediction model is constructed by the port throughput prediction model construction method of the above embodiment.
[0133] According to some embodiments of the present application, the effective effect of the port throughput prediction model constructed in the embodiments of the present application is described in detail below in combination with actual application scenarios, as follows:
[0134] In this embodiment, the monthly container freight volume of a coastal port is used as the research object, the container freight volume data of Haikou Port from January 2000 to January 2023 is selected as the research sample, and the data is interpolated, error value cleaning and other processing are performed.
[0135] Using the relevant steps of the above embodiment, XGBoost is used to predict the input data. Combined with data collection and quality, the following ten throughput influencing factors are selected: Primary Industry GDP, Secondary Industry GDP, Tertiary Industry GDP, Population, Total Retail Sales of Consumer Goods, Number of berths, Number of Severe Weather Events, Import and Export Trade Value, Transportation Consumer Price Index, Waterway Freight Turnover, and the SHAP model is used to calculate the feature importance. The SHAP values of each throughput influencing factor are as follows: Figure 6 shown.
[0136] The features with larger SHAP values are selected as important influencing factors and input into the stacked LSTM model together with the port throughput time series for prediction. The configuration parameters defined by the XGBoost model and the LSTM model are shown in Table 1.
[0137] Table 1 Configuration parameters of XGBoost model and LSTM model
[0138]
[0139]
[0140] The original data set is divided into 80% and 20%. This study uses three evaluation indicators to quantitatively analyze the prediction results of the LSTM model, namely RMSE (Root Mean Squared Error), MAE (Mean Absolute Error) and MAPE (Mean Absolute Percentage Error). The definition of the evaluation indicators is shown in Table 2:
[0141] Table 2 Definition of evaluation indicators
[0142]
[0143] The container throughput prediction results output by the single variable prediction S-LSTM model, the container throughput prediction results output by the S-LSTM model (S-LSTM with features) in this embodiment that considers the characteristics of important influencing factors, and the actual container throughput are compared. The comparison results are as follows: Figure 7 As shown, Figure 7 The horizontal axis represents time in months, and the vertical axis represents container throughput.
[0144] The model is evaluated according to the evaluation indicators, and the model evaluation results are shown in Table 3:
[0145] Table 3 Model evaluation results
[0146]
[0147] Impact feature analysis: Figure 8 This is a general analysis of the feature contribution values of the factors affecting throughput. The vertical axis in the figure represents a feature, which is arranged from top to bottom in terms of importance. The horizontal axis represents the SHAP value, and each point represents a sample. The pinker the color, the larger the value of the feature itself, and the bluer the color, the smaller the value of the feature itself. The dense area shows the behavior of most data. Figure 8 The bee swarm diagram shows that the SHAP values of the primary industry GDP and the total retail sales of consumer goods in the diagram are mostly concentrated at 0, indicating that these two features have little impact on throughput. If the points are concentrated in the area with negative SHAP values, it means that the feature is negatively correlated with the dependent variable during the prediction process, and vice versa if the SHAP value is positive.
[0148] For a single prediction result in XGBoost, Force Plot can explain how each feature affects the model's single decision, that is, the impact on a single prediction value. Fig. 9 For example, the contribution value of a feature in the model output is 1.37. The base value is the average of the model output and the training data. The number below the drawing arrow is the normalized feature contribution value. In the figure, features that increase the prediction result are represented in red, and features that decrease the prediction result are represented in blue. The longer the arrow, the greater the impact of the feature on this single output. Through this figure, you can find out how these features will affect the prediction results for a specific month in a certain year in the prediction results.
[0149] Waterfall Plot can show each step from the baseline output of the model to the final predicted value, how each factor contributes one by one, and the vertical axis is the importance of the feature from high to low, which can clearly show the model decision-making process. Fig.10 As shown in the figure, f(x) represents the predicted value, and the gray number next to the ordinate represents the cumulative sum of the predicted values after adding the contribution of the feature. Fig.10 The number on the arrow shows the specific numerical contribution of each feature, that is, the SHAP value of the feature.
[0150] In addition to ranking the overall influencing factors, individual characteristics can also be analyzed. Fig.11 Taking the GDP of the primary industry as an example, for this feature, the characteristic value of the horizontal axis and the SHAP value of the vertical axis have no obvious correlation, and the distribution is relatively scattered. Fig.12 , the secondary industry GDP is positively correlated with the SHAP value, which means that when the secondary industry GDP increases, the port throughput will also increase.
[0151] Model application: Based on the forecast results of the combined model, the container throughput of a specific port in the next two years and the container throughput of ports within a port group in the future can be calculated to make advance plans for the future operation of the port. At the same time, it can provide an effective reference for the development of the port group. At the same time, based on the interpretation of the forecast model, the main influencing factors of a port's throughput can be obtained, and in the future, the controllable influencing factors can be adjusted based on the forecast results. Clarifying the influencing factors can help ports decide which areas are worth investing in, such as whether it is necessary to expand the terminal, improve the level of port collection and distribution, etc., thereby improving overall operational efficiency and competitiveness.
[0152] The embodiment of the present invention also provides a port throughput prediction model construction system, including:
[0153] The first module is used to obtain sample data on multiple candidate throughput influencing factors and port throughput time series;
[0154] The second module is used to build a machine learning prediction model based on sample data and port throughput time series using machine learning algorithms;
[0155] The third module is used to interpret and analyze the prediction results of the machine learning prediction model through the Shapley interpretation model to obtain the feature contribution value of each candidate throughput influencing factor;
[0156] A fourth module is used to select at least one target throughput influencing factor from multiple candidate throughput influencing factors according to the characteristic contribution value;
[0157] The fifth module is used to build a port throughput prediction model based on the stacked long short-term memory network architecture according to the characteristic contribution values of the factors affecting the target throughput and the port throughput time series.
[0158] It can be understood that the contents of the above-mentioned port throughput prediction model construction method embodiment are all applicable to the present system embodiment, the functions specifically implemented by the present system embodiment are the same as those in the above-mentioned port throughput prediction model construction method embodiment, and the beneficial effects achieved are also the same as those achieved by the above-mentioned port throughput prediction model construction method embodiment.
[0159] Reference Fig.13 , Fig.13 is a schematic diagram of an electronic device provided by an embodiment of the present invention. The electronic device of the embodiment of the present invention includes one or more control processors and a memory, Fig.13 A control processor and a memory are taken as an example.
[0160] The control processor and the memory can be connected via a bus or other means. Fig.13 The example of connecting through bus is taken in the following.
[0161] The memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the control processor, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0162] Those skilled in the art will understand that Fig.13 The device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0163] The non-transient software programs and instructions required to implement the port throughput prediction model construction method or port throughput prediction method applied to the electronic device in the above-mentioned embodiments are stored in the memory. When executed by the control processor, the port throughput prediction model construction method or port throughput prediction method applied to the electronic device in the above-mentioned embodiments is executed.
[0164] In addition, an embodiment of the present invention also provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are executed by one or more control processors, so that the one or more control processors can execute the port throughput prediction model construction method or the port throughput prediction method in the above method embodiment.
[0165] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0166] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge scope of ordinary technicians in the relevant technical field without departing from the purpose of the present invention.
Claims
1. A method for constructing a port throughput prediction model, It is characterized in that The following steps are involved: Obtain sample data on multiple candidate throughput influencing factors and port throughput time series; Using a machine learning algorithm, constructing a machine learning prediction model based on the sample data and the port throughput time series; The prediction results of the machine learning prediction model are explained and analyzed by using the Shapley interpretation model to obtain the characteristic contribution value of each candidate throughput influencing factor; Selecting at least one target throughput influencing factor from the plurality of candidate throughput influencing factors according to the characteristic contribution value; A port throughput prediction model based on a stacked long short-term memory network architecture is constructed according to the characteristic contribution values of the target throughput influencing factors and the port throughput time series.
2. The method for constructing a port throughput prediction model according to claim 1, It is characterized in that The method of using a machine learning algorithm to construct a machine learning prediction model based on the sample data and the port throughput time series includes the following steps: Inputting the sample data and the port throughput time series into the XGBoost model for prediction, and obtaining a first throughput prediction value of the decision tree in the XGBoost model; Obtaining a loss function of the decision tree according to the first throughput prediction value and the corresponding actual throughput value in the port throughput time series; According to the loss function and regularization term of all decision trees, the objective function of the XGBoost model is obtained, wherein the regularization term is used to characterize the complexity of the model; In order to minimize the objective function target, by solving the objective function, the optimal leaf node value of the decision tree in the XGBoost model is updated, and the decision tree is subjected to node splitting based on the candidate throughput influencing factors by using a greedy algorithm to update the leaf nodes of the decision tree, and a machine learning prediction model is obtained based on the updated XGBoost model.
3. The method for constructing a port throughput prediction model according to claim 2, It is characterized in that The method of interpreting and analyzing the prediction results of the machine learning prediction model by using the Shapley interpretation model to obtain the feature contribution value of each candidate throughput influencing factor includes the following steps: Calculate a second throughput prediction value of the input sample according to the machine learning prediction model; Determine a throughput prediction average value according to the second throughput prediction values of all samples in the sample data; Based on the SHAP value distribution formula, the feature contribution value of each candidate throughput influencing factor is determined according to the second throughput prediction value and the throughput prediction average value of the samples.
4. The method for constructing a port throughput prediction model according to claim 1, It is characterized in that The step of selecting at least one target throughput influencing factor from the plurality of candidate throughput influencing factors according to the characteristic contribution value comprises the following steps: Compare the characteristic contribution value of each of the candidate throughput influencing factors with the contribution threshold respectively; The candidate throughput influencing factors whose characteristic contribution values are greater than the contribution threshold are determined as target throughput influencing factors.
5. The method for constructing a port throughput prediction model according to claim 1, It is characterized in that The step of constructing a port throughput prediction model based on a stacked long short-term memory network architecture according to the characteristic contribution values of the target throughput influencing factors and the port throughput time series comprises the following steps: Initialize the port throughput prediction model based on the stacked long short-term memory network architecture; Inputting the sample data, the characteristic contribution value of the target throughput influencing factor and the port throughput time series into the initialized port throughput prediction model to obtain a third throughput prediction value; The port throughput prediction model is continuously updated in reverse according to the third throughput prediction value and the port throughput time series until a preset condition is met, thereby obtaining a constructed port throughput prediction model.
6. The method for constructing a port throughput prediction model according to claim 1, It is characterized in that The port throughput prediction model includes an input gate, a forget gate and an output gate; The forget gate is used to selectively forget the information in the cell state at the previous moment according to the characteristic contribution value of the target throughput influencing factor; The input gate is used to obtain input data, perform feature extraction on the input data, and update the extracted features into the cell state, wherein the input data includes throughput influencing factor data and historical port throughput; The output gate is used to obtain the port throughput prediction value according to the information in the updated cell state.
7. A port throughput prediction method, It is characterized in that The following steps are involved: Obtain data on factors affecting throughput and historical port throughput; The throughput influencing factor data and the historical port throughput are input into a port throughput prediction model to obtain a port throughput prediction value, wherein the port throughput prediction model is constructed by the port throughput prediction model construction method according to any one of claims 1 to 6.
8. A port throughput prediction model construction system, It is characterized in that include: The first module is used to obtain sample data on multiple candidate throughput influencing factors and port throughput time series; The second module is used to use a machine learning algorithm to build a machine learning prediction model based on the sample data and the port throughput time series; The third module is used to interpret and analyze the prediction results of the machine learning prediction model through the Shapley interpretation model to obtain the feature contribution value of each candidate throughput influencing factor; A fourth module is configured to select at least one target throughput influencing factor from the plurality of candidate throughput influencing factors according to the characteristic contribution value; The fifth module is used to construct a port throughput prediction model based on a stacked long short-term memory network architecture according to the characteristic contribution values of the target throughput influencing factors and the port throughput time series.
9. An electronic device, It is characterized in that include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the port throughput prediction model construction method as described in any one of claims 1 to 6 or the port throughput prediction method as described in claim 7.
10. A computer-readable storage medium having a program executable by a processor stored therein, It is characterized in that The program executable by the processor is used to implement the port throughput prediction model construction method according to any one of claims 1 to 6 or the port throughput prediction method according to claim 7 when executed by the processor.
Citation Information
Cited By
Container terminal throughput prediction method, device and equipment based on deep learning
CN119623770A
Wharf container throughput prediction method and system and storage medium
CN120851952A
