Article sales prediction method and device
By dividing historical data into multiple sub-periods and splicing them into streaming data, inputting the prediction model, the problem that existing deep learning models need to be retrained when adding new features is solved, and the scalability and training efficiency of the model are improved.
Patent Information
- Application Number
- CN202411943875.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-03-28
AI Technical Summary
Existing deep learning models need to be retrained when adding new features, resulting in high training costs and waste of resources.
By dividing historical data into multiple sub-periods, extracting sales volume and related feature values for each sub-period, splicing them into streaming data, and inputting them into prediction models, the need for retraining is avoided.
It improves the scalability of the model, reduces the model training cost, and improves the training efficiency.
Smart Images

Figure CN119722165A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of e-commerce operation technology, and in particular to a method and device for predicting item sales volume. Background Art
[0002] In e-commerce operations, sales forecasting plays an important role in ensuring inventory supply while reducing inventory backlogs, and deep learning models are currently commonly used for sales forecasting. However, the input data of the current deep learning model is in the form of a two-dimensional matrix of time and feature values (such as sales, price, traffic, etc.), which means that when adding new features, the deep learning model needs to be retrained using all the training data including the new feature so that the deep learning model can obtain the relationship between sales and time and all other feature values. And as the data analysis deepens, it is found that more and more features affect sales. Therefore, new features need to be continuously added to the two-dimensional matrix, that is, the deep learning model needs to be repeatedly trained using all the training data, which leads to high training costs and waste of resources. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a method and device for predicting sales of an item, including: obtaining first historical data corresponding to a target item in a first historical period, dividing the first historical period into multiple sub-periods, and extracting the sales corresponding to the multiple sub-periods and various features related to the sales and their corresponding feature values from the first historical data; splicing the sales corresponding to the multiple sub-periods to obtain sales splicing data, and splicing the feature values corresponding to each feature in the multiple sub-periods and the target sub-period to obtain feature splicing data; splicing the sales splicing data and the feature splicing data corresponding to each feature to obtain target splicing data; inputting the target splicing data and its corresponding target time identifiers into a prediction model, and using the output of the prediction model as the target sales corresponding to the target item in the target sub-period. Thus, by splicing the input data of the prediction model into streaming data, the scalability of the model is improved. After adding new features to the input data, it is not necessary to retrain the prediction model using all the training data, but only the training data corresponding to the new features needs to be used to train the data model, thereby reducing the cost of model training and improving the efficiency of model training.
[0004] To achieve the above objective, according to one aspect of an embodiment of the present invention, a method for predicting item sales volume is provided.
[0005] A method for predicting item sales in an embodiment of the present invention includes: obtaining first historical data corresponding to a target item in a first historical period, dividing the first historical period into multiple sub-periods, and extracting the sales corresponding to the multiple sub-periods and various features related to the sales and their corresponding feature values from the first historical data; splicing the sales corresponding to the multiple sub-periods to obtain sales splicing data, and splicing the feature values corresponding to each feature in the multiple sub-periods and the target sub-period to obtain feature splicing data; splicing the sales splicing data with the feature splicing data corresponding to each feature to obtain target splicing data; inputting the target splicing data and their corresponding target time identifiers into a prediction model, and using the output of the prediction model as the target sales corresponding to the target item in the target sub-period.
[0006] Optionally, the method of the present invention also includes: for each sub-period in multiple sub-periods and the target sub-period: generating an absolute time identifier corresponding to the sub-period based on the time information corresponding to the sub-period; generating a relative time identifier corresponding to the sub-period based on the time interval between the time information corresponding to the sub-period and the time information corresponding to the target sub-period; generating a target time identifier corresponding to the sub-period based on the absolute time identifier and the relative time identifier.
[0007] Optionally, the target splicing data and their corresponding target time identifiers are input into the prediction model, including: using the target splicing data as the first row of data, and using the target time identifiers corresponding to the target splicing data as the second row of data; using the time information corresponding to the target time identifiers as the third row of data; and inputting the first row of data, the second row of data and the third row of data into the prediction model accordingly.
[0008] Optionally, the method of the present invention also includes: obtaining second historical data corresponding to the target item in a second historical period, dividing the second historical period into multiple training sub-periods, and extracting the sales volume corresponding to the multiple training sub-periods and each training feature related to the sales volume and its corresponding training feature value from the second historical data; splicing the sales volume corresponding to the multiple training sub-periods to obtain training sales volume splicing data, splicing the training feature values corresponding to each training feature in the multiple training sub-periods and the training target sub-periods to obtain training feature splicing data, and splicing the training sales volume splicing data with the training feature splicing data corresponding to each training feature to obtain target training splicing data; inputting the target training splicing data and the target time identifier corresponding to the target training splicing data into the prediction model to train the prediction model.
[0009] Optionally, the loss function corresponding to the prediction model is a cross entropy loss function determined according to out-of-stock loss and inventory loss, wherein out-of-stock loss refers to the sales loss caused by the predicted sales being lower than the actual sales, and inventory loss refers to the loss caused by the predicted sales being higher than the actual sales.
[0010] Optionally, the method of the present invention also includes: before inputting the first row of data, the second row of data and the third row of data into the prediction model, saving the first row of data, the second row of data and the third row of data in a distributed file system in a columnar storage format; reading data from the distributed file system in a streaming manner, and inputting the read first row of data, the second row of data and the third row of data into the prediction model accordingly.
[0011] Optionally, the method of the present invention also includes: after obtaining the actual sales volume corresponding to the target sub-period, adding the time information of the target sub-period, the actual sales volume corresponding to the target sub-period and the multiple characteristic values corresponding to the target sub-period to the first historical data to obtain new first historical data; based on the new first historical data, predicting the sales volume of the target item in the next period of the target sub-period.
[0012] To achieve the above objective, according to another aspect of an embodiment of the present invention, a device for predicting item sales volume is provided.
[0013] An item sales prediction device according to an embodiment of the present invention comprises: a feature extraction module, which is used to obtain first historical data corresponding to a target item in a first historical period, divide the first historical period into multiple sub-periods, and extract the sales corresponding to the multiple sub-periods and various features related to the sales and their corresponding feature values from the first historical data; a feature processing module, which is used to splice the sales corresponding to the multiple sub-periods to obtain sales splicing data, and splice the feature values corresponding to each feature in the multiple sub-periods and the target sub-period to obtain feature splicing data; splicing the sales splicing data and the feature splicing data corresponding to each feature to obtain target splicing data; and a sales prediction module, which is used to input the target splicing data and their corresponding target time identifiers into a prediction model, and use the output of the prediction model as the target sales corresponding to the target item in the target sub-period.
[0014] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device for item sales prediction is provided.
[0015] An electronic device for item sales forecasting according to an embodiment of the present invention comprises: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement an item sales forecasting method according to an embodiment of the present invention.
[0016] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided.
[0017] A computer-readable storage medium according to an embodiment of the present invention stores a computer program, which, when executed by a processor, implements a method for predicting item sales volume according to an embodiment of the present invention.
[0018] To achieve the above objective, according to yet another aspect of an embodiment of the present invention, a computer program product is provided.
[0019] A computer program product according to an embodiment of the present invention includes a computer program, and when the program is executed by a processor, a method for predicting item sales volume according to an embodiment of the present invention is implemented.
[0020] One embodiment of the above invention has the following advantages or beneficial effects: by obtaining the first historical data corresponding to the target item in the first historical period, the first historical period is divided into multiple sub-periods, and the sales volume corresponding to the multiple sub-periods and the various features related to the sales volume and their corresponding feature values are extracted from the first historical data; the sales volume corresponding to the multiple sub-periods are spliced to obtain sales volume splicing data, and the feature values corresponding to each feature in the multiple sub-periods and the target sub-period are spliced to obtain feature splicing data; the sales volume splicing data and the feature splicing data corresponding to each feature are spliced to obtain target splicing data; the target splicing data and the target time identifiers corresponding to them are input into the prediction model, and the output of the prediction model is used as the target sales volume corresponding to the target item in the target sub-period. Thus, by splicing the input data of the prediction model into streaming data, the scalability of the model is improved. After adding new features to the input data, it is not necessary to retrain the prediction model using all the training data, and only the training data corresponding to the new features need to be used to train the data model, which reduces the model training cost and improves the model training efficiency.
[0021] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific implementation examples. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention. Figure 1is a flow chart of a method for predicting sales volume of an item according to an embodiment of the present invention; Figure 2 It is a schematic diagram of the structure of input data in the existing model for item sales forecasting and the model's processing of input data; Figure 3 is a schematic diagram of the structure of input data of a prediction model according to an embodiment of the present invention; Figure 4 is a schematic diagram of the structure of input data of another prediction model according to an embodiment of the present invention; Figure 5 is a schematic diagram of a specific flow chart of another method for predicting sales volume of an item according to an embodiment of the present invention; Figure 6 is a schematic diagram of main modules of an item sales forecasting device according to an embodiment of the present invention; Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention may be applied; Figure 8 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0023] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0024] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.
[0025] It should be pointed out that the embodiments of the present invention and the technical features therein may be combined with each other without conflict.
[0026] Figure 1 4 is a schematic diagram of main steps of a method for predicting item sales volume according to an embodiment of the present invention.
[0027] like Figure 1 As shown, the article sales prediction method of the embodiment of the present invention mainly includes steps S101-S103.
[0028] Step S101: Obtain the first historical data corresponding to the target item in the first historical period, divide the first historical period into multiple sub-periods, and extract the sales volume corresponding to the multiple sub-periods and various features related to the sales volume and their corresponding feature values from the first historical data. Figure 2 As shown in the figure, the input data of the model is in the form of a two-dimensional matrix, the rows of which are elements related to time, and the columns are elements related to features, such as sales, traffic, price, etc. The input data of this model has a characteristic: for the increase or decrease of features, the model needs to be retrained, and the model needs to be trained from scratch. For example, the original input data features include sales, traffic, price, and now temperature is added. Then, all the data such as time, sales, traffic, price and temperature need to be used to retrain the model, which makes the training cost high and the training cycle long.
[0029] The sales forecasting model used in the embodiment of the present invention also has input data that is a two-dimensional matrix, but its structure is different from the two-dimensional matrix of input data in the prior art. The input data structure of the embodiment of the present invention is as follows: Figure 3 As shown, the input data is the concatenation of multiple submatrices, each submatrix is a two-dimensional matrix about time and a single feature, for example, submatrix 1 is a two-dimensional submatrix about time and sales, submatrix 2 is a two-dimensional submatrix about time and flow, and submatrix 3 is a two-dimensional submatrix about time and price, etc. The input data is the concatenation of submatrix 1, submatrix 2, submatrix 3, etc. This structural design of input data makes the model highly scalable. For example, if there are originally three features about time, then the input data is concatenated by three submatrices. If a feature is added now, then a submatrix 4 can be added. When the model is trained again, the model does not need to relearn the correlation between the first three submatrices, but only needs to learn the newly added correlation between submatrix 4 and sales. Compared with the prior art, this greatly reduces the training complexity, reduces the training cost, and improves the training efficiency.
[0030] In the embodiment of the present invention, the first historical data is the historical data about the target item in the first historical period, such as the previous year or the previous two years. The historical period is divided into 365 or 365*2 sub-periods, that is, the historical data is divided into historical data with a granularity of days. Data about sales volume, price, traffic volume, etc. are extracted from the historical data of each day. For example, the sales volume of product A on January 1, 20XX is 100, the price is 7.8 yuan, and the traffic volume (i.e., the number of clicks) is 500.
[0031] The first historical data includes three parts of data: the original real data set, the high-dimensional statistical data set obtained from the original real data set, and the interpretable prediction data. The high-dimensional statistical data refers to the relatively stable high-dimensional data that retains the sales characteristics obtained by aggregating the granular data of each single product, brand, category, etc. The interpretable prediction data refers to the virtual data obtained after smoothing, filling and prediction.
[0032] Step S102: splice the sales volume corresponding to the multiple sub-periods to obtain sales volume splicing data, and splice the feature values corresponding to each feature in the multiple sub-periods and the target sub-period to obtain feature splicing data; splice the sales volume splicing data and the feature splicing data corresponding to each feature to obtain target splicing data. Figure 3 As shown, submatrix 1 represents sales volume splicing data, which includes sales volume values corresponding to multiple sub-periods, submatrix 2 and submatrix 3 are feature splicing data, respectively, where submatrix 2 represents flow splicing data, which includes flow values corresponding to multiple sub-periods, and submatrix 3 represents price splicing data, which includes prices corresponding to multiple sub-periods, where x represents sales volume, l represents flow, and j represents price. Multiple sub-matrices are spliced to obtain a splicing matrix [sales volume, flow, price, ...], and the time corresponding to the splicing matrix is [1,2,3,4,...,1,2,3,4,5,...,1,2,3,4,5,...,......]. Among them, time 1, 2, 3 and 4 correspond to multiple sub-periods, and the flow corresponding to time 5 is the target sub-period. And the flow corresponding to time 5 is the estimated click volume of product A in the target sub-period, and the price corresponding to time 5 is the price set for product A in the target sub-period.
[0033] Step S103: Input the target splicing data and the target time identifiers corresponding to them into the prediction model, and use the output of the prediction model as the target sales volume corresponding to the target item in the target sub-period. Splice multiple sub-matrices to obtain target splicing data, [sales volume (100, 110, 120, 115, ...), flow (500, 600, 550, 700, ...), price (7.8, 7.8, 7.8, 7.8, ...) ...], and the time corresponding to the target splicing data is [1, 2, 3, 4, ..., 1, 2, 3, 4, 5, ..., 1, 2, 3, 4, 5, ..., ...] and input it into the prediction model accordingly. The prediction model predicts the relationship between the target sales volume in the target sub-period and the time, flow, price, etc. in the target sub-period based on the relationship between sales volume and time, flow, price, etc. in the first historical data in the first historical period, and predicts the target sales volume based on the time, flow, price, etc. in the target sub-period.
[0034] The prediction model in the embodiment of the present invention adopts the transformer architecture. The prediction model cannot recognize the order relationship of the actual time series. It is necessary to process the actual time information of each sub-period into a time period identifier that can be recognized by the model, and in order to identify the time period relationship between each sub-period, such as the interval between two time periods of one week, one month, one quarter, one year, etc. Therefore, it is necessary to determine the sub-period that differs from the target sub-period by a periodic length through the time interval between each sub-period, such as a sub-period that differs from the target sub-period by one week, a sub-period that differs from the target sub-period by one month, and a sub-period that differs from the target sub-period by one year. In an optional embodiment of the present invention, for each sub-period in the multiple sub-periods and the target sub-period: an absolute time identifier corresponding to the sub-period is generated according to the time information corresponding to the sub-period; a relative time identifier corresponding to the sub-period is generated according to the time interval between the time information corresponding to the sub-period and the time information corresponding to the target sub-period; a target time identifier corresponding to the sub-period is generated according to the absolute time identifier and the relative time identifier. For example, the actual time information of January 1, 20XX is represented by time period 1, the actual time information of January 2, 20XX is represented by time period 2, and the actual time information of January 3, 20XX is represented by time period 3. Time period 1, time period 2 and time period 3 are absolute time identifiers, and their temporal sequence relationship can be identified according to the order of 1, 2, and 3. In addition, the time interval between each sub-period and the target sub-period is used to represent the relative time identifier corresponding to the sub-period. The relative time identifier can be used to determine the sub-period that differs from the target sub-period by a preset period. For example, to determine the sub-period that differs from the target sub-period by one week, two weeks, or three weeks, the sub-periods with relative time identifiers of 7, 14, or 21 can be selected; to determine the sub-period that differs from the target sub-period by one month, two months, or three months, the sub-periods with relative time identifiers of 30, 60, or 90 can be selected. The target time identifier is generated according to the absolute time identifier and the relative time identifier. The target time identifier may be expressed as an absolute time identifier-relative time identifier, such as 1-7, wherein 1 indicates the first sub-period, and 7 indicates that the time interval between the first sub-period and the target sub-period is 7.
[0035] In an optional embodiment of the present invention, the target splicing data and the target time identifiers respectively corresponding to the target splicing data are input into the prediction model, including: taking the target splicing data as the first line of data, and taking the target time identifiers respectively corresponding to the target splicing data as the second line of data; taking the time information corresponding to the target time identifiers as the third line of data; and correspondingly inputting the first line of data, the second line of data and the third line of data into the prediction model, such as Figure 4As shown, x indicates sales volume, l indicates traffic volume, j indicates price, b indicates target time identifier, and t indicates actual time information. For example, take the target splicing data [sales volume (100, 110, 120, 115), traffic (500, 600, 550, 700), price (7.8, 7.8, 7.8, 7.8)...] as the first row of data, the target time identifier [1-4, 2-3, 3-2, 4-1, 1-4, 2-3, 3-2, 4-1, 5-0, 1-4, 2-3, 3-2, 4-1, 5-0,...] corresponding to the target splicing data as the second row of data, and the actual time information corresponding to the target splicing data [20XX.1.1, 20XX.1.2, 20XX.1.3, 20XX.1.4, 20XX.1.1, 20XX.1.2, 20XX.1.3,20XX.1.4, 20XX.1.1, 20XX.1.2, 20XX.1.3, 20XX.1.4,...] as the third row of data, and the first row of data, the second row of data, and the third row of data are input into the prediction model accordingly.
[0036] In an optional embodiment of the present invention, before the first row of data, the second row of data and the third row of data are input into the prediction model, the first row of data, the second row of data and the third row of data are saved in a distributed file system in a columnar storage format; the data is read from the distributed file system in a streaming manner, and the read first row of data, the second row of data and the third row of data are input into the prediction model accordingly. Since the amount of input data constructed in practice is large, it takes a long time to load it locally, and it is difficult to load it into the memory at one time. In order to increase the loading speed of the input data, the input data can be saved in parquet format (the Parquet format is a columnar storage format). Compared with the text format, the parquet format can greatly reduce the storage space of the input data. In addition, the input data is stored in the parquet format on HDFS (Hadoop Distributed File System). When reading the input data from HDFS, the data is read from HDFS in a streaming manner. Based on the Trainer structure of Transformers, multi-machine, multi-card, and multi-process distributed training is performed, and the training efficiency is accelerated through deepspeed parallelization. Deepspeed is a deep learning optimization library specifically used to improve the training efficiency and performance of large deep learning models.
[0037] In an optional embodiment of the present invention, the second historical data corresponding to the target item in the second historical period is obtained, the second historical period is divided into a plurality of training sub-periods, and the sales volume corresponding to the plurality of training sub-periods and the various training features related to the sales volume and their corresponding training feature values are extracted from the second historical data; the sales volume corresponding to the plurality of training sub-periods is spliced to obtain training sales volume splicing data, the training feature values corresponding to each training feature in the plurality of training sub-periods and the training target sub-period are spliced to obtain training feature splicing data, and the training sales volume splicing data and the training feature splicing data corresponding to each training feature are spliced to obtain target training splicing data; the target training splicing data and the target time identifier corresponding to the target training splicing data are input into the prediction model to train the prediction model. When performing model training, the second historical data of the target item in the second historical period, such as the first three years, is obtained, and the second historical data is used as training data. After extracting training features, such as sales volume, flow, price, etc., the second historical period is divided into a plurality of training sub-periods, such as 365*3=1095 training sub-periods. Extract 1095 sales values corresponding to 1-1095 sub-periods from the second historical data; extract 1095 flow values corresponding to 1-1095 sub-periods from the second historical data; extract 1095 prices corresponding to 1-1095 sub-periods from the second historical data, etc. Splice the 1095 sales values to obtain training sales splicing data, splice the 1095 flow values and the flow values of the target training sub-periods to obtain training flow splicing data, splice the 1095 prices and the prices of the target training sub-periods to obtain training price splicing data, and finally splice the training sales splicing data, the training flow splicing data and the training price splicing data to obtain target training splicing data, and input the target training splicing data and their corresponding target time identifiers into the prediction model accordingly to realize the training of the prediction model. Model training requires multiple parameter adjustments, and it is necessary to determine how to adjust the parameters according to the loss function corresponding to the model.
[0038] During the model training process, the loss function based on which the parameters are adjusted is defined by the out-of-stock loss and inventory loss. In an optional embodiment of the present invention, the loss function corresponding to the prediction model is a cross entropy loss function determined based on the out-of-stock loss and inventory loss, wherein the out-of-stock loss refers to the sales loss caused by the predicted sales being lower than the actual sales, and the inventory loss refers to the loss caused by the predicted sales being higher than the actual sales. For example, the loss function can be: Among them, F refers to the predicted sales, A is the actual sales, and I is the indicative function. When F is greater than A, I=1, and when F is less than A, I=0.
[0039] In order to expand the reference data required by the prediction model, after the actual sales volume of the target sub-period is determined, the data corresponding to the target sub-period is added to the first historical data, thereby ensuring that the model reference data is the latest and most complete, so as to improve the accuracy of the model prediction. In an optional embodiment of the present invention, after obtaining the actual sales volume corresponding to the target sub-period, the time information of the target sub-period, the actual sales volume corresponding to the target sub-period, and the corresponding multiple feature values in the target sub-period are added to the first historical data to obtain new first historical data; based on the new first historical data, the sales volume of the target item in the next period of the target sub-period is predicted. The target time identifier, sales volume, flow, price and other data of the target sub-period are added to the first historical data to obtain new reference data, and the new reference data is used to predict the target sales volume of the next period of the target sub-period.
[0040] In an optional embodiment of the present invention, the multiple features include sales volume, traffic volume, price, temperature, event calendar, etc. In order to improve the accuracy of sales volume forecasting, the features that affect sales volume can be added to the input data on the original basis, such as adding temperature, promotion activity calendar, etc. to the input data, so that the model can combine the relationship between product sales volume and temperature, and the relationship between product sales volume and promotion activities, to further improve the accuracy of sales volume forecasting.
[0041] In the above embodiment of the present invention, the sales forecasting method is described by taking 1 day as an example in the target sub-period. In fact, the model can also predict the sales of multiple days at a time, such as predicting the sales of 7 days, 14 days, 21 days, etc., that is, the target sub-period can be 7 days, 14 days, 21 days, etc. For example, the flow, price, temperature and other data of the 1st to 14th days of the target sub-period are input as input data to the forecasting model, and the forecasting model outputs the target sales corresponding to the 1st to 14th days respectively.
[0042] The following is a further exemplary description of the item sales forecasting method of this embodiment. The item sales forecasting method of this embodiment mainly includes the following steps S501-S509: Figure 5 As shown: Step S501: Obtain first historical data corresponding to the target item in a first historical period, divide the first historical period into multiple sub-periods, and extract sales corresponding to the multiple sub-periods and various features related to the sales and their corresponding feature values from the first historical data. Step S502: splice the sales volume corresponding to multiple sub-periods to obtain sales volume splicing data, and splice the feature values corresponding to each feature in multiple sub-periods and the target sub-period to obtain feature splicing data; splice the sales volume splicing data and the feature splicing data corresponding to each feature to obtain target splicing data. Step S503: for each sub-period in the plurality of sub-periods and the target sub-period: generating an absolute time identifier corresponding to the sub-period according to the time information corresponding to the sub-period. Step S504: Generate a relative time identifier corresponding to the sub-period according to the time interval between the time information corresponding to the sub-period and the time information corresponding to the target sub-period. Step S505: Generate a target time identifier corresponding to the sub-period according to the absolute time identifier and the relative time identifier. Step S506: taking the target splicing data as the first row of data, and taking the target time identifiers respectively corresponding to the target splicing data as the second row of data. Step S507: The target time identifier and the time information corresponding to each other are used as the third line of data. Step S508: input the first row of data, the second row of data, and the third row of data into the prediction model accordingly. Step S509: using the output of the prediction model as the target sales volume corresponding to the target item in the target sub-period.
[0043] The method for predicting the sales volume of an item in an embodiment of the present invention obtains the first historical data corresponding to the target item in the first historical period, divides the first historical period into multiple sub-periods, and extracts the sales volume corresponding to the multiple sub-periods and the various features related to the sales volume and their corresponding feature values from the first historical data; splices the sales volume corresponding to the multiple sub-periods to obtain sales volume splicing data, and splices the feature values corresponding to each feature in the multiple sub-periods and the target sub-period to obtain feature splicing data; splices the sales volume splicing data and the feature splicing data corresponding to each feature to obtain target splicing data; inputs the target splicing data and its corresponding target time identifiers into a prediction model, and uses the output of the prediction model as the target sales volume corresponding to the target item in the target sub-period. Thus, by splicing the input data of the prediction model into streaming data, the scalability of the model is improved. After adding new features to the input data, it is not necessary to retrain the prediction model using all the training data, but only the training data corresponding to the new features needs to be used to train the data model, thereby reducing the model training cost and improving the model training efficiency.
[0044] Figure 6 4 is a schematic diagram of main modules of an apparatus for predicting item sales volume according to an embodiment of the present invention.
[0045] like Figure 6 As shown, the article sales forecasting device 600 of the embodiment of the present invention includes: A feature extraction module 601 is used to obtain first historical data corresponding to a target item in a first historical period, divide the first historical period into multiple sub-periods, and extract sales corresponding to the multiple sub-periods and various features related to the sales and their corresponding feature values from the first historical data; The feature processing module 602 is used to splice the sales volume corresponding to the multiple sub-periods to obtain sales volume splicing data, and splice the feature values corresponding to each feature in the multiple sub-periods and the target sub-period to obtain feature splicing data; splice the sales volume splicing data and the feature splicing data corresponding to each feature to obtain target splicing data; The sales volume prediction module 603 is used to input the target splicing data and the target time identifiers corresponding to them into a prediction model, and use the output of the prediction model as the target sales volume corresponding to the target item in the target sub-period.
[0046] In an optional embodiment of the present invention, the feature processing module 602 is also used to generate, for each sub-period in multiple sub-periods and the target sub-period: an absolute time identifier corresponding to the sub-period based on the time information corresponding to the sub-period; a relative time identifier corresponding to the sub-period based on the time interval between the time information corresponding to the sub-period and the time information corresponding to the target sub-period; and a target time identifier corresponding to the sub-period based on the absolute time identifier and the relative time identifier.
[0047] In an optional embodiment of the present invention, the sales forecasting module 603 is also used to use the target splicing data as the first row of data, and use the target time identifiers corresponding to the target splicing data as the second row of data; use the time information corresponding to the target time identifiers as the third row of data; and input the first row of data, the second row of data and the third row of data into the forecasting model accordingly.
[0048] In an optional embodiment of the present invention, the sales prediction module 603 is also used to obtain second historical data corresponding to the target item in a second historical period, divide the second historical period into multiple training sub-periods, and extract the sales corresponding to the multiple training sub-periods and each training feature related to the sales and its corresponding training feature value from the second historical data; splice the sales corresponding to the multiple training sub-periods to obtain training sales spliced data, splice the training feature values corresponding to each training feature in the multiple training sub-periods and the training target sub-periods to obtain training feature spliced data, and splice the training sales spliced data with the training feature spliced data corresponding to each training feature to obtain target training spliced data; input the target training spliced data and the target time identifier corresponding to the target training spliced data into the prediction model to train the prediction model.
[0049] In an optional embodiment of the present invention, the loss function corresponding to the prediction model is a cross entropy loss function determined based on out-of-stock loss and inventory loss, wherein out-of-stock loss refers to the sales loss caused by the predicted sales being lower than the actual sales, and inventory loss refers to the loss caused by the predicted sales being higher than the actual sales.
[0050] In an optional embodiment of the present invention, the sales forecast module 603 is further used to save the first row of data, the second row of data and the third row of data in a columnar storage format in a distributed file system before inputting the first row of data, the second row of data and the third row of data into the forecast model; read data from the distributed file system in a streaming manner, and input the read first row of data, the second row of data and the third row of data into the forecast model accordingly.
[0051] In an optional embodiment of the present invention, the feature extraction module 601 is also used to add the time information of the target sub-period, the actual sales volume corresponding to the target sub-period, and the multiple feature values corresponding to the target sub-period to the first historical data after obtaining the actual sales volume corresponding to the target sub-period, so as to obtain new first historical data; and predict the sales volume of the target item in the next period of the target sub-period based on the new first historical data.
[0052] The sales volume prediction device of the embodiment of the present invention obtains the first historical data corresponding to the target item in the first historical period, divides the first historical period into multiple sub-periods, and extracts the sales volume corresponding to the multiple sub-periods and the various features related to the sales volume and their corresponding feature values from the first historical data; splices the sales volume corresponding to the multiple sub-periods to obtain sales volume splicing data, and splices the feature values corresponding to each feature in the multiple sub-periods and the target sub-period to obtain feature splicing data; splices the sales volume splicing data and the feature splicing data corresponding to each feature to obtain target splicing data; inputs the target splicing data and the target time identifiers corresponding to them into the prediction model, and uses the output of the prediction model as the target sales volume corresponding to the target item in the target sub-period. Thus, by splicing the input data of the prediction model into streaming data, the scalability of the model is improved. After adding new features to the input data, it is not necessary to retrain the prediction model using all the training data, but only the training data corresponding to the new features needs to be used to train the data model, which reduces the model training cost and improves the model training efficiency.
[0053] Figure 7 An exemplary system architecture 700 is shown to which the sales forecasting method or sales forecasting apparatus according to the embodiments of the present invention can be applied.
[0054] like Figure 7 As shown, the system architecture 700 may include an e-commerce platform 701, networks 702 and 703, a server 704, and a prediction model 705. The networks 702 and 703 are used to provide a medium for a communication link between the e-commerce platform 701, the server 704, and the prediction model 705. The networks 702 and 703 may include various connection types, such as wired or wireless communication links or optical fiber cables, etc.
[0055] The e-commerce platform 701 and the prediction model 705 interact with the server 704 through the networks 702 and 703 to receive or send messages, etc. The e-commerce platform 701 is a platform that provides historical data of item sales. The server 704 obtains first historical data from the e-commerce platform 701 and sends features extracted from the first historical data to the prediction model 705.
[0056] The server 704 may be a server that provides various services. For example, the server 704 is a background management server that provides support for obtaining the first historical data from the e-commerce platform 701 and analyzing and processing the first historical data. The background management server may analyze and process the obtained first historical data, and send the processing result, such as the target splicing data, to the prediction model 705. The prediction model 705 returns the output target sales volume to the server 704.
[0057] It should be noted that the item sales prediction method provided in the embodiment of the present invention is generally executed by the server 704 , and accordingly, the item sales prediction device is generally disposed in the server 704 .
[0058] It should be understood that Figure 7 The number of e-commerce platforms, networks, servers, and prediction models in the example is only illustrative. Any number of e-commerce platforms, networks, servers, and prediction models may be provided as required.
[0059] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 800 of an electronic device suitable for implementing an embodiment of the present invention. Figure 8 The e-commerce platform shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0060] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the computer system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0061] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.
[0062] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.
[0063] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0064] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0065] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a feature extraction module, a feature processing module and a sales forecasting module. The names of these modules do not constitute a limitation on the modules themselves in some cases. For example, the sales forecasting module may also be described as "a module that uses the output of the forecasting model as the target sales volume corresponding to the target item in the target sub-period".
[0066] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: obtaining the first historical data corresponding to the target item in the first historical period, dividing the first historical period into multiple sub-periods, and extracting the sales volume corresponding to the multiple sub-periods and each feature related to the sales volume and its corresponding feature value from the first historical data; splicing the sales volume corresponding to the multiple sub-periods to obtain sales volume splicing data, and splicing the feature values corresponding to each feature in the multiple sub-periods and the target sub-period to obtain feature splicing data; splicing the sales volume splicing data and the feature splicing data corresponding to each feature to obtain target splicing data; inputting the target splicing data and its corresponding target time identifier into the prediction model, and using the output of the prediction model as the target sales volume corresponding to the target item in the target sub-period.
[0067] According to the technical solution of the embodiment of the present invention, by obtaining the first historical data corresponding to the target item in the first historical period, the first historical period is divided into multiple sub-periods, and the sales volume corresponding to the multiple sub-periods and the various features related to the sales volume and their corresponding feature values are extracted from the first historical data; the sales volume corresponding to the multiple sub-periods are spliced to obtain sales volume splicing data, and the feature values corresponding to each feature in the multiple sub-periods and the target sub-period are spliced to obtain feature splicing data; the sales volume splicing data and the feature splicing data corresponding to each feature are spliced to obtain target splicing data; the target splicing data and the target time identifiers corresponding to them are input into the prediction model, and the output of the prediction model is used as the target sales volume corresponding to the target item in the target sub-period. Thus, by splicing the input data of the prediction model into streaming data, the scalability of the model is improved. After adding new features to the input data, it is not necessary to retrain the prediction model using all the training data, but only the training data corresponding to the new features need to be used to train the data model, which reduces the model training cost and improves the model training efficiency.
[0068] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for predicting sales volume of an item, characterized in that: include: Acquire first historical data corresponding to the target item in a first historical period, divide the first historical period into multiple sub-periods, and extract sales volume corresponding to the multiple sub-periods and various features related to the sales volume and their corresponding feature values from the first historical data; The sales volumes corresponding to the multiple sub-periods are spliced to obtain sales volume splicing data, the feature values corresponding to each feature in the multiple sub-periods and the target sub-period are spliced to obtain feature splicing data, and the sales volume splicing data and the feature splicing data corresponding to each feature are spliced to obtain target splicing data; The target splicing data and their corresponding target time identifiers are input into a prediction model, and the output of the prediction model is used as the target sales volume corresponding to the target item in the target sub-period.
2. The device according to claim 1, characterized in that Also includes: For each sub-period in the multiple sub-periods and the target sub-period: Generate an absolute time identifier corresponding to the sub-period according to the time information corresponding to the sub-period; Generate a relative time identifier corresponding to the sub-period according to the time interval between the time information corresponding to the sub-period and the time information corresponding to the target sub-period; A target time identifier corresponding to the sub-period is generated according to the absolute time identifier and the relative time identifier.
3. The method according to claim 2, characterized in that The step of inputting the target splicing data and the target time identifiers respectively corresponding to the target splicing data into the prediction model comprises: The target spliced data is used as the first row of data, and the target time identifiers respectively corresponding to the target spliced data are used as the second row of data; The target time identifiers respectively correspond to time information as the third line of data; The first row of data, the second row of data, and the third row of data are correspondingly input into the prediction model.
4. The method according to any one of claims 1 to 3, characterized in that: Also includes: Acquire second historical data corresponding to the target item in a second historical period, divide the second historical period into a plurality of training sub-periods, and extract sales volume corresponding to the plurality of training sub-periods and various training features related to the sales volume and their corresponding training feature values from the second historical data; The sales volumes corresponding to the multiple training sub-periods are spliced to obtain training sales volume spliced data, the training feature values corresponding to each training feature in the multiple training sub-periods and the training target sub-period are spliced to obtain training feature spliced data, and the training sales volume spliced data and the training feature spliced data corresponding to each training feature are spliced to obtain target training spliced data; The target training spliced data and the target time identifiers respectively corresponding to the target training spliced data are input into a prediction model to train the prediction model.
5. The method according to claim 4, characterized in that The loss function corresponding to the prediction model is a cross entropy loss function determined based on out-of-stock loss and inventory loss, wherein the out-of-stock loss refers to the sales loss caused by the predicted sales being lower than the actual sales, and the inventory loss refers to the loss caused by the predicted sales being higher than the actual sales.
6. The method according to claim 3, characterized in that: Also includes: Before inputting the first row of data, the second row of data, and the third row of data into the prediction model, storing the first row of data, the second row of data, and the third row of data in a distributed file system in a columnar storage format; Data is read from the distributed file system in a streaming data reading manner, and the first row of data, the second row of data, and the third row of data read are correspondingly input into the prediction model.
7. The method according to any one of claims 1 to 3, characterized in that: Also includes: After obtaining the actual sales volume corresponding to the target sub-period, adding the time information of the target sub-period, the actual sales volume corresponding to the target sub-period, and the corresponding multiple feature values in the target sub-period to the first historical data to obtain new first historical data; The sales volume of the target item in the next period of the target sub-period is predicted according to the new first historical data.
8. An item sales forecasting device, characterized in that: include: a feature extraction module, configured to obtain first historical data corresponding to a target item in a first historical period, divide the first historical period into a plurality of sub-periods, and extract, from the first historical data, sales volumes corresponding to the plurality of sub-periods and various features related to the sales volumes and their corresponding feature values; The feature processing module is used to splice the sales volume corresponding to the multiple sub-periods to obtain sales volume splicing data, and splice the feature values corresponding to each feature in the multiple sub-periods and the target sub-period to obtain feature splicing data; splice the sales volume splicing data and the feature splicing data corresponding to each feature to obtain target splicing data; The sales volume forecasting module is used to input the target splicing data and the target time identifiers corresponding to them into a forecasting model, and use the output of the forecasting model as the target sales volume corresponding to the target item in the target sub-period.
9. An electronic device for predicting sales volume of goods, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
11. A computer program product, comprising a computer program, characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Marine transportation container assembling method based on sequence generation and search
CN120069706A