Cold chain warehouse demand prediction method based on machine learning
By employing a bidirectional LSTM model that incorporates data preprocessing, feature engineering, and Bayesian optimization of hyperparameter tuning, the problem of order data quality in cold chain warehousing management is solved, achieving high-precision and stable demand forecasting. This model is applicable to cold chain warehousing and other fields.
Patent Information
- Application Number
- CN202511672336.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-14
- Publication Date
- 2026-02-13
AI Technical Summary
In cold chain warehousing management, there are order data quality issues, such as missing values, outliers, and noise interference, which lead to unstable model predictions, low accuracy, time-consuming and inefficient traditional parameter tuning, insufficient model generalization ability, and difficulty in capturing the bidirectional dependencies of time series.
A machine learning-based approach is employed, including data preprocessing, feature engineering, bidirectional long short-term memory network structure, and Bayesian optimization hyperparameter tuning. Data is smoothed using Savitzky-Golay filters, key features are extracted, a bidirectional LSTM model is constructed, and a Bayesian optimization algorithm is used to automatically search for hyperparameter combinations to improve model stability and accuracy.
It achieves automated parameter tuning, significantly improves prediction accuracy and model stability, reduces human intervention, and enhances the model's generalization ability and responsiveness to sudden fluctuations, making it suitable for cold chain demand forecasting and other fields.
Smart Images

Figure CN121525960A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cold chain warehouse demand forecasting technology, specifically a cold chain warehouse demand forecasting method based on machine learning. Background Technology
[0002] In cold chain warehousing management, order data frequently suffers from quality issues, including missing values, outliers, inconsistent formats, and redundant information. These problems stem from multiple factors, such as instability and non-standardization in the data collection process, the difficulty of integrating different data sources, potential omissions or errors during manual data entry, and data inconsistencies caused by untimely system updates or maintenance. These data quality issues not only affect the completeness and accuracy of the data but may also weaken the effectiveness of subsequent analysis and model predictions. The reasons for this situation are as follows: 1. Manual parameter adjustment is time-consuming and inefficient. The performance of LSTM models is extremely sensitive to hyperparameters (such as learning rate, hidden layer size, and regularization coefficient). Traditional manual parameter tuning or grid search methods are difficult to find the optimal combination, which is time-consuming and has poor stability.
[0003] 2. Prediction accuracy is greatly affected by noise. Experimental data or cold chain order data often contain missing values, outliers, and noise interference. Data that has not been filtered or smoothed can lead to model overfitting and unstable predictions.
[0004] 3. Insufficient model generalization ability One-way LSTM cannot capture bidirectional dependencies in time series, making it difficult to accurately characterize complex dynamic changes, and its fitting effect on nonlinear and sudden fluctuations is limited.
[0005] 4. Optimization algorithms are prone to getting trapped in local optima. Traditional random search and genetic algorithms have difficulty converging effectively in high-dimensional parameter spaces and are prone to getting trapped in local optima, leading to a decline in prediction performance.
[0006] To address the technical challenges in cold chain warehousing management, there is an urgent need for a machine learning prediction method that can automatically adjust parameters, reduce noise, and provide stable and high-precision predictions. Summary of the Invention
[0007] The purpose of this invention is to provide a cold chain warehouse demand forecasting method based on machine learning, which can achieve automatic parameter adjustment, noise reduction, stable forecasting and high accuracy.
[0008] To achieve the above objectives, the present invention provides the following technical solution: A machine learning-based method for cold chain warehouse demand forecasting includes the following steps: Step S1: Data Collection: Collect historical order data from the cold chain warehouse, including fields such as product information, sales quantity, time, discount type, and holidays; Step S2: Data preprocessing: outlier detection and cleaning are performed on the data, missing data are filled by interpolation or mean, time series data are smoothed using Savitzky-Golay filter, noise is removed and characteristic peaks are preserved, and the data is normalized. Step S3: Feature Engineering: Extract key features that affect demand changes from the retained feature peaks, including time lag features, holiday features, promotion features and periodic features. Generate auxiliary feature variables according to experimental or operating conditions to form a multi-dimensional input matrix for model training. Step S4: Construct a bidirectional long short-term memory network structure, simultaneously inputting forward and backward information from the time series, setting up an input layer, hidden layer, output layer, and fully connected layer, establishing a predictive relationship model, and using training data to perform initial training on the model; Step S5: Bayesian optimization of hyperparameters: Using a Gaussian process as a surrogate model, the objective function is defined as minimizing the root mean square error. The acquisition function is designed to achieve a balance between exploration and utilization. The hyperparameter combination is automatically searched, and the LSTM model is retrained under the optimal hyperparameter conditions to obtain the optimal prediction model. Step S6: Model Prediction and Evaluation: Use the trained model to predict new data samples, and use multiple indicators to evaluate the model performance, including the coefficient of determination, mean square error, root mean square error, and mean absolute error. Output the cold chain storage demand forecast results for a period of time in the future to provide a reference for scheduling and inventory decisions.
[0009] Compared with the prior art, the beneficial effects of the present invention are: 1. High degree of automation, reducing human intervention: Bayesian optimization enables automatic adjustment of hyperparameters, avoiding repeated manual trials and saving model configuration time.
[0010] 2. Significantly improved prediction accuracy: The Bayesian optimization adaptive search mechanism can globally optimize the combination of hyperparameters, reducing the model RMSE by about 15-25% and increasing R² to over 0.69. Compared with the traditional LSTM model, the prediction error is reduced by about 20%.
[0011] 3. Enhanced model stability and generalization ability: The bidirectional LSTM structure captures both forward and backward dependencies in the time series simultaneously. Combined with Savitzky-Golay smoothing filtering, it significantly reduces the impact of noise and improves the response to sudden fluctuations.
[0012] 4. High versatility and scalability: This method is not only applicable to cold chain demand forecasting, but can also be widely used in fields such as solubility forecasting, gas absorption concentration forecasting, and warehouse energy consumption forecasting. Attached Figure Description
[0013] Figure 1 This is a basic structure diagram of LSTM; Figure 2 This is a diagram of the structure of a BiLSTM neural network; Figure 3 This is a roadmap for LSTM neural network technology. Figure 4 This is a flowchart illustrating the cold chain warehouse demand forecasting process according to an embodiment of the present invention. Figure 5 The residual sequence diagram of the Savitzky-Golay filter is shown in the residual sequence, residual distribution, and comparison of the effects of different time series smoothing methods in the embodiments of the present invention. Figure 6 The image shows the residual distribution of the Savitzky-Golay filter in the residual sequence, residual distribution, and comparison of the effects of different time series smoothing methods in the embodiments of the present invention. Figure 7 This is a comparison chart of different time series smoothing methods in the residual sequence, residual distribution, and effect comparison of different time series smoothing methods in the embodiments of the present invention; Figure 8 This is a comparison chart of the prediction performance of the BO-LSTM training set in the embodiment of the present invention, comparing the performance of the BO-LSTM and BO-BiLSTM models. Figure 9 This is a comparison chart of the prediction performance of BO-LSTM on the test set in the embodiment of the present invention, comparing the performance of BO-LSTM and BO-BiLSTM models. Figure 10 This is a graph showing the prediction residual sequence of the BO-LSTM test set in a comparison of the performance of the BO-LSTM and BO-BiLSTM models in an embodiment of the present invention. Figure 11 This is a comparison chart of the prediction performance of the BO-BiLSTM training set in the embodiment of the present invention, comparing the performance of the BO-LSTM and BO-BiLSTM models. Figure 12 This is a comparison chart of the prediction performance of BO-BiLSTM on the test set in the embodiment of the present invention, comparing the performance of BO-LSTM and BO-BiLSTM models. Figure 13 This is a graph showing the prediction residual sequence of the BO-BiLSTM test set in a comparison of the performance of the BO-LSTM and BO-BiLSTM models in an embodiment of the present invention. Figure 14This is a comparison of the iterative convergence curves of the BO-LSTM model and the BO-BiLSTM model in an embodiment of the present invention. Figure 15 This is a comparison of the iterative convergence curves of the BO-LSTM and BO-BiLSTM models in an embodiment of the present invention. Figure 16 This is a comparison of the BO-LSTM fitting regression in an embodiment of the present invention, showing the BO-LSTM training set fitting regression plot. Figure 17 This is a regression diagram of the BO-LSTM test set fitting in the BO-LSTM fitting regression comparison of embodiments of the present invention; Figure 18 This is a regression comparison chart of the BO-LSTM dataset in an embodiment of the present invention. Figure 19 This is an example of the BO-BiLSTM regression fitting comparison in an embodiment of the present invention; Figure 20 This is a regression diagram of the BO-BiLSTM test set in the embodiment of the present invention for comparison of BO-BiLSTM fitting regression; Figure 21 This is a regression comparison chart of the BO-BiLSTM dataset in an embodiment of the present invention.
[0014] Figure 22 This is a schematic diagram illustrating the execution flow of a machine learning-based cold chain warehouse demand forecasting method according to the present invention. Detailed Implementation
[0015] 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.
[0016] This invention provides a machine learning-based method for cold chain warehouse demand forecasting, comprising the following steps: Step S1: Data Collection: Collect historical order data from the cold chain warehouse, including fields such as product information, sales quantity, time, discount type, and holidays.
[0017] Step S2: Data preprocessing: outlier detection and cleaning are performed on the data, missing data are filled by interpolation or mean, time series data are smoothed using Savitzky-Golay filter, noise is removed and characteristic peaks are preserved, and the data is normalized.
[0018] Due to the characteristics of cold chain scenarios, order data often suffers from quality issues, including missing values, outliers, inconsistent formats, and redundant information. These problems stem from multiple factors, such as instability and non-standardization in the data collection process, the difficulty of integrating different data sources, potential omissions or errors during manual data entry, and data inconsistencies caused by untimely system updates or maintenance. These data quality issues not only affect the completeness and accuracy of the data but may also weaken the effectiveness of subsequent analysis and model predictions. Therefore, it is necessary to clean and preprocess this problematic data.
[0019] In the data preprocessing cleaning stage, duplicate values, missing values, and invalid data were identified and removed. Common methods include interpolation or mean imputation for missing values, and rule-based filtering or manual verification to remove invalid data and duplicate records, thereby improving the overall quality and reliability of the data. To further unify the range of feature values, the data is normalized. Common methods include Min-Max normalization, which helps improve the model's sensitivity and balance to different features, and is particularly suitable for neural network models sensitive to scales.
[0020] To mitigate random noise fluctuations in time series data and smooth cold chain logistics order time series data for analysis, smoothing techniques must strike a balance between statistical characteristics and the specific needs of the cold chain scenario. This method aims to scientifically and effectively reduce noise while revealing underlying trends and periodic fluctuations. Commonly used smoothing methods include: Simple Moving Average (SMA), Exponential Smoothing, Lowes' Locally Weighted Scatterplot Smoothing, and the Savitzky-Golay Filter. This case study employs the Savitzky-Golay filter to smooth the time series data.
[0021] The Savitzky-Golay filter, proposed by Savitzky and Golay in 1964, is a local polynomial fitting method based on least squares and a sliding window. This method effectively suppresses the influence of external noise signals on the data by performing least squares fitting on discrete data within the window. Therefore, this filter is widely used in data flow smoothing and noise reduction, effectively preserving detailed features while accurately capturing boundary inflection points. Its characteristics make it particularly suitable for analyzing demand fluctuations that are sensitive to changes in cold chain operations.
[0022] When applied in real-world cold chain scenarios, an appropriate model can be selected based on the actual data conditions, balancing smoothing effects with information retention to ensure data continuity and accuracy, thus providing a reliable foundation for subsequent analysis and prediction.
[0023] Step S3: Feature Engineering: Extract key features that affect demand changes from the retained feature peaks, including time lag features, holiday features, promotion features, and periodic features. Generate auxiliary feature variables based on experimental or operating conditions to form a multi-dimensional input matrix for model training.
[0024] To enhance the model's ability to model complex dynamic sequences, this invention designs a series of feature engineering strategies based on the original data, including time lag features, time features, periodic features, and other features, to obtain the temporal dependencies and exogenous disturbances affecting the target variable.
[0025] Lag features: By introducing historical data points as features, the model is helped to capture the temporal dependencies and dynamic change patterns in time series.
[0026] Time features: By extracting time-related attributes, the model's understanding of periodicity, trends, and seasonality in the data is enhanced. Commonly used time features include basic time information such as year, month, day, week, hour, and minute.
[0027] Holiday characteristics: By marking important holidays, holiday lengths, and special events, the model can capture periodic fluctuations and abrupt changes caused by changes in human activities.
[0028] Step S4: Construct a bidirectional long short-term memory network structure, simultaneously inputting forward and backward information from the time series, setting up an input layer, hidden layer, output layer, and fully connected layer, establishing a predictive relationship model, and using training data to perform initial training on the model; Step S5: Bayesian optimization of hyperparameters: Using a Gaussian process as a surrogate model, the objective function is defined as minimizing the root mean square error. The acquisition function is designed to achieve a balance between exploration and utilization. The hyperparameter combination is automatically searched, and the LSTM model is retrained under the optimal hyperparameter conditions to obtain the optimal prediction model. Long Short-Term Memory (LSTM) is a special type of recurrent neural network, first proposed by Hochreiter and Schmidhuber in 1997. It aims to address the vanishing and exploding gradient problems faced by traditional RNNs in sequence modeling. Compared to traditional RNNs, LSTM effectively captures and retains long-term dependency information through memory units and gating mechanisms, thus significantly enhancing the model's performance in complex sequence tasks.
[0029] The core structure of LSTM consists of three parts: an input gate, a forget gate, and an output gate. These gating mechanisms can dynamically adjust the memory state based on historical information, effectively preventing information loss or over-accumulation in long sequences. LSTM can not only capture short-term instantaneous changes but also effectively uncover long-term dependencies in sequences. This characteristic enables LSTM to exhibit outstanding performance in fields such as natural language processing and time series prediction, making it suitable for time-series data with significant seasonality and suddenness, such as cold chain orders.
[0030] like Figure 1 The diagram shows the basic structural unit of a classic LSTM. Each LSTM mainly consists of three gate structures and one cell state, which are: Forget gate: determines whether to discard information from the previous state at the current time step, as shown in formula (1). (1) Input gate: determines which parts of the current input information are added to the unit state, as shown in formula (2). (2) Next, candidate cell states will be generated, which represent new information that can be added to the cell state, as shown in formula (3); (3) Update the cell state: Combine the forget gate and the input gate to update the cell state, as shown in formula (4); (4) Output gate: As an information "conveyor", it runs through the entire sequence to realize long-term memory function and controls how the current state affects the final output, as shown in formula (5) and formula (6).
[0031] (5) (6) in, It is the input at the current moment. The current hidden state. It was the hidden state from a previous moment. It is the current state of the cell. It is the cell state at the previous moment. It is the current state of the candidate unit. It is the activation value of the input gate. It is the activation value of the Forgotten Gate. It is the activation value of the output gate. It is the sigmoid activation function. , , , It is a weight matrix. , , , It is the bias vector, here It is element-wise multiplication.
[0032] like Figure 2 As shown, a one-way LSTM network can only predict information from front to back. Based on the one-way LSTM network, Schuster proposed a BiLSTM network that considers both early and late information.
[0033] BiLSTM networks perform forward and backward computations simultaneously. The horizontal direction represents the bidirectional information flow along the time series, while the vertical direction represents the unidirectional information flow from the input layer to the hidden layer and then to the output layer. The hidden layer comprises two LSTM models: a forward transport layer and a backward transport layer. After receiving input data, the model generates new latent vectors. and As shown in formulas (7), (8), and (9).
[0034] (7) (8) (9) in, These are weighting coefficients. This is the bias vector.
[0035] In the network's structure diagram, the horizontal direction represents the bidirectional information flow along the time series, showing the forward and reverse transmission paths; the vertical direction represents the unidirectional information flow from the input layer to the hidden layer and then to the output layer. Through this bidirectional processing method, BiLSTM can enhance the model's ability to capture bidirectional dependencies in sequential data, thus demonstrating superior performance in tasks such as time series prediction and natural language processing.
[0036] like Figure 3 As shown, the input order data is first normalized, then relevant feature variables are extracted to construct a multivariate time series as the training set. The training set is then input into an LSTM (or BiLSTM) layer for model training, and finally, a fully connected layer is used to generate the prediction results.
[0037] The selection of hyperparameters has a decisive impact on the learning and generalization ability of the speed prediction model. Manually tuning hyperparameters is time-consuming and it is difficult to guarantee finding the optimal parameter combination. In order to improve the generalization ability and training efficiency of the model, this invention introduces the Bayesian optimization algorithm into the LSTM model design, aiming to reduce the time cost required for hyperparameter tuning and improve the model's performance in predicting speed.
[0038] Bayesian optimization is a global optimization method that can obtain the optimal solution with fewer iterations and known data, and can be used to adjust the hyperparameters of machine learning algorithms. The core of Bayesian optimization consists of two parts: First, a mathematical model of the objective function is established through Gaussian process regression to approximate the current black-box objective function and calculate the mean and variance of the function value at each point. Second, a sampling function is constructed based on the posterior probability distribution to estimate the most likely location of the optimal point under the current known data conditions. At the same time, in order to avoid getting trapped in local extrema, Bayesian optimization usually adds a certain degree of randomness, making a trade-off between random exploration and taking values based on the posterior distribution. As shown in formula (10), Bayes' theorem states that... (10) in, , Data respectively , The prior distribution, i.e., the surrogate model, uses a Gaussian process; To utilize the proxy model Observational data Distribution; It is a posterior distribution, that is, using observed data. Update the proxy model The new distribution.
[0039] The mapping from the hyperparameter vector x to the model's generalization performance is used as the objective function. Typically, the error metrics of the model on the training set, such as mean squared error (MSE) and root mean square error (RMSE), are set as the objective function to be optimized. This represents a vector of hyperparameters, such as the learning rate, the number of hidden units, and the regularization parameter. The goal of hyperparameter optimization is to find the hyperparameters in the hyperparameter space that optimize the model's generalization performance. Taking finding the minimum error index as an example, the objective function is to train the LSTM model and calculate its maximum loss on the validation set, which can be expressed as formula (11): (11) Due to the function This expresses the measurement of model generalization metrics, such as generalization accuracy, regarding model hyperparameters. However, currently, training and evaluating a model based on a set of hyperparameters requires significant computation and a long time. It is a black-box objective function with high evaluation costs.
[0040] The Bayesian optimization algorithm uses a Gaussian process (GP) as a surrogate model. A key feature of the Gaussian process is that its "prior distribution" can be updated by the observed values, thus allowing the updated "prior distribution" to obtain the distribution of the new function and achieve the optimization fitting process. The Gaussian process consists of a mean function and a covariance function, as shown in formulas (12) and (13).
[0041] (12) (13) in, It is a mean function. Let it be a kernel function or covariance function, such as Squared Exponential Kernel, Exponential Kernel, etc., and assume... It follows a normal distribution.
[0042] In the Gaussian process of this invention, the Squared Exponential Kernel is used, which is a kernel function commonly used in machine learning and statistical models. The specific formula is shown in (14): (14) in, It is a feature length scale. It is the standard deviation of the signal.
[0043] Gaussian process models possess strong expressive power and high computational efficiency, effectively adapting to complex objective function shapes. Although computational costs may be high on large-scale datasets, high computational efficiency can still be maintained through techniques such as sparse approximation and kernel function selection. This enables Gaussian process models to demonstrate superior adaptability when dealing with complex and variable objective functions, providing strong surrogate model support for Bayesian optimization, thereby achieving efficient and accurate global optimization.
[0044] Sampling functions play a crucial role in Bayesian optimization. Since Gaussian processes only provide estimates of the mean and variance of the objective function, sampling functions are necessary to balance exploration and exploitation in practical optimization. In real-world applications of Bayesian optimization, excessive exploration may prevent the model from fully utilizing prior information, thus limiting optimization performance with limited evaluation resources; conversely, excessive exploitation may cause the model to prematurely fall into local optima, lacking sufficient ability to explore the search space. Therefore, designing a reasonable sampling strategy, based on the mean and variance output of the Gaussian process, to balance exploring new regions with utilizing known optimal regions, is key to achieving efficient global optimization.
[0045] In each iteration of Bayesian optimization, a sampling function is typically used. To obtain the next sample point for evaluation. The acquisition function is composed of the posterior distribution of the observed data, and the next sample point to be evaluated is selected by maximizing it, as shown in Equation (15).
[0046] (15) in, For the optimal combination of hyperparameters, Let the objective function be a hyperparameter. It is a set of hyperparameters.
[0047] Common acquisition functions include probability boosting function (PI), expected boosting function (EI), and confidence upper bound function (UCB). A well-designed acquisition function can guide the optimization process to focus on search regions with high improvement potential, thereby finding a solution closer to the global optimum within a limited number of evaluations, significantly improving the efficiency and effectiveness of optimization. This study chooses EI as the acquisition function and introduces per-second and plus parameters as strategies in Bayesian optimization, aiming to select the most promising hyperparameter combinations for evaluation during the optimization process.
[0048] Expected Improvement: Measures the expected improvement of a set of hyperparameters based on the current optimal values. A higher value indicates that it is more likely to bring better results, see formula (16).
[0049] (16) in, The location of the lowest posterior mean. It is the lowest value of the posterior mean.
[0050] when When, the formula can be obtained. : (17) Then, using the properties of the standard normal distribution, we can obtain: as shown in formula (18). (18) Evaluation speed (per second): Sometimes the time required to evaluate the objective function may vary depending on the region. Considering the time spent on each evaluation, the improvement results are combined with the evaluation time, and the parameter combination that brings the greatest improvement per unit time is selected first, as shown in formula (19).
[0051] (19) in, It is the posterior mean of the timed Gaussian process model.
[0052] This correction makes Bayesian optimization biased towards candidates with larger expected improvement and lower computational cost when selecting the next experimental point, thus achieving better results with the same total optimization time budget.
[0053] Plus: This indicates that an additional adjustment mechanism is added on the basis of the original one. The purpose is to avoid getting trapped in local optima and get rid of the local minimum of the objective function, so as to further balance the relationship between exploration and utilization, as shown in formula (20) and formula (21).
[0054] (20) (twenty one) in, It is a small positive number, often referred to as the improved offset.
[0055] This strategy can prevent EI from "converging prematurely" near the optimal value, prompting the algorithm to break out of the local and further explore the unknown region, thereby improving the utilization of the algorithm.
[0056] To evaluate the demand forecasting BO-LSTM model proposed in this invention for optimizing cold chain logistics warehousing, the model performance is mainly evaluated using five indicators, namely mean squared error (MSE). ), root mean square error ( ), mean absolute error (( ), goodness of fit and residual prediction bias ( ), set root mean square error ( The minimum is the optimization objective, and their definitions are shown in formulas (22), (23), (24), (25), and (26): (twenty two)
[0057] (twenty three)
[0058] (twenty four)
[0059] (25)
[0060] (26) in, For the first The actual value of each sample For the first Predicted values for each sample Here, is the average value of the actual sample. The standard deviation is denoted as . Example:
[0061] To verify the effectiveness of the Bayesian optimization-based LSTM model proposed in this study, order data from the Beigang Logistics Cold Storage Warehouse in China was selected as the analysis sample. The data covers the period from February 5, 2024 to June 1, 2025. Taking Musang King durian fresh fruit order data as an example, a time series was constructed. The order-inventory forecasting mapping relationship was established with discount methods, weekly order volume, and holiday characteristics as key variables. The model parameters were tuned through Bayesian optimization to obtain the optimal model configuration. Finally, this invention compared and analyzed the performance differences between the LSTM model and the BiLSTM model, and evaluated their accuracy and stability in demand forecasting, thus achieving the goal of demand forecasting and result analysis.
[0062] like Figure 4As shown, cold chain order data is first preprocessed, and feature engineering is then performed to extract key features. The dataset is then divided into a test set and a training set in a 2:8 ratio. The training set is input into a Long Short-Term Memory (LSTM) network for model training. To improve model performance, a Bayesian optimization method is introduced, with minimizing the root mean square error (RMSE) as the optimization objective. A Gaussian process is used to fit the objective function, and the acquisition function is used to adaptively select the hyperparameter combination. During iteration, if the stopping condition is not met, the Gaussian process optimization continues; if the stopping condition is met, the optimal hyperparameter combination is determined, and an optimized LSTM prediction model is built based on this. Finally, the prediction results are obtained through this optimized model, thus providing data-driven support for scientific decision-making and efficiency improvement in cold chain warehousing management.
[0063] The raw data used in this analysis of logistics and warehousing order data contains 25 key fields, as detailed in Table 1. These fields cover information related to products, sales, warehouse locations, and time, providing foundational data support for subsequent demand forecasting. (Table 1)
[0064] Based on the original sales order data, core fields such as product name, unit of measurement, sales quantity, discount type, sales time, product category, and location code are filtered and retained. Subsequently, feature engineering and feature recognition are performed on these fields to provide reliable data support for warehouse demand forecasting.
[0065] Before model training, this invention first systematically preprocesses the raw data, including data cleaning and format conversion, to ensure the accuracy, standardization, and consistency of the data. Based on the order time of Musang King durian orders, the data is merged on a weekly basis to form a continuous time series. Simultaneously, this time series is smoothed using a second-order Savitzky-Golay filter with a window size of 5 to reduce fluctuations and anomalies in the data, while preserving detailed features and boundary inflection points, thus enhancing the model's stability and predictive accuracy.
[0066] like Figure 5 , 6 As shown in Figure 7, compared with different time series smoothing methods, the Savitzky-Golay filter performs best in terms of smoothing effect and peak preservation. This filter effectively removes noise while preserving data details and peak values to the greatest extent by fitting a polynomial within a sliding window. Compared with traditional moving average methods, the Savitzky-Golay filter not only has advantages in processing data at window boundaries but also maintains the overall shape of the signal during smoothing, making the data features more complete and realistic.
[0067] Feature engineering was performed based on data processing to transform and extract key indicators that effectively reflect the characteristics of time series data. This helps the model better understand the data structure, thereby improving the model's accuracy and generalization ability. The extracted features include date, work schedule adjustments, holidays, discount methods, and lag time.
[0068] Considering that order data is greatly affected by holidays, holiday information is specifically included as an important feature variable to enhance the model's sensitivity to seasonality and special events.
[0069] Table 2 lists the holidays and adjusted workdays, including New Year's Day, Spring Festival, Qingming Festival, Labor Day, Valentine's Day, Dragon Boat Festival, Mid-Autumn Festival, and National Day. Using this information helps enhance the model's ability to predict order changes during holidays, thereby improving the accuracy and timeliness of forecasts.
[0070] Table 2:
[0071] Table 3: Examples of Date Feature Extraction
[0072] Table 4: Feature Coding Table for Categorical Data
[0073] Time characteristics: As shown in Table 3, the calendar "week number" is used as the counting method. The first week starts from February 5, 2024. That is, February 5, 2024 to February 11, 2024 is 1, February 12, 2024 to February 18, 2024 is 2, and so on.
[0074] Holiday characteristics: As shown in Table 2, "festivals" and "holidays" mainly include New Year's Day, Spring Festival, Qingming Festival, Labor Day, Valentine's Day, Dragon Boat Festival, Mid-Autumn Festival and National Day. The holiday classification data based on days are combined into the sum of data based on weeks, representing the number of holiday days in a week.
[0075] Adjusted workday characteristics: Leave time is adjusted according to national statutory holidays. As shown in Table 4, the sum of daily adjusted workday categories combined into weekly data represents the number of adjusted workdays within a week.
[0076] Promotional features: As shown in Table 4, these include promotional prices, discounted prices, and regular prices, representing the number of times each promotional price, discounted price, and regular price are displayed within a week.
[0077] Lagged Features: In order to capture the dependency and periodicity of the data, a lagged feature field is added to the data, with a lag time step of 1, that is, the demand of the previous week is used as one of the input features of the current week.
[0078] This invention utilizes the MATLAB 2023b development environment to build the corresponding model architecture. The system runs on a Windows 11 operating system, and the hardware configuration includes an AMD Ryzen 7 6800H processor (3.20 GHz), an NVIDIA GeForce RTX 3060 Laptop GPU, and 16 GB of RAM. During model training, GPU acceleration is employed, and the Adam optimizer is selected due to its superior performance in adaptive learning rate adjustment, effectively improving training efficiency and model convergence speed. By appropriately configuring Bayesian optimization parameters, the model's hyperparameter settings are further optimized to achieve the best predictive performance and generalization ability. The search space settings are shown in Table 5.
[0079] Table 5: Search Space Configuration Table
[0080] In this invention, Bayesian optimization is used to tune the hyperparameters of the LSTM model to improve its performance and robustness in time series prediction tasks. The hyperparameters to be tuned include: the number of neurons in the LSTM hidden layers, the learner's learning rate, and the L2 regularization coefficient. The root mean squared error (RMSE) is used as the objective function to measure the prediction performance of different hyperparameter configurations on the validation set.
[0081] Bayesian optimization efficiently searches the hyperparameter space by constructing a Gaussian Process (GP) surrogate model of the objective function. This study selects the Squared Exponential Kernel as the kernel function of the GP, which has a strong assumption of function smoothness and is suitable for modeling continuous performance response surfaces.
[0082] In selecting the acquisition function, the Expected Improvement per Second Plus criterion was adopted to further improve optimization efficiency. This acquisition function considers the magnitude of potential improvement and the time consumed in each evaluation when evaluating potential hyperparameters, enabling the tuning process to find the optimal hyperparameter configuration faster and more effectively within limited time resources.
[0083] The maximum number of iterations for Bayesian optimization was set to 20, meaning the optimization process stopped after exploring 20 sets of hyperparameter configurations. LSTM and BiLSTM models were trained separately, and training was terminated after 800 iterations to ensure the models were well-fitted and the optimization results were comparable.
[0084] This invention uses LSTM and BiLSTM models as a benchmark and introduces a Bayesian optimization algorithm during the model parameter optimization process to establish a Bayesian-optimized long short-term memory network model for prediction, thus obtaining the optimal cold chain storage demand prediction model. The optimal feasible parameter combination of the model was obtained through Bayesian estimation, as shown in Table 6.
[0085] Table 6: Hyperparameter values after Bayesian optimization
[0086] After obtaining the optimal feasible parameter combination, the performance of the two optimized models is verified by comparing their training and test sets. Figure 8 , Figure 9 , Figure 10 , Figure 11 , Figure 12 , Figure 13 As shown.
[0087] After obtaining the ideal parameter combination, the performance of the two optimized models on the training and test sets was evaluated (as shown in Table 6). On the training set, BO-BiLSTM outperformed BO-LSTM in all metrics: Higher (0.99147 vs. 0.99055), lower root mean square error (4.1926 vs. 4.4129), lower mean square error (17.5777 vs. 19.4734), and higher relative prediction error (10.826 vs. 10.5213). On the test set, BO-BiLSTM also performs better. The average generalization and fitting performance of BO-BiLSTM were significantly higher (0.69367 vs. 0.56856), with lower RMSE (19.1841 vs. 22.7672), lower MSE (368.031 vs. 518.3456), and higher RPD (1.8119 vs. 1.5449). Overall, these findings indicate that BO-BiLSTM demonstrates superior generalization and fitting capabilities compared to BO-LSTM on both datasets.
[0088] In the case study of cold chain fresh durian inventory demand forecasting, the BO-BiLSTM model outperformed the BO-LSTM model, more accurately capturing the temporal changes and complex nonlinear relationships in demand. Fine-tuning the hyperparameters of the BiLSTM model using Bayesian optimization effectively improved the model's prediction accuracy and generalization ability.
[0089] After completing model training, this invention evaluated the model using various metrics, including... , , as well as Furthermore, this invention also presents data on various evaluation indicators, including comparison charts of actual and predicted values, linear fitting charts, etc., to demonstrate the performance of the model, so as to facilitate in-depth analysis and research.
[0090] like Figure 14 As shown, during the iteration process of the BO-LSTM model, the model converges rapidly and stabilizes after 6 iterations, demonstrating good optimization efficiency. During this process, the RMSE of the objective value reaches its minimum, which is greater than 0.016; Figure 15 As shown, during the iteration process of the BO-BiLSTM model, the objective value initially showed a brief period of stability before continuing to decrease and gradually converged. After 16 iterations, the objective value remained basically stable, and its lowest value was below 0.014.
[0091] The results validate the effectiveness of the employed Bayesian optimization algorithm in model parameter tuning. It not only finds a better solution in fewer iterations but also significantly improves the model's predictive performance, providing strong technical support for subsequent practical applications. Furthermore, this optimization strategy exhibits good stability and generalization ability, and is also applicable to parameter tuning of other deep learning models.
[0092] Depend on Figure 16 , Figure 17 and Figure 18 As shown, the BO-LSTM model, after Bayesian hyperparameter optimization, exhibits only moderate prediction performance in the cold chain fresh durian case. On the training set, the model's goodness of fit reaches [value missing]. It is 0.99055, and the root mean square error is... The value was 4.4129; however, on the test set, the model's... It is 22.7672, and The value of 0.56856 < 0.6 indicates that the model has a poor fit and weak generalization ability.
[0093] like Figure 19 , Figure 20 and Figure 21 As shown, the BO-BiLSTM model, after Bayesian optimization and hyperparameter tuning, basically achieves accurate prediction of Musang King durian order data. On the training set, the model's... Reaching 0.99147, The value is 4.1926; on the test set, the model's... The value is 0.61122 > 0.6. The score is 21.6125, indicating that the model still has good generalization ability; overall, the scores for all datasets are... It is 0.80134. The value of 12.9025 indicates that the model's prediction performance is relatively stable across the entire dataset and has strong practicality.
[0094] The results of the two models were compared to verify the effectiveness of the Bayesian optimization method in tuning the hyperparameters of the BiLSTM model. This not only improved the model's fitting ability but also enhanced its application potential in actual order forecasting, providing strong technical support for optimizing cold chain supply chain management.
[0095] To evaluate the performance improvement effect of Bayesian optimization, this invention uses LSTM and BiLSTM models without Bayesian optimization as baseline models. The number of hidden layer neurons is uniformly set to 300, the Initial Learn Rate is 1×10−2, and the L2 Regularization is 1×10−5. All other parameters and training environment are the same. The performance of these models in cold chain demand prediction is compared, and the results are shown in Table 7.
[0096] Table 7: Performance Comparison of Different Combinations of Bayesian Optimization and LSTM Models
[0097] Comparing the performance of LSTM and BiLSTM models reveals that BiLSTM exhibits higher fitting ability and lower prediction error on both the training and test sets, while LSTM has an advantage in operational efficiency. After introducing Bayesian optimization, both BO-LSTM and BO-BiLSTM models outperform the unoptimized baseline model in all performance metrics, demonstrating the effectiveness of Bayesian optimization in hyperparameter tuning. In particular, BO-BiLSTM maintains relatively good generalization ability on the test set. It is noteworthy that introducing Bayesian optimization significantly increases the model's training time. The results indicate that, given sufficient training resources, combining BiLSTM with Bayesian optimization can effectively improve prediction accuracy and model stability, providing a more reliable and widely applicable solution for inventory prediction of Musang King durian and even the entire cold chain fresh produce market.
[0098] Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A machine learning-based method for demand forecasting in cold chain warehouses, characterized in that, Includes the following steps: Step S1: Data Collection: Collect historical order data from the cold chain warehouse, including fields such as product information, sales quantity, time, discount type, and holidays; Step S2: Data preprocessing: outlier detection and cleaning are performed on the data, missing data are filled by interpolation or mean, time series data are smoothed using Savitzky-Golay filter, noise is removed and characteristic peaks are preserved, and the data is normalized. Step S3: Feature Engineering: Extract key features that affect demand changes from the retained feature peaks, including time lag features, holiday features, promotion features and periodic features. Generate auxiliary feature variables according to experimental or operating conditions to form a multi-dimensional input matrix for model training. Step S4: Construct a bidirectional long short-term memory network structure, simultaneously inputting forward and backward information from the time series, setting up an input layer, hidden layer, output layer, and fully connected layer, establishing a predictive relationship model, and using training data to perform initial training on the model; Step S5: Bayesian optimization of hyperparameters: Using a Gaussian process as a surrogate model, the objective function is defined as minimizing the root mean square error. The acquisition function is designed to achieve a balance between exploration and utilization. The hyperparameter combination is automatically searched, and the LSTM model is retrained under the optimal hyperparameter conditions to obtain the optimal prediction model. Step S6: Model Prediction and Evaluation: Use the trained model to predict new data samples, and use multiple indicators to evaluate the model performance, including the coefficient of determination, mean square error, root mean square error, and mean absolute error. Output the cold chain storage demand forecast results for a period of time in the future to provide a reference for scheduling and inventory decisions.
2. The cold chain warehouse demand forecasting method based on machine learning according to claim 1, characterized in that, In step S3, The lag feature is introduced by using historical data points as features to help the model capture the temporal dependencies and dynamic change patterns in the time series. The time feature is to enhance the model's understanding of the periodicity, trend and seasonality in the data by extracting time-related attributes; Holiday characteristics help the model capture periodic fluctuations and abrupt changes caused by changes in human activities by marking important holidays, holiday lengths, and special events.
3. The cold chain warehouse demand forecasting method based on machine learning according to claim 1, characterized in that, In step S3, feature engineering is performed on the preprocessed data to extract key features. The dataset is then divided into an 80% training set and a 20% test set. The training set is then input into a long short-term memory network for modeling and training.
4. The cold chain warehouse demand forecasting method based on machine learning according to claim 1, characterized in that, In step S5, in each iteration of the Bayesian optimization, a collection function is used to obtain the next sample point for evaluation. The collection function is composed of the posterior distribution of the observed data, and the next sample point to be evaluated is selected by maximizing it.