CN114048927A - Demand amount prediction method, demand amount prediction device, electronic device, and storage medium - Google Patents

Demand amount prediction method, demand amount prediction device, electronic device, and storage medium Download PDF

Info

Publication number
CN114048927A
CN114048927A CN202210024172.7A CN202210024172A CN114048927A CN 114048927 A CN114048927 A CN 114048927A CN 202210024172 A CN202210024172 A CN 202210024172A CN 114048927 A CN114048927 A CN 114048927A
Authority
CN
China
Prior art keywords
sample set
demand
target
domain sample
sample
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210024172.7A
Other languages
Chinese (zh)
Inventor
周鈵炎
吴盛楠
庄晓天
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Zhenshi Information Technology Co Ltd
Original Assignee
Beijing Jingdong Zhenshi Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Zhenshi Information Technology Co Ltd filed Critical Beijing Jingdong Zhenshi Information Technology Co Ltd
Priority to CN202210024172.7A priority Critical patent/CN114048927A/en
Publication of CN114048927A publication Critical patent/CN114048927A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/04Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • G06F30/27Design optimisation, verification or simulation using machine learning, e.g. artificial intelligence, neural networks, support vector machines [SVM] or training a model
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Economics (AREA)
  • Human Resources & Organizations (AREA)
  • Strategic Management (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Software Systems (AREA)
  • Development Economics (AREA)
  • Quality & Reliability (AREA)
  • Computer Hardware Design (AREA)
  • Medical Informatics (AREA)
  • Evolutionary Biology (AREA)
  • Game Theory and Decision Science (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Marketing (AREA)
  • Operations Research (AREA)
  • Geometry (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the invention discloses a demand forecasting method, a demand forecasting device, electronic equipment and a storage medium, wherein the demand forecasting method comprises the following steps: constructing a target domain sample set according to the historical demand characteristic data of the target article, and constructing an auxiliary domain sample set according to the historical demand characteristic data of a preset article, wherein the preset article is an article with the same attribute as the target article; performing model training based on the target domain sample set and the auxiliary domain sample set to obtain a plurality of prediction models; calculating a learning error for each of a plurality of predictive models; screening at least two prediction models from the plurality of prediction models according to the learning error of each prediction model; and acquiring current demand characteristic data of the target article, and processing the current demand characteristic data by using at least two prediction models to obtain the predicted demand of the target article. The embodiment of the invention can improve the accuracy of the prediction result.

Description

Demand amount prediction method, demand amount prediction device, electronic device, and storage medium
Technical Field
The present invention relates to computer technologies, and in particular, to a demand forecasting method and apparatus, an electronic device, and a storage medium.
Background
In the retail industry, demand (e.g., sales) of an article (e.g., a commodity) is often predicted, a common method is to collect samples, perform model training using the collected samples, perform demand prediction on the article through a trained model, and training out an accurate model usually depends on a large amount of accurate sample data.
In the course of implementing the present invention, it was found that for some articles, such as automobile parts, luxury goods, etc., only a very limited amount of sample data is available, and the sample data is very sparse, and the accuracy of prediction is often not satisfactory for models trained from such sample data.
Disclosure of Invention
The embodiment of the invention provides a demand forecasting method and device, electronic equipment and a storage medium, which can improve the accuracy of a forecasting result.
In a first aspect, an embodiment of the present invention provides a demand forecasting method, including:
constructing a target domain sample set according to historical demand characteristic data of a target article, and constructing an auxiliary domain sample set according to historical demand characteristic data of a preset article, wherein the preset article is an article with the same attribute as the target article;
performing model training based on the target domain sample set and the auxiliary domain sample set to obtain a plurality of prediction models;
calculating a learning error for each of the plurality of predictive models;
screening at least two prediction models from the plurality of prediction models according to the learning error of each prediction model;
and acquiring current demand characteristic data of the target article, and processing the current demand characteristic data by using the at least two prediction models to obtain the predicted demand of the target article.
In a second aspect, an embodiment of the present invention provides a demand prediction apparatus, including:
the construction module is used for constructing a target domain sample set according to historical demand characteristic data of a target article and constructing an auxiliary domain sample set according to historical demand characteristic data of a preset article, wherein the preset article is an article with the same attribute as the target article;
the training module is used for carrying out model training based on the target domain sample set and the auxiliary domain sample set to obtain a plurality of prediction models;
a calculation module for calculating a learning error for each of the plurality of predictive models;
the screening module is used for screening at least two prediction models from the plurality of prediction models according to the learning error of each prediction model;
and the processing module is used for acquiring the current demand characteristic data of the target article and processing the current demand characteristic data by utilizing the at least two prediction models to obtain the predicted demand of the target article.
In a third aspect, an embodiment of the present invention further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the computer program to implement the demand prediction method according to any one of the embodiments of the present invention.
In a fourth aspect, the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the demand prediction method according to any one of the embodiments of the present invention.
In the embodiment of the invention, a target domain sample set can be constructed according to the historical demand characteristic data of a target article, and an auxiliary domain sample set is constructed according to the historical demand characteristic data of a preset article, wherein the preset article is an article with the same attribute as the target article; performing model training based on the target domain sample set and the auxiliary domain sample set to obtain a plurality of prediction models; calculating a learning error for each of a plurality of predictive models; screening at least two prediction models from the plurality of prediction models according to the learning error of each prediction model; and acquiring current demand characteristic data of the target article, and processing the current demand characteristic data by using at least two prediction models to obtain the predicted demand of the target article. In the embodiment of the invention, the idea of transfer learning is applied to an article demand forecasting scene, and sample data (namely, an auxiliary domain sample set) of an article with the same attribute as that of a target article is transferred to be used for training a demand forecasting model of the target article, namely, the sample data of the article with the same attribute as that of the target article is combined with the sample data (namely, the target domain sample set) of the target article to carry out model training, so that the model (namely, a learner) for forecasting the demand of the target article is obtained, the problems of low model forecasting accuracy caused by small sample data amount and sparseness of the target article are solved, and the accuracy of a forecasting result is improved.
Furthermore, a plurality of prediction models are trained based on the transfer learning, at least two prediction models are screened out from the plurality of prediction models according to the learning error, the demand of the target object is comprehensively predicted by utilizing the at least two prediction models, the problem of large error caused by prediction by using only one prediction model can be avoided, and the accuracy of the prediction result is further improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a schematic flow chart of a demand forecasting method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a method for training a prediction model according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart of a method for screening a prediction model according to an embodiment of the present invention;
FIG. 4 is a schematic flow chart of a demand forecasting method according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a demand forecasting apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Because the model trained by using sample data with limited quantity and sparse representation at present cannot meet the requirement on prediction accuracy, in the process of implementing the invention, the inventor finds that Transfer Learning (Transfer Learning) is a machine Learning method, and the knowledge in one field (such as a source field) is transferred to another field (such as a target field), so that the target field can obtain better Learning effect. In general, when performing migration learning, the amount of data in the source domain is sufficient, and the amount of data in the target domain is small. However, transfer learning has not been used in the item demand prediction scenario at present; in addition, when the migration learning is performed in other scenes at present, one prediction model is usually selected from a series of prediction models trained by the migration learning for final data processing, so that the processing error is large due to data overfitting, and the accuracy of data processing is insufficient. In view of these problems, the embodiments of the present invention provide corresponding solutions.
Fig. 1 is a schematic flow chart of a demand forecasting method according to an embodiment of the present invention, which may be implemented by a demand forecasting apparatus according to an embodiment of the present invention, and the apparatus may be implemented in software and/or hardware. In a particular embodiment, the apparatus may be integrated in an electronic device, which may be, for example, a server. The following embodiments will be described by taking as an example that the apparatus is integrated in an electronic device, and referring to fig. 1, the method may specifically include the following steps:
step 101, constructing a target domain sample set according to the historical demand characteristic data of the target article, and constructing an auxiliary domain sample set according to the historical demand characteristic data of a preset article, wherein the preset article is an article with the same attribute as the target article.
For example, the target item may be an item that needs demand forecasting, but the target item has a small sample data volume and is sparsely distributed due to some characteristics of the target item. For example, the target item may be a luxury item, a relatively high-priced item, etc., and the sales frequency of the target item is low and irregular, resulting in a small magnitude of sales data for the target item, even if a single sales data is not generated for consecutive ten days. For example, a target item is a luxury, and the target item only has sales data at a plurality of non-fixed time points, and the sales data are few and sparsely distributed, possibly in a long period of time.
If the model training is performed by only using the data as sample data, the prediction accuracy of the trained model is not enough, and if the model with the insufficient prediction accuracy is put into practical application, because the bull whip Effect (Bullwhip Effect) exists in a supply chain, the error will be gradually amplified upstream and downstream, and great cost consumption is brought. In the actual training process, the sample data that we want is that there is sales data at each time point in a time period, i.e. the sales data is distributed continuously and in large quantity.
In order to solve the problem that the model prediction accuracy is insufficient due to the small amount and sparse distribution of sample data, in the embodiment of the invention, based on the idea of transfer learning, when the model for predicting the target object is trained, the sample data of the preset object with the same attribute as the target object is introduced, that is, the sample data of the preset object is transferred to be used for model training of the target object. Attributes of embodiments of the invention may be type, brand, application domain, etc. The preset article may be an article with a large amount of sample data and continuous sample data distribution. For example, the target item may be a lady bag of a luxury brand, and the default item may be a lady bag of a flat brand; for another example, the target object is a high-end automobile of a certain brand, and the preset object may be an economy automobile of the brand. Compared with the target object, the preset object has higher selling frequency and large and continuous selling data volume. The target item is identified in Stock Keeping Units (SKUs), and the pre-set items may include one or more items having a SKU different from the SKU of the target item.
For example, the historical demand characteristic data of the target item may include a historical demand of the target item and an actual demand corresponding to the historical demand of the target item, the historical demand of the target item may be an actual sales of the target item in a first past preset time period, and the actual demand corresponding to the historical demand of the target item may be an actual sales of the target item in a second past preset time period. The historical demand characteristic data of the preset article may include a historical demand of the preset article and an actual demand corresponding to the historical demand of the preset article, the historical demand of the preset article may be an actual sales volume of the preset article in a first past preset time period, and the actual demand corresponding to the historical demand of the preset article may be an actual sales volume of the preset article in a second past preset time period. And the second preset time period is later than the first preset time period. Illustratively, for example, the first preset time period is 2019-1-1 to 2019-4-1, and the second preset time period is 2019-4-1 to 2019-7-1.
Specifically, when constructing the target domain sample set, the historical demand of the target item may be used as a sample, the actual demand corresponding to the historical demand of the target item may be used as a sample label, and the constructed target domain sample set may include a plurality of samples. When the auxiliary domain sample set is constructed, the historical demand of the preset article can be used as a sample, the actual demand corresponding to the historical demand of the preset article can be used as a sample label, and the constructed auxiliary domain sample set can include a plurality of samples. In general, the number of samples in the auxiliary domain sample set will be much larger than the number of samples in the target domain sample set.
In addition, a test domain sample set can be constructed according to the historical demand characteristic data of the target object, so as to test the learning error of the subsequently generated prediction model. When a test domain sample set is constructed, the historical demand of a target article can be used as a sample, the actual demand corresponding to the historical demand of the target article can be used as a sample label, and the constructed test domain sample set can include a plurality of samples.
And 102, performing model training based on the target domain sample set and the auxiliary domain sample set to obtain a plurality of prediction models.
In an example, multiple rounds of sampling can be performed from the target domain sample set and the auxiliary domain sample set according to a certain sampling rule, each round of sampling constructs a training sample set, multiple rounds of sampling constructs multiple training sample sets, samples included in each training sample set are different, and model training is performed based on the constructed training sample sets to obtain multiple prediction models.
Step 103, calculating the learning error of each prediction model in the plurality of prediction models.
For example, the learning error of each predictive model may be tested based on the constructed test domain sample set. For example, each sample in the test domain sample set may be input into the current prediction model to be processed, so as to obtain the prediction demand amount corresponding to each sample in the test domain sample set, and the learning error of the current prediction model for each sample in the test domain sample set is calculated according to the prediction demand amount corresponding to each sample in the test domain sample set and the sample label.
The predicted demand amount corresponding to each sample in the test domain sample set may be a predicted demand amount corresponding to a historical demand amount of the target item, and the predicted demand amount may be understood as a predicted demand amount obtained by learning the historical demand amount of the target item by using a current prediction model, and the predicted demand amount may be an actual sales amount of the target item in a second past preset time period. For example, the actual sales volume (i.e., the historical demand volume) of the target item in the first preset time period in the past may be input into the current prediction model for prediction processing, so as to obtain the predicted sales volume (i.e., the predicted demand volume) of the target item in the second preset time period in the past. In addition, the target object also has an actual sales volume (i.e. an actual demand volume) in the second past preset time period, and a learning error of the current prediction model for the sales volume prediction of the target object, that is, a learning error of the current prediction model for each sample in the test domain sample set, can be determined according to the actual sales volume and the predicted sales volume of the target object in the second past preset time period.
For example, the learning Error may be a Mean Absolute Percentage Error (MAPE), a Mean-square Error (MSE), a Symmetric Mean Absolute Percentage Error (SMAPE), or the like. Practical research shows that SMAPE is a non-metric evaluation index, the problem that the calculation result is too large due to the small true value of MAPE can be well solved, and the learning error adopts SMAPE, so that the method is more suitable for the application scenario of the embodiment of the invention. The SMAPE may be calculated as follows:
Figure 880276DEST_PATH_IMAGE001
wherein SMAPE represents the learning error of the current prediction model,
Figure 328575DEST_PATH_IMAGE002
representing the second in the test field sample setiThe actual amount of demand for an individual sample,
Figure 170629DEST_PATH_IMAGE003
representing the second of the set of test domain samples predicted using the current prediction modeliThe predicted demand for an individual sample of the load,nrepresenting the number of samples in the sample set of the test domain. In a similar manner, the learning error of each predictive model can be calculated.
And 104, screening at least two prediction models from the plurality of prediction models according to the learning error of each prediction model.
For example, the plurality of prediction models may be sorted according to the magnitude of the learning error, and at least two prediction models with relatively small learning errors may be selected according to the sorting. For example, the plurality of prediction models may be ranked in order of learning error from small to large, and at least two prediction models ranked in the top may be selected.
And 105, acquiring current demand characteristic data of the target article, and processing the current demand characteristic data by using at least two prediction models to obtain the predicted demand of the target article.
For example, the current demand characteristic data of the target item may be a current statistical sales amount of the target item, and the current demand characteristic data may be, for example, a sales amount of the target item from a past time to a current time.
Exemplarily, the current demand characteristic data of the target article can be processed by using at least two prediction models to obtain at least two processing results; and calculating the average value of at least two processing results to obtain the predicted demand corresponding to the current demand characteristic data of the target article.
In the embodiment of the invention, the idea of transfer learning is applied to an article demand forecasting scene, and sample data (namely, an auxiliary domain sample set) of an article with the same attribute as that of a target article is transferred to be used for training a demand forecasting model of the target article, namely, the sample data of the article with the same attribute as that of the target article is combined with the sample data (namely, the target domain sample set) of the target article to carry out model training, so that the model (namely, a learner) for forecasting the demand of the target article is obtained, the problems of low model forecasting accuracy caused by small sample data amount and sparseness of the target article are solved, and the accuracy of a forecasting result is improved.
Furthermore, a plurality of prediction models are trained based on the transfer learning, at least two prediction models are screened out from the plurality of prediction models according to the learning error, the demand of the target object is comprehensively predicted by utilizing the at least two prediction models, the problem of large error caused by prediction by using only one prediction model can be avoided, and the accuracy of the prediction result is further improved.
In a specific embodiment, the plurality of prediction models provided by the embodiment of the present invention may be obtained by training according to the method shown in fig. 2, that is, step 102 in fig. 1 may specifically include the following steps:
step 10201, obtain a current sampling weight of each sample in the target domain sample set and a current sampling weight of each sample in the auxiliary domain sample set.
Specifically, the target domain sample set is established according to historical demand characteristic data of the target item, the historical demand characteristic data of the target item may include historical demand of the target item and actual demand corresponding to the historical demand of the target item, the historical demand of the target item may be actual sales of the target item in a first past preset time period, and the actual demand corresponding to the historical demand of the target item may be actual sales of the target item in a second past preset time period. And the second preset time period is later than the first preset time period. For example, the target domain sample set may be constructed by taking the historical demand of the target item as a sample and taking the actual demand corresponding to the historical demand of the target item as a sample label. The constructed target domain sample set may include a plurality of samples, and the distribution of the samples may be sparse, that is, there may be corresponding samples at some time points, and there may be no corresponding samples at some time points.
Specifically, the auxiliary domain sample set is established according to historical demand characteristic data of the preset article, the historical demand characteristic data of the preset article may include historical demand of the preset article and actual demand corresponding to the historical demand of the preset article, the historical demand of the preset article may be actual sales of the preset article in a first past preset time period, and the actual demand corresponding to the historical demand of the preset article may be actual sales of the preset article in a second past preset time period. And the second preset time period is later than the first preset time period. For example, the auxiliary domain sample set may be constructed by taking the historical demand of the preset item as a sample and taking the actual demand corresponding to the historical demand of the preset item as a sample label. The constructed auxiliary domain sample set may include a plurality of samples, the number of samples in the auxiliary domain sample set may be much larger than the number of samples in the target domain sample set, and the distribution of samples in the auxiliary domain sample set is generally continuous.
For example, in step 10201, the current sampling weight of each sample in the acquired target domain sample set and each sample in the auxiliary domain sample set may be the same, and the sampling weight may be understood as the probability that the sample is acquired, i.e., the probability that each sample in the target domain sample set and each sample in the auxiliary domain sample set are initially acquired is the same.
Step 10202, collecting samples from the target domain sample set and the auxiliary domain sample set according to the current sampling weight of each sample in the target domain sample set and the current sampling weight of each sample in the auxiliary domain sample set to obtain a training sample set, and performing model training according to the training sample set to obtain an intermediate model.
Illustratively, the training sample set also includes a plurality of samples, and the specific number of samples in the training sample set may be set according to actual requirements, for example, may be set according to the computing power of the apparatus, the accuracy requirement of the model, and the like.
Step 10203, determine learning error of the intermediate model.
Specifically, each sample in the target domain sample set may be input to the intermediate model and processed to obtain a predicted demand amount corresponding to each sample in the target domain sample set, and a learning error of the intermediate model for each sample in the target domain sample set is calculated according to the predicted demand amount corresponding to each sample in the target domain sample set and the sample label, where the learning error may be a SMAPE.
The predicted demand amount corresponding to each sample in the target domain sample set may be a predicted demand amount corresponding to a historical demand amount of the target item, and the predicted demand amount may be understood as a predicted demand amount obtained by learning the historical demand amount of the target item by using an intermediate model, and the predicted demand amount may be an actual sales amount of the target item in a second preset time period in the past. For example, the actual sales volume (i.e., the historical demand volume) of the target item in the first preset time period in the past may be input to the intermediate model for prediction processing, so as to obtain the predicted sales volume (i.e., the predicted demand volume) of the target item in the second preset time period in the past. In addition, the target object also has an actual sales volume (i.e. an actual demand volume) in the second past preset time period, and a learning error of the intermediate model for the sales volume prediction of the target object, that is, a learning error of each sample in the target domain sample set, can be determined according to the actual sales volume and the predicted sales volume of the target object in the second past preset time period.
The predicted demand amount corresponding to each sample in the auxiliary domain sample set may be a predicted demand amount corresponding to a historical demand amount of a preset article, and the predicted demand amount may be understood as a predicted demand amount obtained by learning the historical demand amount of the preset article by using an intermediate model, and the predicted demand amount may be an actual sales amount of the preset article in a second past preset time period. For example, the actual sales volume (i.e., the historical demand volume) of the preset item in the first preset time period in the past may be input to the intermediate model for prediction processing, so as to obtain the predicted sales volume (i.e., the predicted demand volume) of the preset item in the second preset time period in the past. In addition, the preset article also has an actual sales volume (i.e. an actual demand volume) in a second past preset time period, and a learning error of the intermediate model for the sales volume prediction of the preset article, that is, a learning error of each sample in the auxiliary domain sample set, can be determined according to the actual sales volume and the predicted sales volume of the preset article in the second past preset time period.
Step 10204, adjusting the current sampling weight of each sample in the target domain sample set and the current sampling weight of each sample in the auxiliary domain sample set according to the learning error of the intermediate model.
Step 10205, determining whether the training iteration number of the first stage reaches a preset iteration number, if so, executing step 10206, and if not, returning to execute step 10201.
Specifically, the preset iteration number may be set according to an actual requirement, for example, the preset iteration number may be set according to the computing capability of the device, the training speed of the model, the required model prediction accuracy, and the like.
For example, the current sampling weight of each sample in the target domain sample set may be increased according to the learning error of each sample in the target domain sample set, where the larger the learning error is, the more the current sampling weight of the corresponding sample is increased; and reducing the current sampling weight of the corresponding sample in the auxiliary domain sample set according to the learning error of the intermediate model for each sample in the auxiliary domain sample set, wherein the larger the learning error is, the more the current sampling weight of the corresponding sample is reduced.
In addition, when the current sampling weight of each sample in the auxiliary domain sample set is adjusted, the current sampling weight of each sample in the auxiliary domain sample set may be reduced according to an exponential function, and the exponential function may be an exponential function, and may be, for example, as follows:
Figure 300259DEST_PATH_IMAGE004
wherein the content of the first and second substances,nindicates the training ofnAn intermediate model, which is a model of the object,nis an integer larger than 2 (because the initially set sampling weight is used in training the first intermediate model, and the adjustment of the sampling weight is only needed in training the second intermediate model),ethe base number of the natural logarithm is represented,sprepresenting a predetermined number of iterations, Y (n) representing the number of training roundsnSampling weight attenuation coefficient of the intermediate model.
It can be understood that, for each sample in the target domain sample set, in the iterative training process, higher attention is given gradually, and the larger the learning error is, the higher the attention is given; and aiming at each sample in the auxiliary domain sample set, gradually reducing the given attention in the iterative training process, wherein the larger the learning error is, the larger the attention reduction amplitude is. The sampling weights of the samples in the two sets are continuously adjusted, and the effect of data screening is continuously achieved through continuous resampling, so that more useful data with better fitting effect can be selected, the problem that the training of the middle model is seriously influenced by the auxiliary domain sample set due to the overlarge difference of the number of the samples in the target domain sample set and the auxiliary domain sample set, the learning error of the middle model is extremely large, and the effect of reducing the learning error of the middle model is achieved.
Step 10206, combine a predetermined number of intermediate models to obtain a prediction model.
Wherein, steps 10201-10206 are the first stage of the whole training process, and steps 10207-10210 are the second stage of the whole training process.
Step 10207, reduce the current sampling weight of each sample in the auxiliary domain sample set.
In particular, an exponential function, a linear function, or the like may be employed to reduce the current sampling weight for each sample in the auxiliary domain sample set. When the current sampling weight of each sample in the auxiliary domain sample set is reduced, the learning error may be reduced according to the current intermediate model, or may not be reduced according to the learning error of the current intermediate model, which is not specifically limited herein.
Step 10208, collecting samples from the target domain sample set and the auxiliary domain sample set according to the current sampling weight of each sample in the target domain sample set and the current sampling weight of each sample in the auxiliary domain sample set to obtain a training sample set, and performing model training according to the training sample set to obtain an intermediate model.
Step 10209, determining whether the training iteration number of the second stage reaches a preset iteration number, if not, returning to step 10207, and continuing to train the next intermediate model after reducing the current sampling weight of each sample in the auxiliary domain sample set; if the predetermined number of iterations is reached, step 10210 is performed.
Step 10210, combine a predetermined number of intermediate models to obtain a prediction model.
Step 10211, determine whether the number of training iterations in the whole stage reaches a preset number of iterations.
The whole stage consists of a first stage and a second stage, wherein the first stage and the second stage both complete one training and calculate the whole stage to train once.
Step 10212, output the plurality of prediction models obtained in the first stage.
Namely, the output of the whole training phase is used as each prediction model output in the first phase.
According to the training method provided by the embodiment of the invention, the sampling weight of each sample in a target domain sample set is gradually increased in a first stage, and the sampling weight of each sample in an auxiliary domain sample set is gradually reduced; in the second stage, the sampling weight of each sample in the target domain sample set adjusted in the first stage is kept unchanged, and the sampling weight of each sample in the auxiliary domain sample set is continuously reduced. In the whole training phase, the effect of data screening is achieved by continuously resampling through adjustment of sampling weights of the two sample sets, so that more useful data with better fitting effect can be selected, the problem that the training of the middle model is seriously affected by the auxiliary domain sample set due to the fact that the difference of the number of samples in the target domain sample set and the auxiliary domain sample set is too large, the learning error of the middle model is extremely large, and the effect of reducing the learning error of the middle model is achieved.
For example, the intermediate model in the embodiment of the present invention may be a weak learner, the prediction model may be a strong learner, and the prediction model in the embodiment of the present invention may be understood as an improved tradaboost r2 model (i.e., a twosegage traadaboost r2 model).
The traditional TrAdaBoostR2 model has only one section, and in the model training iteration stage, the sampling weight of each sample in the auxiliary domain sample set is only adjusted, the sampling weight of each sample in the target domain sample set is not adjusted, and when the difference between the number of samples in the target domain sample set and the number of samples in the auxiliary domain sample set is too large, the sub-model is greatly influenced by the auxiliary domain sample set, so that the model prediction error is easily large. The improved TrAdaBoostR2 model is divided into two sections, in the model training iteration process of the first stage, the sampling weight of each sample in the target domain sample set and the sampling weight of each sample in the auxiliary domain sample set are adjusted, in the second stage, the sampling weight of each sample in the auxiliary domain sample set is continuously adjusted, and the model prediction error caused by the large difference of the number of the samples in the two sample sets is reduced by continuously reducing the sampling weight of each sample in the auxiliary domain sample set, continuously increasing the sampling weight of each sample in the target domain sample set and continuously reducing the sampling weight of each sample in the auxiliary domain sample set in the second stage.
Illustratively, the model prediction Error is measured as Mean Square Error (MSE) and Symmetric Mean Absolute Percentage Error (SMAPE), and in iterative training of the modified tragaboostr 2 model, the following two sets of data are generated in sequence:
a first group:
MSE 0.0752864514891776 for the TwostageTrAdaboost R2 model;
SMAPE 0.5603828384668852 of TwostageTrAdaboost R2 model;
second group:
MSE 0.07031977258409283 for the TwostageTrAdaboost R2 model;
SMAPE: 0.5328852395735963 of TwostageTrAdaboost R2 model.
By comparing the two sets of data, it can be seen that with the model training method provided above, the MSE and SMAPE errors of the model are both reduced with iterative training.
In a specific embodiment, at least two prediction models can be screened according to the method shown in fig. 3, that is, step 104 in fig. 1 may specifically include the following steps:
and step 1041, calculating an error average value and an error standard deviation according to the learning errors of the plurality of prediction models.
Illustratively, the learning error of each prediction model is a SMAPE calculated by cross-validation, i.e., the average and standard deviation of a plurality of learning errors can be calculated, thereby obtaining an error average and an error standard deviation.
And 1042, determining an error interval according to the error average value and the error standard deviation.
For example, the error average value may be added to the error standard deviation of a preset multiple to obtain an upper interval limit, the error average value may be subtracted from the error standard deviation of the preset multiple to obtain a lower interval limit, and the error interval may be determined according to the upper interval limit and the lower interval limit. The value of the preset multiple may be determined according to actual requirements, and may be, for example, 1, 2, 3, and the like.
And 1043, screening the prediction models with the learning errors within the error interval from the plurality of prediction models to obtain at least two prediction models.
By eliminating the prediction model with the learning error not in the error interval, the abnormal prediction model is eliminated, and the accuracy of the subsequent prediction result is improved.
The demand forecasting method provided by the embodiment of the present invention is further described below, with reference to fig. 4, specifically as follows:
step 301, a target domain sample set and an auxiliary domain sample set are constructed.
Constructing a target domain sample set according to historical demand characteristic data of a target article, and constructing an auxiliary domain sample set according to historical demand characteristic data of a preset article, wherein the preset article is an article with the same attribute as the target article; the sample in the target domain sample set is the historical demand of the target article, and the sample label in the target domain sample set is the actual demand corresponding to the historical demand of the target article; the samples in the auxiliary domain sample set are historical demand quantities of preset articles, and the sample labels in the auxiliary domain sample set are actual demand quantities corresponding to the historical demand quantities of the preset articles.
Step 302, preprocessing.
In the preprocessing stage, a sampling weight may be set for each sample in the target domain sample set and each sample in the auxiliary domain sample set, and at this time, the sampling weight set for each sample in the target domain sample set and each sample in the auxiliary domain sample set may be the same, such as 1. The sampling weight may be understood as a sampling probability. After the preprocessing, the first stage of the training process is entered.
Step 303, training the intermediate model.
The method comprises the steps of collecting samples from a target domain sample set and an auxiliary domain sample set according to the current sampling weight of each sample in the target domain sample set and the current sampling weight of each sample in the auxiliary domain sample set to obtain a training sample set, and performing model training according to the training sample set to obtain an intermediate model.
Step 304, sample weights of samples of the two sample sets are adjusted.
Specifically, each sample in the target domain sample set and each sample in the auxiliary domain sample set may be input into the currently trained intermediate model for processing, so as to obtain a predicted demand amount corresponding to each sample in the target domain sample set and a predicted demand amount corresponding to each sample in the auxiliary domain sample set; and calculating the learning error of the current learner on each sample in the target domain sample set according to the prediction demand amount and the sample label corresponding to each sample in the target domain sample set, and calculating the learning error of the current intermediate model on each sample in the auxiliary domain sample set according to the prediction demand amount and the sample label corresponding to each sample in the auxiliary domain sample set.
Increasing the current sampling weight of each sample in the target domain sample set according to the learning error of each sample in the target domain sample set by the current intermediate model, wherein the larger the learning error is, the more the current sampling weight of the corresponding sample is increased; the learning error for each sample in the auxiliary domain sample set according to the current intermediate model reduces the current sampling weight of the corresponding sample in the auxiliary domain sample set, wherein the larger the learning error, the more the current sampling weight of the corresponding sample is reduced. And using the target domain sample set and the auxiliary domain sample set after the sampling weight adjustment for iterative training of a next intermediate model.
In addition, for the adjustment of the sampling weight of the samples in the auxiliary domain sample set, the adjustment may also be performed directly by using an exponential function without depending on the learning error of the current intermediate model, and the exponential function may refer to the description of the foregoing embodiment, and is not described herein again.
Step 305, determining whether the first stage reaches a preset iteration number, and if so, executing step 306; if not, go back to step 303.
And step 306, combining the intermediate models to obtain a prediction model.
The second phase of the training process is entered next.
Step 307, sample sampling weights of the auxiliary domain sample set are adjusted.
In particular, an exponential function, a linear function, or the like may be employed to reduce the current sampling weight for each sample in the auxiliary domain sample set.
Step 308, training the intermediate model.
The method comprises the steps of collecting samples from a target domain sample set and an auxiliary domain sample set according to the current sampling weight of each sample in the target domain sample set and the current sampling weight of each sample in the auxiliary domain sample set to obtain a training sample set, and performing model training according to the training sample set to obtain an intermediate model.
309, determining whether the second stage reaches a preset iteration number, and if so, executing step 310; if not, go back to step 307.
And step 310, combining the intermediate models to obtain a prediction model.
Step 311, determining whether the whole stage reaches a preset iteration number, if so, executing step 312; if not, the process returns to the first stage to execute step 303.
Step 312, a plurality of prediction models are output.
Specifically, a plurality of prediction models obtained by the first-stage training may be output, that is, each prediction model output by the first stage is used as an output of the entire training stage, and the second stage is used for assisting in training.
At step 313, at least two predictive models are selected.
Specifically, a cross-validation SMAPE for each prediction model of the plurality of prediction models may be calculated, and an error mean and an error standard deviation may be calculated based on the plurality of SMAPEs; determining an error interval according to the error average value and the error standard deviation; and screening the prediction models with the learning errors within the error interval from the plurality of prediction models to obtain at least two prediction models.
And step 314, processing the current demand characteristic data by using at least two prediction models to obtain the predicted demand of the target article.
In the embodiment of the invention, the idea of transfer learning is applied to an article demand forecasting scene, and sample data (namely, an auxiliary domain sample set) of an article with the same attribute as that of a target article is transferred to be used for training a demand forecasting model of the target article, namely, the sample data of the article with the same attribute as that of the target article is combined with the sample data (namely, the target domain sample set) of the target article to carry out model training, so that the model (namely, a learner) for forecasting the demand of the target article is obtained, the problems of low model forecasting accuracy caused by small sample data amount and sparseness of the target article are solved, and the accuracy of a forecasting result is improved.
Furthermore, a plurality of prediction models are trained based on the transfer learning, at least two prediction models are screened out from the plurality of prediction models according to the learning error, the demand of the target object is comprehensively predicted by utilizing the at least two prediction models, the problem of large error caused by prediction by using only one prediction model can be avoided, and the accuracy of the prediction result is further improved.
In addition, in the training process, sampling weights of samples in the two sets are continuously adjusted, and continuous resampling achieves the effect of data screening, so that more useful data with better fitting effect can be selected, the problem that the training of the middle model is seriously influenced by the auxiliary domain sample set due to the fact that the quantity difference of the samples in the target domain sample set and the auxiliary domain sample set is too large, the learning error of the middle model is extremely large, the effect of reducing the learning error of the middle model is achieved, and the prediction accuracy of the target prediction model is finally improved.
Fig. 5 is a block diagram of a demand prediction apparatus according to an embodiment of the present invention, which is adapted to execute the demand prediction method according to an embodiment of the present invention. As shown in fig. 5, the apparatus may specifically include:
the construction module 401 is configured to construct a target domain sample set according to historical demand characteristic data of a target article, and construct an auxiliary domain sample set according to historical demand characteristic data of a preset article, where the preset article is an article with the same attribute as the target article;
a training module 402, configured to perform model training based on the target domain sample set and the auxiliary domain sample set to obtain multiple prediction models;
a calculation module 403 for calculating a learning error of each of the plurality of prediction models;
a screening module 404, configured to screen at least two prediction models from the multiple prediction models according to the learning error of each prediction model;
the processing module 405 is configured to obtain current demand characteristic data of the target item, and process the current demand characteristic data by using at least two prediction models to obtain a predicted demand of the target item.
In one embodiment, the calculation module 403 calculates a learning error of each of the plurality of prediction models, including:
a symmetric mean absolute percentage error SMAPE is calculated for each of the plurality of prediction models.
In one embodiment, the filtering module 404 filters at least two prediction models from the plurality of prediction models according to the learning error of each prediction model, including:
calculating an error average value and an error standard deviation according to the learning error of each prediction model;
determining an error interval according to the error average value and the error standard deviation;
and screening the prediction models with the learning errors within the error interval from the plurality of prediction models to obtain at least two prediction models.
In an embodiment, the processing module 405 processes the current demand characteristic data by using at least two prediction models to obtain the predicted demand corresponding to the target item, including:
processing the current demand characteristic data by using at least two prediction models to obtain at least two processing results;
and calculating the average value of at least two processing results to obtain the predicted demand quantity of the target article.
In one embodiment, the historical demand characteristic data of the target article comprises historical demand of the target article and actual demand corresponding to the historical demand of the target article, and the historical demand characteristic data of the preset article comprises historical demand of the preset article and actual demand corresponding to the historical demand of the preset article;
the construction module 401 constructs a target domain sample set according to the historical demand characteristic data of the target item, including: constructing a target domain sample set by taking the historical demand of the target article as a sample and taking the actual demand corresponding to the historical demand of the target article as a sample label;
the constructing module 401 constructs an auxiliary domain sample set according to the historical demand characteristic data of the preset item, including: and taking the historical demand of the preset article as a sample, and taking the actual demand corresponding to the historical demand of the preset article as a sample label to construct an auxiliary domain sample set.
In an embodiment, the training module 402 performs model training based on the target domain sample set and the auxiliary domain sample set to obtain a plurality of prediction models, including:
and performing multiple rounds of sampling from the target domain sample set and the auxiliary domain sample set, constructing a plurality of training sample sets, and performing model training based on the plurality of training sample sets to obtain a plurality of prediction models.
In an embodiment, the training module 402 performs multiple sampling rounds from the target domain sample set and the auxiliary domain sample set, constructs multiple training sample sets, and performs model training based on the multiple training sample sets to obtain multiple prediction models, including:
the first stage is as follows:
acquiring the current sampling weight of each sample in the target domain sample set and the current sampling weight of each sample in the auxiliary domain sample set;
collecting samples from the target domain sample set and the auxiliary domain sample set according to the current sampling weight of each sample in the target domain sample set and the current sampling weight of each sample in the auxiliary domain sample set to obtain a training sample set, and performing model training according to the training sample set to obtain an intermediate model;
determining a learning error of the intermediate model;
adjusting the current sampling weight of each sample in the target domain sample set and the current sampling weight of each sample in the auxiliary domain sample set according to the learning error of the intermediate model;
returning to execute the current sampling weight of each sample in the target domain sample set and the current sampling weight of each sample in the auxiliary domain sample set, obtaining a preset number of intermediate models when the training iteration number of the first stage reaches a preset iteration number, and combining the preset number of intermediate models to obtain a prediction model;
and a second stage:
reducing a current sampling weight of each sample in the auxiliary domain sample set;
collecting samples from the target domain sample set and the auxiliary domain sample set according to the current sampling weight of each sample in the target domain sample set and the current sampling weight of each sample in the auxiliary domain sample set to obtain a training sample set, and performing model training according to the training sample set to obtain an intermediate model;
returning to execute the current sampling weight of each sample in the auxiliary domain sample set, and obtaining a preset number of intermediate models until the training iteration number of the second stage reaches a preset iteration number;
and repeatedly executing each step of the first stage and each step of the second stage until the training iteration number of the whole stage reaches the preset iteration number, and taking the prediction model obtained in the first stage as a plurality of prediction models, wherein the whole stage comprises the first stage and the second stage.
In one embodiment, the training module 402 determines the learning error of the intermediate model, including:
inputting each sample in the target domain sample set and each sample in the auxiliary domain sample set into an intermediate model for processing to obtain a prediction demand amount corresponding to each sample in the target domain sample set and a prediction demand amount corresponding to each sample in the auxiliary domain sample set;
and calculating the learning error of the intermediate model for each sample in the target domain sample set according to the prediction demand amount and the sample label corresponding to each sample in the target domain sample set, and calculating the learning error of the intermediate model for each sample in the auxiliary domain sample set according to the prediction demand amount and the sample label corresponding to each sample in the auxiliary domain sample set.
In one embodiment, the training module 402 adjusts the current sampling weight of each sample in the target domain sample set and the current sampling weight of each sample in the auxiliary domain sample set according to the learning error of the intermediate model, including:
increasing the current sampling weight of each sample in the target domain sample set according to the learning error of each sample in the target domain sample set by the intermediate model, wherein the larger the learning error is, the more the current sampling weight of each sample is increased;
and reducing the current sampling weight of the corresponding sample in the auxiliary domain sample set according to the learning error of the intermediate model for each sample in the auxiliary domain sample set, wherein the larger the learning error is, the more the current sampling weight of the corresponding sample is reduced.
In one embodiment, the training module 402 adjusts the current sampling weight of each sample in the auxiliary domain sample set, including:
reducing the current sampling weight of each sample in the auxiliary domain sample set according to an exponential function, wherein the exponential function is as follows:
Figure 645790DEST_PATH_IMAGE005
wherein the content of the first and second substances,nindicates the training ofnAn intermediate model, which is a model of the object,nis an integer greater than 2 and is,ethe base number of the natural logarithm is represented,sprepresenting a predetermined number of iterations, Y (n) representing the number of training roundsnSampling weight attenuation coefficient of the intermediate model.
It is obvious to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to perform all or part of the above described functions. For the specific working process of the functional module, reference may be made to the corresponding process in the foregoing method embodiment, which is not described herein again.
The device provided by the embodiment of the invention applies the idea of transfer learning to an article demand forecasting scene, and transfers the sample data (namely, an auxiliary domain sample set) of the article with the same attribute as that of the target article to be used for training the demand forecasting model of the target article, namely, combines the sample data of the article with the same attribute as that of the target article with the sample data (namely, the target domain sample set) of the target article to perform model training, so that the model (namely, a learner) for forecasting the demand of the target article is obtained, the problems of low model forecasting accuracy caused by small sample data amount and sparseness of the target article are solved, and the accuracy of a forecasting result is improved.
Furthermore, a plurality of prediction models are trained based on the transfer learning, at least two prediction models are screened out from the plurality of prediction models according to the learning error, the demand of the target object is comprehensively predicted by utilizing the at least two prediction models, the problem of large error caused by prediction by using only one prediction model can be avoided, and the accuracy of the prediction result is further improved.
In addition, in the training process, sampling weights of samples in the two sets are continuously adjusted, and continuous resampling achieves the effect of data screening, so that more useful data with better fitting effect can be selected, the problem that the training of the middle model is seriously influenced by the auxiliary domain sample set due to the fact that the quantity difference of the samples in the target domain sample set and the auxiliary domain sample set is too large, the learning error of the middle model is extremely large, the effect of reducing the learning error of the middle model is achieved, and the prediction accuracy of the target prediction model is finally improved.
The embodiment of the present invention further provides an electronic device, which includes a memory, a processor, and a computer program that is stored in the memory and can be run on the processor, and when the processor executes the computer program, the demand prediction method provided in any of the above embodiments is implemented.
The embodiment of the invention also provides a computer readable medium, on which a computer program is stored, and the program is executed by a processor to implement the demand forecasting method provided by any one of the above embodiments.
Referring now to FIG. 6, shown is a block diagram of a computer system 500 suitable for use in implementing an electronic device of an embodiment of the present invention. The electronic device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 6, the computer system 500 includes a Central Processing Unit (CPU)501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 501.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules and/or units described in the embodiments of the present invention may be implemented by software, and may also be implemented by hardware. The described modules and/or units may also be provided in a processor, and may be described as: a processor includes a construction module, a training module, a calculation module, a screening module, and a processing module. Wherein the names of the modules do not in some cases constitute a limitation of the module itself.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: constructing a target domain sample set according to historical demand characteristic data of a target article, and constructing an auxiliary domain sample set according to historical demand characteristic data of a preset article, wherein the preset article is an article with the same attribute as the target article; performing model training based on the target domain sample set and the auxiliary domain sample set to obtain a plurality of prediction models; calculating a learning error for each of a plurality of predictive models; screening at least two prediction models from the plurality of prediction models according to the learning error of each prediction model; and acquiring current demand characteristic data of the target article, and processing the current demand characteristic data by using at least two prediction models to obtain the predicted demand of the target article.
According to the technical scheme of the embodiment of the invention, the idea of transfer learning can be applied to an article demand forecasting scene, and the sample data (namely, the auxiliary domain sample set) of the article with the same attribute as that of the target article is transferred to be used for the training of the demand forecasting model of the target article, namely, the sample data of the article with the same attribute as that of the target article is combined with the sample data (namely, the target domain sample set) of the target article to carry out model training, so that the model (namely, the learner) for forecasting the demand of the target article is obtained, the problems of low model forecasting accuracy caused by small sample data amount and sparseness of the target article are solved, and the accuracy of a forecasting result is improved.
Furthermore, a plurality of prediction models are trained based on the transfer learning, at least two prediction models are screened out from the plurality of prediction models according to the learning error, the demand of the target object is comprehensively predicted by utilizing the at least two prediction models, the problem of large error caused by prediction by using only one prediction model can be avoided, and the accuracy of the prediction result is further improved.
In addition, in the training process, sampling weights of samples in the two sets are continuously adjusted, and continuous resampling achieves the effect of data screening, so that more useful data with better fitting effect can be selected, the problem that the training of the middle model is seriously influenced by the auxiliary domain sample set due to the fact that the quantity difference of the samples in the target domain sample set and the auxiliary domain sample set is too large, the learning error of the middle model is extremely large, the effect of reducing the learning error of the middle model is achieved, and the prediction accuracy of the target prediction model is finally improved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. A demand prediction method, comprising:
constructing a target domain sample set according to historical demand characteristic data of a target article, and constructing an auxiliary domain sample set according to historical demand characteristic data of a preset article, wherein the preset article is an article with the same attribute as the target article;
performing model training based on the target domain sample set and the auxiliary domain sample set to obtain a plurality of prediction models;
calculating a learning error for each of the plurality of predictive models;
screening at least two prediction models from the plurality of prediction models according to the learning error of each prediction model;
and acquiring current demand characteristic data of the target article, and processing the current demand characteristic data by using the at least two prediction models to obtain the predicted demand of the target article.
2. The demand forecasting method according to claim 1, wherein the screening out at least two predictive models from the plurality of predictive models according to the learning error of each predictive model includes:
calculating an error average value and an error standard deviation according to the learning error of each prediction model;
determining an error interval according to the error average value and the error standard deviation;
and screening out the prediction models with the learning errors within the error interval from the plurality of prediction models to obtain the at least two prediction models.
3. The demand forecasting method according to claim 1, wherein the processing the current demand characteristic data by using the at least two forecasting models to obtain the forecasted demand of the target item comprises:
processing the current demand characteristic data by using the at least two prediction models to obtain at least two processing results;
and calculating the average value of the at least two processing results to obtain the predicted demand quantity of the target article.
4. The demand forecasting method according to any one of claims 1 to 3, wherein the historical demand characteristic data of the target item includes a historical demand of the target item and an actual demand corresponding to the historical demand of the target item, and the historical demand characteristic data of the preset item includes a historical demand of the preset item and an actual demand corresponding to the historical demand of the preset item;
the constructing of the target domain sample set according to the historical demand characteristic data of the target item comprises: taking the historical demand of the target object as a sample, and taking the actual demand corresponding to the historical demand of the target object as a sample label to construct the target domain sample set;
the constructing of the auxiliary domain sample set according to the historical demand characteristic data of the preset article comprises: and constructing the auxiliary domain sample set by taking the historical demand of the preset article as a sample and taking the actual demand corresponding to the historical demand of the preset article as a sample label.
5. The demand forecasting method according to claim 4, wherein the performing model training based on the target domain sample set and the auxiliary domain sample set to obtain a plurality of forecasting models comprises:
and performing multiple rounds of sampling from the target domain sample set and the auxiliary domain sample set to construct multiple training sample sets, and performing model training based on the multiple training sample sets to obtain multiple prediction models.
6. The demand forecasting method according to claim 5, wherein the performing multiple rounds of sampling from the target domain sample set and the auxiliary domain sample set to construct a plurality of training sample sets, and performing model training based on the plurality of training sample sets to obtain the plurality of forecasting models comprises:
the first stage is as follows:
obtaining a current sampling weight of each sample in the target domain sample set and a current sampling weight of each sample in the auxiliary domain sample set;
collecting samples from the target domain sample set and the auxiliary domain sample set according to the current sampling weight of each sample in the target domain sample set and the current sampling weight of each sample in the auxiliary domain sample set to obtain a training sample set, and performing model training according to the training sample set to obtain an intermediate model;
determining a learning error of the intermediate model;
adjusting a current sampling weight of each sample in the target domain sample set and a current sampling weight of each sample in the auxiliary domain sample set according to a learning error of the intermediate model;
returning to execute the current sampling weight of each sample in the target domain sample set and the current sampling weight of each sample in the auxiliary domain sample set, obtaining a preset number of intermediate models when the training iteration number of the first stage reaches a preset iteration number, and combining the preset number of intermediate models to obtain a prediction model;
and a second stage:
reducing a current sampling weight of each sample in the auxiliary domain sample set;
collecting samples from the target domain sample set and the auxiliary domain sample set according to the current sampling weight of each sample in the target domain sample set and the current sampling weight of each sample in the auxiliary domain sample set to obtain a training sample set, and performing model training according to the training sample set to obtain an intermediate model;
returning to execute the current sampling weight reduction of each sample in the auxiliary domain sample set until the training iteration number of the second stage reaches the preset iteration number to obtain a preset number of intermediate models;
and repeatedly executing each step of the first stage and each step of the second stage until the training iteration number of the whole stage reaches the preset iteration number, and taking the prediction model obtained in the first stage as the plurality of prediction models, wherein the whole stage comprises the first stage and the second stage.
7. The demand prediction method according to claim 6, wherein the determining a learning error of the intermediate model includes:
inputting each sample in the target domain sample set and each sample in the auxiliary domain sample set into the intermediate model for processing to obtain a prediction demand amount corresponding to each sample in the target domain sample set and a prediction demand amount corresponding to each sample in the auxiliary domain sample set;
and calculating the learning error of the intermediate model for each sample in the target domain sample set according to the prediction demand amount and the sample label corresponding to each sample in the target domain sample set, and calculating the learning error of the intermediate model for each sample in the auxiliary domain sample set according to the prediction demand amount and the sample label corresponding to each sample in the auxiliary domain sample set.
8. The demand prediction method of claim 7, wherein the adjusting the current sampling weight of each sample in the target domain sample set and the current sampling weight of each sample in the auxiliary domain sample set according to the learning error of the intermediate model comprises:
increasing the current sampling weight of each sample in the target domain sample set according to the learning error of the intermediate model for each sample in the target domain sample set, wherein the larger the learning error is, the more the current sampling weight of the corresponding sample is increased;
reducing a current sampling weight of a corresponding sample in the auxiliary domain sample set according to a learning error of the intermediate model for each sample in the auxiliary domain sample set, wherein the larger the learning error, the more the current sampling weight of the corresponding sample is reduced.
9. The method of claim 6, wherein the adjusting the current sampling weight of each sample in the set of auxiliary domain samples comprises:
reducing a current sampling weight of each sample in the auxiliary domain sample set according to an exponential function, the exponential function being as follows:
Figure 791173DEST_PATH_IMAGE001
wherein the content of the first and second substances,nindicates the training ofnAn intermediate model, which is a model of the object,nis an integer greater than 2 and is,ethe base number of the natural logarithm is represented,sprepresenting said predetermined number of iterations, Y (n) representing the number of training roundsnSampling weight attenuation coefficient of the intermediate model.
10. A demand amount prediction device, comprising:
the construction module is used for constructing a target domain sample set according to historical demand characteristic data of a target article and constructing an auxiliary domain sample set according to historical demand characteristic data of a preset article, wherein the preset article is an article with the same attribute as the target article;
the training module is used for carrying out model training based on the target domain sample set and the auxiliary domain sample set to obtain a plurality of prediction models;
a calculation module for calculating a learning error for each of the plurality of predictive models;
the screening module is used for screening at least two prediction models from the plurality of prediction models according to the learning error of each prediction model;
and the processing module is used for acquiring the current demand characteristic data of the target article and processing the current demand characteristic data by utilizing the at least two prediction models to obtain the predicted demand of the target article.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the demand prediction method according to any one of claims 1 to 9 when executing the program.
12. A computer-readable storage medium on which a computer program is stored, the program, when executed by a processor, implementing the demand prediction method according to any one of claims 1 to 9.
CN202210024172.7A 2022-01-11 2022-01-11 Demand amount prediction method, demand amount prediction device, electronic device, and storage medium Pending CN114048927A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210024172.7A CN114048927A (en) 2022-01-11 2022-01-11 Demand amount prediction method, demand amount prediction device, electronic device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210024172.7A CN114048927A (en) 2022-01-11 2022-01-11 Demand amount prediction method, demand amount prediction device, electronic device, and storage medium

Publications (1)

Publication Number Publication Date
CN114048927A true CN114048927A (en) 2022-02-15

Family

ID=80213662

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210024172.7A Pending CN114048927A (en) 2022-01-11 2022-01-11 Demand amount prediction method, demand amount prediction device, electronic device, and storage medium

Country Status (1)

Country Link
CN (1) CN114048927A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115736162A (en) * 2022-11-21 2023-03-07 河南农业大学 Method and system for preparing prefabricated dishes based on intelligent data analysis

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109214436A (en) * 2018-08-22 2019-01-15 阿里巴巴集团控股有限公司 A kind of prediction model training method and device for target scene
CN110852446A (en) * 2019-11-13 2020-02-28 腾讯科技(深圳)有限公司 Machine learning model training method, device and computer readable storage medium
US20200134469A1 (en) * 2018-10-30 2020-04-30 Samsung Sds Co., Ltd. Method and apparatus for determining a base model for transfer learning
CN111652655A (en) * 2020-06-10 2020-09-11 创新奇智(上海)科技有限公司 Commodity sales prediction method and device, electronic equipment and readable storage medium
CN112150201A (en) * 2020-09-23 2020-12-29 创络(上海)数据科技有限公司 Application of KNN-based time sequence migration learning in sales prediction
CN113435632A (en) * 2021-06-09 2021-09-24 北京京东振世信息技术有限公司 Information generation method and device, electronic equipment and computer readable medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109214436A (en) * 2018-08-22 2019-01-15 阿里巴巴集团控股有限公司 A kind of prediction model training method and device for target scene
US20200134469A1 (en) * 2018-10-30 2020-04-30 Samsung Sds Co., Ltd. Method and apparatus for determining a base model for transfer learning
CN110852446A (en) * 2019-11-13 2020-02-28 腾讯科技(深圳)有限公司 Machine learning model training method, device and computer readable storage medium
CN111652655A (en) * 2020-06-10 2020-09-11 创新奇智(上海)科技有限公司 Commodity sales prediction method and device, electronic equipment and readable storage medium
CN112150201A (en) * 2020-09-23 2020-12-29 创络(上海)数据科技有限公司 Application of KNN-based time sequence migration learning in sales prediction
CN113435632A (en) * 2021-06-09 2021-09-24 北京京东振世信息技术有限公司 Information generation method and device, electronic equipment and computer readable medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
XIAOCHUAN2463: "迁移学习用于供应链中的新品销量预测", 《一起拆书》 *
胡建华 等: "基于改进迁移学习算法的岩体质量评价模型", 《黄金科学技术》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115736162A (en) * 2022-11-21 2023-03-07 河南农业大学 Method and system for preparing prefabricated dishes based on intelligent data analysis

Similar Documents

Publication Publication Date Title
CN110969285B (en) Prediction model training method, prediction device, prediction equipment and medium
EP3893169A2 (en) Method, apparatus and device for generating model and storage medium
CN110689070B (en) Training method and device of business prediction model
CN110400184B (en) Method and apparatus for generating information
CN113743971A (en) Data processing method and device
CN113763019A (en) User information management method and device
CN110866625A (en) Promotion index information generation method and device
CN114219545B (en) Data processing method and device
CN114048927A (en) Demand amount prediction method, demand amount prediction device, electronic device, and storage medium
CN111798261A (en) Information updating method and device
CN114663015A (en) Replenishment method and device
CN114049162B (en) Model training method, demand prediction method, apparatus, device, and storage medium
CN112231299A (en) Method and device for dynamically adjusting feature library
CN111738632A (en) Device control method, device, electronic device and computer readable medium
CN113469598A (en) Intelligent supply chain system and server platform
CN110766431A (en) Method and device for judging whether user is sensitive to coupon
CN115062687A (en) Enterprise credit monitoring method, device, equipment and storage medium
CN112906723B (en) Feature selection method and device
CN113947439A (en) Demand prediction model training method and device and demand prediction method and device
CN109934604B (en) Sales data processing method and system, storage medium and electronic equipment
CN113191806A (en) Method and device for determining flow regulation target
CN113792952A (en) Method and apparatus for generating a model
Seyogaa et al. A Comparison Between Backpropagation, Holt-Winter, and Polynomial Regression Methods in Forecasting Dog Bites Cases in Bali
CN115009744B (en) Method and device for predicting delivery duration of front cargo
CN111353629B (en) Frequency updating method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination