Prediction method and device
By using setting correction parameters in sales forecasting, considering weather and holiday characteristics, and adjusting the model prediction value, the prediction deviation problem of tree model in extreme cases is solved, and the accuracy of sales forecasting is improved.
Patent Information
- Application Number
- CN202411290417.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2025-01-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing sales forecasting methods, the tree model is prone to systematic deviations when predicting sales, and cannot accurately capture the impact of extreme situations such as bad weather and special holidays on sales, resulting in inaccurate prediction results.
By obtaining the historical sales data of the product, using the set correction parameters to correct sales in the future, considering weather characteristics and holiday characteristics, calculate the self-correlation coefficient and correction coefficient, and adjusting the model prediction value to reduce deviation.
Improve the accuracy of sales forecasts and can effectively solve the problem of tree model prediction bias, especially in bad weather and holiday periods, sales forecasts are low or high.
Smart Images

Figure CN119250884A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to a prediction method and device. Background Art
[0002] Current sales forecasts usually use ensemble tree models. However, tree models have systematic deviations when predicting sales (for example, the prediction results are consistently too high or too low) and cannot accurately capture extreme situations (such as the impact of bad weather or special holidays on sales).
[0003] Therefore, how to accurately predict sales volume is an urgent problem that needs to be solved. Summary of the invention
[0004] The embodiments of the present invention provide a prediction method and device for accurately predicting sales volume.
[0005] In a first aspect, an embodiment of the present invention provides a prediction method, which includes: obtaining historical sales data of a product, predicting the sales volume of the product in the future based on a first model and the historical sales data of the product, and using set correction parameters to correct the sales volume of the product in the future, wherein the set correction parameters are related to one or more of the model parameters of the first model, weather characteristics in the future, and holiday characteristics in the future.
[0006] As described in the background technology above, the existing sales forecasting methods do not take into account the impact of systematic deviations, bad weather and special holidays on sales. The present application takes the above factors into consideration when forecasting sales and uses them as setting correction parameters to correct the sales volume of goods in the future, making the sales forecast more accurate.
[0007] Optionally, the set correction parameters are related to the model parameters of the first model. Before using the set correction parameters to correct the sales volume of the product in the future, it also includes: predicting the estimated sales volume of the product at multiple first historical time nodes based on the historical sales volume of the product and the first model, and the multiple first historical time nodes are all located before the future time; determining the sales deviation corresponding to each first historical time node based on the estimated sales volume of the product at each first historical time node and the actual sales volume of the product at each first historical time node; calculating the autocorrelation coefficient of the first model based on the sales deviations corresponding to the each first historical time node, and determining that the autocorrelation coefficient is greater than a first threshold.
[0008] Through the above steps, it can be determined whether the previous (that is, the first time) predicted sales volume of the product is consistent with the actual sales volume. If it is not consistent, that is, there is a deviation between the predicted sales volume and the actual sales volume, it means that the previous predicted sales volume is inaccurate, so the sales volume forecast needs to be corrected. Judging whether to correct it before the correction can save resources and improve efficiency.
[0009] Optionally, before using the set correction parameters to correct the sales volume of the product in the future, it also includes: predicting the sales volume deviation of the product in the future based on the sales volume deviation corresponding to each first time node, using it as the first correction coefficient, and using the first correction coefficient to correct the sales volume of the product in the future.
[0010] Through the above steps, the error of the first model is determined to be a deviation by calculating the autocorrelation coefficient, and then it is determined that the error of the first model can be predicted, and the first correction coefficient is determined by the deviation of each time node. After that, appropriate adjustments are made to the predicted value directly output by the model. The model can be corrected for the problem that the model predicted value is continuously high or low for a period of time, and thus the problem of biased model prediction in the above background technology can be effectively solved, thereby improving the prediction accuracy.
[0011] Optionally, setting correction parameters related to weather characteristics at a future time, and using the set correction parameters to correct the sales volume of the product at the future time also includes: determining that the weather at the future time is inclement weather, and using the set correction parameters to correct the sales volume of the product at the future time, including: based on weather characteristics of multiple historical time nodes before the future time, obtaining a second historical time node with the same weather characteristics as the inclement weather at the future time, and one or more third historical time nodes with weather characteristics of non-inclement weather, calculating the historical average sales volume based on the actual sales volume of the one or more third historical time nodes, determining a second correction coefficient based on the historical average sales volume and the actual sales volume of the second historical time node, and using the second correction coefficient to correct the sales volume of the product at the future time.
[0012] Through the above steps, if bad weather occurs in the future, by finding the historical time with similar weather characteristics to the future time, it can be used as a reference to determine the change in sales in bad weather compared to normal weather, and then correct the sales in the future. In this way, the problem of low sales forecast when bad weather such as rain, hail, typhoons, etc. occurs can be solved.
[0013] Optionally, obtaining the first historical time node with the same weather characteristics as the bad weather at the future time includes: determining the weather characteristics of the bad weather at the future time, and determining the first group to which the weather characteristics of the bad weather belong from multiple preset weather groups, wherein the first group includes multiple date subgroups, and the sales of each date in each date subgroup are affected by the same time characteristics, determining the time characteristics of the future time, and determining the first date subgroup affected by the time characteristics from multiple date subgroups in the first group, and taking the historical time node in the first date subgroup that is before the future time as the first historical time node. In this way, by grouping data with similar weather characteristics into one group, the impact of weather characteristics on sales can be better captured, and a reference time with more reference value can be found.
[0014] Optionally, setting correction parameters related to holiday characteristics of the future time, using the set correction parameters to correct the sales volume of the product in the future, also includes: determining that the future time is a holiday, using the set correction parameters to correct the sales volume of the product in the future, including: based on the holiday characteristics of multiple historical time nodes before the future time, obtaining a fourth historical time node with the same holiday characteristics as the future time, and one or more fifth historical time nodes whose holiday characteristics are non-holidays, calculating the historical average sales volume based on the actual sales volume of one or more fifth historical time nodes, determining a third correction coefficient based on the historical average sales volume and the actual sales volume of the fourth historical time node, and using the third correction coefficient to correct the sales volume of the product in the future.
[0015] Through the above steps, if the future time is a holiday, by taking historical holidays as a reference, the change in sales during holidays compared to non-holidays can be determined, and then the sales in the future time can be corrected. In this way, the problem of high or low predictions for specific products on specific holidays can be solved.
[0016] Optionally, obtain preset hierarchical tables, the hierarchical tables include hierarchical tables for different cities and different commodity categories, and the hierarchical tables for a city and a commodity category include historical sales data for each commodity under the commodity category in the city. Calculating the historical average sales includes: obtaining hierarchical tables of the same city and the same commodity category as the commodity from each hierarchical table, and determining the number of historical sales data in the hierarchical table; if the number of historical sales data is greater than a second threshold, calculating the historical average sales; if the number of historical sales data is less than the second threshold, obtaining the hierarchical table of the previous city or commodity category of the city or commodity category corresponding to the hierarchical table, and calculating the historical average sales based on the historical sales data contained in the hierarchical table. In this way, a sufficient number of sample data can be found as a reference through a step-by-step downgrade strategy.
[0017] In a second aspect, an embodiment of the present invention provides a prediction device, the device comprising:
[0018] The acquisition module is used to obtain the historical sales data of the product.
[0019] The prediction module is used to predict the sales volume of the product in the future based on the first model and the historical sales volume data of the product.
[0020] The correction module is used to correct the sales volume of the product in the future by using the set correction parameters, wherein the set correction parameters are related to one or more of the model parameters of the first model, the weather characteristics in the future, and the holiday characteristics in the future.
[0021] In one possible implementation, the set correction parameter is related to the model parameter of the first model, and the prediction module is also used to: predict the estimated sales of the product at multiple first historical time nodes based on the historical sales of the product and the first model, and the multiple first historical time nodes are all located before the future time; determine the sales deviation corresponding to each first historical time node based on the estimated sales of the product at each first historical time node and the actual sales of the product at each first historical time node; calculate the autocorrelation coefficient of the first model based on the sales deviations corresponding to the each first historical time node, and determine that the autocorrelation coefficient is greater than a first threshold.
[0022] In a possible implementation, the correction module is specifically used to: predict the sales deviation of the product in the future based on the sales deviation corresponding to each first time node, use it as the first correction coefficient, and use the first correction coefficient to correct the sales of the product in the future.
[0023] In one possible implementation, setting correction parameters is related to weather characteristics at a future time, and the correction module is specifically used to: determine that the weather at the future time is inclement weather, use the set correction parameters, and correct the sales volume of the product at the future time, including: based on the weather characteristics of multiple historical time nodes before the future time, obtaining a second historical time node with the same weather characteristics as the inclement weather at the future time, and one or more third historical time nodes with weather characteristics of non-inclement weather, calculating the historical average sales volume based on the actual sales volume of the one or more third historical time nodes, determining a second correction coefficient based on the historical average sales volume and the actual sales volume at the second historical time node, and using the second correction coefficient to correct the sales volume of the product at the future time.
[0024] In one possible implementation, the correction module is also used to: determine the weather characteristics of the severe weather in the future time, and determine the first group to which the weather characteristics of the severe weather belong from multiple preset weather groups, wherein the first group includes multiple date sub-groups, and the sales volume of each date in each date sub-group is affected by the same time characteristics, determine the time characteristics of the future time, and determine the first date sub-group affected by the time characteristics among the multiple date sub-groups in the first group, and use the historical time node in the first date sub-group that is before the future time as the first historical time node.
[0025] In one possible implementation, setting correction parameters is related to holiday characteristics of the future time, and the correction module is specifically used to: determine whether the future time is a holiday, use the set correction parameters to correct the sales volume of the product in the future time, including: based on the holiday characteristics of multiple historical time nodes before the future time, obtaining a fourth historical time node with the same holiday characteristics as the future time, and one or more fifth historical time nodes whose holiday characteristics are non-holidays, calculating the historical average sales volume based on the actual sales volume of one or more fifth historical time nodes, determining a third correction coefficient based on the historical average sales volume and the actual sales volume of the fourth historical time node, and using the third correction coefficient to correct the sales volume of the product in the future time.
[0026] In a possible implementation, the correction module is also used to: obtain preset hierarchical tables, each hierarchical table includes hierarchical tables of different cities and different commodity categories, and the hierarchical table of a city and a commodity category includes historical sales data of each commodity under the commodity category in the city; calculate the historical average sales, including: obtaining a hierarchical table of the same city and the same commodity category as the commodity from each hierarchical table, and determining the number of historical sales data in the hierarchical table; if the number of historical sales data is greater than a second threshold, calculating the historical average sales; if the number of historical sales data is less than the second threshold, obtaining the hierarchical table of the upper-level city or commodity category of the city or commodity category corresponding to the hierarchical table, and calculating the historical average sales based on the historical sales data contained in the hierarchical table.
[0027] In a third aspect, the present application also provides a prediction device, which includes 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 method described in the various possible designs of the first aspect.
[0028] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program or instructions are stored. When the computer program or instructions are executed by a processor, the method described in the various possible designs of the first aspect is implemented.
[0029] In a fifth aspect, an embodiment of the present application further provides a computer program product, which, when executed on a computer, enables the computer to execute any of the methods described in the first aspect above.
[0030] These implementations or other implementations of the present application will be more concise and understandable in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0032] Figure 1 A schematic diagram of a commodity sales distribution provided by an embodiment of the present invention;
[0033] Figure 2 A schematic diagram of a sudden change in sales volume provided by an embodiment of the present invention;
[0034] Figure 3 A schematic diagram of how weather factors affect sales provided by an embodiment of the present invention;
[0035] Figure 4 A schematic diagram of how holiday (Lantern Festival) factors affect sales volume provided by an embodiment of the present invention;
[0036] Figure 5 A flowchart of a prediction method provided by an embodiment of the present invention;
[0037] Figure 6 A schematic diagram of a flow chart of another prediction method provided by an embodiment of the present invention;
[0038] Figure 7 A schematic diagram of a deviation autocorrelation coefficient provided by an embodiment of the present invention;
[0039] Figure 8 A schematic diagram of a flow chart of another prediction method provided by an embodiment of the present invention;
[0040] Fig. 9 A schematic diagram of a flow chart of another prediction method provided by an embodiment of the present invention;
[0041] Fig.10 A schematic diagram of a prediction device provided by an embodiment of the present invention;
[0042] Fig.11 A schematic diagram of another prediction device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and beneficial effects of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0044] Below, some terms in this application are explained. It should be noted that these explanations are for the convenience of understanding by those skilled in the art and do not constitute a limitation on the scope of protection claimed in this application.
[0045] 1. Deviation.
[0046] Bias refers to the difference between the actual value and the predicted or expected value. In data analysis, bias can be divided into systematic bias and random bias. Among them, systematic bias is caused by some systematic errors in the data or limitations of the model, and usually has a predictable pattern. The existence of bias will affect the accuracy of the prediction model, so identifying and correcting bias is an important step in data analysis.
[0047] 2. Residual.
[0048] In statistics, residual refers to the difference between the actual observed value and the model predicted value. It is an important indicator used to measure the prediction error of the model. The size and distribution of the residual can reflect the degree of fit of the model. If the residual is small and evenly distributed, it means that the model fits the data well; if the residual is large or there is a systematic deviation, it means that the model may be defective and needs further improvement.
[0049] It is understandable that the bias is predictable, while the residual is random and unpredictable.
[0050] 3. White noise.
[0051] White noise is often used to simulate random disturbances or errors to test and evaluate system performance. It has the following main characteristics:
[0052] 1. Uniform spectrum distribution: The power of white noise is evenly distributed across all frequency ranges, which means it has the same intensity at different frequencies.
[0053] 2. Zero mean: The mean value of the white noise signal is zero, which means that the signal fluctuations in the positive and negative directions are symmetrical.
[0054] 3. No autocorrelation: The values of white noise signal at different time points are independent of each other, which means there is no correlation between them.
[0055] Except for the current time point (t=s), the value of the white noise sequence at any other time point should not be significantly correlated with the current value. Specifically: when t=s (i.e. the same time point), the autocorrelation coefficient is 1, because a value is completely correlated with itself. For all other time differences (t≠s), the autocorrelation coefficient should be close to 0, indicating that there is no linear relationship between different time points. The residuals predicted by the model should theoretically be white noise, that is, their autocorrelation coefficient should be close to 0
[0056] 4. Confidence level.
[0057] Confidence level refers to the degree of reliability of an interval estimate used to estimate a parameter in statistics. Specifically, the confidence level indicates how many confidence intervals will contain the true parameter value in repeated sampling. Common confidence levels are 95% and 99%.
[0058] For example, if we say that the 95% confidence interval for an estimate is [10,20], this means that with repeated sampling, there is a 95% chance that this interval will contain the true parameter value. In other words, the higher the confidence level, the wider the confidence interval, indicating that we are more confident in the reliability of the estimate.
[0059] 5. Divide into buckets.
[0060] Bucketing is the process of mapping continuous numerical features into different intervals or "buckets", thereby converting continuous variables into discrete variables. Bucketing has at least the following benefits:
[0061] 1. By dividing continuous data into different intervals, nonlinear relationships in the data can be captured.
[0062] 2. Classifying extreme values into specific buckets can reduce the impact of outliers on the model.
[0063] 3. Converting continuous data into categorical data can simplify certain analysis processes.
[0064] Common bucketing methods include:
[0065] 1. Equidistant bucketing: The value range of each bucket is equal. Suitable for situations where the sample distribution is relatively uniform.
[0066] 2. Equal frequency bucketing (quantile bucketing): Each bucket contains the same number of samples. Samples with large numerical differences may be classified into the same category.
[0067] 3. Model bucketing: Use algorithms such as clustering or decision trees to determine the best way to bucket.
[0068] The number and width of buckets are usually determined based on specific business needs and data characteristics, and a balance needs to be found between retaining sufficient information and avoiding overfitting.
[0069] 6. K-means clustering.
[0070] K-means clustering is a classic unsupervised learning algorithm widely used in data clustering. It divides data points into K clusters so that data points within the same cluster have high similarity, while the similarity between different clusters is low.
[0071] 7. Cycle phase.
[0072] Periodic phase is a commonly used concept in signal processing, timing analysis and other fields. It is usually used to describe the position or state of a periodic signal (such as sine wave, cosine wave, vibration, fluctuation, etc.) at a specific time point. Periodic phase refers to the relative position of a specific time point in the entire period in a periodic time series.
[0073] As mentioned in the background technology, the tree model may produce inaccurate prediction results when predicting sales. The main reasons are as follows:
[0074] Reason 1:
[0075] The distribution of product sales shows a power law distribution (also called long tail distribution, such as Figure 1 Here is an example of a sales distribution diagram of a product, where most products have low sales, and only a few have high sales. Specifically, 20% of the products contribute 80% of the sales. However, this distribution feature will cause different series to influence each other when using a tree model to model multiple products or multiple time series, resulting in systematic prediction bias in the model.
[0076] Reason 2:
[0077] There may be sudden changes in product sales, such as the gradual withdrawal of products from the market, the launch of similar competing products to seize market resources, or the expansion of store coverage areas. Figure 2 As an example, a sudden change in sales volume is given. It can be seen from the figure that sales volume increases significantly after March 8, 2023. This is due to the expansion of the store coverage area on March 8, 2023. When predicting, the tree model is highly dependent on the relevant characteristics of historical sales volume (such as average sales volume, previous sales volume, etc.). However, when sales volume changes suddenly, the distribution of historical data and future sales volume is very different. This causes the model prediction results to be high or low for a long time, and it is difficult to quickly adapt to the new sales level.
[0078] Reason 3:
[0079] Weather conditions can significantly affect sales. For example, severe weather such as rain, hail, heavy snow, and typhoons can restrict residents from going out, thereby increasing sales of forward warehouse delivery models such as Dingdong Maicai. Unlike the long-term factors that affect sales in reason 2, weather effects are usually short-term, and sales levels are directly determined by the weather conditions of the day. For example, Figure 3 A schematic diagram showing how weather factors affect sales is given as an example. It can be seen from the figure that sales usually peak on weekends, but on March 17, 2023 (Friday), sales were close to weekend levels due to rainfall.
[0080] Reason 4:
[0081] Special holidays can also have a significant boost or inhibitory effect on sales. For example, during the Lantern Festival, the sales of glutinous rice balls increase exponentially, and the sales of rice dumplings during the Dragon Boat Festival, and flowers during the Chinese Valentine's Day or Valentine's Day also have very high sales. However, during the Spring Festival, the sales of almost all categories will drop significantly. For example, Figure 4 A schematic diagram showing how holidays (Lantern Festival) affect sales is given as an example. It can be seen from the figure that during the Lantern Festival, the sales volume of glutinous rice balls has a very obvious peak, and after the festival is over, the sales volume instantly drops to a normal level.
[0082] The above-mentioned fluctuations in sales volume will directly cause errors in sales forecast, which will further affect purchasing and allocation decisions, leading to direct economic losses such as out-of-stock and loss.
[0083] To address the above problems, the common solution in the industry is to introduce external features into the model, construct cross-features, and use the nonlinear mapping capabilities of the model to predict sales in different scenarios. However, in actual applications, this method is not ideal for the following three reasons:
[0084] 1. Systematic biases in modeling cannot be addressed by constructing features.
[0085] 2. At present, the continuous deviation caused by factors such as product delisting or sales cannibalization is solved through data preprocessing and fine feature engineering. However, this method requires accurate grasp of the change information and specific time points of product sales strategy, which has high requirements for data processing.
[0086] 3. There are fewer samples of severe weather and special holidays, which makes it difficult for the tree model to effectively utilize this information, and the model cannot accurately respond to the impact of external factors such as severe weather or special holidays.
[0087] Based on this, the present invention provides a prediction method, which uses set correction parameters to correct the sales volume of a product in the future, so that the estimated sales volume is more accurate.
[0088] The present application scheme is described in detail below in conjunction with the accompanying drawings.
[0089] See also Figure 5 , a flow chart of a prediction method is shown, which specifically includes the following steps:
[0090] Step 510: Obtain historical sales data of the product.
[0091] Among them, historical sales data may include a variety of information, such as actual sales, weather characteristics, price changes, promotional discounts, seasonal factors, etc., without limitation.
[0092] Optionally, you can obtain sales data based on actual needs. For example, when you need to predict sales, you can obtain historical data for a product within a specific time range before the current time, such as the most recent 30 days, 60 days, or 90 days. Alternatively, you can configure the prediction time point in advance, such as making a prediction at 2 a.m. every day or 8 a.m. every Monday morning, and obtain data from the previous specified time period every time the prediction time point arrives. In addition, you can also use other customized data acquisition methods based on product characteristics or business needs, and so on, without restriction.
[0093] Step 520: Based on the first model and the historical sales data of the product, predict the sales volume of the product in the future.
[0094] Here, the first model can be various types of prediction models, such as time series models, machine learning models (such as random forests, gradient boosting trees), deep learning models, etc., without limitation.
[0095] Optionally, based on the first model and the historical sales data of the product, the sales volume of the product in the future can be predicted by inputting the historical sales data and other relevant features of the product into a pre-trained model, and finally obtaining the sales volume prediction result in the future after calculation and processing by the model. Among them, the first model can be obtained by training in advance, for example, a large amount of historical sales data can be obtained in advance, and then the model parameters are trained using appropriate algorithms, such as continuously adjusting the model parameters through optimization methods such as gradient descent. During the training process, cross-validation and other techniques may be used to evaluate the model performance, and the parameters can be adjusted as needed until the model performance reaches the preset standard or the number of iterations reaches the set value, and the model training is terminated. The trained model will be used for the actual sales forecasting task.
[0096] Step 530: Use the set correction parameters to correct the sales volume of the product in the future.
[0097] The setting of the correction parameter is related to one or more of the model parameters of the first model, weather characteristics in the future, and holiday characteristics in the future.
[0098] The following introduces the specific implementation method of using each type of set correction parameters to correct the sales volume of a product in the future from the perspective of each type of set correction parameters.
[0099] Correction method 1
[0100] In the first correction method, the correction parameters are set to be related to the model parameters of the first model.
[0101] See also Figure 6 , showing a flow chart of a prediction method provided by a first correction method, the correction method comprises the following steps 610 to 660:
[0102] Step 610, determining the sales deviations of multiple first historical time nodes before the future time according to the historical sales of the product and the first model.
[0103] For example, we can first predict the estimated sales volume of the product at each first time node based on the historical sales volume of the product and the first model, and then determine the sales volume deviation corresponding to each first time node based on the estimated sales volume of the product at each first time node and the actual sales volume of the product at each first time node. In this way, we can determine whether the estimated sales volume of the product is consistent with the actual sales volume.
[0104] Optionally, after determining the sales deviation corresponding to each first time node, it is also possible to determine whether each sales deviation is greater than a preset threshold. If so, it means that the previously estimated sales volume of the product deviates greatly from the actual sales volume, proving that the sales volume estimated by the first model is not accurate and the estimated result needs to be corrected. Therefore, the future sales volume can be corrected so that the corrected estimated sales volume is closer to the actual sales volume of the product.
[0105] Through the above steps, it can be determined whether the predicted sales volume of the product before (that is, the first historical time node) is consistent with the actual sales volume. If it is not consistent, that is, there is a deviation between the predicted sales volume and the actual sales volume, it means that the previous predicted sales volume is inaccurate, so the sales volume forecast needs to be corrected. Judging whether to correct it before correcting it can save resources and improve efficiency.
[0106] Step 620: Determine the autocorrelation coefficient of the first model according to the sales volume deviations at each of the first historical time nodes.
[0107] As explained in the explanation of terms above, the deviation of the model can be predicted, but the residual of the model cannot be predicted. If you want to correct the estimated sales volume of the product through prediction, you need to determine whether the error of the model is a deviation. The residual of the model prediction should theoretically be white noise, that is, its autocorrelation coefficient should be close to 0. Therefore, you can determine whether the error of the first model is a deviation or a residual by calculating whether the autocorrelation coefficient of the error of the first model is 0.
[0108] Step 630 , determining whether the autocorrelation coefficient of the first model is greater than a first threshold, if so, executing step 640 , if not, executing step 660 .
[0109] In the analysis of step 620, it can be seen that if the autocorrelation coefficient of the model error is close to 0, it can be determined that the error of the first model is a residual. However, in actual application, due to the influence of random factors (such as weather changes, sudden changes in consumer behavior, etc.), the autocorrelation coefficient of white noise will not be strictly equal to 0. At a 95% confidence level, the correlation coefficient of white noise will fall within (where T is the error sequence length, i.e., the number of observation points in the data). If multiple autocorrelation coefficients of a sequence exceed this range, then the sequence is not white noise, i.e., the sequence is not a residual sequence, and the error of the model is not a residual, but a deviation. From the above analysis, we can see that the deviation of the model can be predicted, i.e., the sales volume of the product in the future can be corrected by prediction.
[0110] Alternatively, the autocorrelogram can be used to detect white noise. Figure 7 A schematic diagram of the error autocorrelation coefficient is shown in the figure. The "boundary" in the figure is If the correlation coefficients of the sequence fall within the "boundary", it proves that the sequence is white noise, that is, the error of the model is a residual and does not need to be corrected. If the correlation coefficients of the sequence fall outside the "boundary", it proves that the sequence is not white noise, and the model has deviations and needs to be corrected.
[0111] Step 640: Determine a first correction coefficient according to the deviations of each first time node.
[0112] Optionally, the first correction coefficient may be determined by using traditional statistical methods such as autoregressive (AR), moving average (MA) or auto-regressive and moving average model (ARMA) to predict the deviation, or by using methods such as exponential smoothing (i.e., giving higher weight to recent data) and machine learning (i.e., using more complex algorithms). Among them, the AR model uses past values to predict future values, the MA model uses the weighted average of past prediction errors to predict future values, and the ARMA model is a method that combines AR and MA.
[0113] For example, the following example uses a model to make deviation predictions:
[0114] First, the difference between actual sales and predicted sales is calculated to obtain a deviation time series. Through autocorrelation analysis, it is found that the deviation series has significant autocorrelation at lags 1 and 2. Assume that the AR model is:
[0115] D t =0.7*D t-1 +0.2*D t-2 +ε
[0116] Among them, D t is the deviation of the time series at time t, D t-1 is the deviation of the time series at time t-1, Dt -2 is the deviation of the time series at t-2, and ε is the minimum value.
[0117] For example, if the deviations of the previous two days were 100 and 80 respectively, the predicted deviation for today is: 0.7*100+0.2*80=86. In this way, the systematic deviation of the model prediction can be effectively reduced and the accuracy of the prediction can be improved.
[0118] Step 650: Use the first correction coefficient to correct the sales volume of the product in the future.
[0119] Optionally, the sum of the sales volume of the product in the future and the first correction coefficient may be used as the predicted sales volume.
[0120] Through step 640, the deviation is calculated into a constant as the first correction coefficient, and then the sales volume of the product in the future is corrected according to the first correction coefficient. For example, if the forecast result is continuously too high, a constant can be subtracted from all the forecast results to reduce the degree of the high forecast result (i.e., the first correction coefficient is a negative number). Similarly, if the forecast result is continuously too low, a constant can be added to all the forecast results to increase the value of the forecast result (i.e., the first correction coefficient is a positive number). In this way, the systematic deviation of the model prediction can be reduced, thereby improving the accuracy of the prediction.
[0121] For example, if the actual sales volume last week was 70, 80, 70, 65, 65, 90, 90, and the predicted sales volume last week was 61, 69, 59, 56, 54, 81, 79, that is, the deviation between the predicted sales volume and the actual sales volume is about 10. At this time, since the white noise autocorrelation of the above group of data is very high, it can be determined that the error of the first model is a deviation by calculating the autocorrelation coefficient in steps 620 and 630. Then, the first correction coefficient is obtained according to the deviation prediction, for example, the first correction coefficient is 10, and then the first correction coefficient is added to the future predicted value as the corrected predicted value.
[0122] Step 660: The sales volume of the product in the future predicted by the first model is used as the predicted sales volume.
[0123] If the autocorrelation coefficient of the first model is less than the first threshold, the error of the first model is not a residual, and the first model does not need to be adjusted. The sales volume of the product in the future predicted by the first model is directly used as the predicted sales volume.
[0124] Through the above steps 610 to 660, the error of the first model is determined to be a deviation by calculating the autocorrelation coefficient, and then it is determined that the error of the first model can be predicted, and the first correction coefficient is determined by the deviation of each time node. After that, appropriate adjustments are made to the predicted value directly output by the model. The model can be corrected for the problem that the model predicted value is continuously high or low for a period of time, and the problem of deviation in model prediction in the above background technology can be effectively solved, thereby improving the prediction accuracy.
[0125] Correction method 2
[0126] In the second correction method, the correction parameters are set in relation to the weather characteristics at a future time.
[0127] See also Figure 8 , a flow chart of the prediction method provided by the second correction method is shown, and the correction method includes the following steps 810 to 860:
[0128] Step 810: Determine whether the weather in the future time is bad weather, if so, execute step 820, if not, execute step 860.
[0129] The purpose of this step is to determine whether the weather in the future is bad weather. If the weather in the future is bad weather, the future sales volume can be corrected using a correction factor related to the weather characteristics in the future.
[0130] Step 820: Based on the weather characteristics of multiple historical time nodes before the future time, obtain a second historical time node having the same weather characteristics as the severe weather at the future time.
[0131] After determining whether the weather in the future time is severe weather, the first historical time node having the same weather characteristics as the severe weather in the future time may be obtained by querying a preset weather group.
[0132] Optionally, different weather conditions may be divided into buckets according to weather characteristics.
[0133] Among them, weather characteristics can be rainfall, wind humidity, temperature and so on.
[0134] Optionally, K-means clustering method can be used to divide weather into buckets. For details, please refer to the following steps:
[0135] a. Randomly select K initial points as the center points of the cluster (also called centroids).
[0136] b. For each data point, calculate its distance to each cluster center (usually using Euclidean distance), and assign the data point to the cluster to which the closest cluster center belongs.
[0137] c. For each cluster, calculate the average value of all data points belonging to the cluster and use the average value as the new cluster center.
[0138] d. Repeat the process of data point allocation and cluster center update (i.e., step b and step c) until the cluster center no longer changes significantly or the preset maximum number of iterations is reached.
[0139] e. The final cluster center and cluster assignment results are the K-means clustering results.
[0140] Through the above steps a to e, by grouping data with similar weather characteristics into one group, the impact of weather characteristics on sales can be better captured, and then a reference time with more reference value can be found.
[0141] Optionally, after bucketing the weather, you can also remove abnormal data. Sales may increase not only in bad weather conditions, but also at other times, such as during events, weekends, holidays, etc., or when data is inaccurate during an epidemic, so it is necessary to remove abnormal data.
[0142] Optionally, you can delete data with activities on the day of severe weather, data with activities seven days before severe weather, and data during epidemics based on the discount of the purchase price.
[0143] Optionally, after removing abnormal data, the data can be grouped according to weekends and holidays so that the time period phase of the grouped data is the same. In sales forecasting, there is a specific periodic sales performance from Monday to Sunday, which is generally the highest on Tuesday and Friday during the week, the lowest on Wednesday and Thursday, and the highest on weekends. For example, calculate the impact of rainfall on sales. Since the impact of rainfall during the week and on weekends on sales is different, if a certain data is sales data on Sunday rain, the data is grouped into the weekend group. For another example, if a certain data is National Day data, the data is grouped into the National Day group. In this way, the burst coefficient can be calculated under the same standard.
[0144] Optionally, a first group to which the weather characteristics of the severe weather belong can be determined from a plurality of preset weather groups, and a first date subgroup affected by the time characteristics can be determined from a plurality of date subgroups of the first group, and then in step 820, a historical time node in the first date subgroup before the future time can be used as the second historical time node, that is, the second historical time node and the future time belong to the same date subgroup under the same group. In this way, it can be ensured that the second historical time node (that is, the reference date) has the same weather characteristics and time cycle phase as the future time.
[0145] Optionally, the similarity between the weather characteristics of the future time and the weather characteristics of the historical time can be calculated, and the historical time with the largest similarity can be used as the second historical time node (ie, reference date).
[0146] Optionally, a K-nearest neighbors (KNN) algorithm may be used to calculate the similarities of different features of severe weather.
[0147] Optionally, in the same city and the same secondary category, you can find the date with the most similar weather characteristics of bad weather within a month in history to the weather characteristics of the future time. When there is a weather sample with a similarity exceeding a preset threshold in history, this day is used as the second historical time node; if there are multiple historical weather samples that meet the conditions, you can perform a weighted average of the samples that meet the conditions according to the similarity (i.e., set weights for historical data). For example, if the rainfall in the future time is 10mm, and there have been 9mm and 5mm rainfalls in history, a larger weight can be set for the data with a rainfall of 9mm during calculation.
[0148] Optionally, the weight coefficient may be determined according to the similarity of weather conditions (such as the Euclidean distance of rainfall).
[0149] Optionally, the second time node may be searched under the same category in the same city. If the number of the second time nodes is less than the second threshold, the second time node may be searched under the previous category.
[0150] For example, when no historical reference samples can be found in the same city or the same secondary category, or the second correction coefficient of the historical reference samples exceeds the threshold (i.e., when an extreme outlier appears), a step-down strategy can be adopted, that is, gradually searching for similar samples in a wider range, with the search levels being: city-secondary category, city-primary category, city-procurement category, city, and nationwide. In this way, a sufficient number of sample data can be found as a reference through a step-down strategy.
[0151] Step 830: Obtain one or more third historical time nodes whose weather characteristics are not severe weather, and calculate the historical average sales volume based on the actual sales volume at the one or more third historical time nodes.
[0152] That is, the average sales volume under normal weather conditions is obtained, and the impact of bad weather on sales volume compared to normal weather is calculated based on the average sales volume under normal weather conditions.
[0153] Optionally, in step 820, a hierarchical table may be set in advance, the hierarchical table includes hierarchical tables of different cities and different commodity categories, and the hierarchical table of a city and a commodity category includes the historical sales data of each commodity under the commodity category in the city. In step 830, calculating the historical average sales includes: obtaining a hierarchical table of the same city and the same commodity category as the commodity from each hierarchical table, and determining the number of historical sales data in the hierarchical table; if the number of historical sales data is greater than a second threshold, calculating the historical average sales; if the number of historical sales data is less than the second threshold, obtaining a hierarchical table of the previous city or commodity category of the city or commodity category corresponding to the hierarchical table, and calculating the historical average sales based on the historical sales data contained in the hierarchical table. In this way, a sufficient number of sample data can be found as a reference through a step-by-step downgrade strategy.
[0154] Step 840: Determine a second correction coefficient based on the historical average sales volume and the actual sales volume at the second historical time node.
[0155] Optionally, the calculation formula of the second correction coefficient is:
[0156]
[0157] Among them, K2 is the second correction coefficient, X is the sales volume on the day of bad weather, Y is the average sales volume of n days of normal weather in history, n is a positive integer, for example, n is 7, and Y is the average sales volume of 7 days of normal weather in history.
[0158] Optionally, a degradation strategy may be adopted to calculate the second correction parameter layer by layer.
[0159] Since there are many category groups for commodities, such as the purchasing category group including: vegetable group, meat, poultry and egg group, wine and beverage group, etc., the purchasing category group is divided into primary categories, and the primary category is divided into secondary categories (such as pork group, beef group, etc.), and commodities under different category groups in different cities have different reactions to the weather. For example, the vegetable group is more sensitive to the weather, while the daily distribution group is less sensitive to the weather. Therefore, when calculating the second correction coefficient, you can first consider weather processing under the city-secondary category. If the sales volume of the sample under the secondary category is very small or abnormal conditions occur, in order to prevent extreme values, it is processed under the city-first category, that is, gradually downgraded, and the scope of processing is getting wider and wider, which can effectively reduce the occurrence of abnormal conditions. For example, weather processing is performed in the beef group (secondary category) in Shanghai, and it is found that the sales volume of the beef group in Shanghai is very small, so weather processing is performed in the fresh meat group (primary category) in Shanghai.
[0160] Step 850: Use the second correction coefficient to correct the sales volume of the product in the future.
[0161] Optionally, the sales volume of the product in the future may be corrected according to the product's sales volume in the future and the product's second correction coefficient.
[0162] Step 860: The sales volume of the product in the future predicted by the first model is used as the predicted sales volume.
[0163] If it is determined that the weather in the future is not bad weather, do not use the second correction coefficient to correct the sales volume of the product in the future. The sales volume of the product in the future predicted by the first model can be directly used as the predicted sales volume.
[0164] It is understandable that there is no order between the above step 820 and steps 830-840. The reference time (i.e., the second historical time node) can be found through step 820 first, and then the second correction coefficient can be calculated through steps 830 and 840; or the second correction coefficient of all times within a historical period can be calculated through steps 830 and 840 first, and then the reference time (i.e., the second historical time node) can be found according to step 820. Therefore, the order of the steps is not limited.
[0165] Through the above steps 810 to 860, if severe weather occurs in the future, historical times with similar weather characteristics to the future time can be found and used as a reference to determine the change in sales due to severe weather compared to normal weather, and then the sales in the future can be corrected. In this way, the problem of low sales forecasts when severe weather such as rain, hail, and typhoons occurs can be solved.
[0166] Correction method three
[0167] In the third correction method, the correction parameters are set in relation to the holiday characteristics of the future time.
[0168] See also Fig. 9 , a flowchart of a prediction method provided by the third correction method is shown, and the correction method includes the following steps 910 to 960:
[0169] Step 910: Determine whether the future time is a holiday, if so, execute step 920, if not, execute step 960.
[0170] The purpose of this step is to determine whether the future time is a holiday. If the future time is a holiday, the future sales volume can be corrected using correction parameters related to the holiday characteristics of the future time.
[0171] The holiday characteristics include one or more of the following: holiday name, holiday date, N days before and after the holiday, where N is a positive integer. The N days before and after the holiday are the holiday impact start time to the holiday impact end time. Figure 4 As mentioned above, the impact of special holidays on certain categories is not limited to the holiday day, but also has different degrees of sales impact on the days before and after the holiday, such as Figure 4 , the sales volume of glutinous rice balls increased significantly in the three days before the holiday, and the sales volume also increased significantly in the first seven days. Therefore, the N days before and after the holiday can be treated as separate special holidays.
[0172] Step 920: According to the holiday characteristics of multiple historical time nodes before the future time, a fourth historical time node having the same holiday characteristics as the future time is obtained.
[0173] Optionally, abnormal data may be removed before step 920. Sales may increase not only during holidays but also at other times, such as during bad weather or when data is inaccurate during an epidemic, so abnormal data needs to be removed.
[0174] Optionally, you can find the date of the same festival within a period of history under the same city and the same secondary category as the fourth historical time node. It is worth noting that this step also treats the N days before and after the festival as separate special festivals, that is, the start date and end date of the festival are expanded and treated as separate festivals.
[0175] Since a large number of new products may be launched every year during special holidays, if the fourth historical time node cannot be found in history, a gradual degradation strategy can be adopted to ensure that the reference time for the search is not missed. The gradual degradation strategy is the same as the above step 830 and will not be repeated here.
[0176] Step 930: Obtain one or more fifth historical time nodes whose non-holiday characteristics are non-holidays, and calculate the historical average sales volume based on the actual sales volume of the one or more fifth historical time nodes.
[0177] That is, obtain the average sales volume of non-holidays, and calculate the impact of holidays on sales volume compared to non-holidays through the average sales volume of non-holidays.
[0178] Step 940: Determine a third correction coefficient based on the historical average sales volume and the actual sales volume at the fourth historical time node.
[0179] Optionally, the third correction coefficient may be calculated by the following formula:
[0180]
[0181] Among them, K3 is the third correction coefficient, M is the sales volume on the holiday day, N is the average sales volume in the previous m days without holidays, m is a positive integer, for example, m is 14, and N is the average sales volume in the previous 14 days without holidays.
[0182] Optionally, you can also use prophet's multiplication holiday model to fit the holiday outbreak coefficient from historical data. The formula is as follows:
[0183]
[0184] Among them, k i is the learned third correction parameter for holidays, Indicates whether the current date is the i-th special holiday, if so, it is 1, otherwise it is 0.
[0185] Optionally, a degradation strategy may be used to calculate the third correction parameter layer by layer. The degradation strategy is the same as step 850 and will not be described in detail here.
[0186] Step 950: Use the third correction coefficient to correct the sales volume of the product in the future.
[0187] Optionally, the sales volume of the product in the future may be corrected according to the product of the sales volume in the future and the third correction coefficient.
[0188] Step 960: The sales volume of the product in the future predicted by the first model is used as the predicted sales volume.
[0189] If it is determined that the future time is not a holiday, do not use the third correction coefficient to correct the sales volume of the product in the future time. The sales volume of the product in the future time predicted by the first model can be directly used as the predicted sales volume.
[0190] It is understandable that there is no order between the above step 920 and steps 930-940. The reference time (i.e., the fourth historical time node) can be found through step 920 first, and then the third correction coefficient can be calculated through steps 930 and 940; or the third correction coefficient of all times within a historical period can be calculated through steps 930 and 940 first, and then the reference time (i.e., the fourth historical time node) can be found according to step 920. Therefore, the order of the steps is not limited.
[0191] Through the above steps 910 to 960, if the future time is a holiday, by taking historical holidays as a reference, the change in sales during holidays compared to non-holidays can be determined, and then the sales in the future time can be corrected. In this way, the problem of high or low predictions for specific products on specific holidays can be solved.
[0192] Optionally, if the correction parameter is set to be related to multiple factors of the model parameter of the first model, weather characteristics at a future time, and holiday characteristics at a future time, the multiple results need to be fused.
[0193] When setting the correction parameters in the above calculation, in correction method one, the correction parameters are related to the model parameters of the first model and are processed by addition, that is, the sum of the sales volume of the product in the future and the correction coefficient is used as the corrected future sales volume. In correction method two, the correction parameters are related to the weather characteristics of the future and are processed by multiplication, that is, the product of the sales volume of the product in the future and the correction coefficient is used as the corrected future sales volume. In correction method three, the correction parameters are related to the holiday characteristics of the future and are processed by multiplication, that is, the product of the sales volume of the product in the future and the correction coefficient is used as the corrected future sales volume.
[0194] If the correction parameter is set to be related to multiple of the model parameters of the first model, the weather characteristics of the future time, and the holiday characteristics of the future time, then the addition operation is first processed, that is, first check whether the correction parameter is related to the model parameters of the first model, and then perform the multiplication operation, that is, then check whether the correction parameter is related to the weather characteristics of the future time and the holiday characteristics of the future time. If the correction parameter is related to the weather characteristics of the future time and the holiday characteristics of the future time at the same time, select the maximum value of the second correction coefficient and the third correction coefficient for multiplication. In this way, excessive correction caused by cumulative multiplication can be avoided, thereby achieving a balance between reducing the risk of out-of-stock and reducing losses.
[0195] Through the above steps, the accuracy of sales forecasting can be improved. As described in the background technology above, the existing sales forecasting methods do not consider the impact of systematic deviations, bad weather and special holidays on sales. The present application takes the above factors into consideration when forecasting sales and uses them as setting correction parameters to correct the sales volume of goods in the future, making the sales forecast more accurate.
[0196] Based on the same concept, an embodiment of the present application also provides a prediction device, which can execute the prediction method introduced in the above content.
[0197] See also Fig.10 , a schematic diagram of the structure of a prediction device provided in an embodiment of the present application is given, such as Fig.10 As shown, the prediction device comprises:
[0198] The acquisition module 1001 is used to acquire the historical sales data of the product.
[0199] The prediction module 1002 is used to predict the sales volume of the product in the future based on the first model and the historical sales volume data of the product.
[0200] The correction module 1003 is used to correct the sales volume of the product in the future by using the set correction parameters, wherein the set correction parameters are related to one or more of the model parameters of the first model, the weather characteristics in the future, and the holiday characteristics in the future.
[0201] In one possible implementation, the set correction parameters are related to the model parameters of the first model, and the prediction module 1002 is also used to: predict the estimated sales of the product at multiple first historical time nodes based on the historical sales of the product and the first model, and the multiple first historical time nodes are all located before the future time; determine the sales deviation corresponding to each first historical time node based on the estimated sales of the product at each first historical time node and the actual sales of the product at each first historical time node; calculate the autocorrelation coefficient of the first model based on the sales deviations corresponding to each first historical time node, and determine that the autocorrelation coefficient is greater than a first threshold.
[0202] In a possible implementation, the correction module 1003 is specifically used to: predict the sales deviation of the product in the future based on the sales deviation corresponding to each first time node, use it as the first correction coefficient, and use the first correction coefficient to correct the sales of the product in the future.
[0203] In one possible implementation, the correction parameters are set in relation to the weather characteristics of the future time, and the correction module 1003 is specifically used to: determine that the weather in the future time is inclement weather, and use the set correction parameters to correct the sales volume of the product in the future time, including: based on the weather characteristics of multiple historical time nodes before the future time, obtaining a second historical time node with the same weather characteristics as the inclement weather in the future time, and one or more third historical time nodes with weather characteristics of non-inclement weather, calculating the historical average sales volume based on the actual sales volume of the one or more third historical time nodes, determining a second correction coefficient based on the historical average sales volume and the actual sales volume at the second historical time node, and using the second correction coefficient to correct the sales volume of the product in the future time.
[0204] In one possible implementation, the correction module 1003 is also used to: determine the weather characteristics of the severe weather in the future time, and determine the first group to which the weather characteristics of the severe weather belong from the preset multiple weather groups, wherein the first group includes multiple date sub-groups, and the sales volume of each date in each date sub-group is affected by the same time characteristics, determine the time characteristics of the future time, and determine the first date sub-group affected by the time characteristics among the multiple date sub-groups in the first group, and use the historical time node in the first date sub-group that is before the future time as the first historical time node.
[0205] In one possible implementation, the correction parameters are set in relation to the holiday characteristics of the future time, and the correction module 1003 is specifically used to: determine if the future time is a holiday, and use the set correction parameters to correct the sales volume of the product in the future time, including: obtaining a fourth historical time node having the same holiday characteristics as the future time and one or more fifth historical time nodes having non-holiday holiday characteristics based on the holiday characteristics of multiple historical time nodes before the future time, calculating the historical average sales volume based on the actual sales volume of the one or more fifth historical time nodes, determining a third correction coefficient based on the historical average sales volume and the actual sales volume of the fourth historical time node, and using the third correction coefficient to correct the sales volume of the product in the future time.
[0206] In a possible implementation, the correction module 1003 is also used to: obtain preset hierarchical tables, each hierarchical table includes hierarchical tables of different cities and different commodity categories, and the hierarchical table of a city and a commodity category includes historical sales data of each commodity under the commodity category in the city, and calculate the historical average sales, including: obtaining a hierarchical table of the same city and the same commodity category as the commodity from each hierarchical table, and determining the number of historical sales data in the hierarchical table, if the number of historical sales data is greater than a second threshold, calculating the historical average sales, if the number of historical sales data is less than the second threshold, obtaining the hierarchical table of the city or commodity category above the city or commodity category corresponding to the hierarchical table, and calculating the historical average sales based on the historical sales data contained in the hierarchical table.
[0207] See also Fig.11 , showing a schematic diagram of the structure of another prediction device provided in an embodiment of the present application, such as Fig.11 As shown, the test device includes: a memory 1101 and a processor 1102, and the processor 1102 is coupled to the memory 1101. The memory 1101 is used to store program instructions, and the processor 1102 is used to call the program instructions stored in the memory 1101 and execute the above prediction method according to the obtained program.
[0208] Optionally, the data processing device may further include an interface circuit 1103, which may be a transceiver or an input / output interface. The input / output interface is used to input and / or output information, where output may be understood as sending and input may be understood as receiving. The processor 1102 may communicate with other devices in the test device or other devices other than the test device through the interface circuit 1103 to obtain information required for executing the above data processing method.
[0209] When the prediction device 1100 is used to implement Figure 5 When the method is shown, the processor 1102 is used to implement the functions of the above-mentioned acquisition module 1001, prediction module 1002, and correction module 1003.
[0210] It is understandable that the processor in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
[0211] The memory in the embodiments of the present application can be a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, a register, a hard disk, a mobile hard disk, a compact disc read-only memory (CD-ROM) or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. The storage medium can also be a component of the processor.
[0212] Based on the same technical concept, an embodiment of the present invention also provides a computer-readable storage medium, on which a computer program or instruction is stored. When the computer program or instruction is executed by a processor, the computer executes the above-mentioned transaction processing method.
[0213] Based on the same technical concept, an embodiment of the present invention further provides a computer-readable program product, which, when executed, enables a computer to execute the above transaction processing method.
[0214] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0215] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0216] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0217] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0218] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A prediction method, characterized in that: The method comprises: Get historical sales data of products; Predicting the sales volume of the product in the future based on the first model and the historical sales volume data of the product; Use the set correction parameters to correct the sales volume of the product in the future; The setting correction parameter is related to one or more of the model parameters of the first model, the weather characteristics of the future time, and the holiday characteristics of the future time.
2. The method according to claim 1, characterized in that The setting correction parameter is related to the model parameter of the first model; and before the setting correction parameter is used to correct the sales volume of the commodity in the future, the method further includes: Predicting, based on the historical sales volume of the product and the first model, the estimated sales volume of the product at a plurality of first historical time nodes, wherein the plurality of first historical time nodes are all located before the future time; Determine the sales deviation corresponding to each first historical time node according to the estimated sales volume of the product at each first historical time node and the actual sales volume of the product at each first historical time node; According to the sales volume deviations corresponding to the first historical time nodes, the autocorrelation coefficient of the first model is calculated, and it is determined that the autocorrelation coefficient is greater than a first threshold.
3. The method according to claim 2, characterized in that The use setting correction parameter to correct the sales volume of the commodity in the future time includes: According to the sales deviations corresponding to the first time nodes, predict the sales deviation of the product at the future time, and use it as the first correction coefficient; The first correction coefficient is used to correct the sales volume of the commodity at the future time.
4. The method according to claim 1, characterized in that The setting correction parameter is related to the weather characteristics of the future time; Before the use of the set correction parameter to correct the sales volume of the commodity in the future time, the method further includes: Determining that the weather at the future time is severe weather; The use setting correction parameter to correct the sales volume of the commodity in the future time includes: According to the weather characteristics of multiple historical time nodes before the future time, obtaining a second historical time node having the same weather characteristics as the severe weather at the future time, and one or more third historical time nodes having weather characteristics of non-severe weather; Calculate the historical average sales volume according to the actual sales volume at the one or more third historical time nodes, and determine the second correction coefficient according to the historical average sales volume and the actual sales volume at the second historical time node; The second correction coefficient is used to correct the sales volume of the commodity at the future time.
5. The method according to claim 4, characterized in that Obtaining a first historical time node having the same weather characteristics as the severe weather at the future time, including: Determine the weather characteristics of the bad weather in the future time, and determine a first group to which the weather characteristics of the bad weather belong from a plurality of preset weather groups, wherein the first group includes a plurality of date subgroups, and the sales volume of each date in each date subgroup is affected by the same time characteristics; Determine the time characteristics of the future time, and determine a first date subgroup affected by the time characteristics from among the multiple date subgroups of the first group, and use a historical time node in the first date subgroup that is before the future time as the first historical time node.
6. The method according to claim 1, characterized in that The setting correction parameter is related to the holiday characteristics of the future time; Before the use of the set correction parameter to correct the sales volume of the commodity in the future time, the method further includes: determining that the future time is a holiday; The use setting correction parameter to correct the sales volume of the commodity in the future includes: According to the holiday characteristics of the plurality of historical time nodes before the future time, obtaining a fourth historical time node having the same holiday characteristics as the future time, and one or more fifth historical time nodes having a holiday characteristic of non-holiday; Calculate the historical average sales volume according to the actual sales volume at the one or more fifth historical time nodes, and determine the third correction coefficient according to the historical average sales volume and the actual sales volume at the fourth historical time node; The third correction coefficient is used to correct the sales volume of the commodity at the future time.
7. The method according to any one of claims 4 to 6, characterized in that The method further comprises: Obtaining preset hierarchical tables, wherein the hierarchical tables include hierarchical tables of different cities and different commodity categories, and the hierarchical table of a city and a commodity category includes historical sales data of each commodity under the commodity category in the city; The calculation of historical average sales volume includes: Obtaining a hierarchical table of the same commodity category in the same city as the commodity from each of the hierarchical tables, and determining the amount of historical sales data in the hierarchical table; If the amount of the historical sales data is greater than a second threshold, calculating the historical average sales; If the amount of the historical sales data is less than the second threshold, obtain the hierarchical table of the upper-level city or commodity category of the city or commodity category corresponding to the hierarchical table, and calculate the historical average sales based on the historical sales data contained in the hierarchical table.
8. A prediction device, characterized in that: The prediction device comprises: The acquisition module is used to obtain the historical sales data of the product; A prediction module, used to predict the sales volume of the commodity in the future based on the first model and the historical sales volume data of the commodity; A correction module is used to use set correction parameters to correct the sales volume of the product in the future; wherein the set correction parameters are related to one or more of the model parameters of the first model, the weather characteristics of the future time, and the holiday characteristics of the future time.
9. A prediction device, characterized in that: include: A processor, wherein the processor is coupled to a memory, the memory is used to store a computer program or an instruction, and the processor is used to execute the computer program or the instruction to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: It stores a computer program executable by a computer device, and when the program is run on the computer device, the computer device executes the steps of any method described in claims 1 to 7.
11. A computer program product, characterized in that When the method is executed on a computer, the computer is enabled to execute the method according to any one of claims 1 to 7.
Citation Information
Cited By
Intelligent supply chain management optimization method and system based on big data
CN120851299A
Big data-based intelligent supply chain management optimization method and system
CN120851299B
