A container throughput prediction method based on stacked ensemble learning

By using a stacked ensemble learning method, combining multiple models and adaptive window rolling prediction, the problems of data fusion and response to external changes in container throughput prediction are solved, resulting in more accurate and stable prediction results.

CN122153276APending Publication Date: 2026-06-05ZHEJIANG UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHEJIANG UNIV
Filing Date
2026-01-22
Publication Date
2026-06-05

Smart Images

  • Figure CN122153276A_ABST
    Figure CN122153276A_ABST
Patent Text Reader

Abstract

The application discloses a container throughput prediction method based on stacked ensemble learning, and relates to the technical field of intelligent ports. In the system operation, multi-source data is collected from a port operation system, an economic statistics platform and a shipping database, a comprehensive feature system containing throughput, freight rate, transportation time, policy variable, seasonal characteristics and macroeconomic indicators is constructed, and serialization and standardization processing are performed, and an improved model is constructed. The improved CNN-LSTM model introduces a deep separable convolution, a bidirectional LSTM and an improved attention mechanism to enhance the representation ability of key time steps, adopts Bayesian optimization to automatically search for hyperparameters, combines an early stopping strategy to control overfitting, simultaneously realizes multi-model integration based on inverse error weighting and meta-learning linear regression model, adaptively adjusts the rolling prediction window size according to the data coefficient of variation, generates future multi-period throughput prediction results through multi-step rolling prediction, and performs denormalization output.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of smart port technology, specifically to a container throughput prediction method based on stacked ensemble learning. Background Technology

[0002] Accurate forecasting of port container throughput plays an increasingly crucial role in international logistics supply chain management. Accurate throughput forecasting has a decisive impact on port operation planning, resource allocation, and operational efficiency, and its accuracy directly affects the operating costs and efficiency of the entire supply chain. In the digital economy era, the generation and acquisition of data are becoming increasingly diversified. How to effectively integrate and transform multi-source information related to port operations, such as economic indicators, policy variables, and market environments, into predictive value has become a focus of industry attention. With the increasing sophistication of forecasting needs, how to coordinate and complement various algorithmic models (such as statistical learning, deep learning, and ensemble learning) to improve predictive performance has become a technological challenge.

[0003] Existing throughput forecasting methods mostly rely on a single model architecture, failing to fully exploit the complex spatiotemporal characteristics of the data. The forecasting process is often limited to historical throughput data itself, neglecting to effectively integrate key external driving factors such as freight rates, transit times, macroeconomic conditions, and environmental policies. How to systematically collect, integrate, and process multi-source heterogeneous data to construct an intelligent forecasting method capable of adaptive adjustment, ensuring that forecast results reflect both inherent patterns and external changes, is a core problem urgently needing to be solved. To address these challenges, meet the dual requirements of port operations for forecasting accuracy and stability, and leverage the advantages of deep learning in feature extraction and time-series modeling, it is necessary to establish an intelligent forecasting method that integrates multiple algorithms. With the maturity of big data and artificial intelligence technologies, port operation data, shipping market information, macroeconomic indicators, and policy and regulatory changes can all be systematically collected and integrated, laying the data foundation for building advanced forecasting methods. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention provides a container throughput prediction method based on stacked ensemble learning, which solves the problems mentioned in the background art.

[0005] To achieve the above objectives, the present invention provides the following technical solution: a container throughput prediction method based on stacked ensemble learning, comprising the following steps: Step 1: Data preparation stage. Obtain port operation-related data from multi-source data platforms, perform feature engineering and data standardization, and construct time series training samples. Step 2: Model training phase. The improved CNN-LSTM model, bidirectional GRU model and XGBoost model are trained respectively. Bayesian optimization is used to automatically tune hyperparameters and an early stopping mechanism is used to prevent overfitting. Step 3: Integration and optimization stage, calculate the performance weights of each base model on the validation set, train the meta-learning model to achieve model fusion, and establish a weighted ensemble prediction mechanism; Step 4: In the prediction output stage, the adaptive window rolling prediction method is used to generate the throughput prediction values ​​for multiple future periods, the results are inversely normalized, and the prediction report is output.

[0006] Preferably, the data preparation stage includes: Historical container throughput and operation records are obtained from the port operation system, macroeconomic indicators are obtained from the economic statistics platform, freight rates, transportation time and route-related data are obtained from the shipping database, and further policy variables such as environmental protection policies, international trade policies and regional economic cooperation processes are collected. We construct a comprehensive feature system that includes throughput series, international and regional freight rate indices, average transit time, policy variables, quarterly and monthly cyclical characteristics, and macroeconomic prosperity indicators. We then use a recursive feature elimination method to remove redundant features that have a low contribution to the forecast. Time series data are constructed into supervised learning samples with input-output pairs at fixed time steps; Multidimensional features are scaled using MinMax normalization or standard deviation normalization.

[0007] Preferably, the step of constructing time series data into supervised learning samples includes: constructing an input window from a multidimensional feature sequence of consecutive periods L according to a preset time step L, and using the container throughput of the next 1 to K periods as the prediction target output, where the value of L ranges from 6 to 18 and the value of K ranges from 1 to 12; when constructing the input window, introducing periodic auxiliary features such as holiday location coding, quarterly cycle coding, and monthly cycle coding to enhance the model's ability to identify the seasonal characteristics of port operations; during the serialization process, to avoid information leakage, each window is strictly limited to containing all true values ​​before the target prediction period; during feature normalization, group normalization is performed on throughput features, freight rate features, and macroeconomic features respectively, so that data from different sources and statistical ranges maintain scale consistency, distribution stability, and controllable training sensitivity during model training; Based on the supervised learning samples, an improved CNN-LSTM model, a bidirectional GRU model, and an XGBoost model are trained respectively, wherein: The improved CNN-LSTM model includes deep separable convolutional layers, bidirectional long short-term memory network layers, and an attention module containing global average pooling, feature recalibration, and residual connection structures. The bidirectional GRU model consists of bidirectional gated recurrent units and is combined with the global average pooling layer to generate a time series representation. The XGBoost model takes the flattened temporal feature vector as input and uses gradient boosting trees to model nonlinear and high-order interactive features. The hyperparameters of each model are automatically searched using Bayesian optimization, and an early stopping mechanism is adopted to suppress overfitting based on the performance on the validation set.

[0008] Preferably, the depthwise separable convolutional layer in the improved CNN-LSTM model includes: firstly, performing a one-dimensional depthwise convolution in the time dimension to extract local temporal dependencies, and then performing a pointwise convolution in the feature dimension to capture cross-feature interaction information; the size of the depthwise convolutional kernel is adaptively adjusted according to the temporal variation frequency of the features, thereby enhancing the model's ability to perceive short-term fluctuations and local structural changes without significantly increasing the parameter scale; the obtained convolutional features are batch normalized and then input into a bidirectional long short-term memory network layer, with the bidirectional structure processing the forward and backward sequences respectively, enabling the model to simultaneously capture complex temporal features where throughput is affected by both preceding trends and subsequent local reverse effects; the convolutional output and the LSTM output are fused together through residual connections to improve the continuity of feature channel expression and gradient propagation stability.

[0009] Preferably, the attention module is implemented through the following steps: first, global average pooling is performed on the time series matrix output by the bidirectional long short-term memory network to extract the importance statistics of each time step in the overall sequence; then, the pooling result is input into the feature recalibration submodule, and a time-related weight vector is generated using a fully connected layer and activation function. The weight vector is combined with the original time step features element-wise to significantly enhance the key event time periods (such as sudden increases in freight rates, policy changes, and abnormal transportation times). Finally, the attention-weighted features are fused with the unweighted initial time series through the residual structure to achieve stable feature enhancement and avoid the risk of over-suppressing non-key features during attention calculation, thereby improving the accuracy and robustness of the overall time series feature representation.

[0010] Preferably, the bidirectional GRU model includes: processing the input sequence in parallel using forward GRU and backward GRU to generate forward hidden states and backward hidden states respectively; constructing a bidirectional time series representation through hidden state concatenation or summation operations to fully capture the trend continuity and backward convergence in the container throughput sequence; and then compressing the time dimension through global average pooling operations to reduce the noise sensitivity of the sequence representation while extracting macroscopic statistical features. The resulting statistical vectors are processed by a dropout module to suppress the model's overfitting tendency before being input into a fully connected layer to generate prediction results. The bidirectional GRU model, as a temporal modeling module that complements deep convolutional networks, can enhance the ability to express soft-constraint features such as long-term dependencies, implicit periodic fluctuations, and deferred effects, providing structural differences and predictive complementarity for subsequent ensemble learning.

[0011] Preferably, the Bayesian optimization method uses a Gaussian process as a surrogate model and constructs a continuous optimization search in a high-dimensional hyperparameter space that includes the number of convolutional kernels, the size of the convolutional kernels, the number of LSTM units, the number of GRU units, the learning rate, the dropout rate, the tree depth, the minimum sub-leaf weight, and the sampling ratio. The sampling function determines the next set of hyperparameter sampling points, and the surrogate model is updated through iterative sampling and error feedback. The mean square error of the validation set is used as the optimization objective, so that the Gaussian process can gradually find the optimal performance region while ensuring the smoothness of the surrogate estimation. The search is terminated when the performance improvement is insufficient after several consecutive iterations, thereby obtaining a better model configuration with extremely low computational cost and significantly improving the training efficiency and generalization accuracy of deep models.

[0012] Preferably, the inverse error weighting in the integration optimization step includes: performing a normalized inverse proportional transformation on the mean square error of each base model on the validation set to form a model performance score; then normalizing the performance score proportionally to obtain the primary integration weights, so that the model with the smaller validation error receives a higher weight; to eliminate the weight shift caused by abnormal fluctuations of a single model within a specific time period, a smoothing regularization factor is introduced to prune extreme weights; the predicted values ​​of each base model are input into a linear regression meta-learning model, and the optimal linear combination relationship between the predicted values ​​of the three types of models is learned through least squares fitting, so as to reduce the systematic error when a single model fails and improve the robustness of the overall prediction results to complex market environments.

[0013] Preferably, the adaptive window determination step calculates the time fluctuation intensity based on the coefficient of variation of the training samples within a recent time interval; When throughput and freight rates exhibit high volatility, the window length is automatically extended to 12-18 periods to enhance the ability to capture medium- to long-term trends; When the characteristic fluctuations are relatively mild, the window is shortened to 6-9 periods to improve the sensitivity of short-term forecasts. This adaptive mechanism continuously and automatically adjusts the window length according to changes in the external market, including policy shocks, changes in shipping prices, and seasonal changes in demand, by periodically recalculating the coefficient of variation. This ensures that the input data contains sufficient historical information while avoiding interference from redundant time slices during the rolling forecasting process, thus achieving high adaptability of the forecasting model under different economic cycles.

[0014] Preferably, the rolling forecasting step includes: first generating the next period's throughput forecast using an integrated forecasting model; appending the forecast or actual value sequentially to the end of the input sequence and removing the earliest data to achieve forward sliding of the window; repeating this process to predict values ​​for multiple future periods; introducing an error feedback mechanism in the rolling forecast, updating the normalization parameters, data window, and feature distribution status after each batch of forecasts is completed to mitigate the risk of forecast drift; and calculating multiple evaluation indicators after the forecast output is denormalized, including mean squared error, mean absolute percentage error, deviation curve, and trend fit, to support port planning departments in carrying out application scenarios such as operation plan formulation, berth scheduling optimization, yard resource allocation, and policy scenario simulation, thereby improving the business usability of the forecasting method.

[0015] This invention provides a container throughput prediction method based on stacked ensemble learning, which has the following advantages: (1) When the system is running, the present invention constructs a multi-dimensional feature system including throughput, freight rate, transportation time, policy variables, quarterly characteristics and macroeconomic indicators, and makes full use of multi-source heterogeneous data related to port operation, so that the model can simultaneously perceive internal operating rules and changes in the external market environment, thereby improving the comprehensiveness and accuracy of container throughput prediction results.

[0016] (2) By combining depthwise separable convolution, bidirectional recurrent neural network and improved attention mechanism, an improved CNN-LSTM model is constructed, and a hybrid prediction architecture is formed with bidirectional GRU and XGBoost models, which effectively improves the modeling ability for complex nonlinearity and time-series dependence, so that the model has stable prediction performance under different fluctuation scenarios.

[0017] (3) By adopting Bayesian hyperparameter optimization to automatically search for hyperparameter combinations, the cost of manual parameter tuning is reduced. By combining the two-level integration strategy of inverse error weighting and meta-learning linear regression, intelligent fusion of prediction results of multiple heterogeneous models is realized, which significantly improves prediction accuracy and reduces the risk of single model failure.

[0018] (4) By using an adaptive window mechanism to dynamically adjust the length of the input sequence based on the coefficient of variation of the data, the method can automatically adjust the degree of attention to long-term trends and short-term fluctuations in different scenarios such as drastic fluctuations in freight rates, rapid changes in policies, and stable market environments, thereby improving the applicability and robustness of the method.

[0019] (5) By introducing an improved attention module, the model can automatically focus on key time steps and important features, thereby enhancing its ability to identify historical event nodes, policy adjustment points and major market fluctuations, and providing more interpretable and valuable prediction results for port operation and management. Attached Figure Description

[0020] Figure 1 This is a schematic diagram of the overall process of the method of the present invention; Figure 2 This is a schematic diagram of the overall architecture of the integrated model of the present invention; Figure 3 This is a schematic diagram of the CNN-LSTM-Attention architecture, which is the base model 1 of this invention. Figure 4 This is a schematic diagram of the improved attention module structure of the present invention; Figure 5 This is a schematic diagram of the GRU network architecture, which is the base model 2 of this invention. Figure 6 This is a schematic diagram of the data preprocessing process of the present invention; Figure 7 This is a schematic diagram of the model training and optimization process of the present invention; Figure 8 This is a schematic diagram of the Bayesian optimization process of the present invention; Figure 9 This is a schematic diagram of the rolling prediction strategy of the present invention; Figure 10 This is a comparison chart of the prediction results of the three base models of this invention; Figure 11 This is a schematic diagram comparing the predicted container throughput with the actual container throughput of this invention. Figure 12 This is a graph showing the training / validation loss variation of the base models 1 and 2 of this invention. Figure 13 This is a training curve for the early stopping feature of XGBoost in this invention. Detailed Implementation

[0021] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0022] Example 1 This invention provides a container throughput prediction method based on stacked ensemble learning. Please refer to [link / reference]. Figure 1-13 This includes the following steps: Step 1: Data preparation stage. Obtain port operation-related data from multi-source data platforms, perform feature engineering and data standardization, and construct time series training samples. Step 2: Model training phase. The improved CNN-LSTM model, bidirectional GRU model and XGBoost model are trained respectively. Bayesian optimization is used to automatically tune hyperparameters and an early stopping mechanism is used to prevent overfitting. Step 3: Integration and optimization stage, calculate the performance weights of each base model on the validation set, train the meta-learning model to achieve model fusion, and establish a weighted ensemble prediction mechanism; Step 4: In the prediction output stage, the adaptive window rolling prediction method is used to generate the throughput prediction values ​​for multiple future periods, the results are inversely normalized, and the prediction report is output.

[0023] In this embodiment, monthly container throughput data and related operational records for several consecutive years are first collected from the port operation system, including operational indicators such as ship berthing frequency, yard utilization rate, and operational load intensity. At the same time, international and regional freight rate indices, average transit time, and major route frequency density related to the port are obtained from the shipping database. In addition, macroeconomic indicator data, including regional GDP index, total import and export volume, and manufacturing prosperity index, which reflect changes in the external economic environment, are obtained from the economic statistics platform.

[0024] In response to external environmental factors, this embodiment further collects policy variable data closely related to port operations, including but not limited to adjustments in environmental protection policies, changes in international trade policies, the effective date of regional economic cooperation mechanisms, and adjustments in port fee policies, and transforms the above policy variables into quantifiable time series indicator variables.

[0025] After completing the multi-source data collection, time alignment processing was performed on various types of data, uniformly mapping data with different update frequencies to a monthly time scale. Then, outlier detection and missing value imputation were performed, and a comprehensive feature system was constructed, including throughput sequences, freight rate indices, transportation times, policy variables, quarterly and monthly cyclical characteristics, and macroeconomic indicators. Finally, a recursive feature elimination method was used to evaluate the contribution of each feature to the prediction results, eliminating redundant features to form a highly relevant and low-redundancy set of model input features.

[0026] Example 2 This embodiment is an explanation based on Embodiment 1. Please refer to it. Figure 1-13 Specifically, the data preparation stage includes: Historical container throughput and operation records are obtained from the port operation system, macroeconomic indicators are obtained from the economic statistics platform, freight rates, transportation time and route-related data are obtained from the shipping database, and further policy variables such as environmental protection policies, international trade policies and regional economic cooperation processes are collected. We construct a comprehensive feature system that includes throughput series, international and regional freight rate indices, average transit time, policy variables, quarterly and monthly cyclical characteristics, and macroeconomic prosperity indicators. We then use a recursive feature elimination method to remove redundant features that have a low contribution to the forecast. Time series data are constructed into supervised learning samples with input-output pairs at fixed time steps; Multidimensional features are scaled using MinMax normalization or standard deviation normalization.

[0027] The steps for constructing supervised learning samples from time series data include: constructing an input window from a multidimensional feature sequence of L consecutive periods according to a preset time step L, and using the container throughput of the next 1 to K periods as the prediction target output, where L ranges from 6 to 18 and K ranges from 1 to 12; when constructing the input window, periodic auxiliary features such as holiday location coding, quarterly cycle coding, and monthly cycle coding are introduced to enhance the model's ability to identify the seasonal characteristics of port operations; during the serialization process, to avoid information leakage, each window is strictly limited to containing all true values ​​before the target prediction period; during feature normalization, group normalization is performed on throughput features, freight rate features, and macroeconomic features respectively, so that data from different sources and statistical ranges maintain scale consistency, distribution stability, and controllable training sensitivity during model training; Based on the supervised learning samples, an improved CNN-LSTM model, a bidirectional GRU model, and an XGBoost model are trained respectively, wherein: The improved CNN-LSTM model includes deep separable convolutional layers, bidirectional long short-term memory network layers, and an attention module containing global average pooling, feature recalibration, and residual connection structures. The bidirectional GRU model consists of bidirectional gated recurrent units and is combined with the global average pooling layer to generate a time series representation. The XGBoost model takes the flattened temporal feature vector as input and uses gradient boosting trees to model nonlinear and high-order interactive features. The hyperparameters of each model are automatically searched using Bayesian optimization methods, referring to... Figure 13 An early stopping mechanism is used to suppress overfitting based on the performance of the validation set.

[0028] In this embodiment, supervised learning samples are constructed based on the feature set obtained in Embodiment 1, according to a preset time step L. Specifically, a multidimensional feature sequence of consecutive periods L is used as the input window, and the container throughput of the next 1 to K periods is used as the prediction target output, where the value of L ranges from 6 to 18, and the value of K ranges from 1 to 12.

[0029] In constructing the input window, periodic auxiliary features such as holiday location codes, quarterly cycle codes, and monthly cycle codes are introduced to enhance the model's ability to identify seasonal changes in port operations. At the same time, when constructing the sample, the input window is strictly limited to include only real historical data before the target prediction period to avoid future information leakage issues.

[0030] To address the differences in numerical distribution and statistical scale among different types of features, this embodiment performs grouping normalization on throughput features, freight rate features, and macroeconomic features respectively, using MinMax normalization or standard deviation normalization methods to maintain numerical stability and comparability of data from different sources during model training, thereby improving model training efficiency and convergence stability.

[0031] Example 3 This embodiment is an explanation based on Embodiment 1. Please refer to it. Figure 1-13Specifically, the depthwise separable convolutional layer in the improved CNN-LSTM model includes: firstly, performing one-dimensional depthwise convolution in the time dimension to extract local temporal dependencies, and then performing pointwise convolution in the feature dimension to capture cross-feature interaction information; the size of the depthwise convolution kernel is adaptively adjusted according to the temporal change frequency of the features, thereby enhancing the model's ability to perceive short-term fluctuations and local structural changes without significantly increasing the parameter scale; the obtained convolutional features are batch normalized and then input into a bidirectional long short-term memory network layer, with the bidirectional structure processing the forward and backward sequences respectively, enabling the model to simultaneously capture complex temporal features where throughput is affected by both preceding trends and subsequent local reverse effects; the convolutional output and the LSTM output are fused together through residual connections to improve the continuity of feature channel expression and gradient propagation stability.

[0032] The attention module is implemented through the following steps: First, global average pooling is performed on the time series matrix output by the bidirectional long short-term memory network to extract the importance statistics of each time step in the overall sequence; then the pooling result is input into the feature recalibration submodule, and a time-related weight vector is generated using a fully connected layer and activation function. The weight vector is combined with the original time step features element-wise to significantly enhance the key event time periods (such as sudden increases in freight rates, policy changes, and abnormal transportation times). Finally, the attention-weighted features are fused with the unweighted initial time series through the residual structure to achieve stable feature enhancement and avoid the risk of over-suppressing non-key features during attention calculation, thereby improving the accuracy and robustness of the overall time series feature representation.

[0033] The bidirectional GRU model includes: forward GRU and backward GRU processing the input sequence in parallel to generate forward hidden state and backward hidden state respectively; constructing bidirectional time series representation through hidden state concatenation or summation operations to fully capture the trend continuity and backward convergence in the container throughput sequence; and then compressing the time dimension through global average pooling operation to reduce the noise sensitivity of the sequence representation, while extracting macroscopic statistical features. The resulting statistical vectors are processed by a dropout module to suppress the model's overfitting tendency before being input into a fully connected layer to generate prediction results. The bidirectional GRU model, as a temporal modeling module that complements deep convolutional networks, can enhance the ability to express soft-constraint features such as long-term dependencies, implicit periodic fluctuations, and deferred effects, providing structural differences and predictive complementarity for subsequent ensemble learning.

[0034] In this embodiment, based on the supervised learning samples constructed in Embodiment 2, an improved CNN-LSTM model, a bidirectional GRU model, and an XGBoost model are trained respectively. The improved CNN-LSTM model first extracts local temporal patterns in the temporal dimension through deep separable convolutional layers and captures cross-feature interaction relationships in the feature dimension. Then, it models long-term temporal dependencies through a bidirectional long short-term memory network and introduces an attention module at the output, which includes global average pooling, feature recalibration, and residual connection structures, to highlight the focus on key time periods.

[0035] The bidirectional GRU model processes the input sequence in parallel using both forward and backward GRUs to generate bidirectional hidden states. These hidden states are then concatenated or summed to form a bidirectional temporal representation. The prediction result is then output after global average pooling and dropout modules to suppress overfitting. The XGBoost model, on the other hand, takes a flattened temporal feature vector as input, models the nonlinear and high-order feature interactions through a gradient boosting tree structure, and executes an early stopping strategy based on the validation set error.

[0036] During model training, Bayesian optimization is used to automatically search for the key hyperparameters of the above model. Gaussian process is used as a surrogate model, and the hyperparameter sampling strategy is determined by the acquisition function. The mean square error of the verification set is used as the optimization target. The search is terminated when the performance improvement is insufficient after multiple iterations, thereby obtaining a model configuration with better generalization performance.

[0037] Example 4 This embodiment is an explanation based on Embodiment 1. Please refer to it. Figure 1-13 Specifically: The Bayesian optimization method uses a Gaussian process as a surrogate model and constructs a continuous optimization search in a high-dimensional hyperparameter space that includes the number of convolutional kernels, the size of the convolutional kernels, the number of LSTM units, the number of GRU units, the learning rate, the dropout rate, the tree depth, the minimum sub-leaf weight, and the sampling ratio. The sampling function determines the next set of hyperparameter sampling points, and the surrogate model is updated through iterative sampling and error feedback. The mean square error of the validation set is used as the optimization objective, so that the Gaussian process can gradually find the optimal performance region while ensuring the smoothness of the surrogate estimation. The search is terminated when the performance improvement is insufficient after several consecutive iterations, thereby obtaining a better model configuration with extremely low computational cost and significantly improving the training efficiency and generalization accuracy of deep models.

[0038] The inverse error weighting in the ensemble optimization step includes: performing a normalized inverse proportional transformation on the mean squared error of each base model on the validation set to form a model performance score; then normalizing the performance score proportionally to obtain the primary ensemble weights, so that models with smaller validation errors receive higher weights; to eliminate weight shifts caused by abnormal fluctuations of a single model within a specific time period, a smoothing regularization factor is introduced to prune extreme weights; the predicted values ​​of each base model are input into a linear regression meta-learning model, and the optimal linear combination relationship between the predicted values ​​of the three types of models is learned through least squares fitting, so as to reduce the systematic error when a single model fails and improve the robustness of the overall prediction results to complex market environments.

[0039] The adaptive window determination step calculates the intensity of time fluctuations based on the coefficient of variation of the training samples within a recent time interval. When throughput and freight rates exhibit high volatility, the window length is automatically extended to 12-18 periods to enhance the ability to capture medium- to long-term trends; When the characteristic fluctuations are relatively mild, the window is shortened to 6-9 periods to improve the sensitivity of short-term forecasts. This adaptive mechanism continuously and automatically adjusts the window length according to changes in the external market, including policy shocks, changes in shipping prices, and seasonal changes in demand, by periodically recalculating the coefficient of variation. This ensures that the input data contains sufficient historical information while avoiding interference from redundant time slices during the rolling forecasting process, thus achieving high adaptability of the forecasting model under different economic cycles.

[0040] In this embodiment, the prediction error index of each base model on the validation set is first calculated, and its mean squared error is normalized and inversely proportional to calculate the primary performance weight of each base model, so that the model with the smaller prediction error occupies a higher proportion in the ensemble. To avoid weight imbalance caused by abnormal fluctuations of a single model in a local time period, a smoothing regularization factor is introduced to prune extreme weights.

[0041] Subsequently, the prediction results of each base model are used as input features and introduced into a linear regression meta-learning model. The optimal linear mapping relationship between the prediction results of the three models and the actual throughput is learned through least-squares fitting, forming the final stacked ensemble prediction model. (See [link to relevant documentation]). Figure 2 Through the aforementioned two-level fusion mechanism, the risk of single-model failure is significantly reduced, and the stability and robustness of the overall prediction results are improved.

[0042] Example 5 A container throughput prediction method based on stacked ensemble learning is described in the following reference: Figure 2Specifically, the rolling forecasting step includes: first, using an integrated forecasting model to generate the next period's throughput forecast value; appending the forecast value or the actual value sequentially to the end of the input sequence and removing the earliest data to achieve forward sliding of the window; repeating this process to predict values ​​for multiple future periods; introducing an error feedback mechanism in the rolling forecast, updating the normalization parameters, data window, and feature distribution state after each batch of forecasts is completed to mitigate the risk of forecast drift; and calculating multiple evaluation indicators after the forecast output is denormalized, including mean squared error, mean absolute percentage error, deviation curve, and trend fit, to support port planning departments in carrying out application scenarios such as operation plan formulation, berth scheduling optimization, yard resource allocation, and policy scenario simulation, thereby improving the business usability of the forecasting method.

[0043] In this embodiment, the data fluctuation intensity is first calculated based on the coefficient of variation of the training samples over a recent period. When features such as throughput and freight rates exhibit high volatility, the input window length is adaptively extended to 12 to 18 periods to enhance the model's ability to capture medium- to long-term trends. When feature fluctuations are relatively smooth, the window length is shrunk to 6 to 9 periods to improve short-term prediction sensitivity.

[0044] In the rolling forecasting process, an ensemble forecasting model is used to generate the throughput forecast for the next period, and this forecast or actual observation is appended to the end of the input sequence. Simultaneously, the earliest time point data is removed, shifting the forecast window forward. This process is repeated to complete throughput forecasts for multiple future periods. An error feedback mechanism is introduced during the forecasting process to dynamically update the normalization parameters, window data, and feature distribution status, mitigating the risk of forecast drift.

[0045] Finally, the prediction results are inversely normalized, and evaluation indicators such as mean square error, mean absolute percentage error, and trend fit are calculated to generate a prediction report, providing decision support for port operation planning, berth scheduling optimization, yard resource allocation, and policy scenario analysis.

[0046] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A container throughput prediction method based on stacked ensemble learning, characterized in that: Includes the following steps: Step 1: Data preparation stage. Obtain port operation-related data from multi-source data platforms, perform feature engineering and data standardization, and construct time series training samples. Step 2: Model training phase. The improved CNN-LSTM model, bidirectional GRU model and XGBoost model are trained respectively. Bayesian optimization is used to automatically tune hyperparameters and an early stopping mechanism is used to prevent overfitting. Step 3: Integration and optimization stage, calculate the performance weights of each base model on the validation set, train the meta-learning model to achieve model fusion, and establish a weighted ensemble prediction mechanism; Step 4: In the prediction output stage, the adaptive window rolling prediction method is used to generate the throughput prediction values ​​for multiple future periods, the results are inversely normalized, and the prediction report is output.

2. The container throughput prediction method based on stacked ensemble learning according to claim 1, characterized in that: The data preparation phase includes: Historical container throughput and operation records are obtained from the port operation system, macroeconomic indicators are obtained from the economic statistics platform, freight rates, transportation time and route-related data are obtained from the shipping database, and further policy variables such as environmental protection policies, international trade policies and regional economic cooperation processes are collected. We construct a comprehensive feature system that includes throughput series, international and regional freight rate indices, average transit time, policy variables, quarterly and monthly cyclical characteristics, and macroeconomic prosperity indicators. We then use a recursive feature elimination method to remove redundant features that have a low contribution to the forecast. Time series data are constructed into supervised learning samples with input-output pairs at fixed time steps; Multidimensional features are scaled using MinMax normalization or standard deviation normalization.

3. The container throughput prediction method based on stacked ensemble learning according to claim 1, characterized in that: The steps for constructing supervised learning samples from time series data include: constructing an input window from a multidimensional feature sequence of consecutive periods L according to a preset time step L, and using the container throughput of the next 1 to K periods as the prediction target output, where L ranges from 6 to 18 and K ranges from 1 to 12; when constructing the input window, periodic auxiliary features such as holiday location coding, quarterly cycle coding, and monthly cycle coding are introduced to enhance the model's ability to identify the seasonal characteristics of port operations; during the serialization process, to avoid information leakage, each window is strictly limited to containing all true values ​​before the target prediction period; during feature normalization, group normalization is performed on throughput features, freight rate features, and macroeconomic features respectively, so that data from different sources and statistical ranges maintain scale consistency, distribution stability, and controllable training sensitivity during model training; Based on the supervised learning samples, an improved CNN-LSTM model, a bidirectional GRU model, and an XGBoost model are trained respectively, wherein: The improved CNN-LSTM model includes deep separable convolutional layers, bidirectional long short-term memory network layers, and an attention module containing global average pooling, feature recalibration, and residual connection structures. The bidirectional GRU model consists of bidirectional gated recurrent units and is combined with the global average pooling layer to generate a time series representation. The XGBoost model takes the flattened temporal feature vector as input and uses gradient boosting trees to model nonlinear and high-order interactive features. The hyperparameters of each model are automatically searched using Bayesian optimization, and an early stopping mechanism is adopted to suppress overfitting based on the performance on the validation set.

4. The container throughput prediction method based on stacked ensemble learning according to claim 3, characterized in that: The improved CNN-LSTM model's depthwise separable convolutional layer comprises: first, performing a one-dimensional depthwise convolution in the time dimension to extract local temporal dependencies, and then performing a pointwise convolution in the feature dimension to capture cross-feature interaction information; the size of the depthwise convolutional kernel is adaptively adjusted according to the temporal variation frequency of the features, thereby enhancing the model's ability to perceive short-term fluctuations and local structural changes without significantly increasing the parameter scale; the resulting convolutional features are batch normalized and then input into a bidirectional long short-term memory network layer, with the bidirectional structure processing the forward and backward sequences respectively, enabling the model to simultaneously capture complex temporal features where throughput is affected by both preceding trends and subsequent local reverse effects; the convolutional output and the LSTM output are fused together through residual connections to improve the continuity of feature channel representation and gradient propagation stability.

5. The container throughput prediction method based on stacked ensemble learning according to claim 3, characterized in that: The attention module is implemented through the following steps: First, global average pooling is performed on the time series matrix output by the bidirectional long short-term memory network to extract the importance statistics of each time step in the overall sequence; then the pooling result is input into the feature recalibration submodule, and a time-related weight vector is generated using a fully connected layer and activation function. The weight vector is combined with the original time step features element-wise to significantly enhance key event time periods, including sudden increases in freight rates, policy changes, and abnormal transportation times. Finally, the attention-weighted features are fused with the unweighted initial time series through the residual structure to achieve stable feature enhancement and avoid the risk of over-suppressing non-key features during attention calculation, thereby improving the accuracy and robustness of the overall time series feature representation.

6. The container throughput prediction method based on stacked ensemble learning according to claim 3, characterized in that: The bidirectional GRU model includes: forward GRU and backward GRU processing the input sequence in parallel to generate forward hidden state and backward hidden state respectively; constructing bidirectional time series representation through hidden state concatenation or summation operations to fully capture the trend continuity and backward convergence in the container throughput sequence; and then compressing the time dimension through global average pooling operation to reduce the noise sensitivity of the sequence representation, while extracting macroscopic statistical features. The resulting statistical vectors are processed by a dropout module to suppress the model's overfitting tendency before being input into a fully connected layer to generate prediction results. The bidirectional GRU model, as a temporal modeling module that complements deep convolutional networks, can enhance the ability to express soft-constraint features such as long-term dependencies, implicit periodic fluctuations, and deferred effects, providing structural differences and predictive complementarity for subsequent ensemble learning.

7. The container throughput prediction method based on stacked ensemble learning according to claim 3, characterized in that: The Bayesian optimization method uses a Gaussian process as a surrogate model and constructs a continuous optimization search in a high-dimensional hyperparameter space that includes the number of convolutional kernels, kernel size, number of LSTM units, number of GRU units, learning rate, dropout rate, tree depth, minimum sub-leaf weight, and sampling ratio. The sampling function determines the next set of hyperparameter sampling points, and the surrogate model is updated through iterative sampling and error feedback. The mean square error of the validation set is used as the optimization objective, so that the Gaussian process can gradually find the optimal performance region while ensuring the smoothness of the surrogate estimation. The search is terminated when the performance improvement is insufficient after several consecutive iterations, thereby obtaining a better model configuration with extremely low computational cost and significantly improving the training efficiency and generalization accuracy of deep models.

8. The container throughput prediction method based on stacked ensemble learning according to claim 1, characterized in that: The inverse error weighting in the ensemble optimization step includes: performing a normalized inverse proportional transformation on the mean squared error of each base model on the validation set to form a model performance score; then normalizing the performance score proportionally to obtain the primary ensemble weights, so that models with smaller validation errors receive higher weights; to eliminate weight shifts caused by abnormal fluctuations of a single model within a specific time period, a smoothing regularization factor is introduced to prune extreme weights; the predicted values ​​of each base model are input into a linear regression meta-learning model, and the optimal linear combination relationship between the predicted values ​​of the three types of models is learned through least squares fitting, so as to reduce the systematic error when a single model fails and improve the robustness of the overall prediction results to complex market environments.

9. The container throughput prediction method based on stacked ensemble learning according to claim 1, characterized in that: The adaptive window determination step calculates the intensity of time fluctuations based on the coefficient of variation of the training samples within a recent time interval. When throughput and freight rates exhibit high volatility, the window length is automatically extended to 12-18 periods to enhance the ability to capture medium- to long-term trends; When the characteristic fluctuations are relatively mild, the window is shortened to 6-9 periods to improve the sensitivity of short-term forecasts. This adaptive mechanism continuously and automatically adjusts the window length according to changes in the external market, including policy shocks, changes in shipping prices, and seasonal changes in demand, by periodically recalculating the coefficient of variation. This ensures that the input data contains sufficient historical information while avoiding interference from redundant time slices during the rolling forecasting process, thus achieving high adaptability of the forecasting model under different economic cycles.

10. The container throughput prediction method based on stacked ensemble learning according to claim 9, characterized in that: The rolling forecasting step includes: first, using an integrated forecasting model to generate the next period's throughput forecast value; appending the forecast value or the actual value sequentially to the end of the input sequence and removing the oldest data to achieve window forward sliding; repeating this process to predict values ​​for multiple future periods; introducing an error feedback mechanism in the rolling forecast, updating the normalization parameters, data window, and feature distribution state after each batch of forecasts is completed to mitigate the risk of forecast drift; and calculating multiple evaluation indicators after the forecast output is denormalized, including mean squared error, mean absolute percentage error, deviation curve, and trend fit, to support port planning departments in carrying out application scenarios such as operation plan formulation, berth scheduling optimization, yard resource allocation, and policy scenario simulation, thereby improving the business usability of the forecasting method.