Training method of sales volume prediction model
By using multiple training algorithms to be selected in the training of sales prediction model for feature learning and weight adjustment, the problems of slow training speed and inaccurate model parameters in the prior art are solved, and the accuracy and efficiency of sales prediction are improved.
Patent Information
- Application Number
- CN202410920574.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-11-12
AI Technical Summary
The training algorithm of the existing sales prediction model is single, the training speed is slow, and the model parameters are inaccurate, resulting in inaccurate prediction results.
By obtaining the historical feature data and initial model of the target product, using multiple training algorithms to be selected in the solver for feature learning, and deciding the first K algorithms from large to small according to the weight value of the algorithm, the target training algorithm with the smallest solution error is determined according to the algorithm's weight value. , and perform model training based on this algorithm, adjust the weight value to optimize algorithm selection until the preset conditions are met.
The selection efficiency and accuracy of the training algorithm to be selected is improved, the rapid learning of the initial model and more accurate model parameters are realized, and the training efficiency of the sales prediction model is improved.
Smart Images

Figure CN118941323A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of machine learning, and in particular to a training method, device, program product, medium and electronic device for a sales prediction model. Background Art
[0002] In the process of production and operation, enterprises often predict sales in certain time periods in the future to ensure reasonable production and avoid stockpiling. For example, large supermarkets need to predict the sales of various commodities in a certain period of time in order to make reasonable purchases; traditional manufacturing industries also need to make reasonable predictions on the sales of products produced in order to plan production and avoid insufficient supply or large inventory.
[0003] In recent years, with the development of machine learning in various fields, more and more companies are applying machine learning to conduct business prediction and analysis. However, the existing prediction methods use a single training algorithm, slow training speed, and inaccurate model parameters, resulting in inaccurate prediction results. Summary of the invention
[0004] In view of this, the purpose of the embodiments of the present application is to provide a training method, device, program product, medium and electronic device for a sales forecasting model. The training method of the present application can improve the selection efficiency and accuracy of the training algorithm to be selected, which is conducive to the rapid learning of the initial model to obtain more accurate model parameters and obtain a sales forecasting model.
[0005] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0006] According to a first aspect of an embodiment of the present application, a method for training a sales prediction model is provided, the method comprising: obtaining historical feature data, historical sales volume and an initial model of a target product, wherein the initial model is a model used for sales prediction and has not been trained; based on the initial model, determining a product sub-problem regarding the feature data and sales volume of the target product; inputting the historical feature data, the historical sales volume, the initial model and the product sub-problem into a solver for feature learning to obtain a sales prediction model; wherein the solver comprises N to-be-selected training algorithms, the training algorithms being used to train the initial model, N being an integer greater than or equal to 2, and the process of performing feature learning in the solver comprising: extracting the first K to-be-selected training algorithms from large to small according to the weight values of the N to-be-selected training algorithms Method, wherein K is an integer greater than or equal to 1, K is less than N, and the weight value is used to characterize the computational efficiency of the candidate training algorithm; the K candidate training algorithms are used to solve the commodity sub-problems corresponding to the initial model respectively, and the solution errors of each candidate training algorithm are obtained; the training algorithm with the smallest solution error is determined from the K candidate training algorithms as the target training algorithm, and the training task of the initial model is performed based on the target training algorithm; after the training task is executed for a first preset time, the weight value of each candidate training algorithm is adjusted according to the solution error of each candidate training algorithm, and the step of extracting the first K candidate training algorithms from large to small according to the weight values of the N candidate training algorithms is returned to execute, until the preset conditions are met, and the sales forecast model determined by the initial model after multiple rounds of training is obtained.
[0007] In some embodiments of the present application, based on the aforementioned scheme, the historical feature data includes any one or more of the following: product category; number of holidays; promotion method; mall address; and number of advertisements placed.
[0008] In some embodiments of the present application, based on the aforementioned scheme, the initial model is a regression model.
[0009] In some embodiments of the present application, based on the aforementioned scheme, before extracting the first K candidate training algorithms from large to small according to the weight values of the N candidate training algorithms for the first time, the method also includes: randomly assigning a weight value to each of the N candidate training algorithms.
[0010] In some embodiments of the present application, based on the aforementioned scheme, the use of the K to-be-selected training algorithms to respectively solve the commodity sub-problems corresponding to the initial model includes: using the K to-be-selected training algorithms to respectively solve the commodity sub-problems corresponding to the initial model within the same second preset time length; adjusting the weight value of each to-be-selected training algorithm according to the solution error of each to-be-selected training algorithm, including: if the solution error is less than the preset error value, increasing the weight value; if the solution error is greater than the preset error value, lowering the weight value; if the solution error is equal to the preset error value, not adjusting the weight value.
[0011] In some embodiments of the present application, based on the aforementioned scheme, the solver includes a preset Nesterov acceleration algorithm, and the Nesterov acceleration algorithm is used to accelerate the training of the initial model by the target training algorithm.
[0012] According to a second aspect of an embodiment of the present application, a training device for a sales prediction model is provided, the device comprising: an acquisition unit, for acquiring historical feature data, historical sales and an initial model of a target product, wherein the initial model is a model used for sales prediction and has not been trained; a product sub-problem determination unit, for determining a product sub-problem regarding the feature data and sales of the target product based on the initial model; a learning unit, for inputting the historical feature data, the historical sales, the initial model and the product sub-problem into a solver for feature learning to obtain a sales prediction model; wherein the solver comprises N to-be-selected training algorithms, the training algorithms being used to train the initial model, N being an integer greater than or equal to 2, and the process of performing feature learning in the solver comprising: according to the weight values of the N to-be-selected training algorithms, from The first K candidate training algorithms are extracted from large to small, wherein K is an integer greater than or equal to 1, K is less than N, and the weight value is used to characterize the computational efficiency of the candidate training algorithms; the commodity sub-problems corresponding to the initial model are solved respectively by using the K candidate training algorithms, and the solution errors of each candidate training algorithm are obtained; the training algorithm with the smallest solution error is determined from the K candidate training algorithms as the target training algorithm, and the training task of the initial model is performed based on the target training algorithm; after the training task is executed for a first preset time, the weight value of each candidate training algorithm is adjusted according to the solution error of each candidate training algorithm, and the step of extracting the first K candidate training algorithms from large to small according to the weight values of the N candidate training algorithms is returned to execute, until the preset conditions are met, and the sales forecasting model determined by the initial model after multiple rounds of training is obtained.
[0013] According to a third aspect of an embodiment of the present application, a computer program product is provided, which includes computer instructions, which are stored in a computer-readable storage medium and are suitable for being read and executed by a processor, so that a computer device having the processor executes to implement the operations performed by the method described in any one of the first aspects above.
[0014] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which at least one computer program instruction is stored. The at least one computer program instruction is loaded and executed by a processor to implement the operations performed by the method described in any one of the first aspects above.
[0015] According to a fifth aspect of an embodiment of the present application, an electronic device is provided, comprising one or more processors and one or more memories, wherein at least one computer program instruction is stored in the one or more memories, and the at least one computer program instruction is loaded and executed by the one or more processors to implement the operations performed by the method described in any one of the first aspects above.
[0016] Based on the technical solution proposed in this application, in the commodity sales forecasting scenario, during the training process of the sales forecasting model, according to the weight values of the N candidate training algorithms in the solver used to characterize the computational efficiency of the candidate training algorithms, the first K candidate training algorithms are extracted from large to small, and the K candidate training algorithms are used to solve the commodity sub-problems corresponding to the initial model respectively, and the target training algorithm with the smallest solution error is determined from the K candidate training algorithms, and the training task of the initial model is performed based on the target training algorithm. After the training task is executed for a first preset time, the weight values of each candidate training algorithm are adjusted according to the solution error of each candidate training algorithm, and then the above training steps are repeated. In this way, the candidate training algorithms are continuously adjusted during the business data processing process, the accuracy of the algorithm selection of machine learning is improved, and it is ensured that high-efficiency algorithms can be matched at different training stages, which is conducive to the rapid learning of the initial model to obtain more accurate model parameters and improve the training efficiency of the sales forecasting model.
[0017] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0019] Figure 1 A flow chart showing a method for training a sales forecasting model in an embodiment of the present application is shown;
[0020] Figure 2 A block diagram of a training device for a sales forecasting model in an embodiment of the present application is shown;
[0021] Figure 3 A schematic diagram of the structure of an electronic device in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0023] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0024] The block diagrams shown in the accompanying drawings are only functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices. It should also be noted that in the accompanying drawings, in order to ensure the simplicity of the drawings, some components in the drawings that do not affect the explanation of the technical solution of the present application are adaptively omitted.
[0025] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0026] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the feature. In the description of this application, unless otherwise specified, "plurality" means two or more.
[0027] It should be noted that the sales forecasting model trained according to the training method of the sales forecasting model proposed in this application can be applied to scenarios where sales of enterprise products are predicted, such as large supermarkets, convenience stores, etc.
[0028] Reference Figure 1 , which shows a flow chart of a method for training a sales forecast model in an embodiment of the present application. The method for training a sales forecast model can be executed by a device having a computing and processing function, referring to Figure 1 As shown, the training method of the sales prediction model includes at least steps S10 to S30, which are described in detail as follows:
[0029] Step S10, obtaining historical feature data, historical sales volume and an initial model of the target product, wherein the initial model is a model used for sales volume prediction and has not been trained.
[0030] Step S20: determining the commodity sub-problem regarding the characteristic data and sales volume of the target commodity based on the initial model.
[0031] Step S30, inputting the historical feature data, the historical sales volume, the initial model and the commodity sub-problem into a solver for feature learning to obtain a sales volume prediction model.
[0032] The solver includes N training algorithms to be selected, and the training algorithms are used to train the initial model, where N is an integer greater than or equal to 2. In the above step S30, the process of performing feature learning in the solver includes steps S31 to S34:
[0033] Step S31, extracting the first K candidate training algorithms from large to small according to the weight values of the N candidate training algorithms, wherein K is an integer greater than or equal to 1, K is less than N, and the weight value is used to characterize the computational efficiency of the candidate training algorithm;
[0034] Step S32, using the K candidate training algorithms to solve the commodity sub-problems corresponding to the initial model respectively, and obtaining the solution error of each candidate training algorithm;
[0035] Step S33, determining a training algorithm with the smallest solution error from the K candidate training algorithms as a target training algorithm, and performing a training task on the initial model based on the target training algorithm;
[0036] Step S34, after the training task is executed for the first preset time, the weight values of each candidate training algorithm are adjusted accordingly according to the solution errors of each candidate training algorithm, and the step of extracting the first K candidate training algorithms from large to small according to the weight values of N candidate training algorithms is returned to execute, until the preset conditions are met, and the sales forecasting model determined by the initial model after multiple rounds of training is obtained.
[0037] In step S10, the target product may be any product sold in a shopping mall or supermarket, such as milk, clothes, cars, etc.
[0038] In step S10, the historical feature data may be data that can directly or indirectly affect the sales volume of the target product. For example, in this application, it may include any one or more of the following: product type; number of holidays; promotion method; mall address; number of advertisements, etc.
[0039] In the present application, after obtaining the sales forecasting model, the sales forecasting model can be used to predict the future sales of the target product based on the current feature data of the target product. For example, in a specific implementation, the sales forecasting model can be used to predict the future sales of the target product based on the current number of holidays, promotion methods, mall addresses, number of advertisements, etc.
[0040] The initial model in the present application may be a regression model, specifically a linear regression model or a polynomial regression model.
[0041] In the present application, the training method of the sales forecasting model can be applied to a machine learning solver, in which at least a multi-level algorithm framework can be preset. In the inner layer, the training method of the sales forecasting model proposed in the present application can be used to solve the commodity sub-problem using the candidate training algorithm in the solver to verify the efficiency of different candidate training algorithms, and finally select the most efficient algorithm as the target training algorithm to improve the computational efficiency and learning speed. Among them, the candidate training algorithms in the solver can include conjugate gradient method, ADMM, quasi-Newton method, etc.
[0042] In the present application, an iterative calculation acceleration algorithm may be used in the outer layer of the solver, and the acceleration algorithm is used to accelerate the training of the initial model by the training algorithm. Specifically, the acceleration algorithm may use the Nesterov acceleration algorithm.
[0043] In the present application, before extracting the training algorithms to be selected, all the training algorithms that can be used in machine learning should be added to the algorithm pool pre-built in the solver as the training algorithms to be selected. Specifically, N training algorithms to be selected can be set in the present application, and N should be greater than or equal to 2. At this time, before the above-mentioned step S31, that is, before the first K training algorithms to be selected are extracted from large to small according to the weight values of the N training algorithms to be selected for the first time, a weight value can be randomly assigned to each training algorithm to be selected in the algorithm pool, or a higher weight value can be assigned to the algorithm with higher usage efficiency based on experience.
[0044] In the present application, since the weight value is used to characterize the computational efficiency of the candidate training algorithm, in the above step S31, when extracting the candidate training algorithm, extracting the top K candidate training algorithms with corresponding weights from large to small will be conducive to selecting the candidate training algorithm with the lowest or lower solution error (that is, the highest or lower computational efficiency).
[0045] In the present application, the K candidate training algorithms are used to solve the commodity sub-problems corresponding to the initial model respectively, which can be to use the K candidate training algorithms to solve the commodity sub-problems corresponding to the initial model respectively within the same second preset time length. Among them, the smaller the solution error of solving the commodity sub-problem, the more accurate the solution result is, and it can be considered that the corresponding candidate training algorithm has a higher calculation efficiency.
[0046] Furthermore, the K candidate training algorithms are used to solve the commodity sub-problems corresponding to the initial model within the same second preset time, and the solution results (such as solution errors) of each candidate training algorithm are obtained respectively. Among the solution errors corresponding to the K candidate training algorithms, the candidate training algorithm with the highest corresponding computational efficiency is determined. When the K candidate training algorithms are used to solve the commodity sub-problems, they can be independently calculated in parallel. Since the solution time is the same, the size of the K solution errors can be directly compared to determine the computational efficiency of the corresponding candidate training algorithm.
[0047] In this application, by solving the commodity sub-problem, the efficiency of different candidate training algorithms in the algorithm pool is verified, and finally the training algorithm with the smallest solution error (i.e., the highest computational efficiency) is selected as the target training algorithm to ensure the subsequent efficient learning process of the initial model.
[0048] The inventors of this application consider that in the entire machine learning training process, different computational efficiencies may occur in the same candidate training algorithm when solving commodity sub-problems at different training stages, that is, different computational efficiencies will appear when training the initial model, which may cause the initial model to always be obtained from a small range of training algorithms. In the long run, some training algorithms with better effects but never selected may be missed, so it is necessary to explore other rarely visited candidate training algorithms every certain period. Specifically, a cycle threshold can be set in this application, that is, the first preset duration in step S34. When the duration threshold is exceeded, an attempt can be made to re-extract a training algorithm from the N candidate training algorithms to train the initial model.
[0049] In this way, the above steps S31 and S33 can be executed cyclically every first preset time threshold to ensure automatic updating of the target training algorithm and ensure that the selected training algorithms used in the entire machine learning training process have high computational efficiency (ie, training efficiency).
[0050] In the present application, in order to ensure that the next time the candidate training algorithm is extracted, the candidate training algorithm with low computational efficiency that has been verified last time will not be extracted. Before re-executing the above steps S31 and S33, a weight adjustment step can be added, namely step S34: the weight value of each candidate training algorithm is adjusted according to the solution error of each candidate training algorithm.
[0051] In the present application, the weight values of each candidate training algorithm are adjusted according to the solution errors of each candidate training algorithm, which can be specifically performed according to the following steps S341 to S343:
[0052] Step S341: if the solution error is less than a preset error value, increase the weight value.
[0053] Step S342: if the solution error is greater than a preset error value, lower the weight value.
[0054] Step S343: if the solution error is equal to the preset error value, the weight value is not adjusted.
[0055] Specifically, the weight value corresponding to the candidate training algorithm whose solution error exceeds the preset error value is reduced; and / or the weight corresponding to the candidate training algorithm whose solution error is less than the preset error value is increased. There is no restriction on the function form of weight increase and decrease. For example, a fixed value can be adjusted according to the solution error, such as the adjustment value is η. The adjustment value can also be flexibly determined according to the solution error, such as η = f1(z), where f1 is an anti-correlated function with respect to the solution error z, that is, the larger the optimization target value (the worse the result), the smaller η, and vice versa.
[0056] In the same training process, by setting a preset error value to increase or decrease the weight of the candidate training algorithm, the candidate training algorithm in the algorithm pool can be continuously optimized. When the candidate training algorithm is randomly extracted in the subsequent process, the probability of extracting a high-efficiency algorithm can be increased, and the probability of extracting an inefficient algorithm can be reduced, thereby improving the overall computational efficiency of the machine learning process.
[0057] After each training task is executed for the first preset time, the first K candidate training algorithms are extracted from the largest to the smallest according to the weight values of the N candidate training algorithms, and the K candidate training algorithms are used to solve the commodity sub-problems corresponding to the initial model respectively, and the target training algorithm with the smallest solution error is determined from the K candidate training algorithms, and the training task of the initial model is executed based on the target training algorithm. In this way, the candidate training algorithms are continuously adjusted during the business data processing process, ensuring a high computing efficiency.
[0058] In the present application, in the above step S34, during the feature learning process in the solver, when the preset conditions are met, the training is terminated to obtain the sales forecasting model determined by the initial model after multiple rounds of training, otherwise the next cycle is performed.
[0059] Specifically, after each cycle completes feature learning, The initial model in the feature learning process is evaluated to obtain an evaluation result, and further, whether the preset conditions are met can be determined based on the evaluation result and the learning time to obtain the sales forecast model. In this example, l is the loss function, x is the model parameter to be solved in the initial model, and a i is the historical feature data, b i is the historical sales volume, and R is the penalty function of the complexity of the initial model.
[0060] Specifically, the method for evaluating the initial model that has completed learning with this feature can be: judging Whether the value of meets the preset convergence requirements, for example, during the convergence process, the current model parameters are adjusted to make the above If the value of is less than the preset convergence threshold, it is judged that the preset conditions are met and the current model parameters can be used as the final parameters.
[0061] In addition, in the above step S34 of the present application, in order to prevent the solver from performing unlimited optimization and feature learning, a total time threshold for feature learning can be set. When the preset total time threshold is reached, feature learning can also be terminated to obtain a sales forecasting model.
[0062] In addition, in the above step S34 of the present application, the preset condition may be that when the number of cycles from the above steps S31 to S33 reaches a preset number, a sales forecast model is obtained.
[0063] In the process of feature learning of the initial model in the solver, when the preset convergence requirements are met, the total feature learning time reaches the total time threshold, and the number of cycles reaches any one of the preset numbers, the feature learning process of the model can be terminated to obtain the sales prediction model.
[0064] In order to make the acquisition process of the sales forecast model of this application easier to understand, the following is an explanation and description in the form of a specific example:
[0065] The target product is a certain model of car.
[0066] First, obtain the characteristic data of the car within 2 years, including: the configuration type of the car a 1 、Holiday time 2 and quantity a 3 、Store address a 4 , advertising time and quantity 5 etc.; further, other parameters that may affect sales volume (a 6 ,a 7 ,…a d ), such as product pricing, competitor pricing, and fuel prices. After obtaining the corresponding sales volume, the feature data and sales volume are sorted and grouped to form a learning sample. The initial model used is as follows:
[0067] b = x 0 +a 1 x 1 +a 2 x 2 +a 3 x 3 +···+a d x d , where x 0 Offset for the model.
[0068] use The initial model in the training process is evaluated to determine whether the final sales forecast model is obtained and end the learning process. Or R(x)=λ||x||1.
[0069] Set up a training algorithm pool, which contains several (N) training algorithms to be selected: A1, A2, A3, ..., A n , the weight values are set as: w1,w2,w3,…,w n .
[0070] Introduce initial variable y0 and auxiliary variables x0, z0; set t=0.
[0071] Cycle steps:
[0072] Update the auxiliary variable x according to the interpolation formula t+1 =(1-α t )x t +α t z t ;
[0073] Solve the commodity subproblem f determined according to the initial model t , the commodity subproblem has different variants, for example,
[0074] Select K algorithms with relatively high weights from the training algorithm pool (first target algorithm): For the commodity subproblem f t Solve independently and in parallel, and change the weight value corresponding to the selected training algorithm according to the solution result Select the best solution There are many strategies for changing the weight value. For example, according to the multiplicative update principle, the candidate training algorithm with good performance is updated as follows: w←w·(1+η), η∈(0,1); the candidate training algorithm with poor performance is updated as follows: w←w·(1-η), η∈(0,1);
[0075] After each training task is executed for the first preset time, the first K candidate training algorithms are extracted from the largest to the smallest according to the weight values of the N candidate training algorithms, and the K candidate training algorithms are used to solve the commodity sub-problems corresponding to the initial model respectively, and the target training algorithm with the smallest solution error is determined from the K candidate training algorithms, and the training task of the initial model is executed based on the target training algorithm. In this way, the candidate training algorithms are continuously adjusted during the business data processing process, ensuring a high computing efficiency.
[0076] In this application, when the preset conditions are met (i.e., judging When the value of reaches the preset convergence requirement, the training is terminated to obtain the trained sales forecast model, otherwise the next cycle is performed: t = t + 1; finally, y is returned. t+1 .
[0077] Based on the technical solution proposed in this application, in the commodity sales forecasting scenario, during the training process of the sales forecasting model, according to the weight values of the N candidate training algorithms in the solver used to characterize the computational efficiency of the candidate training algorithms, the first K candidate training algorithms are extracted from large to small, and the K candidate training algorithms are used to solve the commodity sub-problems corresponding to the initial model respectively, and the target training algorithm with the smallest solution error is determined from the K candidate training algorithms, and the training task of the initial model is performed based on the target training algorithm. After the training task is executed for a first preset time, the weight values of each candidate training algorithm are adjusted according to the solution error of each candidate training algorithm, and then the above training steps are repeated. In this way, the candidate training algorithms are continuously adjusted during the business data processing process, the accuracy of the algorithm selection of machine learning is improved, and it is ensured that high-efficiency algorithms can be matched at different training stages, which is conducive to the rapid learning of the initial model to obtain more accurate model parameters and improve the training efficiency of the sales forecasting model.
[0078] The following describes an embodiment of the device of the present application, which can be used to execute the training method of the sales prediction model in the above embodiment of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the training method of the sales prediction model in the above embodiment of the present application.
[0079] See also Figure 2 , shows a block diagram of a training device for a sales forecasting model in an embodiment of the present application.
[0080] like Figure 2 As shown, the training device 200 of the sales prediction model according to the embodiment of the present application includes: an acquisition unit 201, a commodity sub-problem determination unit 202 and a learning unit 203.
[0081] Among them, the acquisition unit 201 is used to obtain the historical feature data, historical sales volume and initial model of the target product, wherein the initial model is a model used for sales prediction and has not been trained; the product sub-problem determination unit 202 is used to determine the product sub-problem about the feature data and sales volume of the target product based on the initial model; the learning unit 203 is used to input the historical feature data, the historical sales volume, the initial model and the product sub-problem into the solver for feature learning to obtain a sales prediction model; wherein the solver includes N to-be-selected training algorithms, the training algorithm is used to train the initial model, N is an integer greater than or equal to 2, and the process of performing feature learning in the solver includes: according to the weight values of the N to-be-selected training algorithms, the first K to-be-selected training algorithms are extracted from large to small Method, wherein K is an integer greater than or equal to 1, K is less than N, and the weight value is used to characterize the computational efficiency of the candidate training algorithm; the K candidate training algorithms are used to solve the commodity sub-problems corresponding to the initial model respectively, and the solution errors of each candidate training algorithm are obtained; the training algorithm with the smallest solution error is determined from the K candidate training algorithms as the target training algorithm, and the training task of the initial model is performed based on the target training algorithm; after the training task is executed for a first preset time, the weight value of each candidate training algorithm is adjusted according to the solution error of each candidate training algorithm, and the step of extracting the first K candidate training algorithms from large to small according to the weight values of the N candidate training algorithms is returned to execute, until the preset conditions are met, and the sales forecasting model determined by the initial model after multiple rounds of training is obtained.
[0082] In some embodiments of the present application, based on the aforementioned scheme, the historical feature data includes any one or more of the following: product category; number of holidays; promotion method; mall address; and number of advertisements placed.
[0083] In some embodiments of the present application, based on the aforementioned scheme, the initial model is a regression model.
[0084] In some embodiments of the present application, based on the aforementioned scheme, the device also includes: an allocation unit, which is used to randomly assign a weight value to each of the N candidate training algorithms before extracting the first K candidate training algorithms from large to small according to the weight values of the N candidate training algorithms for the first time.
[0085] In some embodiments of the present application, based on the aforementioned scheme, the learning unit 203 is configured to: use the K candidate training algorithms to solve the product sub-problems corresponding to the initial model within the same second preset time length respectively; adjust the weight value of each candidate training algorithm according to the solution error of each candidate training algorithm, including: if the solution error is less than the preset error value, increase the weight value; if the solution error is greater than the preset error value, lower the weight value; if the solution error is equal to the preset error value, do not adjust the weight value.
[0086] In some embodiments of the present application, based on the aforementioned scheme, the solver includes a preset Nesterov acceleration algorithm, and the Nesterov acceleration algorithm is used to accelerate the training of the initial model by the target training algorithm.
[0087] Based on the same inventive concept, an embodiment of the present application provides a computer program product, which includes computer instructions, which are stored in a computer-readable storage medium and are suitable for being read and executed by a processor, so that a computer device with the processor executes to implement the operations performed by the training method of the sales prediction model as described above.
[0088] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium, in which at least one computer program instruction is stored. The at least one computer program instruction is loaded and executed by a processor to implement the operations performed by the training method of the sales prediction model as described above.
[0089] Based on the same inventive concept, the embodiment of the present application further provides an electronic device, referring to Figure 3 , shows a schematic diagram of the structure of an electronic device in an embodiment of the present application, wherein the electronic device includes one or more memories 304, one or more processors 302, and at least one computer program (computer program instruction) stored in the memory 304 and executable on the processor 302, and when the processor 302 executes the computer program, the training method of the sales prediction model as described above is implemented.
[0090] Among them, Figure 3In the embodiment of the present invention, a bus architecture (represented by bus 300) is shown, which may include any number of interconnected buses and bridges, and bus 300 links various circuits including one or more processors represented by processor 302 and memory represented by memory 304. Bus 300 may also link various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. Bus interface 305 provides an interface between bus 300 and receiver 301 and transmitter 303. Receiver 301 and transmitter 303 may be the same element, namely a transceiver, providing a unit for communicating with various other devices over a transmission medium. Processor 302 is responsible for managing bus 300 and general processing, while memory 304 may be used to store data used by processor 302 when performing operations.
[0091] The functions described herein may be implemented in hardware, software executed by a processor, firmware, or any combination thereof. If implemented in software executed by a processor, the functions may be stored as one or more instructions or codes on a computer-readable medium or transmitted via a computer-readable medium. Other examples and implementations are within the scope and spirit of the present application and the appended claims. For example, due to the nature of software, the functions described above may be implemented using software executed by a processor, hardware, firmware, hard wiring, or a combination of any of these. In addition, each functional unit may be integrated into a processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit.
[0092] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0093] The units described as separate components may or may not be physically separated, and the components of the control device may or may not be physical units, that is, they may be located in one place or distributed in multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0094] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly or all or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc., which can store computer program instructions.
[0095] The above description is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present application shall be included in the scope of the claims of the present application.
Claims
1. A training method for a sales forecasting model. It is characterized in that include: Acquire historical feature data, historical sales volume, and an initial model of the target product, wherein the initial model is a model that is used for sales volume forecasting and has not been trained; Based on the initial model, determining a commodity sub-problem regarding the characteristic data and sales volume of the target commodity; The historical feature data, the historical sales volume, the initial model and the commodity sub-problem are input into a solver for feature learning to obtain a sales forecasting model; wherein the solver includes N training algorithms to be selected, the training algorithm is used to train the initial model, N is an integer greater than or equal to 2, and the process of performing feature learning in the solver includes: According to the weight values of the N candidate training algorithms, the first K candidate training algorithms are extracted from large to small, where K is an integer greater than or equal to 1 and K is less than N, and the weight value is used to characterize the computational efficiency of the candidate training algorithm; Using the K candidate training algorithms to solve the commodity sub-problems corresponding to the initial model respectively, and obtaining the solution error of each candidate training algorithm; Determine a training algorithm with the smallest solution error from the K candidate training algorithms as a target training algorithm, and perform a training task on the initial model based on the target training algorithm; After the training task is executed for a first preset time, the weight values of each candidate training algorithm are adjusted accordingly according to the solution errors of each candidate training algorithm, and the step of extracting the first K candidate training algorithms from large to small according to the weight values of N candidate training algorithms is returned to execute until the preset conditions are met, and the sales forecasting model determined by the initial model after multiple rounds of training is obtained.
2. The method according to claim 1, It is characterized in that The historical feature data includes any one or more of the following: Types of goods; number of holidays; promotion methods; store address; number of advertisements placed.
3. The method according to claim 1, It is characterized in that The initial model is a regression model.
4. The method according to claim 1, It is characterized in that Before extracting the first K candidate training algorithms from large to small according to the weight values of the N candidate training algorithms for the first time, the method further includes: A weight value is randomly assigned to each of the N candidate training algorithms.
5. The method according to claim 1, It is characterized in that The using the K selected training algorithms to respectively solve the commodity sub-problems corresponding to the initial model includes: Using the K selected training algorithms to solve the commodity sub-problems corresponding to the initial model within the same second preset time period respectively; The step of adjusting the weight values of the training algorithms to be selected according to the solution errors of the training algorithms to be selected includes: If the solution error is less than a preset error value, increase the weight value; If the solution error is greater than a preset error value, lowering the weight value; If the solution error is equal to the preset error value, the weight value is not adjusted.
6. The method according to any one of claims 1 to 4, It is characterized in that The solver includes a preset Nesterov acceleration algorithm, and the Nesterov acceleration algorithm is used to accelerate the training of the initial model by the target training algorithm.
7. A training device for a sales forecasting model, It is characterized in that The device comprises: An acquisition unit, used to acquire historical feature data, historical sales volume and an initial model of a target commodity, wherein the initial model is a model used for sales volume prediction and has not been trained; A commodity sub-problem determination unit, configured to determine a commodity sub-problem regarding the characteristic data and sales volume of the target commodity based on the initial model; A learning unit is used to input the historical feature data, the historical sales volume, the initial model and the commodity sub-problem into a solver for feature learning to obtain a sales prediction model; wherein the solver includes N training algorithms to be selected, the training algorithm is used to train the initial model, N is an integer greater than or equal to 2, and the process of performing feature learning in the solver includes: According to the weight values of the N candidate training algorithms, the first K candidate training algorithms are extracted from large to small, where K is an integer greater than or equal to 1 and K is less than N, and the weight value is used to characterize the computational efficiency of the candidate training algorithm; Using the K candidate training algorithms to solve the commodity sub-problems corresponding to the initial model respectively, and obtaining the solution error of each candidate training algorithm; Determine a training algorithm with the smallest solution error from the K candidate training algorithms as a target training algorithm, and perform a training task on the initial model based on the target training algorithm; After the training task is executed for a first preset time, the weight values of each candidate training algorithm are adjusted accordingly according to the solution errors of each candidate training algorithm, and the step of extracting the first K candidate training algorithms from large to small according to the weight values of N candidate training algorithms is returned to execute until the preset conditions are met, and the sales forecasting model determined by the initial model after multiple rounds of training is obtained.
8. A computer program product, It is characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium and are suitable for being read and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores at least one program code, and the at least one program code is loaded and executed by a processor to implement the operations performed by the method according to any one of claims 1 to 6.
10. An electronic device, It is characterized in that The electronic device includes one or more processors and one or more memories, wherein the one or more memories store at least one program code, and the at least one program code is loaded and executed by the one or more processors to implement the method according to any one of claims 1 to 6.
