Cigarette seasonal putting prediction method and device based on ensemble learning and medium
Through an integrated learning-based method, a time series prediction model is constructed, which solves the cigarette delivery problem that relies on experience in the prior art, and achieves more accurate and reliable seasonal factor prediction and cigarette delivery determination.
Patent Information
- Application Number
- CN202510263049.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-06
- Publication Date
- 2025-06-17
AI Technical Summary
The existing cigarette delivery methods rely on the experience of managers and lack scientific basis and systematic theoretical support, resulting in a gap between decision-making and ideal optimal state.
The cigarette seasonal delivery prediction method based on integrated learning is adopted, and the training set is constructed by obtaining annual marketing plan data, seasonal data and historical sales data, and the training set is constructed by pre-processing. The time series prediction model is trained using the integrated learning algorithm to predict future seasonal factors and cigarette delivery.
The accuracy and reliability of seasonal factor prediction are improved, and the automatic intelligent output of seasonal factors is achieved, guiding cigarette release and controlling market status is achieved.
Smart Images

Figure CN120163606A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of cigarette delivery, and particularly relates to a cigarette seasonal delivery prediction method, device and medium based on ensemble learning. Background Art
[0002] Cigarette delivery is a key link in cigarette marketing, reflecting the precise response to market demand. Given that the terminal consumption of cigarettes shows significant seasonal characteristics, fluctuations in delivery volume caused by seasonality must be considered in cigarette delivery.
[0003] In the existing actual delivery work, managers will simply evaluate the delivery volume through an Excel spreadsheet based on factors such as whether there are holidays in the next month, the difference from the annual sales plan, and whether it is necessary to sell or stock up in advance for the next month. The proportion of the increase is often subjectively determined. This method requires managers to have mature marketing management experience, and the effectiveness of the delivery is limited by the heterogeneity of personal abilities and experience. Secondly, even if managers have sufficient experience, due to the lack of scientific basis and systematic theoretical support, there is still a gap between their decisions and the ideal optimal state. Summary of the Invention
[0004] The purpose of the present invention is to provide a cigarette seasonal delivery prediction method, device and medium based on ensemble learning to solve the problems in the prior art that require managers to have mature marketing management experience, and the effectiveness of the delivery is limited by the heterogeneity of personal abilities and experience. Secondly, even if managers have sufficient experience, due to the lack of scientific basis and systematic theoretical support, there is still a gap between their decisions and the ideal optimal state.
[0005] To achieve the above purpose, the present invention adopts the following technical solutions: In the first aspect, the present invention provides a cigarette seasonal delivery prediction method based on ensemble learning, the method comprising: Obtaining annual marketing plan data, seasonal data and historical sales data of cigarette delivery; Preprocessing the annual marketing plan data, seasonal data and historical sales data to obtain periodic historical exogenous variables and historical seasonal factors, where the historical seasonal factors are used to characterize the change range of the cigarette delivery volume in any one period relative to the average value of the historical cigarette delivery volume; Constructing a training set based on the periodic historical exogenous variables and historical seasonal factors; Based on the training set, an ensemble learning algorithm is used to train a pre-constructed time series prediction model to obtain a trained time series prediction model. The trained time series prediction model is used to predict the seasonal factor prediction values for a future period of time, and the seasonal factor prediction values for the future period of time are used to determine the cigarette delivery volume for the future period of time.
[0006] Preferably, the historical exogenous variables include: historical seasonal variables and historical sales volume variables; the expression of the time series prediction model is: ; In the formula, is the historical seasonal factor in the t-th period, are the historical seasonal factors in the previous k periods of the t-th period, where k is the lag order, are the historical seasonal variables in the previous k periods of the t-th period, are the historical sales volume variables in the previous k periods of the t-th period, is the initial bias, is the factor coefficient, is the seasonal coefficient, is the sales volume coefficient, is the error term in the t-th period.
[0007] Preferably, the method further includes: Obtain the prediction demand of the user, where the prediction demand is a future period of time, and the future period of time includes at least one future period; Obtain the seasonal variables in each future period and the historical seasonal factors, historical sales volume variables, and historical seasonal variables in the previous k periods of the first future period; Input the seasonal variables in each future period and the historical seasonal factors, historical sales volume variables, and historical seasonal variables in the previous k periods of the first future period into the trained time series prediction model to predict the seasonal factor prediction values for each future period in the future period of time; Determine the cigarette delivery volume for each future period in the future period of time based on the seasonal factor prediction values for each future period in the future period of time.
[0008] Preferably, the method further includes: Record the actual delivery volume data in the first half of the future period of time; Recalculate the actual seasonal factors in the first half of the period based on the actual delivery volume data in the first half of the period; Update the training set with the actual seasonal factors in the first half of the period. Based on the updated training set, retrain the time series prediction model, and use the retrained time series prediction model to re-predict the seasonal factors in the second half of a future period to obtain new predicted values of the seasonal factors for the second half of the period.
[0009] Preferably, the ensemble learning algorithm includes: an input layer, base learners, and a meta-learner; The input layer is used to input the training set during the training process; The base learners are used to take the training set as input, perform one training, and obtain a first prediction result; The meta-learner is used to take the first prediction result as input, perform secondary training, and obtain a second prediction result.
[0010] Preferably, the base learners include: an autoregressive model, a multiple regression model, and a neural network model; The meta-learner includes: a random forest model, a support vector regression model, a gradient boosting model, a multi-layer perceptron model, a decision tree model, a Ridge regression model, and a Lasso regression model.
[0011] Preferably, construct a training set with a preset proportion of data from historical exogenous variables and historical seasonal factors, and construct a test set with the remaining data; taking the training set as input, performing one training, and obtaining a first prediction result includes: Based on the cross-validation rules of the time series, divide the training set to obtain multiple training subsets; Train and test the base learners based on the multiple training subsets, the training set, and the test set to obtain the training data set of the meta-learner, and use the training data set of the meta-learner as the first prediction result.
[0012] Preferably, the multiple training subsets are T1, T2, T3, T4, and T5 in sequence. Training and testing the base learners based on the multiple training subsets, the training set, and the test set to obtain the training data set of the meta-learner includes: Train the base learners with T1 and test the base learners with T2 to obtain the prediction result of T2; Train the base learners with T1 and T2 and test the base learners with T3 to obtain the prediction result of T3; Train the base learners with T1, T2, and T3 and test the base learners with T4 to obtain the prediction result of T4; Train the base learners with T1, T2, T3, and T4 and test the base learners with T5 to obtain the prediction result of T5; Train the base learners with the training set and test the base learners with the test set to obtain the prediction results of the test set; use the prediction results of T2, T3, T4, T5, and the prediction results of the test set as the training data set of the meta-learner.
[0013] In a second aspect, the present invention provides a cigarette seasonal placement prediction device based on ensemble learning for implementing the above-mentioned cigarette seasonal placement prediction method based on ensemble learning. The device includes: A data acquisition module for acquiring annual marketing plan data, seasonal data, and historical sales data of cigarette placement; A data processing module for preprocessing the annual marketing plan data, seasonal data, and historical sales data to obtain periodic historical exogenous variables and historical seasonal factors, where the historical seasonal factors are used to characterize the change range of cigarette placement volume in any one period relative to the mean value of historical cigarette placement volume; A training set construction module for constructing a training set based on the periodic historical exogenous variables and historical seasonal factors; A model training module for training a pre-constructed time series prediction model based on the training set using an ensemble learning algorithm to obtain a trained time series prediction model, where the trained time series prediction model is used to predict the predicted values of seasonal factors in a future period, and the predicted values of seasonal factors in the future period are used to determine the cigarette placement volume in the future period.
[0014] In a third aspect, the present invention provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-mentioned cigarette seasonal placement prediction method based on ensemble learning.
[0015] In a fourth aspect, the present invention provides a computer-readable storage medium with a computer program stored thereon. When the program is executed by a processor, it implements the above-mentioned cigarette seasonal placement prediction method based on ensemble learning.
[0016] Beneficial effects: 1. The present invention constructs a time series prediction model to quantify the seasonal characteristics of cigarette demand, which is beneficial to improving the accuracy and reliability of the prediction of seasonal factors in the later stage; 2. The present invention uses periodic historical exogenous variables and historical seasonal factors to construct a training set, and based on the training set, uses an ensemble learning algorithm to train the time series prediction model. The obtained trained time series prediction model is used to predict the predicted values of seasonal factors in a future period, realizing the automatic and intelligent output of seasonal factors, which is of great significance for guiding cigarette placement and regulating the market state. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention, and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the embodiments of the present invention, but do not constitute a limitation to the embodiments of the present invention. In the accompanying drawings: Figure 1 is a flowchart of a cigarette seasonal delivery prediction method based on ensemble learning provided by an embodiment of the present invention; Figure 2 is a schematic diagram of the network structure of an ensemble learning algorithm provided by an embodiment of the present invention; Figure 3 is a block diagram of a cigarette seasonal delivery prediction device based on ensemble learning provided by an embodiment of the present invention; Figure 4 is a monthly seasonal factor trend curve diagram of cigarettes in a certain city from July 2017 to February 2024; Figure 5 is a weekly seasonal factor trend curve diagram of cigarettes in a certain city from July 2017 to February 2024; Figure 6 is a comparison curve diagram of prediction examples of monthly seasonal factors by a base learner and an ensemble learning-based cigarette seasonal delivery prediction method; Figure 7 is a comparison curve diagram of prediction examples of weekly seasonal factors by a base learner and an ensemble learning-based cigarette seasonal delivery prediction method. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or in the prior art, the following will briefly introduce the present invention in combination with the accompanying drawings and the description of the embodiments or the prior art. Obviously, the following description of the structure of the accompanying drawings is only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on these drawings. It should be noted here that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation to the present invention.
[0019] Embodiment 1 Figure 1 is a flowchart of a cigarette seasonal delivery prediction method based on ensemble learning provided by an embodiment of the present invention. As Figure 1 shown, this embodiment provides a cigarette seasonal delivery prediction method based on ensemble learning, and the method includes: Step S10: Obtain the annual marketing plan data, seasonal data, and historical sales data of cigarette delivery; among them, the historical sales data can be the data of a certain year, and the seasonal data mainly includes: the total number of holidays in this year and data such as holiday status.
[0020] Step S20: Preprocess the annual marketing plan data, seasonal data, and historical sales data to obtain periodic historical exogenous variables and historical seasonal factors. The historical seasonal factors are used to characterize the change range of the cigarette delivery volume in any one cycle relative to the average value of the historical cigarette delivery volume. Among them, the preprocessing mainly includes: data cleaning, standardization processing, etc.
[0021] In this embodiment, the periodic historical exogenous variables and historical seasonal factors may have a cycle of one week (7 days) or one month (30 days). The historical exogenous variables include: historical seasonal variables and historical sales volume variables. The historical seasonal variables include variables such as the holiday status in one cycle, the holiday status in the next cycle, and the number of days occupied by holidays. The sales volume variables include variables such as the sales volume in the previous cycle, the cumulative sales volume in the current year, the difference in sales volume from the annual marketing plan, and the difference in sales volume from the monthly marketing plan.
[0022] In this embodiment, the historical seasonal factor of any one cycle can be calculated according to the change range of the cigarette delivery volume in this cycle relative to the average value of the historical cigarette delivery volume.
[0023] Step S30: Construct a training set based on the periodic historical exogenous variables and historical seasonal factors.
[0024] Step S40: Based on the training set, use an ensemble learning algorithm to train a pre-constructed time series prediction model to obtain a trained time series prediction model. The trained time series prediction model is used to predict the seasonal factor prediction values in the future for a period of time, and the seasonal factor prediction values in the future for a period of time are used to determine the cigarette delivery volume in the future for a period of time.
[0025] In this embodiment, the expression of the time series prediction model is: ; In the formula, is the historical seasonal factor of the t-th cycle, are the historical seasonal factors of the first k cycles before the t-th cycle, k is the lag order, are the historical seasonal variables of the first k cycles before the t-th cycle, are the historical sales volume variables of the first k cycles before the t-th cycle, is the initial bias, is the factor coefficient, is the seasonal coefficient, is the sales volume coefficient, is the error term of the t-th cycle.
[0026] In this embodiment, the calculation of the seasonal factor is defined as a multivariate and multi-step time series prediction model to quantify the seasonal pattern of the cigarette terminal demand; in this embodiment, the seasonal factor includes the weekly seasonal factor and the monthly seasonal factor. In this embodiment, the training set includes the historical seasonal factors of the first k cycles before the t-th cycle , the historical seasonal variables of the first k cycles before the t-th cycle and the historical sales volume variables of the first k cycles before the t-th cycle . Taking the historical seasonal factor of the t-th cycle as the training label, an ensemble learning algorithm is used to train the pre-constructed time series prediction model to determine the initial bias, factor coefficient, seasonal coefficient, sales coefficient, error term and other model parameters of the time series prediction model. After these parameters are calculated, they are input , and to calculate the corresponding .
[0027] Therefore, in the prediction stage, it is necessary to obtain , and and other three parameters. As a further optimization of this embodiment, the method further includes: Step a10: Obtain the prediction demand of the user. The prediction demand is a future period of time, and the future period of time includes at least one future cycle. The future cycle can also be one week (7 days) or one month (30 days) as a cycle.
[0028] Step a20: Obtain the seasonal variables within each future cycle and the historical seasonal factors, historical sales volume variables and historical seasonal variables of the first k cycles before the first future cycle.
[0029] Step a30: Input the seasonal variables within each future cycle and the historical seasonal factors, historical sales volume variables and historical seasonal variables of the first k cycles before the first future cycle into the trained time series prediction model to predict the seasonal factor prediction values of each future cycle within the future period of time.
[0030] Step a40: Determine the cigarette delivery volume of each future cycle within the future period of time based on the seasonal factor prediction values of each future cycle within the future period of time.
[0031] In this embodiment, for example, when predicting the seasonal factors for a year, historical seasonal factors, historical sales volume variables, and historical seasonal variables with a lag order k for the first month of that year are obtained. These parameters are substituted into the trained time series prediction model, and the model will output the predicted value of the seasonal factor for the first month of that year. The cigarette delivery volume for the first month is determined using the seasonal factor for the first month. Then, the predicted cigarette delivery volume and the predicted value of the seasonal factor are used as new historical data. In the second month, the seasonal variables for the first month (i.e., variables such as holiday status, holiday status for the next period, and the number of days occupied by holidays) are counted, and the predicted value of the seasonal factor and the corresponding cigarette delivery volume for the second month are predicted again. Each month of that year is predicted in sequence to obtain the predicted values of the seasonal factors for the whole year, achieving the automatic and intelligent output of seasonal factors. At the same time, the cigarette delivery volume in a future period is used to guide cigarette delivery and regulate the market state. Therefore, this is of great significance for guiding cigarette delivery and regulating the market state.
[0032] As a further optimization of this embodiment, the method further includes: Step b10: Record the actual delivery volume data for the first half of a future period.
[0033] Step b20: Recalculate the actual seasonal factors for the first half of the period based on the actual delivery volume data for the first half of the period.
[0034] Step b30: Update the training set with the actual seasonal factors for the first half of the period. Based on the updated training set, retrain the time series prediction model, and use the retrained time series prediction model to re-predict the seasonal factors for the second half of the future period to obtain new predicted values of the seasonal factors for the second half of the period.
[0035] In this embodiment, through steps a10 to a40, the cigarette delivery volume for each month or each week of a whole year can be predicted. The cigarette delivery volume for each month or each week in step a40 is used as the delivery plan for marketing and sales, and the actual sales data is recorded, such as the actual sales volume for each week or each month, the sales volume difference between the actual sales volume for each week or each month and the actual sales volume for the previous week or month, and the actual difference between the actual sales volume for each week or each month and the delivery plan.
[0036] When six months later (half of a whole year), new exogenous variables are established using these data, the new exogenous variables are input into the time series prediction model, the actual seasonal factors (actual monthly seasonal factors or actual weekly seasonal factors) are calculated, and a new training set is reconstructed using the actual seasonal factors and the corresponding new exogenous variables to retrain the time series prediction model. The retrained time series prediction model then predicts the seasonal factor prediction values for the second half of the whole year, achieving the correction of the seasonal factor prediction values for the second half and improving the accuracy and reliability of the model prediction.
[0037] As a further optimization of this embodiment, as Figure 2 shown, the ensemble learning algorithm includes: an input layer, base learners, and a meta-learner; wherein, the base learners include: an autoregressive model, a multiple regression model, and a neural network model; the meta-learner includes: a random forest model, a support vector regression model, a gradient boosting model, a multi-layer perceptron model, a decision tree model, a Ridge regression model, and a Lasso regression model; The input layer is used to input the training set during the training process, that is, Figure 2 the data input in The base learners are used to take the training set as input, perform one training, and obtain the first prediction result; The meta-learner is used to take the first prediction result as input, perform secondary training, and obtain the second prediction result.
[0038] In this embodiment, the base learners receive historical data (the data in the training set) and output their respective prediction results, and these prediction results are then used as the input of the meta-learner. Through secondary training, the prediction accuracy is further improved.
[0039] In the autoregressive model among the base learners, considering seasonal factors is crucial for time series prediction. Therefore, in this embodiment, SARIMA and SARIMAX are selected as the benchmark algorithms to more accurately capture the seasonal changes and the influence of external factors.
[0040] SARIMA (Seasonal Autoregressive Integrated Moving Average Model) is an extension of ARIMA (Autoregressive Integrated Moving Average Model) and is applicable to time series data containing seasonal components. Its mathematical expression is: ; wherein, and are the autoregressive polynomials of the non-seasonal and seasonal parts respectively, P is the order of the non-seasonal autoregressive term, the superscript s is the seasonal period length, and are the differences of the non-seasonal and seasonal components respectively, d is the order of the non-seasonal difference term, and D is the order of the seasonal difference term; and are the moving average polynomials of the non-seasonal and seasonal components respectively, q is the order of the non-seasonal moving average term, and Q is the order of the seasonal moving average term.
[0041] SARIMAX (Seasonal AutoRegressive Integrated Moving Average with eXogenous variables model) is an extension of SARIMA, which enhances the predictive ability of the model by incorporating exogenous variables. The mathematical expression is: ; In the formula, is a matrix of exogenous variables, are the regression coefficients of the exogenous variables, is the error term.
[0042] In the multiple regression model of the base learner, Support Vector Regression (SVR) and Random Forest (RF) are used as the benchmark algorithms in the multiple regression model.
[0043] SVR is a machine learning algorithm suitable for complex non-linear relationships. In multivariate time series prediction, SVR takes multiple features at each time point (such as the observations of multiple time series, i.e., seasonal factors) as inputs, and the model finds the optimal hyperplane for fitting by minimizing the error and maximizing the margin. The formula is: ; Among them, is the input feature vector, which is the seasonal factors of multiple time series and their exogenous variables, ; is the weight vector; is the bias term.
[0044] SVR needs to maintain the complexity of the model within a certain error range, so a tolerance parameter and a penalty parameter are introduced to control the balance between the error and the model complexity, which can be expressed as: ; In the formula, is the error threshold, is the penalty parameter, is the tolerance parameter of the i-th training sample, I is the total number of training samples, and i is the i-th training sample.
[0045] RF usually takes the observations of multiple time steps ( ) and the exogenous variables As input features, multiple decision trees are trained to predict future values of the target variable. Each decision tree generates a prediction by partitioning the input features (including past time-step data and exogenous variables), and the final prediction result is the average of the prediction values of all decision trees, which can be expressed as: ; In the formula, is the total number of trees, is the prediction result of the th tree for the seasonal factor , is the final prediction result.
[0046] Then, multiple decision trees are constructed for training. Each tree is split based on the input features, and a subset of features is randomly selected to build the tree to reduce the risk of overfitting.
[0047] In the neural network model of the base learner, in this embodiment, RNN, LSTM, and GRU are selected as the benchmark algorithms in the neural network.
[0048] The recurrent neural network (RNN) is a neural network suitable for processing sequential data, and it can handle the temporal dependence between input data. The core feature of the RNN is that the hidden state of the network can be passed to the next time step, which enables the network to "remember" the previous information. The algorithm expression is as follows: ; Among them, is the hidden state at time , is the hidden state at time , is the seasonal factor, is the bias term, is the activation function, U is the weight of the autoregressive variable, and W is the weight of the exogenous variable.
[0049] The predicted value of the output seasonal factor can be expressed as: ; Among them, is the weight matrix of the output layer, is the bias term of the output layer.
[0050] The long short-term memory network (LSTM) is a variant of the RNN, which is used to solve the problem of gradient vanishing or gradient explosion encountered by traditional RNNs when processing long-sequence data. The LSTM controls the flow of information by introducing a gating mechanism, which enables the network to learn long-term dependencies.
[0051] The structure of the gated recurrent unit (GRU) is simpler and has fewer parameters. It combines the forget gate and the input gate in the LSTM into an update gate, and at the same time combines the memory unit and the hidden layer into a reset gate, reducing the computational load during training.
[0052] Therefore, the predicted outputs of the three types of models are used as the inputs of the three dimensions of the meta-learner, and through secondary training, the prediction accuracy is further improved.
[0053] In this embodiment, 7 classical algorithms for linear and non-linear regression are selected in the meta-learner, which are: random forest, support vector regression, gradient boosting, multi-layer perceptron, decision tree, Ridge regression, and Lasso regression; in the actual prediction process, it is necessary to pre-select the specific algorithms used by the base learner and the meta-learner. For the pre-selection of algorithms, please refer to Embodiment 3.
[0054] In this embodiment, in order to maximize the data utilization rate and at the same time maintain the order of the time series data, the following method is used to train the base learner and the meta-learner.
[0055] Construct a training set from a preset proportion of the data in the exogenous variables and seasonal factors, and the remaining data is used to construct a test set. For example, 80% of the data is used as the training set, and the remaining 20% of the data is used as the test set. Then, using the training set as the input, perform one training to obtain the first prediction result, including: Step c10: Based on the cross-validation rule of the time series, divide the training set to obtain multiple training subsets; in this embodiment, the multiple training subsets are T1, T2, T3, T4, and T5 in sequence; among them, the cross-validation rule of the time series is that multiple training sets need to be constructed in chronological order, and cross-training and testing are performed using the multiple training sets.
[0056] Step c20: Train and test the base learner based on the multiple training subsets, the training set, and the test set to obtain the training data set of the meta-learner, and use the training data set of the meta-learner as the first prediction result;; The specific steps are as follows: Train the base learner with T1, test the base learner with T2, and obtain the prediction result of T2; train the base learner with T1 and T2, test the base learner with T3, and obtain the prediction result of T3; train the base learner with T1, T2, and T3, test the base learner with T4, and obtain the prediction result of T4; train the base learner with T1, T2, T3, and T4, test the base learner with T5, and obtain the prediction result of T5; train the base learner with the training set, test the base learner with the test set, and obtain the prediction result of the test set; the prediction results of T2, T3, T4, T5, and the test set are all the first prediction results, and use the prediction results of T2, T3, T4, T5, and the test set as the training data set of the meta-learner.
[0057] Through the above training method, the prediction results of each base learner can be trained and evaluated based on different training sets and test sets.
[0058] In this embodiment, during the training process of the meta-learner, use T2 to T5 for training and the original 20% test set for testing. This can maximize the utilization of data and avoid future information leakage, thereby ensuring the robustness of model training and the accuracy of prediction.
[0059] Embodiment 2 Figure 3 It is a block diagram of a cigarette seasonal placement prediction device based on ensemble learning provided by an embodiment of the present invention. As Figure 3 shown, this embodiment provides a cigarette seasonal placement prediction device based on ensemble learning, which is used to implement the cigarette seasonal placement prediction method based on ensemble learning in Embodiment 1. The device includes: A data acquisition module, which is used to acquire the annual marketing plan data, seasonal data, and historical sales data of cigarette placement; A data processing module, which is used to preprocess the annual marketing plan data, seasonal data, and historical sales data to obtain periodic historical exogenous variables and historical seasonal factors. The historical seasonal factors are used to characterize the change range of the cigarette placement volume in any period relative to the average value of the historical cigarette placement volume; A training set construction module, which is used to construct a training set based on the periodic historical exogenous variables and historical seasonal factors; A model training module is used to train a pre - constructed time - series prediction model based on a training set using an ensemble learning algorithm, obtaining a trained time - series prediction model. The trained time - series prediction model is used to predict the seasonal factor prediction values for a future period of time, and the seasonal factor prediction values for the future period of time are used to determine the cigarette delivery volume for the future period of time.
[0060] This embodiment also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the cigarette seasonal delivery prediction method based on ensemble learning in Embodiment 1.
[0061] This embodiment also provides a computer - readable storage medium, on which a computer program is stored. When the program is executed by a processor, it implements the cigarette seasonal delivery prediction method based on ensemble learning in Embodiment 1.
[0062] The present invention constructs a time - series prediction model to quantify the seasonal characteristics of cigarette demand, which is beneficial to improving the accuracy and reliability of the later prediction of seasonal factors. Moreover, a training set is constructed using periodic historical exogenous variables and historical seasonal factors. Based on the training set, an ensemble learning algorithm is used to train the time - series prediction model, and the obtained trained time - series prediction model is used to predict the seasonal factor prediction values for a future period of time, realizing the automatic and intelligent output of seasonal factors, which is of great significance for guiding cigarette delivery and regulating the market state.
[0063] Embodiment 3 In this embodiment, the historical sales data of a certain city is used to test and verify the cigarette seasonal delivery prediction method based on ensemble learning in Embodiment 1 (hereinafter referred to as SELA - AP) and to pre - select the relevant algorithms of the base learner and the meta - learner.
[0064] Figure 4 is the monthly seasonal factor trend curve of cigarettes in a certain city from July 2017 to February 2024, Figure 5 is the weekly seasonal factor trend curve of cigarettes in a certain city from July 2017 to February 2024. It can be seen from Figure 4 and Figure 5 that during January - February each year, due to the influence of the Spring Festival holiday, the seasonal factor shows an obvious peak, and then drops rapidly in March - April, and the data as a whole shows significant seasonal fluctuations.
[0065] Regarding the selection of relevant algorithms, to reduce the possibility of model over - fitting, a cross - validation strategy is implemented for the training set, and the performance indicators adopted are the mean absolute percentage error (MAPE), the mean square error (MSE), and the mean absolute error (MAE).
[0066] 1. Monthly seasonal factor of the base learner For the algorithm preselection of the base learner for the monthly seasonal factor, at lag orders of 3, 6, 9, and 12, the results are shown in Table 1. The evaluation results show that RNN and SVR have lower errors than other algorithms of the same type at any lag order. Among the autoregressive algorithms, SARIMA is better than SARIMAX when the lag orders are 3, 6, and 9, while the opposite is true at [specific condition not provided]. Therefore, the selection of this type of algorithm is determined by the optimal lag order reflected by the meta-learner.
[0067] Table 1 Results of algorithm preselection of the base learner under the monthly seasonal factor
[0068] 2. Weekly seasonal factor of the base learner For the algorithm preselection of the base learner for the weekly seasonal factor, at lag orders of 2, 4, and 8, the results are shown in Table 2. The evaluation results show that SARIMAX, GRU, and RF have lower errors than other algorithms of the same type at any lag order. Therefore, these three algorithms are used as the base learners for the weekly seasonal factor.
[0069] Table 2 Results of algorithm preselection of the base learner under the weekly seasonal factor
[0070] 3. Monthly seasonal factor of the meta-learner For the algorithm preselection of the meta-learner for the monthly seasonal factor, the performance of seven algorithms, namely random forest, support vector regression, gradient boosting, multi-layer perceptron, decision tree, Ridge regression, and Lasso regression, was compared at different lag orders (3, 6, 9, and 12) respectively, as shown in Table 3. The results show that when the lag order k is 12 and the meta-learner is random forest, the error is the lowest. Therefore, SARIMAX is also selected as the meta-learner in the autoregressive algorithm.
[0071] Table 3 Results of algorithm preselection of the meta-learner under the monthly seasonal factor
[0072] 3. Weekly seasonal factor of the meta-learner For the algorithm preselection of the meta-learner for the weekly seasonal factor, as shown in Table 4. The results show that when the lag order is 4 and the meta-learner is Lasso regression, the error is the lowest.
[0073] Table 4 Results of algorithm preselection of the meta-learner under the weekly seasonal factor
[0074] Figure 6 It is a comparative curve graph of the prediction examples of the monthly seasonal factor by the base learner and the ensemble learning cigarette seasonal delivery prediction method. This curve graph is the prediction example of the monthly seasonal factor from January to July in a certain city in 2024. Figure 6 In it, the Actual curve represents the curve of the actual monthly seasonal factor.
[0075] From Figure 6 it shows that SELA-AP is more accurate in predicting the values and change trends of the monthly seasonal factor. Among April, May, June, and July, it is significantly closer to the actual value compared with the other three base learners.
[0076] Table 5 gives the prediction performance indicators of the base learner and SELA-AP proposed in Example 1. It can be found that among the three types of base learners, SARIMAX has the best performance, but SELA-AP still has significant advantages, with MAPE below 10% and MSE below 0.1, verifying the superiority of this algorithm in prediction accuracy and further indicating its effectiveness and reliability in practical applications.
[0077] Table 5 Prediction performance indicators of different algorithms under the monthly seasonal factor
[0078] Figure 7 It is a comparative curve graph of the prediction examples of the weekly seasonal factor by the base learner and the ensemble learning cigarette seasonal delivery prediction method. This curve graph is the prediction example of the weekly seasonal factor from January to July in a certain city in 2024. Figure 7 In it, the Actual curve represents the curve of the actual weekly seasonal factor.
[0079] From Figure 7 it can be clearly seen that the fluctuations of the weekly seasonal factors are more intense, but SELA-AP can predict relatively extreme fluctuation values, such as "2-1" and "4-2", which illustrates the reliability of the proposed algorithm.
[0080] Table 6 gives the prediction performance indicators of the base learner and SELA-AP proposed in Example 1. SELA-AP still has obvious advantages, with MAPE below 10%, while the MAPE of SARIMAX, the best-performing base learner, can reach 16.137%.
[0081] Table 6 Prediction performance indicators of different algorithms under the weekly seasonal factor
[0082] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0083] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams, can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for realizing the functions specified in one Figure 1 one or more flows and / or Figure 1 or more blocks.
[0084] The above are only the embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims
1. A seasonal cigarette delivery prediction method based on ensemble learning, characterized in that: The method comprises: Obtain annual marketing plan data, seasonal data, and historical sales data for cigarette launches; Preprocessing the annual marketing plan data, seasonal data and historical sales data to obtain periodic historical exogenous variables and historical seasonal factors, wherein the historical seasonal factors are used to characterize the variation range of the cigarette delivery volume in any period relative to the mean of the historical cigarette delivery volume; Construct a training set based on periodic historical exogenous variables and historical seasonal factors; Based on the training set, an integrated learning algorithm is used to train the pre-constructed time series prediction model to obtain a trained time series prediction model. The trained time series prediction model is used to predict the seasonal factor prediction value in the future period, and the seasonal factor prediction value in the future period is used to determine the cigarette delivery amount in the future period.
2. The seasonal cigarette delivery prediction method based on ensemble learning according to claim 1 is characterized in that: The historical exogenous variables include: historical season variables and historical sales variables; the expression of the time series prediction model is: ; In the formula, is the historical seasonal factor of the tth period, is the historical seasonal factor of the first k cycles of the tth cycle, k is the lag order, is the historical seasonal variable of the first k periods of the tth period, is the historical sales variable of the first k periods of the tth period, is the initial bias, is the factor coefficient, is the seasonal coefficient, is the sales coefficient, is the error term of the tth period.
3. The seasonal cigarette delivery prediction method based on ensemble learning according to claim 2 is characterized in that: The method further comprises: Acquire a user's predicted demand, where the predicted demand is for a period of time in the future, and the period of time in the future includes at least one future cycle; Obtain the seasonal variables in each future cycle and the historical seasonal factors, historical sales variables and historical seasonal variables of the first k cycles of the first future cycle; Input the seasonal variables in each future cycle and the historical seasonal factors, historical sales variables and historical seasonal variables of the first k cycles of the first future cycle into the trained time series prediction model to predict the seasonal factor forecast values of each future cycle in the future period; The cigarette delivery quantity for each future period within a period of time in the future is determined based on the seasonal factor forecast value for each future period within a period of time in the future.
4. The seasonal cigarette delivery prediction method based on ensemble learning according to claim 3 is characterized in that: The method further comprises: Record the actual delivery data for the first half of a period of time in the future; Recalculate the actual seasonal factor for the first half of the period based on the actual delivery data for the first half of the period; The training set is updated with the actual seasonal factors of the first half of the period, and the time series prediction model is retrained based on the updated training set. The seasonal factors of the second half of the future period are re-predicted with the retrained time series prediction model to obtain new seasonal factor prediction values for the second half of the period.
5. The seasonal cigarette delivery prediction method based on ensemble learning according to claim 1 is characterized in that: The ensemble learning algorithm comprises: an input layer, a base learner and a meta learner; The input layer is used to input a training set during the training process; The base learner is used to take the training set as input, perform one training, and obtain a first prediction result; The meta-learner is used to perform secondary training with the first prediction result as input to obtain a second prediction result.
6. The seasonal cigarette delivery prediction method based on ensemble learning according to claim 5 is characterized in that: The base learners include: autoregressive model, multivariate regression model and neural network model; The meta-learner includes: a random forest model, a support vector regression model, a gradient boosting model, a multi-layer perceptron model, a decision tree model, a Ridge regression model and a Lasso regression model.
7. The seasonal cigarette delivery prediction method based on ensemble learning according to claim 5, characterized in that: The data with a preset proportion of historical exogenous variables and historical seasonal factors are used to construct the training set, and the remaining data are used to construct the test set; Take the training set as input, perform a training, and get the first prediction result, including: Based on the cross-validation rule of time series, the training set is divided into multiple training subsets; The base learner is trained and tested based on multiple training subsets, training sets and test sets to obtain a training data set for the meta learner, and the training data set for the meta learner is used as the first prediction result.
8. The seasonal cigarette delivery prediction method based on ensemble learning according to claim 7 is characterized in that: The multiple training subsets are T1, T2, T3, T4 and T5. The base learner is trained and tested based on the multiple training subsets, training sets and test sets to obtain the training data set of the meta learner, including: Use T1 to train the base learner, use T2 to test the base learner, and get the prediction result of T2; The base learner is trained with T1 and T2, and tested with T3 to obtain the prediction result of T3; The base learner is trained with T1, T2 and T3, and tested with T4 to obtain the prediction result of T4; The base learner is trained with T1, T2, T3 and T4, and tested with T5 to obtain the prediction result of T5; The base learner is trained with the training set, and tested with the test set to obtain the prediction results of the test set; the prediction results of T2, T3, T4, T5 and the test set are used as the training data set of the meta-learner.
9. A cigarette seasonal delivery prediction device based on ensemble learning, used to implement the cigarette seasonal delivery prediction method based on ensemble learning as claimed in any one of claims 1 to 8, characterized in that: The device comprises: Data acquisition module, used to obtain annual marketing plan data, seasonal data and historical sales data of cigarette launches; A data processing module is used to pre-process the annual marketing plan data, seasonal data and historical sales data to obtain periodic historical exogenous variables and historical seasonal factors, wherein the historical seasonal factors are used to characterize the variation range of the cigarette delivery volume in any period relative to the mean value of the historical cigarette delivery volume; The training set construction module is used to construct the training set based on periodic historical exogenous variables and historical seasonal factors; The model training module is used to train the pre-built time series prediction model based on the training set using an integrated learning algorithm to obtain a trained time series prediction model. The trained time series prediction model is used to predict the seasonal factor prediction value in the future period, and the seasonal factor prediction value in the future period is used to determine the cigarette delivery amount in the future period.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the seasonal cigarette delivery prediction method based on ensemble learning described in any one of claims 1 to 8 is implemented.