Sales data processing method and system
By applying neural network models to predict sales data in the catering industry, the problem of inaccurate prediction of traditional methods in big data scenarios is solved, and higher prediction accuracy and more reasonable stocking management are achieved.
Patent Information
- Application Number
- CN202510250850.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-04
- Publication Date
- 2025-06-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When traditional sales data prediction methods deal with scenarios such as the catering industry, which have large data volume, wide distribution and obvious periodicity, there are problems such as the catering industry, which are large and inaccurate, resulting in redundant or insufficient stocking, affecting the operation of the catering industry.
A sales data processing method is proposed. By determining the historical sales data of the target sales terminal, a training set is generated and applied to the neural network model for iterative calculations, the target sales data is predicted, and the stocking volume is determined based on the prediction results.
This method is more accurate than the traditional method, can integrate more data, improve prediction accuracy, and avoid waste caused by improper stocking and poor customer experience.
Smart Images

Figure CN120146912A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and in particular, to a method and system for processing sales data. Background Art
[0002] Traditional sales data prediction methods mainly rely on statistics and simple mathematical models, which are applicable to scenarios with relatively small data volumes and relatively linear relationships. By statistically analyzing historical data, relatively simple prediction values are obtained.
[0003] For specific industries, such as the catering industry, there are characteristics of large data volumes, wide data distribution, and obvious periodicity. In this regard, using traditional methods to predict sales amounts has problems of large workload and insufficient accuracy. When stocking goods according to the prediction results, due to the inaccuracy of the stocking prediction results, there may be redundancy or insufficiency in stocking. Redundancy in stocking in the catering industry easily leads to spoilage of ingredients, while insufficiency in stocking will lead to poor customer experience. Summary of the Invention
[0004] Embodiments of this application provide a method for processing sales data to improve the above problems.
[0005] To achieve the above object, this application adopts the following technical solutions: In a first aspect, this application proposes a method for processing sales data, the method including: Determine a target sales terminal, and obtain historical sales data of the target sales terminal. The historical sales data includes N small cycles with the same time span and the corresponding sales data for each small cycle, where N is a natural number; Generate a training set based on M consecutive small cycles, where M is a natural number less than N and greater than 3, and apply the training set to a neural network model for iterative calculation. The neural network model is used to generate a predicted sales data based on M - 1 consecutive input sales data. When the neural network model meets a preset condition, stop training and output the trained neural network model; Determine the Xth small cycle as the target cycle, where X is a natural number greater than N. Input the sales data corresponding to the (X - M + 1)th, (X - M + 2)th, (X - M + 3)th to the (X - 1)th small cycles into the neural network model, and obtain the predicted target sales data of the target cycle according to the output result of the neural network model; Determine the stocking quantity corresponding to the target cycle based on the target sales data.
[0006] In combination with the first aspect, optionally, a training set is generated based on M consecutive small cycles, where M is a natural number less than N and greater than 3, and the training set is applied to a neural network model for iterative calculation. The neural network model is used to generate a predicted sales data based on M - 1 consecutive input sales data. When the neural network model meets a preset condition, the training stops and the trained neural network model is output, including: The sales data corresponding to the (J - M + 1)-th, (J - M + 2)-th, (J - M + 3)-th to (J - 1)-th small cycles are imported into the neural network model for iterative calculation. Among them, the J-th training set includes the sales data corresponding to the (J - M + 1)-th, (J - M + 2)-th, (J - M + 3)-th to (J - 1)-th small cycles. The sales data corresponding to the (J - M + 1)-th, (J - M + 2)-th, (J - M + 3)-th to (J - 1)-th small cycles are used as three dimensions, and the three dimensions form the feature vector of the sales data corresponding to the (J - 1)-th small cycle. J is any natural number from M to N - 1; When the neural network model meets the preset condition, the calculation stops, and the trained neural network model is obtained.
[0007] In combination with the first aspect, optionally, when the neural network model meets the preset condition, the calculation stops, and the trained neural network model is obtained, including: Based on the neural network model, M predicted sales data corresponding to the (J - M + 1)-th, (J - M + 2)-th, (J - M + 3)-th to J-th are obtained; The M predicted sales data are compared one by one with the actual corresponding M sales data. According to the comparison results, the M sales data are divided into a high-difference group and a low-difference group. Among them, the difference between the sales data belonging to the high-difference group and the corresponding predicted sales data is greater than the difference between the sales data belonging to the low-difference group and the corresponding predicted sales data; The sales data belonging to the high-difference group in the J-th training set are given a first weight, and the sales data belonging to the low-difference group are given a second weight. The first weight is less than the second weight. Among them, the first weight and the second weight are used to represent the credibility of the data in the training set; When the ratio of the first weight to the second weight is less than the target value, the training stops and the trained target neural network model is output.
[0008] In combination with the first aspect, optionally, the sales data belonging to the high-difference group in the J-th training set are given a first weight, and the sales data belonging to the low-difference group are given a second weight. The first weight is less than the second weight. Among them, the first weight and the second weight are used to represent the credibility of the data in the training set, satisfying: a + b = 2 where a is the first weight and b is the second weight.
[0009] In combination with the first aspect, optionally, the sales data belonging to the high-difference group in the Jth training set is given a first weight, and the sales data belonging to the low-difference group is given a second weight, where the first weight is less than the second weight. The first weight and the second weight are used to represent the credibility of the data in the training set, including: Obtain the first average difference T1 between the sales data belonging to the high-difference group and the corresponding predicted sales data; Obtain the second average difference T2 between the sales data belonging to the high-difference group and the corresponding predicted sales data; Determine the first weight a and the second weight b based on the first average difference T1 and the second average difference T2, and satisfy: T1 / T2 = b / a.
[0010] In combination with the first aspect, optionally, when the neural network model meets the preset conditions, stop the calculation and obtain the trained neural network model, including: Obtain the error value. When the error value is less than the preset value, stop the calculation and output the trained neural network model. The error value satisfies: During each iterative calculation, compare the predicted sales data with the corresponding sales data. If the predicted sales data is greater than the corresponding sales data, determine the error value as: T = (yt - y1) / y1 If the predicted sales data is greater than the corresponding sales data, determine the error value as: T = (y1 - yt) / y1 Where T is the error value, yt is the predicted sales data, and y1 is the corresponding sales data.
[0011] In combination with the first aspect, optionally, the method further includes: Obtain N sales data, and generate a continuous sales data curve based on the time axis position corresponding to each sales data, where the time axis position corresponding to each sales data is the midpoint position of the corresponding sales cycle on the time axis; Predict the sales data of the (N + 1)th small cycle based on the sales data curve and obtain the prediction result; When the (N + 1)th small cycle is the target cycle, calibrate the target sales data of the target cycle output by the neural network model based on the prediction result.
[0012] In combination with the first aspect, optionally, when the (N + 1)th small cycle is the target cycle, calibrate the target sales data of the target cycle output by the neural network model based on the prediction result, including: If the difference value between the prediction result and the target sales data of the target period output by the neural network model is greater than the preset threshold, then the higher value among the prediction result and the target sales data of the target period output by the neural network model is used as the target sales data; If the difference value between the prediction result and the target sales data of the target period output by the neural network model is less than the preset threshold, then the average value of the prediction result and the target sales data of the target period output by the neural network model is used as the target sales data.
[0013] Combined with the first aspect, optionally, determine the target sales terminal, obtain the historical sales data of the target sales terminal, the historical sales data includes N small cycles with the same time span and the sales data corresponding to each small cycle, N is a natural number, where: The sales data is one or any combination of two of the sales amount, sales types, and combined sales data of goods.
[0014] In a second aspect, the present application also proposes a sales data processing system, the sales data processing system includes: The first sub-module, the first sub-module is used to determine the target sales terminal, obtain the historical sales data of the target sales terminal, the historical sales data includes N small cycles with the same time span and the sales data corresponding to each small cycle, N is a natural number; The second sub-module, the second sub-module is used to generate a training set based on M consecutive small cycles, where M is a natural number less than N and greater than 3, and apply the training set to the neural network model and perform iterative calculations. The neural network model is used to generate a predicted sales data according to the input M - 1 consecutive sales data. When the neural network model meets the preset conditions, stop training and output the trained neural network model; The third sub-module, the third sub-module is used to determine the Xth small cycle as the target cycle, X is a natural number greater than N, input the sales data corresponding to the (X - M + 1)th, (X - M + 2)th, (X - M + 3)th to the (X - 1)th small cycles into the neural network model, and obtain the predicted target sales data of the target cycle according to the output result of the neural network model; The fourth sub-module, the fourth sub-module is used to determine the stock quantity corresponding to the target cycle based on the target sales data.
[0015] Optionally, combined with the second aspect, the system is configured: Generate a training set based on M consecutive small cycles, where M is a natural number less than N and greater than 3, and apply the training set to the neural network model and perform iterative calculations. The neural network model is used to generate a predicted sales data according to the input M - 1 consecutive sales data. When the neural network model meets the preset conditions, stop training and output the trained neural network model, including: Import the sales data corresponding to the (J - M + 1)-th, (J - M + 2)-th, (J - M + 3)-th to (J - 1)-th small cycles into the neural network model for iterative calculation. Among them, the J-th training set includes the sales data corresponding to the (J - M + 1)-th, (J - M + 2)-th, (J - M + 3)-th to (J - 1)-th small cycles. Take the sales data corresponding to the (J - M + 1)-th, (J - M + 2)-th, (J - M + 3)-th to (J - 1)-th small cycles as three dimensions, and the three dimensions form the feature vector of the sales data corresponding to the (J - 1)-th small cycle. J is any natural number from M to N - 1; When the neural network model meets the preset conditions, stop the calculation and obtain the trained neural network model.
[0016] Optionally, in combination with the second aspect, the system is configured: When the neural network model meets the preset conditions, stop the calculation and obtain the trained neural network model, including: Obtain a total of M predicted sales data corresponding to the (J - M + 1)-th, (J - M + 2)-th, (J - M + 3)-th to J-th based on the neural network model; Compare the M predicted sales data with the actual corresponding M sales data one by one. According to the comparison results, divide the M sales data into a high-difference group and a low-difference group. Among them, the difference between the sales data belonging to the high-difference group and the corresponding predicted sales data is greater than the difference between the sales data belonging to the low-difference group and the corresponding predicted sales data; Assign a first weight to the sales data belonging to the high-difference group in the J-th training set, and assign a second weight to the sales data belonging to the low-difference group. The first weight is less than the second weight. Among them, the first weight and the second weight are used to represent the credibility of the data in the training set; When the ratio of the first weight to the second weight is less than the target value, stop training and output the trained target neural network model.
[0017] Optionally, in combination with the second aspect, the system is configured: Assign a first weight to the sales data belonging to the high-difference group in the J-th training set, and assign a second weight to the sales data belonging to the low-difference group. The first weight is less than the second weight. Among them, the first weight and the second weight are used to represent the credibility of the data in the training set, and satisfy: a + b = 2 where a is the first weight and b is the second weight.
[0018] Optionally, in combination with the second aspect, the system is configured: In the J-th training set, the sales data belonging to the high-difference group are assigned a first weight, and the sales data belonging to the low-difference group are assigned a second weight, where the first weight is less than the second weight. Here, the first weight and the second weight are used to represent the credibility of the data in the training set, including: Obtain the first average difference T1 between the sales data belonging to the high-difference group and the corresponding predicted sales data; Obtain the second average difference T2 between the sales data belonging to the high-difference group and the corresponding predicted sales data; Determine the first weight a and the second weight b based on the first average difference T1 and the second average difference T2, and satisfy: T1 / T2 = b / a.
[0019] Optionally, in combination with the second aspect, the system is configured: When the neural network model meets the preset conditions, stop the calculation and obtain the trained neural network model, including: Obtain the error value. When the error value is less than the preset value, stop the calculation and output the trained neural network model. Here, the error value satisfies: During each iterative calculation, compare the predicted sales data with the corresponding sales data. If the predicted sales data is greater than the corresponding sales data, determine the error value as: T = (yt - y1) / y1 If the predicted sales data is less than the corresponding sales data, determine the error value as: T = (y1 - yt) / y1 Where, T is the error value, yt is the predicted sales data, and y1 is the corresponding sales data.
[0020] Optionally, in combination with the second aspect, the system is configured: The method further includes: Obtain N sales data, and generate a continuous sales data curve based on the time-axis position corresponding to each sales data, where the time-axis position corresponding to each sales data is the midpoint position of the corresponding sales cycle on the time axis; Predict the sales data of the (N + 1)-th small cycle based on the sales data curve, and obtain the prediction result; When the (N + 1)-th small cycle is the target cycle, calibrate the target sales data of the target cycle output by the neural network model based on the prediction result.
[0021] Optionally, in combination with the second aspect, the system is configured: When the (N + 1)-th small cycle is the target cycle, calibrate the target sales data of the target cycle output by the neural network model based on the prediction result, including: If the difference value between the prediction result and the target sales data of the target period output by the neural network model is greater than the preset threshold, then the higher value among the prediction result and the target sales data of the target period output by the neural network model is taken as the target sales data; If the difference value between the prediction result and the target sales data of the target period output by the neural network model is less than the preset threshold, then the average value of the prediction result and the target sales data of the target period output by the neural network model is taken as the target sales data.
[0022] Optionally, in combination with the second aspect, the system is configured to: Determine the target sales terminal, and obtain the historical sales data of the target sales terminal. The historical sales data includes N small periods with the same time span and the corresponding sales data for each small period. N is a natural number, where: The sales data is one or any combination of two of the sales amount, sales type, and combined sales data of goods.
[0023] A third aspect of the embodiments of the present invention provides an electronic device, which includes: At least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method proposed in the first aspect of the embodiments of the present invention.
[0024] A fourth aspect of the embodiments of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the method proposed in the first aspect of the embodiments of the present invention.
[0025] In summary, the above method and system have the following technical effects: A method and system for processing sales data proposed in the embodiments of the present application obtain the historical sales data of the target sales terminal, construct and train a neural network model based on the continuous sales data, predict the target sales data corresponding to the upcoming period based on the trained neural network model, and adjust the stock quantity corresponding to the target period through the target sales data. The method and system for processing sales data proposed in the embodiments of the present application are more accurate than the traditional curve curvature prediction method through the target data predicted by the neural network, and can integrate more data at the same time, improve the prediction accuracy, and avoid the waste caused by the insufficient or redundant stock quantity during advance stock preparation due to inaccurate data prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a schematic flowchart of a method for processing sales data proposed in the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0027] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0028] An embodiment of the present application proposes a sales data processing method. Please refer to Figure 1 , and the method includes steps S101-S104: S101: Determine the target sales terminal, and obtain the historical sales data of the target sales terminal. The historical sales data includes N small periods with the same time span and the corresponding sales data for each small period, where N is a natural number.
[0029] It can be understood that the sales terminal can be a single sales outlet or a single store. According to the different sales natures, the type of the sales terminal is not limited in this embodiment. In this embodiment, taking the catering industry as an example, the sales terminal can be an independent store under a chain catering enterprise.
[0030] For the historical sales data, in this embodiment, the sales amount of the store is taken as an example. However, in some other embodiments, the sales data can be one or any combination of two of the sales amount, sales types, and combined sales data of goods. For example, dishes and combinations of dishes, or dish set data, which are not limited in this embodiment.
[0031] Limited by environmental factors such as seasons and time, the sales amount of each period in the catering industry has regular changes. Therefore, in this embodiment, for the convenience of understanding, the small period can be a quarter. In some other embodiments, the small period can also be a year, a month, or some other time span, which is not limited in this application.
[0032] Exemplarily, for the sales data of a store in 3 years, it can be composed of 3*4 quarterly sales data.
[0033] S102: Generate a training set based on M consecutive small periods, where M is a natural number less than N and greater than 3, and apply the training set to the neural network model for iterative calculation. The neural network model is used to generate a predicted sales data based on the input M-1 consecutive sales data. When the neural network model meets the preset conditions, stop training and output the trained neural network model.
[0034] It is understandable that the sales volume in each cycle of the catering industry has regular changes. However, this pattern is affected by various factors and cannot be intuitively expressed by a mathematical formula. Therefore, in this embodiment, based on the development of neural network technology, multiple consecutive cycles can be used as a training set for training a neural network model.
[0035] Exemplarily, in this embodiment, a training set can be composed of the sales data of 4 consecutive quarters. Therefore, in this embodiment, M = 4, and it can be the sales data of the first three quarters and the last quarter in a year as the training set.
[0036] Specifically, in this embodiment, the sales data corresponding to the (J - M + 1)-th, (J - M + 2)-th, (J - M + 3)-th to (J - 1)-th small cycles can be imported into the neural network model for iterative calculation. Among them, the J-th training set includes the sales data corresponding to the (J - M + 1)-th, (J - M + 2)-th, (J - M + 3)-th to (J - 1)-th small cycles. Then, the sales data corresponding to the (J - M + 1)-th, (J - M + 2)-th, (J - M + 3)-th to (J - 1)-th small cycles are used as three dimensions, and the three dimensions form the feature vector of the sales data corresponding to the (J - 1)-th small cycle. J is any natural number from M to N - 1; Exemplarily, for the sales data of 12 quarters in 3 years, taking the first year as an example, the sales data of the 1st, 2nd, and 3rd quarters can be used as the three dimensions input to the neural network model for iterative calculation with the sales data of the 4th quarter. Of course, it can also be the sales data of the 2nd, 3rd, and 4th quarters for iterative calculation with the sales data of the 5th quarter. Through the calculation of a large amount of data, a relatively accurate neural network model can be obtained.
[0037] It should be noted that only simple data is used as an example in this embodiment. In the actual process, the multiple historical data of multiple stores can be used to train a single neural network simultaneously to improve the accuracy of the neural network model.
[0038] In this embodiment, when the neural network model meets the preset conditions, the calculation is stopped, and the trained neural network model is obtained.
[0039] Regarding how to determine whether the neural network model is trained, exemplarily, as a feasible implementation method, in this embodiment, the weights corresponding to multiple data in the neural network training set can be dynamically allocated, and it is determined whether the training is completed according to the allocation situation.
[0040] In this embodiment, M predicted sales data corresponding to the (J - M + 1)-th, (J - M + 2)-th, (J - M + 3)-th to J-th can be obtained based on a neural network model. Then, the M predicted sales data are compared one by one with the corresponding M actual sales data. According to the comparison results, the M sales data are divided into a high-difference group and a low-difference group. Among them, the difference between the sales data belonging to the high-difference group and the corresponding predicted sales data is greater than the difference between the sales data belonging to the low-difference group and the corresponding predicted sales data. Then, in the J-th training set, the sales data belonging to the high-difference group are assigned a first weight, and the sales data belonging to the low-difference group are assigned a second weight. The first weight is less than the second weight. Here, the first weight and the second weight are used to represent the credibility of the data in the training set. When the ratio of the first weight to the second weight is less than the target value, the training stops and the trained target neural network model is output.
[0041] Exemplarily, J is equal to 12. Four predicted sales data corresponding to the 9th, 10th, 11th, and 12th are obtained through the neural network model. At the same time, 4 corresponding sales data can also be obtained according to the historical records. By corresponding these 8 data one by one and subtracting them, 4 differences can be obtained.
[0042] According to the differences of these 4 differences, these 4 differences can be divided into two groups, namely a high-difference group and a low-difference group, in groups of two or three.
[0043] Exemplarily, the first average difference T1 between the sales data belonging to the high-difference group and the corresponding predicted sales data, and the second average difference T2 between the sales data belonging to the high-difference group and the corresponding predicted sales data, and T1 is greater than T2.
[0044] In the process of importing these 4 sales data as the training set into the neural network model for training, for the data in the high-difference group, the corresponding weight can be 0.5. The first weight and the second weight are used to represent the credibility of the data in the training set. That is to say, for the data with a corresponding weight of 0.5, when imported into the neural network model, the influence on the neural network model is relatively small. In contrast, for the data belonging to the low-difference group, the corresponding weight can be 1.5, and when imported into the neural network model, the influence on the neural network model is relatively large.
[0045] Regarding how to allocate the weights when importing them into the neural network model, a method of determining an initializer and determining multiple identical weights based on the initializer can be adopted. Of course, according to the different neural network models specifically selected, the specific method is not limited in this embodiment.
[0046] Optionally, for the relationship between the first weight and the second weight, for example, in the case where the number of high-difference groups and low-difference groups is equal, that is, (M / 2)a+(M / 2)b = M, through mathematical transformation, we can obtain: a + b = 2 where a is the first weight and b is the second weight.
[0047] In this way, the actual total amount in one year during the training process will not change significantly, and the impact on the neural network is also small.
[0048] Optionally, the proportional relationship between the first weight and the second weight can be determined by the relationship of the difference. For example, based on the first average difference T1 and the second average difference T2, the first weight a and the second weight b are determined, and satisfy: T1 / T2 = b / a. Of course, in some other embodiments, there may be other methods, which are not limited in this embodiment.
[0049] Optionally, in another implementation manner in this embodiment, it is also possible to determine whether the training is completed by determining the loss function. For example, the error value can be determined through the loss function and compared with the preset threshold. When the error value is less than the preset value, the calculation is stopped and the trained neural network model is output.
[0050] For example, during each iterative calculation, the predicted sales data is compared with the corresponding sales data. If the predicted sales data is greater than the corresponding sales data, the error value is determined as: T = (yt - y1)y1 If the predicted sales data is less than the corresponding sales data, the error value is determined as: T = (y1 - yt)y1 where T is the error value, yt is the predicted sales data, and y1 is the corresponding sales data.
[0051] For example, let the feature vector be x = [y1, x2, x3], where y1, x2, and x3 respectively represent the first three normalized sales data. Let the neural network training model be f(x;θ), where θ represents the model parameters, so that the model output value f(x;θ) can approach the true value y of the sales data in the fourth quarter. Then the training process of the neural network training model can be realized by minimizing the loss function, that is: L(θ) = 1 / N * Σ(f(x_i;θ) - y_i)^2 Among them, N represents the number of training samples, and xi and yi respectively represent the input features and output values of the i-th sample. This loss function can measure the error between the predicted value and the true value of the model. Through optimization algorithms such as backpropagation algorithm and gradient descent, the model parameters θ can be updated to improve the accuracy of the model.
[0052] It can be understood that when the error value is less than the preset value, the training process of the neural network training model is stopped. This is because when the error value is less than a certain threshold, the model has already predicted the data accurately enough, and continuing to train the model has little effect and may cause problems such as overfitting.
[0053] S103: Determine the X-th small cycle as the target cycle, where X is a natural number greater than N. Input the sales data corresponding to the small cycles from the (X - M + 1)-th, (X - M + 2)-th, (X - M + 3)-th to the (X - 1)-th into the neural network model, and obtain the target sales data of the predicted target cycle according to the output result of the neural network model.
[0054] It can be understood that after the model training is completed, by inputting the sales data corresponding to the small cycles from the (X - M + 1)-th, (X - M + 2)-th, (X - M + 3)-th to the (X - 1)-th into the neural network model, the target sales data of the predicted target cycle can be obtained according to the output result of the neural network model. It should be noted that when predicting the target sales data of a specific cycle in this way, the unknown data can be predicted through the existing data, and then the predicted data can be input into the neural network model as the existing data for prediction to achieve discontinuous prediction.
[0055] S104: Determine the stock quantity corresponding to the target cycle based on the target sales data.
[0056] It can be understood that after obtaining the target sales data, the stock quantity or other data that need to be prepared corresponding to the target cycle can be determined in advance according to the target sales data, avoiding material redundancy or shortage.
[0057] Optionally, in this embodiment, it can also be accounted and revised through traditional prediction methods.
[0058] Exemplarily, the sales data of the (N + 1)-th small cycle can be predicted based on the sales data curve, and the prediction result can be obtained.
[0059] The sales curve can be the result of fitting multiple historical sales data, and the specific fitting process is not elaborated in this application.
[0060] When the (N + 1)-th small cycle is the target cycle, the target sales data of the target cycle output by the neural network model is calibrated based on the prediction result.
[0061] Exemplarily, the calibration process can be as follows: if the predicted result is compared with the target sales data of the target period output by the neural network model, and the difference value between the predicted result and the target sales data of the target period output by the neural network model is greater than the preset threshold, it can be proved that the difference value is large. Therefore, for safety reasons, to avoid insufficient stock preparation, the higher value between the predicted result and the target sales data of the target period output by the neural network model is taken as the target sales data. Of course, if the difference value between the predicted result and the target sales data of the target period output by the neural network model is less than the preset threshold, the difference is not significant. Therefore, the average value of the predicted result and the target sales data of the target period output by the neural network model can be taken as the target sales data.
[0062] A sales data processing method proposed in an embodiment of the present application obtains the historical sales data of a target sales terminal, constructs and trains a neural network model based on the continuous sales data, predicts the target sales data corresponding to a period that has not yet arrived based on the trained neural network model, and adjusts the stock quantity corresponding to the target period through the target sales data. The sales data processing method proposed in an embodiment of the present application is more accurate in predicting the target data through the neural network than the traditional curve curvature prediction method. At the same time, it can integrate more data, improve the prediction accuracy, and avoid the waste caused by insufficient or redundant stock preparation when stocking in advance due to inaccurate data prediction.
[0063] Based on the same inventive concept, an embodiment of the present application also proposes a sales data processing system, which includes: A first sub-module, which is used to determine the target sales terminal and obtain the historical sales data of the target sales terminal. The historical sales data includes N small periods with the same time span and the sales data corresponding to each small period, where N is a natural number; A second sub-module, which is used to generate a training set based on M consecutive small periods, where M is a natural number less than N and greater than 3, and apply the training set to the neural network model for iterative calculation. The neural network model is used to generate a predicted sales data according to the input M - 1 consecutive sales data. When the neural network model meets the preset conditions, the training stops and the trained neural network model is output; A third sub-module, which is used to determine the Xth small period as the target period, where X is a natural number greater than N, input the sales data corresponding to the (X - M + 1)th, (X - M + 2)th, (X - M + 3)th to the (X - 1)th small periods into the neural network model, and obtain the predicted target sales data of the target period according to the output result of the neural network model; A fourth sub-module, which is used to determine the stock quantity corresponding to the target period based on the target sales data.
[0064] Optionally, in combination with the second aspect, the system is configured as follows: Generate a training set based on M consecutive small cycles, where M is a natural number less than N and greater than 3, and apply the training set to a neural network model for iterative calculation. The neural network model is used to generate a predicted sales data based on M - 1 consecutive input sales data. When the neural network model meets a preset condition, stop training and output the trained neural network model, including: Import the sales data corresponding to the (J - M + 1)-th, (J - M + 2)-th, (J - M + 3)-th to (J - 1)-th small cycles into the neural network model for iterative calculation. Among them, the J-th training set includes the sales data corresponding to the (J - M + 1)-th, (J - M + 2)-th, (J - M + 3)-th to (J - 1)-th small cycles. Take the sales data corresponding to the (J - M + 1)-th, (J - M + 2)-th, (J - M + 3)-th to (J - 1)-th small cycles as three dimensions, and the three dimensions form the feature vector of the sales data corresponding to the (J - 1)-th small cycle. J is any natural number from M to N - 1; When the neural network model meets the preset condition, stop the calculation and obtain the trained neural network model.
[0065] Optionally, the system is configured as follows: When the neural network model meets the preset condition, stop the calculation and obtain the trained neural network model, including: Obtain a total of M predicted sales data corresponding to the (J - M + 1)-th, (J - M + 2)-th, (J - M + 3)-th to J-th based on the neural network model; Compare the M predicted sales data with the actual corresponding M sales data one by one. According to the comparison results, divide the M sales data into a high-difference group and a low-difference group. Among them, the difference between the sales data belonging to the high-difference group and the corresponding predicted sales data is greater than the difference between the sales data belonging to the low-difference group and the corresponding predicted sales data; Assign a first weight to the sales data belonging to the high-difference group in the J-th training set, and assign a second weight to the sales data belonging to the low-difference group. The first weight is less than the second weight, where the first weight and the second weight are used to represent the credibility of the data in the training set; When the ratio of the first weight to the second weight is less than the target value, stop training and output the trained target neural network model.
[0066] Optionally, the system is configured as follows: Assign a first weight to the sales data belonging to the high-difference group in the J-th training set, and assign a second weight to the sales data belonging to the low-difference group. The first weight is less than the second weight, where the first weight and the second weight are used to represent the credibility of the data in the training set, and satisfy: a + b = 2 Among them, a is the first weight and b is the second weight.
[0067] Optionally, the system is configured to: Assign the sales data belonging to the high-difference group in the Jth training set the first weight, and assign the sales data belonging to the low-difference group the second weight. The first weight is less than the second weight. Among them, the first weight and the second weight are used to characterize the credibility of the data in the training set, including: Obtain the first average difference T1 between the sales data belonging to the high-difference group and the corresponding predicted sales data; Obtain the second average difference T2 between the sales data belonging to the high-difference group and the corresponding predicted sales data; Determine the first weight a and the second weight b based on the first average difference T1 and the second average difference T2, and satisfy: T1 / T2 = b / a.
[0068] Optionally, the system is configured to: When the neural network model meets the preset conditions, stop the calculation and obtain the trained neural network model, including: Obtain the error value. When the error value is less than the preset value, stop the calculation and output the trained neural network model. Among them, the error value satisfies: During each iterative calculation, compare the predicted sales data with the corresponding sales data. If the predicted sales data is greater than the corresponding sales data, determine the error value as: T = (yt - y1)y1 If the predicted sales data is less than the corresponding sales data, determine the error value as: T = (y1 - yt)y1 Among them, T is the error value, yt is the predicted sales data, and y1 is the corresponding sales data.
[0069] Optionally, the system is configured to: The method further includes: Obtain N sales data, and generate a continuous sales data curve based on the time axis position corresponding to each sales data. Among them, the time axis position corresponding to each sales data is the midpoint position of the corresponding sales cycle on the time axis; Predict the sales data of the (N + 1)th small cycle based on the sales data curve and obtain the prediction result; When the (N + 1)th small cycle is the target cycle, calibrate the target sales data of the target cycle output by the neural network model based on the prediction result.
[0070] Optionally, in combination with the second aspect, the system is configured to: When the (N + 1)-th small period is the target period, calibrate the target sales data of the target period output by the neural network model based on the prediction result, including: If the difference value between the prediction result and the target sales data of the target period output by the neural network model is greater than the preset threshold, then take the higher value among the prediction result and the target sales data of the target period output by the neural network model as the target sales data; If the difference value between the prediction result and the target sales data of the target period output by the neural network model is less than the preset threshold, then take the average value of the prediction result and the target sales data of the target period output by the neural network model as the target sales data.
[0071] Optionally, in combination with the second aspect, the system is configured to: Determine the target sales terminal, and obtain the historical sales data of the target sales terminal. The historical sales data includes N small periods with the same time span and the corresponding sales data for each small period. N is a natural number, where: The sales data is one or any combination of two of the sales amount, the sales type, and the combined sales data of the goods.
[0072] A sales data processing system proposed in an embodiment of the present application obtains the historical sales data of the target sales terminal, constructs and trains a neural network model based on the continuous sales data, predicts the target sales data corresponding to the period that has not yet arrived based on the trained neural network model, and adjusts the stock quantity corresponding to the target period through the target sales data. The sales data processing system proposed in an embodiment of the present application is more accurate through the target data predicted by the neural network than the traditional curve curvature prediction method, and at the same time can integrate more data, improve the prediction accuracy, and avoid the waste caused by the insufficient or redundant stock quantity during advance stock preparation due to inaccurate data prediction.
[0073] Based on the same inventive concept, an embodiment of the present application also proposes an electronic device, which includes: At least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the sales data processing method of the embodiment of the present application.
[0074] In addition, to achieve the above object, an embodiment of the present application also proposes a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, it implements the sales data processing method of the embodiment of the present application.
[0075] The following specifically introduces each component of the electronic device: Among them, the processor is the control center of the electronic device, which can be a single processor or a collective term for multiple processing elements. For example, the processor can be one or more central processing units (CPUs), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. For example: one or more digital signal processors (DSPs), or one or more field programmable gate arrays (FPGAs).
[0076] Optionally, the processor can execute various functions of the electronic device by running or executing software programs stored in the memory and calling data stored in the memory.
[0077] Among them, the memory is used to store the software program for implementing the solution of the present invention and is controlled by the processor for execution. The specific implementation manner can refer to the above method embodiments and will not be elaborated here.
[0078] Optionally, the memory can be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory can be integrated with the processor or exist independently and be coupled to the processor through the interface circuit of the electronic device. The embodiments of the present invention do not make specific limitations on this.
[0079] The transceiver is used to communicate with network devices or terminal devices.
[0080] Optionally, the transceiver can include a receiver and a transmitter. Among them, the receiver is used to implement the receiving function, and the transmitter is used to implement the transmitting function.
[0081] Optionally, the transceiver may be integrated with the processor or exist independently, and is coupled to the processor through the interface circuit of the router. The embodiments of the present invention do not make specific limitations thereon.
[0082] In addition, for the technical effects of the electronic device, reference may be made to the technical effects of the data transmission method in the foregoing method embodiments, which will not be elaborated herein.
[0083] It should be understood that the processor in the embodiments of the present invention may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0084] It should also be understood that the memory in the embodiments of the present invention can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0085] The above embodiments can be implemented in whole or in part by software, hardware (such as circuits), firmware, or any combination thereof. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. A computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the processes or functions according to the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wired (such as infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that contains one or more collections of available media. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, or a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state drive.
[0086] It should be understood that the term "and / or" in this document is merely a description of the association relationship between associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. Here, A and B can be singular or plural. Additionally, the character " / " in this document generally represents an "or" relationship between the associated objects before and after, but it may also represent an "and / or" relationship, which can be understood specifically by referring to the context before and after.
[0087] In the present invention, "at least one" means one or more, and "a plurality" means two or more. "At least one of the following" or its similar expressions refer to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can represent: a, b, c, a - b, a - c, b - c, or a - b - c, where a, b, and c can be single or multiple.
[0088] It should be understood that in various embodiments of the present invention, the magnitudes of the sequence numbers of the above processes do not imply the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
[0089] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. A professional technician can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the present invention.
Claims
1. A sales data processing method, characterized in that: The method comprises: Determine a target sales terminal, and obtain historical sales data of the target sales terminal, wherein the historical sales data includes N small periods with the same time span and sales data corresponding to each small period, where N is a natural number; Generate a training set based on M consecutive small cycles, where M is a natural number less than N and greater than 3, and apply the training set to a neural network model and perform iterative calculations, wherein the neural network model is used to generate a predicted sales data based on M-1 consecutive sales data input, and stop training when the neural network model meets a preset condition and output the trained neural network model; Determine the Xth small cycle as the target cycle, where X is a natural number greater than N, input the sales data corresponding to the X-M+1th, X-M+2th, X-M+3th to X-1th small cycles into the neural network model, and obtain the predicted target sales data of the target cycle according to the output result of the neural network model; The inventory quantity corresponding to the target period is determined based on the target sales data.
2. A sales data processing method according to claim 1, characterized in that: A training set is generated based on M consecutive small cycles, where M is a natural number less than N and greater than 3, and the training set is applied to a neural network model and iteratively calculated, wherein the neural network model is used to generate a predicted sales data according to M-1 consecutive sales data input, and when the neural network model meets a preset condition, the training is stopped and the trained neural network model is output, including: Import the sales data corresponding to the J-M+1th, J-M+2th, J-M+3th to J-1th small cycles into the neural network model for iterative calculation, wherein the Jth training set includes the sales data corresponding to the J-M+1th, J-M+2th, J-M+3th to J-1th small cycles, and use the sales data corresponding to the J-M+1th, J-M+2th, J-M+3th to J-1th small cycles as three dimensions, and the three dimensions constitute the feature vector of the sales data corresponding to the J-1th small cycle, and J is any natural number from M to N-1; When the neural network model meets the preset conditions, the calculation is stopped and the trained neural network model is obtained.
3. A sales data processing method according to claim 2, characterized in that: When the neural network model meets the preset conditions, the calculation is stopped, and the trained neural network model is obtained, including: Based on the neural network model, a total of M predicted sales data corresponding to the J-M+1th, J-M+2th, J-M+3th to the Jth are obtained; Compare the M predicted sales data with the M actual corresponding sales data one by one, and divide the M sales data into a high-difference group and a low-difference group according to the comparison result, wherein the difference between the sales data belonging to the high-difference group and the corresponding predicted sales data is greater than the difference between the sales data belonging to the low-difference group and the corresponding predicted sales data; Assigning a first weight to the sales data belonging to the high-variance group in the J-th training set, and assigning a second weight to the sales data belonging to the low-variance group, wherein the first weight is smaller than the second weight, wherein the first weight and the second weight are used to characterize the credibility of the data in the training set; When the ratio of the first weight to the second weight is less than a target value, the training of the trained target neural network model is stopped.
4. A sales data processing method according to claim 3, characterized in that: In the J-th training set, the sales data belonging to the high-variance group is assigned a first weight, and the sales data belonging to the low-variance group is assigned a second weight, wherein the first weight is less than the second weight, wherein the first weight and the second weight are used to characterize the credibility of the data in the training set, and satisfy: a+b=2 Among them, a is the first weight, and b is the second weight.
5. A sales data processing method according to claim 4, characterized in that: Assigning a first weight to the sales data belonging to the high-variance group in the J-th training set, and assigning a second weight to the sales data belonging to the low-variance group, wherein the first weight is less than the second weight, wherein the first weight and the second weight are used to characterize the credibility of the data in the training set, including: Obtaining a first average difference T1 between the sales data belonging to the high-variance group and the corresponding predicted sales data; Obtaining a second average difference T2 between the sales data belonging to the high-variance group and the corresponding predicted sales data; The first weight a and the second weight b are determined based on the first average difference T1 and the second average difference T2, and satisfy: T1 / T2=b / a.
6. A sales data processing method according to claim 2, characterized in that: When the neural network model meets the preset conditions, the calculation is stopped, and the trained neural network model is obtained, including: Obtain an error value, stop calculating when the error value is less than a preset value, and output the trained neural network model, wherein the error value satisfies: In each iterative calculation process, the predicted sales data is compared with the corresponding sales data. If the predicted sales data is greater than the corresponding sales data, the error value is determined as: T = (yt-y1)y1 If the predicted sales data is greater than the corresponding sales data, the error value is determined as: T = (y1-yt)y1 Among them, T is the error value, yt is the predicted sales data, and y1 is the corresponding sales data.
7. A sales data processing method according to claim 1, characterized in that: The method further comprises: Obtain N sales data, and generate a continuous sales data curve based on the time axis position corresponding to each sales data, wherein the time axis position corresponding to each sales data is the midpoint position of the corresponding sales cycle on the time axis; Predicting the sales data of the N+1th small period based on the sales data curve, and obtaining a prediction result; When the N+1th small cycle is the target cycle, the target sales data of the target cycle output by the neural network model is calibrated based on the prediction result.
8. A sales data processing method according to claim 7, characterized in that: When the N+1th small cycle is the target cycle, calibrating the target sales data of the target cycle output by the neural network model based on the prediction result includes: If the difference between the prediction result and the target sales data of the target period output by the neural network model is greater than a preset threshold, the higher of the prediction result and the target sales data of the target period output by the neural network model is used as the target sales data; If the difference between the prediction result and the target sales data of the target period output by the neural network model is less than the preset threshold, the average value of the prediction result and the target sales data of the target period output by the neural network model is taken as the target sales data.
9. A sales data processing method according to any one of claims 1 to 8, characterized in that: Determine a target sales terminal, and obtain historical sales data of the target sales terminal, wherein the historical sales data includes N small periods with the same time span and sales data corresponding to each small period, where N is a natural number, wherein: The sales data is one of sales volume, sales category, and combined sales data of commodities, or a combination of any two of them.
10. A sales data processing system, characterized in that: The sales data processing system comprises: A first submodule, the first submodule is used to determine a target sales terminal, and obtain historical sales data of the target sales terminal, wherein the historical sales data includes N small periods with the same time span and sales data corresponding to each of the small periods, where N is a natural number; A second submodule, the second submodule is used to generate a training set based on M consecutive small cycles, where M is a natural number less than N and greater than 3, and apply the training set to a neural network model and perform iterative calculations, the neural network model is used to generate a predicted sales data based on M-1 consecutive sales data input, and when the neural network model meets a preset condition, the training is stopped and the trained neural network model is output; The third submodule is used to determine the Xth small cycle as the target cycle, where X is a natural number greater than N, input the sales data corresponding to the X-M+1th, X-M+2th, X-M+3th to X-1th small cycles into the neural network model, and obtain the predicted target sales data of the target cycle according to the output result of the neural network model; A fourth submodule is used to determine the inventory quantity corresponding to the target period based on the target sales data.