Prediction method of time series in supply chain scene and related device
By combining historical time series and text information in supply chain scenarios, using the attention processing and language processing module of the prediction model to integrate the generational characteristics of previous generation objects, the problem of failure to fully utilize the language capabilities of large-scale models in the prior art is solved, and the accuracy of time series prediction is improved.
Patent Information
- Application Number
- CN202411751199.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-30
- Publication Date
- 2025-03-11
AI Technical Summary
Existing time series prediction methods fail to fully utilize the language capabilities of large models in supply chain scenarios, resulting in inaccurate prediction results.
By obtaining the historical time series and text information of contemporary objects in the supply chain scenario, the prediction model is used to combine historical time series and text information for prediction, especially through attention processing and language processing modules, the prediction accuracy is improved.
Improve the accuracy of time series prediction, and achieve more accurate future time series prediction by utilizing the language ability of the big model combined with historical data and text information.
Smart Images

Figure CN119599624A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method and related device for predicting time series in a supply chain scenario. Background Art
[0002] In the supply chain scenario, in order to ensure the matching of supply and consumption and to adjust the supply strategy in a timely manner, it is necessary to predict the time series of its objects in future time periods.
[0003] Using a large model network to train a time series large model is an effective way to apply the large model to the time series forecasting of the supply chain. According to the characteristics of the time series, designing an effective strategy to retrain the large model can directly obtain the forecast results. The existing strategy also proves that this method is effective. However, although the existing method can obtain the forecast, it does not use the language ability of the large model, but only uses a large number of parameters.
[0004] In the existing time series prediction methods, the time series of the current object is input into a large model for prediction, which only utilizes the large number of parameters of the large model but does not utilize the language ability of the large model, and the prediction results are not accurate enough. Summary of the invention
[0005] The first aspect of the present application provides a method for predicting time series in a supply chain scenario, comprising:
[0006] Obtaining a historical time series and text information corresponding to a contemporary object in a supply chain scenario, wherein the historical time series includes data corresponding to a to-be-predicted item of the contemporary object at a historical time;
[0007] Through the prediction model, based on the historical time series and the text information, a target time series of the contemporary object is predicted, and the target time series includes data corresponding to the item to be predicted of the contemporary object at at least one future time.
[0008] In a possible implementation, the text information includes generation information corresponding to the contemporary object, and the generation information is obtained based on contemporary description information of the contemporary object, a previous generation historical time series corresponding to at least one previous generation object, and previous generation description information.
[0009] In a possible implementation, obtaining the historical time series and text information corresponding to the contemporary objects in the supply chain scenario includes:
[0010] Obtain a contemporary historical time series and contemporary description information of a contemporary object in a supply chain scenario, wherein the contemporary historical time series includes data corresponding to a to-be-predicted item of the contemporary object in a first historical period, and the contemporary description information includes at least description information related to the target time series; and obtain a predecessor historical time series and predecessor description information of at least one predecessor object, wherein the predecessor historical time series includes data corresponding to a corresponding item of the predecessor object in a second historical period, and the predecessor description information includes at least description information related to the predecessor historical time series, and a start time of the second historical period is earlier than a start time of the first historical period.
[0011] In a possible implementation, the predicting of the target time series of the contemporary object by using a prediction model according to the historical time series and the text information includes:
[0012] According to the contemporary historical time series and the contemporary description information, the contemporary features of the contemporary object are obtained; and, through the first module in the prediction model, the previous historical time series and the previous description information of each previous generation object are subjected to attention processing to obtain the intergenerational features of each previous generation object;
[0013] Merging the intergenerational features of the previous generation objects to obtain previous generation features;
[0014] The target time series of the contemporary object is predicted based on the contemporary features and the previous features through the language processing module in the prediction model.
[0015] In a possible implementation, the text information includes prediction condition information corresponding to the contemporary object, and the prediction condition information represents a description of a data change trend of a to-be-predicted item of the contemporary object at at least one future time.
[0016] In a possible implementation, the predicting of the target time series of the contemporary object by using a prediction model according to the historical time series and the text information includes:
[0017] By using the prediction module of the prediction model, an initial sequence of the contemporary object is predicted based on the historical time series, wherein the initial sequence includes initial data corresponding to the item to be predicted of the contemporary object at at least one future time;
[0018] The initial sequence is adjusted according to the prediction condition information through the diffusion module of the prediction model to obtain the target time sequence of the contemporary object.
[0019] In a possible implementation, the diffusion module of the prediction model is obtained by the following method:
[0020] Obtain sample historical time series and sample prediction condition information;
[0021] Adding noise to the sample historical time series to obtain noise;
[0022] Using the sample prediction condition information as a condition, denoising the noise to obtain a sample target time series;
[0023] Determining a first target loss based on the sample prediction condition information and the sample target time series;
[0024] The parameters of the diffusion module are adjusted based on the first target loss, and the step of adding noise to the sample historical time series is returned to obtain the noise step until the module convergence condition is reached, thereby obtaining a diffusion module with adjusted parameters.
[0025] In a possible implementation, the prediction module of the prediction model is obtained by the following method:
[0026] Obtain a first sample time series and a second sample time series, wherein the time corresponding to the second sample time series is later than that of the first sample time series;
[0027] Obtaining a predicted time series according to the first sample time series by using a prediction module of the prediction model, wherein the predicted time series corresponds to the second sample time series in time;
[0028] Converting the second sample time series into sample description information;
[0029] Determine a second target loss based on the sample description information and the predicted time series; and determine a third target loss based on the second sample time series and the predicted time series;
[0030] Based on the second target loss and the third target loss, the parameters of the prediction module are adjusted, and the prediction module that passes the prediction model is returned to be executed, and the prediction time series step is obtained according to the first sample time series, until the module convergence condition is reached, and the prediction module with adjusted parameters is obtained.
[0031] In a possible implementation, determining the second target loss based on the sample description information and the predicted time series includes:
[0032] Mapping the predicted time series code to a vector space through a time series encoder to obtain a time series vector; and mapping the sample description information code to the vector space through a text encoder to obtain a sample description vector;
[0033] A second target loss is determined based on the distance between the time series vector and the sample description vector in the vector space.
[0034] A second aspect of the present application provides a time series prediction device in a supply chain scenario, comprising:
[0035] An acquisition module, used to obtain a historical time series and text information corresponding to a contemporary object in a supply chain scenario, wherein the historical time series includes data corresponding to a to-be-predicted item of the contemporary object at a historical time;
[0036] The prediction module is used to predict the target time series of the contemporary object based on the historical time series and the text information through a prediction model, and the target time series includes data corresponding to the predicted items of the contemporary object at at least one future time.
[0037] The third aspect of the present application provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the method for predicting time series in a supply chain scenario of the above-mentioned first aspect or any implementation method of the first aspect.
[0038] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0039] The memory is used to store computer programs;
[0040] The processor is used to execute the computer program so that the electronic device can implement the method for predicting time series in a supply chain scenario of the above-mentioned first aspect or any implementation method of the first aspect.
[0041] A fifth aspect of the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the method for predicting time series in a supply chain scenario of the above-mentioned first aspect or any implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0043] Figure 1 It is a flowchart of a method for predicting time series in a supply chain scenario provided by an embodiment of the present application;
[0044] Figure 2It is a flowchart of obtaining the historical time series and text information corresponding to the contemporary objects in the supply chain scenario provided by the embodiment of the present application;
[0045] Figure 3 It is a flowchart of predicting the target time series of the contemporary object according to the historical time series and the text information through the prediction model provided by the embodiment of the present application;
[0046] Figure 4 It is a schematic diagram of an application scenario provided by an embodiment of the present application;
[0047] Figure 5 It is a flowchart of predicting the target time series of the contemporary object according to the historical time series and the text information through the prediction model provided by the embodiment of the present application;
[0048] Figure 6 It is a schematic diagram of a scenario in which the prediction model provided in the embodiment of the present application predicts a target time series;
[0049] Figure 7 It is a schematic diagram of the flow of a diffusion module for obtaining a prediction model provided in an embodiment of the present application;
[0050] Figure 8 is a schematic diagram of a training scenario of a diffusion module in a prediction model provided in an embodiment of the present application;
[0051] Fig. 9 It is a flowchart of a prediction module for obtaining a prediction model provided in an embodiment of the present application;
[0052] Fig.10 It is a schematic diagram of a training scenario of a prediction module in a prediction model provided in an embodiment of the present application;
[0053] Fig.11 is a flow chart of determining the second target loss based on the sample description information and the predicted time series provided by an embodiment of the present application;
[0054] Fig.12 It is a schematic diagram of the training scenario of the time series encoder and the text encoder provided in the embodiment of the present application;
[0055] Fig.13 It is a structural schematic diagram of a time series prediction device in a supply chain scenario provided by an embodiment of the present application;
[0056] Fig.14 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0058] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0059] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0060] Figure 1 It is a flowchart of a method for predicting a time series in a supply chain scenario provided in an embodiment of the present application, which may include steps 101 to 102, and these steps are described in detail below.
[0061] 101. Obtain a historical time series and text information corresponding to a contemporary object in a supply chain scenario, wherein the historical time series includes data corresponding to a to-be-predicted item of the contemporary object at a historical time;
[0062] Among them, the supply chain scenario is a scenario with supply and demand relationship, such as production supply chain, sales supply chain, etc. This application does not limit the specific scenario of the supply chain.
[0063] Among them, the item to be predicted is an item corresponding to the supply chain scenario and requires prediction of future situations.
[0064] As an example, in a production supply chain, the item to be predicted may be the number of spare parts produced, the production schedule, etc.; in a sales supply chain, the item to be predicted may be sales volume, the number of spare parts sold.
[0065] In the supply chain scenario, the object can be a sales object, a production object, etc. The specific content referred to by the object is different for different supply chain scenarios.
[0066] For example, in an electronic sales scenario, the contemporary object may be an electronic product currently being sold, and the historical time series may be the sales volume of the electronic product in the past.
[0067] In this supply chain scenario, the contemporary object has appeared for a period of time, and the data corresponding to the contemporary object in the historical time is obtained to obtain the historical time series of the contemporary object.
[0068] Among them, the historical time series is the data corresponding to the item to be predicted, and is the data corresponding to the contemporary object in the historical time in the supply chain scenario.
[0069] Among them, text information corresponding to the contemporary object is also obtained. The text information corresponds to the contemporary object and may be related to the historical time series or not. The specific content of the text information can be set according to actual conditions and is not limited in this embodiment.
[0070] In a possible implementation, the text information includes generational information corresponding to the contemporary object. Accordingly, the historical time series and text information corresponding to the current object are obtained by obtaining the historical time series and description information of the contemporary object and the previous generation object. Figure 2 The process of obtaining the historical time series and text information corresponding to contemporary objects in the supply chain scenario is described in detail.
[0071] In a possible implementation, the text information includes prediction condition information corresponding to the contemporary object. Accordingly, obtaining the text information is obtaining the prediction condition information corresponding to the contemporary object.
[0072] 102. Using a prediction model, based on the historical time series and the text information, a target time series of the contemporary object is predicted, where the target time series includes data corresponding to the item to be predicted of the contemporary object at at least one future time.
[0073] Among them, the prediction model can adopt a large language model (LLM), which can combine the text information and historical time series for processing to predict the target time series of the contemporary object in the future time. The target time series is the data corresponding to the predicted item of the contemporary object at at least one future time.
[0074] As an example, when the historical time series is the sales volume of electronic products, the corresponding target time series is the sales volume of electronic products in the future.
[0075] As an example, the historical time series is the number of spare parts produced by the production line for component A, and correspondingly, the target time series is the number of spare parts produced by the production line for component A in the future.
[0076] In a possible implementation, when the text information includes generational information corresponding to the contemporary object, the generational information corresponding to the contemporary object and the historical time series corresponding to the contemporary object can be used for prediction to obtain the target time series of the contemporary object. Figure 3 This process is described in detail in .
[0077] In this embodiment, the historical time series and text information corresponding to the contemporary object in the supply chain scenario are obtained, and the historical time series includes the data corresponding to the item to be predicted of the contemporary object at the historical time; through the prediction model, based on the historical time series and the text information, the target time series of the contemporary object is predicted, and the target time series includes the data corresponding to the item to be predicted of the contemporary object at at least one future time. When the prediction model predicts the target time series, it utilizes the language ability of the model to be predicted, and can combine the content in the text information, and predict the target time series based on the historical time series corresponding to the contemporary object and the specific content in the text information, thereby improving the prediction accuracy.
[0078] In a possible implementation, the text information includes generation information corresponding to the contemporary object, and the generation information is obtained based on contemporary description information of the contemporary object, a previous generation historical time series and previous generation description information corresponding to at least one previous generation object.
[0079] Among them, the predecessor objects and contemporary objects in this application have a certain continuation correlation relationship.
[0080] For example, when the object is an electronic product, there may be continuity between the contemporary object and the previous generation object in terms of software and hardware, and the contemporary electronic product may be an improvement on the software or hardware of the previous generation electronic product.
[0081] Among them, the generational information corresponding to the contemporary object is obtained by the contemporary description information of the contemporary object, the previous generation historical time series corresponding to the previous generation object and the previous generation description information. Correspondingly, the generational information contains the characteristics of the contemporary description information of the contemporary object, the characteristics of the previous generation historical time series corresponding to the previous generation object and the characteristics of the previous generation description information.
[0082] Figure 2 It is a flowchart of obtaining the historical time series and text information corresponding to the contemporary objects in the supply chain scenario provided by the embodiment of the present application, which may include steps 201 to 202, and these steps are described in detail below.
[0083] 201. Obtain a contemporary historical time series and contemporary description information of a contemporary object in a supply chain scenario, wherein the contemporary historical time series includes data corresponding to a to-be-predicted item of the contemporary object in a first historical period, and the contemporary description information includes at least description information related to the target time series;
[0084] The contemporary historical time series of the contemporary object is the time series of the contemporary object before the current moment, and the first historical period is the time earlier than the current moment.
[0085] As an example, when the contemporary object is a contemporary electronic product in a sales scenario, the contemporary historical time series is the sales volume of the contemporary electronic product generated before the current moment.
[0086] The contemporary description information at least includes description information related to the target time series, which is a description of the future time series that has not yet occurred.
[0087] The contemporary description information may include static description and expert rules for the target time series description.
[0088] In a possible implementation, the static description may be a statistical description of the target time series, such as mean, variance, lag characteristics, etc.
[0089] In a possible implementation, the expert rule may be a prediction of whether the target time sequence of the contemporary object can be achieved in the future.
[0090] This application uses the sales scenario as an example for explanation. The contemporary object refers to the contemporary product, and the previous generation object refers to the previous generation product. The previous generation product and the contemporary product have a certain continuity. For example, a product has been sold for two generations, and the third generation is currently on sale. Then the contemporary object refers to the third generation product currently on sale, and the previous generation object refers to the first generation product and the second generation product.
[0091] The contemporary historical time series may include the historical sales series of the contemporary product, and the historical sales series includes sales volume and sales time.
[0092] The contemporary description information includes static descriptions and expert rules for the future sales of the contemporary product.
[0093] As an example, the static description can be a statistical description of the future sales time series of the contemporary product, such as the mean, variance, lag characteristics, etc. of the future sales volume; the static description can also be a description of the product characteristics of the contemporary product, such as "this model is...2020 model, the geographical location is..., the sales business type is..., the CPU brand is..., the panel size is...".
[0094] As an example, the expert rule can be a text description of the current market analysis, such as, "The current model is equipped with an AI chip, and sales may increase by xx%", "On a certain date in a certain month, the sales of this model are planned to reach xx%", "This model is... a 2020 model, and its sales will climb to..." in 5 months.
[0095] 202. Obtain a previous historical time series and previous description information of at least one previous object, wherein the previous historical time series includes data corresponding to the corresponding items of the previous object in a second historical period, and the previous description information includes at least description information related to the previous historical time series, and the start time of the second historical period is earlier than the start time of the first historical period.
[0096] Among them, the predecessor object has a certain continuity with the contemporary object. There are differences and similarities between the two.
[0097] Among them, the previous historical time series of the previous object is the time series generated by the previous object in the second historical period, and the start time of the previous historical time series generated for the previous product is earlier than the start time of the contemporary historical time series generated by the contemporary product.
[0098] Moreover, the previous generation historical time series corresponds to the item to be predicted of the contemporary object, and the corresponding item of the previous generation object is data corresponding to the second historical period.
[0099] As an example, the previous generation object is the previous generation sales product, the contemporary object is the contemporary sales product, the item to be predicted is the sales volume of the contemporary sales product, and accordingly, the previous generation historical time series is the sales volume of the previous generation sales product, and the previous generation historical time series can be the sales volume of the previous generation sales product throughout the entire sales life cycle.
[0100] Among them, the start time of sales of the previous generation sales product is earlier than the start time of sales of the current generation sales product. Accordingly, the start time of the second historical period corresponding to the previous generation historical time series is earlier than the start time of the first historical period corresponding to the current historical time series.
[0101] The predecessor description information includes a description of a time series that has not yet occurred in the future at that time during the generation of the time series by the predecessor object, and may also include a description summarizing the historical time series of the predecessor object.
[0102] In a possible implementation, a knowledge base may be set up to store all description information (including contemporary description information and previous generation description information) in the knowledge base, and when prediction is required, the contemporary description information and previous generation description information are extracted from the knowledge base.
[0103] Among them, the knowledge base is compatible with functions such as transition and rampup. Therefore, it is possible to extract descriptive information in text format of a specific target format (such as prompt) for the information in the knowledge base. It can be extracted by combining RAG (Resource Allocation Graph) with prompt (text or instructions that provide input to the model to guide it to generate specific output).
[0104] Among them, in RAG, there are a variety of CSV (Comma-Separated Values, character-separated value) data, which stores tabular data (numbers and text) in plain text. Plain text means that the file is a sequence of characters and does not contain data that must be interpreted like binary numbers. CSV files consist of any number of records, separated by some kind of line break; each record consists of fields, and the separator between fields is other characters or strings, the most common of which are commas or tabs. Usually, all records have exactly the same field sequence and are plain text files.
[0105] Moreover, the CSV table of the transition contains the predecessor and descendant objects of each generation object, as well as the start and end time. The CSV table of the rampup contains information about the sales percentage that each model may reach in a few months. The prompt template is as follows: "The input time series is..., the model is..., the geographical location is..., the sales business type is..., the CPU brand is..., the panel size is..., the generational relationship is..., and the sales volume will ramp up to... in 5 months, more information..."
[0106] When obtaining the current description information and the previous description information, the information in various formats may be extracted from the database and converted into the information in the same format (text format).
[0107] The order of obtaining the current historical time series and the current description information and obtaining the previous historical time series and the previous description information is not limited thereto, and the two can be executed simultaneously or in any order.
[0108] In this embodiment, the contemporary historical time series and contemporary description information of the contemporary objects in the supply chain scenario are obtained, the contemporary historical time series includes the data corresponding to the to-be-predicted items of the contemporary objects in the first historical period, and the contemporary description information includes at least description information related to the target time series; and the previous historical time series and previous description information of at least one previous generation object are obtained, the previous historical time series includes the data corresponding to the corresponding items of the previous generation objects in the second historical period, and the previous description information includes at least description information related to the previous historical time series, and the start time of the second historical period is earlier than the start time of the first historical period, thereby realizing the acquisition of the historical time series and text information corresponding to the contemporary objects, providing the description information and historical time series basis for the subsequent prediction of the target time series of the contemporary objects, so as to realize the use of the language ability of the model to be predicted, predict the target time series, and improve the prediction accuracy.
[0109] Figure 3 It is a flowchart of the embodiment of the present application for predicting the target time series of the contemporary object based on the historical time series and the text information through the prediction model, which may include steps 301 to 304. These steps are described in detail below.
[0110] 301. Obtain the contemporary features of the contemporary object based on the contemporary historical time series and contemporary description information;
[0111] Among them, the contemporary characteristics include contemporary historical time series characteristics and contemporary description characteristics.
[0112] In one possible implementation, a vector conversion is performed on the contemporary historical time series to obtain a contemporary historical time series vector corresponding to the contemporary historical time series; a vector conversion is performed on the contemporary description information to obtain a contemporary description vector of the contemporary description information, and the contemporary historical time series vector and the contemporary description vector are concatenated to obtain contemporary features.
[0113] The length of the feature can be set in advance. For example, if the feature is 1326-dimensional, the contemporary historical time series vector and the contemporary description vector can be set to 663 dimensions respectively, and the two can be directly concatenated to obtain the vector corresponding to the contemporary feature.
[0114] In a possible implementation, a large language model (LLM) may be used to perform vector conversion (embedding) to obtain a corresponding feature vector.
[0115] 302. Performing attention processing on the previous generation historical time series and the previous generation description information of each previous generation object through the first module in the prediction model to obtain each generation feature of each previous generation object;
[0116] Among them, the first module in the prediction model performs attention processing on the previous historical time series and previous description information of each previous generation object, so as to obtain the representation between the intergenerational knowledge of each previous generation object and the corresponding previous historical time series.
[0117] In a possible implementation, each previous generation object is first processed by the first module to obtain the generational features of each previous generation object, and then the generational features of each previous generation object are fused to obtain the previous generation feature, which includes the features of each previous generation object.
[0118] In one possible implementation, features are extracted from the previous historical time series of the first predecessor object to obtain the previous historical time series features; features are extracted from the previous description information of the first predecessor object to obtain the previous description features; attention processing is performed on the previous historical time series features and the previous text features to obtain the generational features of the first predecessor object.
[0119] In a possible implementation, features are extracted for the previous historical time series of the first predecessor object according to the small model method through a linear layer to obtain a feature vector of the previous historical time series. The specific extraction method is a combination of Patch (small area feature extraction) and linear (linear layer); features are extracted for the previous description information of the first predecessor object through a linear projection (linear processing) method to obtain a previous description feature vector; the previous historical time series feature vector is used as Q, the previous description feature vector is used as KV, and QKV is processed through an attention algorithm to capture the relationship between timing and description, so as to obtain the intergenerational characteristics of the first predecessor object that integrates the previous historical time series and the previous description information of the first predecessor object.
[0120] The amount of text of the previous description information of each previous object is huge, and directly using the cross-attention algorithm will lead to a decrease in running performance. Therefore, in this embodiment, linear mapping is used to process the description information of different previous objects, and through linear mapping, multiple phrases can be fused to form new phrases with richer information.
[0121] Among them, the attention processing method adopted in this embodiment is multi-head attention, and the multi-head attention algorithm is trained in advance to determine which phrases in the description information have higher weights.
[0122] Correspondingly, the attention head in the multi-head attention algorithm is represented by k, and the attention algorithm can be calculated using the following formula (1):
[0123] (1)
[0124] Among them, i represents the i-th predecessor object, k represents the k-th head of multi-head attention, represents the Q matrix of the i-th predecessor for the k-th head of multi-head attention, represents the K matrix of the i-th predecessor for the k-th head of multi-head attention, Represents the V matrix of the i-th predecessor for the k-th head of multi-head attention. It represents the characteristics of the previous historical time series obtained by extracting the previous historical time series. represents the previous generation description feature obtained by extracting the previous generation description information. W represents the weight, represents the weight of the Q matrix of the kth head, represents the weight of the K matrix of the k-th head, represents the weight of the V matrix of the k-th head.
[0125] As an example, there are two phrases "CPU is I7" and "Panel is 17 inches". Each sentence provides less information. Through linear mapping, the phrases are aggregated into "CPU is I7 and Panel is 17 inches". This phrase contains the CPU model and panel attributes. One phrase can obtain more information. If the previous description information of two previous objects has similar phrase combinations, the historical time series of the two previous objects may be closer. Accordingly, when training the multi-head attention algorithm, after multiple rounds of training, it can be known which phrase combinations have higher weights.
[0126] The above formula (1) is used to process multiple phrases obtained by linearly processing the previous generation time series features and the previous generation description information using a multi-head attention algorithm to obtain the generational features of the first previous generation object.
[0127] The above process is performed for each predecessor object respectively to obtain the generational characteristics of each predecessor object. The generational characteristics are characteristics that integrate the historical time series of the corresponding predecessor object and the relationship between the description information.
[0128] The order of obtaining the contemporary features of the contemporary object and the intergenerational features of each previous generation of objects is not limited thereto, and the two can be executed simultaneously or in any order.
[0129] 303. Fusing the intergenerational features of the previous generation objects to obtain previous generation features;
[0130] Among them, the intergenerational characteristics of each previous generation object are fused, and the purpose of the fusion is to merge the intergenerational characteristics of each previous generation object into the same feature dimension.
[0131] Among them, the intergenerational features of each previous object can be controlled to reduce their dimension through one-dimensional convolution (Conv), and the standby features after dimension reduction can be spliced and fused to obtain the previous generation features.
[0132] The previous generation feature includes the previous generation time series feature and the previous generation description feature of each previous generation object, and the previous generation feature can characterize the relationship between the previous generation time series of each previous generation object and the relationship between the previous generation descriptions.
[0133] In a possible implementation, after obtaining the previous generation feature, a large language model LLM can be used to perform vector conversion (embedding) to obtain a corresponding feature vector, the feature vector of the previous generation feature has the same size as the feature vector of the contemporary feature, and the dimension of the previous generation feature is the same as the dimension of the contemporary feature.
[0134] 304. The target time series of the contemporary object is predicted based on the contemporary features and the previous features through the language processing module in the prediction model.
[0135] Among them, when the contemporary features and the previous generation features are processed by the language processing module in the prediction model, the contemporary features and the previous generation features are spliced to obtain the information to be input, and the information to be input is input into the language processing module to predict the target time series of the contemporary object.
[0136] Among them, the language processing module can adopt a large language model (LLM model), utilize the language ability of the large language model, and combine the knowledge information of the input information (the knowledge information of the previous generation object and the knowledge information of the current object) during prediction, so as to obtain higher prediction accuracy.
[0137] In this embodiment, the contemporary historical time series and contemporary description information of the contemporary object are processed to obtain the contemporary features of the contemporary object. The previous historical time series and the previous description information of each previous generation object are processed by the first module in the prediction model to obtain the generational features of each previous generation object. Moreover, the generational features of each previous generation object are fused to obtain the previous generation features, which include the generational features of each previous generation object. The language processing module in the prediction model is used to predict the target time series of the contemporary object based on the contemporary features and the previous generation features. In the prediction process, not only the large parameter amount of the language processing module in the prediction model is utilized, but also its language ability is utilized to ensure the accuracy of the target time series predicted by the prediction model.
[0138] Figure 4This is a schematic diagram of an application scenario provided by an embodiment of the present application. The application scenario is a scenario of selling electronic products, wherein the contemporary products currently on sale are 2023 products, and the previous generation products include 2020 products, 2021 products, and 2022 products. In this application scenario, the subsequent sales of 2023 products are predicted. An intergenerational information knowledge base is provided in this scenario, and the intergenerational information knowledge base stores descriptive information for previous generation products and contemporary products. The sales curves of each generation of products are used in the figure to represent the historical time series of each generation of products.
[0139] Among them, the contemporary description information of the contemporary product is obtained from the intergenerational information knowledge base 401: "This model is...2023 model, the geographical location is..., the sales business type is..., the CPU brand is..., the panel size is, the intergenerational relationship is..., and the sales volume climbed to... after 5 months." The contemporary historical time series of the contemporary product is also obtained, specifically the historical sales volume (sales volume curve) of the 2023 electronic product.
[0140] The contemporary description information and the contemporary historical time series features are extracted by LLM Embedding (Large Language Model Feature Extraction Module) 402 to obtain contemporary features, which are 1326-dimensional feature vectors.
[0141] Among them, the description information of the three previous generation products, namely the 2020 products, the 2021 products and the 2022 products, are obtained from the generational information knowledge base respectively, and the historical sales (sales curve) of the 2020 products, the 2021 products and the 2022 products are obtained, and the first module 403 of the prediction model is used to process the description information and sales of each previous generation product to obtain the generational characteristics of each previous generation, and then the generational characteristics of the three previous generation products are fused to obtain the previous generation characteristics.
[0142] Among them, the previous generation description feature vector extracted by linear processing of the description information of each previous generation product is used as the KV input of the attention algorithm, and the previous generation historical time series features extracted by Patch+linear (small area feature extraction and linear layer) combination method for the sales volume of each previous generation product are used as the Q input of the attention algorithm. The generational characteristics of each previous generation product are obtained after being processed by the attention algorithm, and the generational characteristics are subjected to a linear layer (linear) dimensionality reduction processing.
[0143] Among them, after the first module obtains the generational feature fusion of each previous generation product, it obtains the previous generation feature after dimensionality reduction through a one-dimensional convolution (Conv), and converts the previous generation feature into a vector through the LLM Embedding module 402 to obtain a 1326-dimensional feature vector.
[0144] After the previous generation features and the current generation features of the same dimension are concatenated, they are input into the language processing module (LLMModel) 404 of the prediction model, and the prediction result is output, which is the future sales volume of the current generation product.
[0145] In a possible implementation, the text information includes prediction condition information corresponding to the contemporary object, and the prediction condition information represents a description of a data change trend of a to-be-predicted item of the contemporary object at at least one future time.
[0146] The target time series to be predicted is the data of the item to be predicted at a future time, and the prediction condition information may be a description of the data change trend of the item to be predicted at at least one future time, so as to provide guidance for the target time series.
[0147] For example, the data change trend may be an expectation of data for the item to be predicted in the future.
[0148] The text information is of guiding significance for the predicted target time series during the prediction process, and the application of the prediction condition information in predicting the target time series will be described in detail in the subsequent embodiments.
[0149] In a possible implementation, when the text information includes prediction condition information corresponding to the contemporary object, the prediction model can be used to predict the historical time series combined with the prediction condition information to obtain the target time series of the contemporary object. Figure 5 This process is described in detail in .
[0150] Figure 5 It is a flowchart of the embodiment of the present application for predicting the target time series of the contemporary object based on the historical time series and the text information through the prediction model, which may include steps 501 to 502. These steps are described in detail below.
[0151] 501. Using the prediction module of the prediction model, according to the historical time series, predict and obtain an initial sequence of the contemporary object, wherein the initial sequence includes initial data corresponding to the item to be predicted of the contemporary object at at least one future time;
[0152] The historical time series is the data corresponding to the contemporary object at the historical time.
[0153] Among them, the prediction module of the prediction model can be used to make predictions based only on historical time series, and the accuracy of the predicted initial series is limited.
[0154] As an example, the object is a product for sale, the contemporary object is a product currently in the sales stage, and the historical time series may include the sales volume that has been generated for the product currently in the sales stage.
[0155] In a possible implementation, the prediction module can be pre-trained. To improve the prediction accuracy of the prediction module, the training process involves multi-modal constraints. Fig. 9 The process of training the prediction module is described in detail.
[0156] 502. Adjust the initial sequence according to the prediction condition information through the diffusion module of the prediction model to obtain the target time series of the contemporary object.
[0157] However, since the rules in the historical time series may not be applicable to the future, or the prediction module has not successfully learned some rules of the historical time series, the initial predicted sequence may not be accurate enough. Therefore, it is necessary to adjust the initial sequence to improve the prediction accuracy of the prediction model.
[0158] The prediction condition information is used to adjust the initial sequence.
[0159] The prediction model is provided with a diffusion module, through which the purpose of adjusting the initial sequence by using the prediction condition information to obtain the target time series is achieved.
[0160] The prediction condition information is in text format, and is converted into a vector form through an encoder, and the prediction condition information in the vector form is input into the diffusion module.
[0161] In a possible implementation, the diffusion module adds noise to the initial sequence to obtain noise, and uses the prediction condition information to denoise the noise to obtain the target time series. Since the diffusion module adds noise to the initial sequence and adds the prediction condition information during denoising, the target time series output by the diffusion module conforms to the prediction condition information and is similar to the initial sequence, thereby achieving the purpose of adjusting the initial sequence according to the prediction condition information.
[0162] The prediction condition information is a requirement for the performance of the sequence in the future time. Therefore, inputting the prediction condition information into the diffusion module can change the performance of the initial sequence obtained by the prediction and obtain the target time series.
[0163] In a possible implementation, before the initial sequence is input into the diffusion module, it is first subjected to dimensionality reduction processing so that the initial sequence input into the diffusion module meets the input conditions. After the diffusion module obtains the target time series, it also performs dimensionality increase processing on the target time series so that the dimension of the target time series finally outputted is consistent with that of the initial sequence.
[0164] Figure 6It is a schematic diagram of a scenario in which a prediction model provided in an embodiment of the present application predicts a target time series. The prediction model includes a prediction module 601, a dimensionality reduction module 602, a diffusion module 603, a dimensionality increase module 604, and an encoder 605. Among them, the diffusion module includes: a noise adding unit 6031 and a denoising unit 6032. In this scenario, the prediction condition information is "the prediction should retain a strong seasonal law and gradually increasing oscillation, and at the same time have an upward trend". Among them, the historical time series is input into the prediction module 601 to obtain an initial sequence, and the initial sequence is input into the diffusion module 603 after the dimensionality reduction module 602. The noise adding unit 6031 in the diffusion module 603 adds noise to the initial sequence to obtain noise. The prediction condition information in text format is encoded by the encoder 605 to obtain a conditional vector, and the conditional vector and the noise are denoised by the denoising unit 6032 together to obtain a time series. The time series is dimensionalized by the dimensionality increase module 604 to obtain a target time series, and the dimension of the target time series is the same as the dimension of the initial sequence. The target time series finally obtained is similar to the initial series and meets the requirements of the preset condition information, has a strong seasonal pattern and gradually increasing oscillation, and the data of the target time series has an upward trend.
[0165] In one possible implementation, the diffusion module can adopt a classifier-based guidance diffusion module to constrain the degree of matching between the sequence produced in the denoising process and the prediction condition information, so as to make controllable adjustments to the prediction results of the prediction module and realize the conditional controllable generation function.
[0166] In one possible implementation, the diffusion module needs to be pre-trained, and then Figure 7 The process of training the diffusion module is described in detail.
[0167] In this embodiment, the prediction module of the prediction model is used to predict the initial sequence of the contemporary object based on the historical time series, and the initial sequence includes the initial data corresponding to the item to be predicted of the contemporary object at at least one future time; the diffusion module of the prediction model is used to adjust the initial sequence based on the prediction condition information to obtain the target time series of the contemporary object. The prediction module of the prediction model is used to predict the initial sequence of the contemporary object based on the historical time series, and the initial sequence includes the initial data corresponding to the item to be predicted of the contemporary object at at least one future time. The diffusion module of the prediction module is used to adjust the initial sequence using the prediction condition information to obtain the target time series, thereby achieving the purpose of predicting the data corresponding to the predicted item of the contemporary object at at least one future time. Moreover, since the preset condition information is used to adjust the initial sequence, the predicted target time series matches the prediction condition information, thereby improving the prediction accuracy.
[0168] Figure 7 It is a flow chart of a diffusion module for obtaining a prediction model provided in an embodiment of the present application, which may include steps 701 to 705. These steps are described in detail below.
[0169] 701. Obtain sample historical time series and sample prediction condition information;
[0170] The sample historical time series is a historical time series corresponding to the item to be predicted, and is used as a training sample for training the diffusion model.
[0171] As an example, the prediction model is a prediction model for product sales prediction. The sample historical time series can be the sales volume of the product in a period of historical time, specifically, the sales volume in a complete sales life cycle of a generation of products, or the sales volume for a period of time.
[0172] The sample prediction condition information is a condition adjusted according to the rules of the historical time series in a text format.
[0173] The sample historical time series and sample prediction condition information are used as a group of training samples to implement training for the diffusion module.
[0174] In a possible implementation, the sample prediction condition information in a text format is encoded to obtain the sample prediction condition information in a vector format.
[0175] 702. Add noise to the historical time series of the sample to obtain noise;
[0176] The diffusion module first adds noise to the historical time series of the sample to obtain noise.
[0177] The noise adding method may be to add Gaussian noise, and the noise adding process is not limited in the present application.
[0178] 703. Using the sample prediction condition information as a condition, denoising is performed on the noise to obtain a sample target time series;
[0179] The sample prediction condition information is used as a condition to perform denoising together with the noise to obtain a sample target time series.
[0180] Among them, the denoising process can be used as the inverse process of the denoising process. Due to the addition of conditions, the denoising process is affected by the sample prediction condition information, and the obtained sample target time series is related to the sample prediction condition information.
[0181] However, since the diffusion module performs a denoising and denoising process on the input content to obtain output content that is completely consistent with the input content, and after adding the sample prediction condition information as a condition, the denoising process is affected by uncertain conditions, so the obtained sample target time series may not match the sample prediction condition information.
[0182] 704. Determine a first target loss based on the sample prediction condition information and the sample target time series;
[0183] Among them, the training process for the diffusion module adopts the form of classifier guidance, and constrains the degree of matching between the sample target time series generated after the denoising process and the sample prediction condition information to achieve a conditional and controllable generation sequence.
[0184] Wherein, by calculating the loss between the sample prediction condition information and the sample target time series output by the diffusion module, it is determined whether the sample target time series matches the sample prediction condition information.
[0185] In a possible implementation, the sample prediction condition information and the sample target time series are mapped to a vector space, and the distance between the two in the vector space is calculated, and the distance is used as the first target loss of the two.
[0186] Specifically, a time series encoder is used to encode and map the sample target time series into a vector space to obtain a sample time series vector; a text encoder is used to encode and map the sample prediction condition information into the vector space to obtain a sample text vector; and a distance between the sample time series vector and the sample text vector in the vector space is calculated to obtain a first target loss between the sample prediction condition information and the sample target time series.
[0187] The time series encoder and the text encoder may be pre-trained, and the distances determined by the time series encoder and the text encoder for matching time series and text format contents are smaller than other distances.
[0188] 705. Adjust the parameters of the diffusion module based on the first target loss, and return to execute the noise addition for the sample historical time series to obtain the noise step until the module convergence condition is met, and obtain the diffusion module with the adjusted parameters.
[0189] Among them, the first target loss is used to adjust the parameters of the diffusion module, and the diffusion module with adjusted parameters is used to continue the process of predicting the sample target time series based on the sample historical time series and the sample prediction conditions, until the preset module convergence conditions are reached and the training is terminated.
[0190] Among them, the module convergence condition may be that the first target loss no longer decreases. Of course, the module convergence condition can be set according to actual conditions and is not limited in this application.
[0191] Figure 8 801, a diffusion module 802, a dimensionality increase module 803, an encoder 804, a time series encoder 805, and a text encoder 806. The diffusion module includes a noise adding unit 8021 and a noise removing unit 8022.
[0192] The sample historical time series is reduced in dimension by the dimension reduction module 801 to obtain a sequence Z, which is input into the noise adding unit 8021 of the diffusion module 802 to obtain the noise Z T After the sample prediction condition information in text format is encoded by the encoder, the encoded result is used as the condition input to the denoising unit 8022 of the diffusion module 802. The noise Z T After denoising by the denoising unit 8022 according to the condition, a sample target time series Z is obtained. After the sample target time series is upgraded by the dimensionality upgrading module 803, the target sample time series is input into the time series encoder 805 to obtain a sample time series vector. The sample prediction condition information is input into the text encoder 806 for encoding to obtain a sample text sequence vector. The distance between the sample time series vector and the text sequence vector in the vector space is calculated by the calculation formula, and the first target loss between the sample prediction condition information and the sample target time series is determined. The loss is used to adjust the parameters of the diffusion module, and this cycle is repeated until the module convergence condition is reached and the training process is completed.
[0193] In this embodiment, a sample historical time series and sample prediction condition information are obtained; noise is added to the sample historical time series to obtain noise; the sample prediction condition information is used as a condition to denoise the noise to obtain a sample target time series; a first target loss is determined based on the sample prediction condition information and the sample target time series; the parameters of the diffusion module are adjusted based on the first target loss, and the step of adding noise to the sample historical time series to obtain noise is returned to execute until the module convergence condition is met to obtain a diffusion module with adjusted parameters. During the training process, noise is added to the sample historical time series to obtain noise, and a classifier-guided form is used to constrain the degree of matching between the sample target time series generated after the denoising process and the sample prediction condition information, thereby realizing a conditional controllable generation sequence, which can ensure that the trained diffusion module can generate a target time series that matches the prediction condition information from the input time series, thereby improving the prediction accuracy of the prediction model.
[0194] Fig. 9It is a flowchart of a prediction module for obtaining a prediction model provided in an embodiment of the present application, which may include steps 901 to 902. These steps are described in detail below.
[0195] 901. Obtain a first sample time series and a second sample time series, wherein the time corresponding to the second sample time series is later than that of the first sample time series;
[0196] The sample time series set is divided into two parts, the first sample time series corresponds to an earlier time, and the second sample time series corresponds to a later time.
[0197] The first sample time series and the second sample time series may be time-continuous time series.
[0198] As an example, the supply chain scenario in which this prediction module is applied is a product sales scenario. The sales period of the product is from January to September, and the sample time series is the sales volume of the product during the sales period. The first sample time series can be the sales volume from January to July, and the second sample time series can be the sales volume from August to September.
[0199] In a possible implementation, a complete time series may be divided into two parts, the former part being the first sample time series and the latter part being the second sample time series.
[0200] 902. Obtain a predicted time series according to the first sample time series through a prediction module of the prediction model, wherein the predicted time series corresponds to the second sample time series in time;
[0201] The prediction module uses the first sample time series to perform prediction, that is, to perform prediction on the future time corresponding to the first sample time series to obtain a predicted time series.
[0202] The predicted time series corresponds to the time of the second sample time series, and the time of the two may be the same.
[0203] As an example, the forecasting module predicts the sales volume of a product from August to September based on the sales volume of the product from January to July.
[0204] 903. Convert the second sample time series into sample description information;
[0205] The second sample time series is converted into sample description information by using a time series to text function module, and the sample description information is text format information.
[0206] As an example, the sales volume of a product from August to September is converted into the text format "The sales volume of this product increased steadily from August to September, with a sharp increase in late August and early September, and a slow increase in sales volume in mid-September."
[0207] 904. Determine a second target loss based on the sample description information and the predicted time series;
[0208] The prediction module is trained by adopting a multimodal constraint method to improve the prediction accuracy of the prediction module.
[0209] In this embodiment, the multimodal constraint includes calculating the loss of sample description information and the prediction time series and the loss of the second sample time series and the prediction time series, and using the two losses to adjust the parameters of the prediction module so that the sum of the two losses of the prediction module reaches the convergence condition.
[0210] In a possible implementation, the process of determining the second target loss includes: encoding the predicted time series, encoding the sample description information, mapping the encoding results of the two to the same vector space, calculating the distance of the encoding results in the vector space, obtaining the loss between the sample description information and the predicted time series, and subsequently Fig.11 The process of determining the second target loss is described in detail.
[0211] The time series encoder and the text encoder may be pre-trained, and the distances determined by the time series encoder and the text encoder for matching time series and text format contents are smaller than other distances.
[0212] 905. Determine a third target loss based on the second sample time series and the predicted time series;
[0213] Therein, the gap between the second sample time series and the predicted time series is determined, and the gap is used as the loss between the two.
[0214] In a possible implementation, the loss between the second sample time series and the predicted time series is calculated, and mean square error loss (MSE loss) may be used for calculation.
[0215] The order of determining the second target loss and determining the third target loss is not limited thereto, and both may be performed simultaneously or in any order.
[0216] 906. Based on the second target loss and the third target loss, adjust the parameters of the prediction module, and return to execute the prediction module through the prediction model, and obtain the prediction time series step according to the first sample time series until the module convergence condition is reached, and obtain the prediction module with adjusted parameters.
[0217] Among them, the loss of this training is determined according to the second target loss and the third target loss, the parameters of the prediction module are adjusted using the loss, and the prediction module with adjusted parameters is used to perform the next training.
[0218] Among them, the second target loss and the third target loss can be combined by weighted calculation to obtain the loss of this training, and the weight can be set according to needs.
[0219] Among them, the sample description information clearly requires that the predicted time series of the prediction module have similar semantics to the true value (the second sample time series), which can guide the training process of the prediction module.
[0220] Fig.10 It is a schematic diagram of a training scenario of a prediction module in a prediction model provided by an embodiment of the present application, including: a conversion module 1001, a large language model (LLM) 1002, a text encoder 1003, a time series encoder 1004, and a prediction module 1005. The training sample includes a first sample time series x and a second sample time series y, and the second sample time series y is converted into sample description information in text format by the conversion module 1001, and the sample description information is subjected to feature extraction processing by the large language model (LLM) 1002, and the extracted content is encoded by the text encoder 1003 to obtain a sample description vector that is mapped to a vector space.
[0221] Among them, the first sample time series x is predicted by the prediction module 1005 to obtain the predicted time series y', and the predicted time series y' is subjected to loss calculation with the second sample time series y to obtain the third target loss. The predicted time series y' is encoded and mapped by the time series encoder 1004 to obtain the predicted time series vector to the vector space, and the second target loss between the sample description information and the predicted time series y' is determined by calculating the distance between the predicted time series vector and the sample description vector in the vector space.
[0222] Among them, the second target loss and the third target loss are weightedly added to obtain the loss of the prediction module in this training. The loss is used to guide the adjustment of the prediction module through back propagation. Based on this, the training process is executed repeatedly until the module convergence condition is reached and the training process is completed, thereby realizing multimodal constraints in the training process of the prediction module.
[0223] In this embodiment, a first sample time series and a second sample time series are obtained, and the time corresponding to the second sample time series is later than that of the first sample time series; a prediction module of the prediction model is used to predict a prediction time series corresponding to the time of the second sample time series based on the first sample time series; the second sample time series is converted into sample description information; based on the sample description information and the prediction time series, a second target loss is determined; and, based on the second sample time series and the prediction time series, a third target loss is determined; based on the second target loss and the third target loss, the parameters of the prediction module are adjusted, and the prediction module with adjusted parameters is used to return to training until the module convergence condition is reached, thereby obtaining a prediction module with adjusted parameters. During the training process, the second sample time series is converted into sample description information in text format, and the prediction module is used to predict the first sample time series to obtain the predicted time series. The loss between the predicted time series and the sample description information in text format, as well as the loss between the predicted time series and the first sample time series, are determined. The prediction module is adjusted using these two losses, thereby realizing multimodal constraints in the training process of the prediction module. By explicitly requiring that the predicted value of the prediction module have similar semantics to the true value, the prediction module is guided to converge faster and more robustly in the parameter space, thereby avoiding local suboptimal spaces where the quantitative loss value is low but the qualitative prediction effect is poor.
[0224] Fig.11 It is a flowchart of determining the second target loss based on the sample description information and the predicted time series provided by an embodiment of the present application, which may include steps 1101 to 1103, and these steps are described in detail below.
[0225] 1101. Map the predicted time series code to a vector space through a time series encoder to obtain a time series vector;
[0226] Among them, the time series encoder encodes the time series and maps it into the vector space.
[0227] The time series encoder encodes the predicted time series and maps it into a vector space to obtain a corresponding time series vector.
[0228] 1102. Encode and map the sample description information to the vector space through a text encoder to obtain a sample description vector;
[0229] Among them, the text encoder encodes the content in text format and maps it into the vector space.
[0230] The text encoder encodes the sample description information and maps it into a vector space to obtain a corresponding text sequence vector.
[0231] 1103. Determine a second target loss based on the distance between the time series vector and the sample description in the vector space.
[0232] Among them, in this vector space, the distance between the time series vector and the text sequence vector is calculated. This distance represents the gap between the predicted time series and the sample description information, which is the second target loss.
[0233] In a possible implementation, in the space vector, the cosine distance between the time series vector and the sample description vector is calculated.
[0234] The cosine distance measures the correlation between the time series vector and the sample description vector in the vector space. The larger the cosine distance, the lower the correlation; the smaller the cosine distance, the higher the correlation.
[0235] Among them, the time series encoder and text encoder can be pre-trained, and the time series encoder and text encoder can determine the distance for the matching time series and text format description information, which is smaller than other distances, indicating that the correlation between the time series and the description information is the largest.
[0236] In the process of training the time series encoder and the text encoder, a joint training method is adopted.
[0237] Fig.12 It is a schematic diagram of the training scenario of the time series encoder and the text encoder provided in an embodiment of the present application, including: a time series encoder 1201, a text encoder 1202 and a large language model (LLM) 1203.
[0238] Among them, firstly obtain the training sample pairs with corresponding sample time series and sample description information. The sample description information can be obtained by describing the sample time series data using LLM through prompt word engineering (in-context learning, etc.), or by manual annotation to obtain paired training sample pairs.
[0239] The sample time series in multiple pairs of training samples are input into the time series encoder 1201, and the sample description information is input into the text encoder 1202 after feature extraction by the large language model 1203, so as to obtain multiple sample time series vectors (TS1, TS2, TS3, TS4, TS5) and sample description vectors (TXT1, TXT2, TXT3, TXT4, TXT5) mapped into the vector space. The distance representing the cosine similarity between each sample time series vector and the sample description vector is calculated in turn through the symmetric cross entropy. Fig.12The dark squares in the middle represent the distance between the corresponding sample time series vector and the sample description vector. The distance between the sample time series vector and other sample description vectors and the distance between the sample description vector and other sample time series vectors is the smallest. Correspondingly, the correlation between the corresponding sample time series and sample description information is large. The sample time series and sample description information with large correlation are used as positive samples, and the sample time series and sample description information with small correlation are used as negative samples. They are converted into positive and negative sample classification problems in contrastive learning, so that the distance between the time series vector finally learned and the matching sample description vector is minimized, and the training is completed.
[0240] In this embodiment, the predicted time series is encoded and mapped to the vector space through the time series encoder to obtain the time series vector; and the sample description information is encoded and mapped to the vector space through the text encoder to obtain the sample description vector; based on the distance between the time series vector and the sample description vector in the vector space, the second target loss is determined. The predicted time series and the sample description information in text format are mapped to the same vector space, and the loss between the predicted time series and the sample description information is calculated by the distance in the vector space, thereby achieving the purpose of quantifying the loss of information of different dimensions.
[0241] A method for predicting a time series in a supply chain scenario provided in an embodiment of the present application is introduced above. A device for executing the method for predicting a time series in a supply chain scenario will be introduced below.
[0242] Fig.13 1 is a schematic diagram of a structure of a time series prediction device in a supply chain scenario provided by an embodiment of the present application. The time series prediction device 1300 in the supply chain scenario includes:
[0243] An obtaining unit 1301 is used to obtain a historical time series and text information corresponding to a contemporary object in a supply chain scenario, wherein the historical time series includes data corresponding to a to-be-predicted item of the contemporary object at a historical time;
[0244] The prediction unit 1302 is used to predict the target time series of the contemporary object according to the historical time series and the text information through a prediction model, and the target time series includes data corresponding to the predicted item of the contemporary object at at least one future time.
[0245] In a possible implementation, the text information includes generation information corresponding to the contemporary object, and the generation information is obtained based on contemporary description information of the contemporary object, a previous generation historical time series and previous generation description information corresponding to at least one previous generation object.
[0246] In a possible implementation, the obtaining unit is specifically used for:
[0247] Obtain a contemporary historical time series and contemporary description information of a contemporary object in a supply chain scenario, wherein the contemporary historical time series includes data corresponding to the to-be-predicted item of the contemporary object in a first historical period, and the contemporary description information includes at least description information related to the target time series; and obtain a previous historical time series and previous description information of at least one previous generation object, wherein the previous historical time series includes data corresponding to the corresponding item of the previous generation object in a second historical period, and the previous description information includes at least description information related to the previous historical time series, and the start time of the second historical period is earlier than the start time of the first historical period.
[0248] In a possible implementation, the prediction unit is specifically configured to:
[0249] According to the contemporary historical time series and the contemporary description information, the contemporary features of the contemporary object are obtained; and, through the first module in the prediction model, the previous historical time series and the previous description information of each previous generation object are subjected to attention processing to obtain the intergenerational features of each previous generation object;
[0250] Merging the intergenerational features of the previous generation objects to obtain the previous generation features;
[0251] Through the language processing module in the prediction model, the target time series of the contemporary object is predicted based on the contemporary features and the previous features.
[0252] In a possible implementation, the text information includes prediction condition information corresponding to the contemporary object, and the prediction condition information represents a description of a data change trend of a to-be-predicted item of the contemporary object at at least one future time.
[0253] In a possible implementation, the prediction unit is specifically used to:
[0254] By using the prediction module of the prediction model, an initial sequence of the contemporary object is predicted based on the historical time series, and the initial sequence includes initial data corresponding to the item to be predicted of the contemporary object at at least one future time;
[0255] Through the diffusion module of the prediction model, the initial sequence is adjusted according to the prediction condition information to obtain the target time sequence of the contemporary object.
[0256] In one possible implementation, the diffusion module of the prediction model is obtained by the following method:
[0257] Obtain sample historical time series and sample prediction condition information;
[0258] Add noise to the historical time series of the sample to obtain noise;
[0259] The sample prediction condition information is used as a condition to denoise the noise and obtain a sample target time series;
[0260] Determining a first target loss based on the sample prediction condition information and the sample target time series;
[0261] The parameters of the diffusion module are adjusted based on the first target loss, and the noise step is obtained by returning to the historical time series of the sample to obtain the noise step until the module convergence condition is reached, thereby obtaining the diffusion module with the adjusted parameters.
[0262] In a possible implementation, the prediction module of the prediction model is obtained by the following method:
[0263] Obtain a first sample time series and a second sample time series, wherein the time corresponding to the second sample time series is later than that of the first sample time series;
[0264] By using the prediction module of the prediction model, a prediction time series is obtained according to the first sample time series, and the prediction time series corresponds to the second sample time series in time;
[0265] Converting the second sample time series into sample description information;
[0266] Determine a second target loss based on the sample description information and the predicted time series; and determine a third target loss based on the second sample time series and the predicted time series;
[0267] Based on the second target loss and the third target loss, the parameters of the prediction module are adjusted, and the prediction module that passes the prediction model is returned to be executed. According to the first sample time series, the prediction time series step is obtained until the module convergence condition is reached, and the prediction module with adjusted parameters is obtained.
[0268] In a possible implementation, determining the second target loss based on the sample description information and the predicted time series includes:
[0269] The predicted time series is encoded and mapped to a vector space through a time series encoder to obtain a time series vector; and the sample description information is encoded and mapped to the vector space through a text encoder to obtain a sample description vector;
[0270] Based on the distance between the time series vector and the sample description vector in the vector space, a second target loss is determined.
[0271] It should be noted that for the functional explanation of each component structure in the time series prediction device in the supply chain scenario provided in this embodiment, please refer to the explanation in the aforementioned method embodiment, and no further details will be given here.
[0272] In this embodiment, the historical time series and text information corresponding to the contemporary object in the supply chain scenario are obtained, and the historical time series includes the data corresponding to the item to be predicted of the contemporary object at the historical time; through the prediction model, based on the historical time series and the text information, the target time series of the contemporary object is predicted, and the target time series includes the data corresponding to the item to be predicted of the contemporary object at at least one future time. When the prediction model predicts the target time series, it utilizes the language ability of the model to be predicted, and can combine the content in the text information, and predict the target time series based on the historical time series corresponding to the contemporary object and the specific content in the text information, thereby improving the prediction accuracy.
[0273] The present application also provides an electronic device in an embodiment. Fig.14 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Fig.14 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0274] like Fig.14 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1402 or a program loaded from a storage device 1408 to a random access memory (RAM) 1403. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 1403. The processing device 1401, the ROM 1402, and the RAM 1403 are connected to each other via a bus 1404. An input / output (I / O) interface 1405 is also connected to the bus 1404.
[0275] Typically, the following devices may be connected to the I / O interface 1405: an input device 1406 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1408 including, for example, a memory card, a hard disk, etc.; and a communication device 1409. The communication device 1409 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Fig.14 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0276] Also provided in an embodiment of the present application is a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements a method for predicting time series in any supply chain scenario provided in an embodiment of the present application.
[0277] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement a time series prediction method in any supply chain scenario provided in an embodiment of the present application.
[0278] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0279] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0280] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0281] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A time series prediction method in a supply chain scenario, comprising: Obtaining a historical time series and text information corresponding to a contemporary object in a supply chain scenario, wherein the historical time series includes data corresponding to a to-be-predicted item of the contemporary object at a historical time; Through the prediction model, based on the historical time series and the text information, a target time series of the contemporary object is predicted, and the target time series includes data corresponding to the item to be predicted of the contemporary object at at least one future time.
2. According to the time series prediction method in the supply chain scenario described in claim 1, the text information includes generational information corresponding to the contemporary object, and the generational information is obtained based on contemporary description information of the contemporary object, previous generation historical time series corresponding to at least one previous generation object, and previous generation description information.
3. According to the method for predicting time series in a supply chain scenario according to claim 1 or 2, the step of obtaining the historical time series and text information corresponding to the contemporary objects in the supply chain scenario comprises: Obtaining a contemporary historical time series and contemporary description information of a contemporary object in a supply chain scenario, wherein the contemporary historical time series includes data corresponding to a to-be-predicted item of the contemporary object in a first historical period, and the contemporary description information includes at least description information related to the target time series; Furthermore, a previous historical time series and previous description information of at least one previous object are obtained, wherein the previous historical time series includes data corresponding to the corresponding items of the previous object in the second historical period, and the previous description information includes at least description information related to the previous historical time series, and the start time of the second historical period is earlier than the start time of the first historical period.
4. According to the method for predicting time series in a supply chain scenario of claim 3, the step of predicting the target time series of the contemporary object based on the historical time series and the text information through the prediction model comprises: Obtaining contemporary features of the contemporary object according to the contemporary historical time series and the contemporary description information; And, by using the first module in the prediction model, the previous generation historical time series and the previous generation description information of each of the previous generation objects are subjected to attention processing to obtain the generational characteristics of each of the previous generation objects; Merging the intergenerational features of the previous generation objects to obtain previous generation features; The target time series of the contemporary object is predicted based on the contemporary features and the previous features through the language processing module in the prediction model.
5. According to the time series prediction method in the supply chain scenario described in claim 1, the text information includes prediction condition information corresponding to the contemporary object, and the prediction condition information represents the data change trend description of the predicted item of the contemporary object at at least one future time.
6. The method for predicting time series in a supply chain scenario according to claim 5, wherein the method predicts the target time series of the contemporary object based on the historical time series and the text information through the prediction model, comprising: By using the prediction module of the prediction model, an initial sequence of the contemporary object is predicted based on the historical time series, wherein the initial sequence includes initial data corresponding to the item to be predicted of the contemporary object at at least one future time; The initial sequence is adjusted according to the prediction condition information through the diffusion module of the prediction model to obtain the target time sequence of the contemporary object.
7. According to the method for predicting time series in a supply chain scenario of claim 6, the diffusion module of the prediction model is obtained by the following method: Obtain sample historical time series and sample prediction condition information; Adding noise to the sample historical time series to obtain noise; Using the sample prediction condition information as a condition, denoising the noise to obtain a sample target time series; Determining a first target loss based on the sample prediction condition information and the sample target time series; The parameters of the diffusion module are adjusted based on the first target loss, and the step of adding noise to the sample historical time series is returned to obtain the noise step until the module convergence condition is reached, thereby obtaining a diffusion module with adjusted parameters.
8. According to the method for predicting time series in a supply chain scenario in claim 5, the prediction module of the prediction model is obtained by the following method: Obtain a first sample time series and a second sample time series, wherein the time corresponding to the second sample time series is later than that of the first sample time series; Obtaining a predicted time series according to the first sample time series by using a prediction module of the prediction model, wherein the predicted time series corresponds to the second sample time series in time; Converting the second sample time series into sample description information; Determine a second target loss based on the sample description information and the predicted time series; and determine a third target loss based on the second sample time series and the predicted time series; Based on the second target loss and the third target loss, the parameters of the prediction module are adjusted, and the prediction module that passes the prediction model is returned to be executed, and the prediction time series step is obtained according to the first sample time series, until the module convergence condition is reached, and the prediction module with adjusted parameters is obtained.
9. The method for predicting time series in a supply chain scenario according to claim 8, wherein determining the second target loss based on the sample description information and the predicted time series comprises: Mapping the predicted time series code to a vector space through a time series encoder to obtain a time series vector; And, encoding and mapping the sample description information to the vector space through a text encoder to obtain a sample description vector; A second target loss is determined based on the distance between the time series vector and the sample description vector in the vector space.
10. A time series prediction device in a supply chain scenario, comprising: An acquisition module, used to obtain a historical time series and text information corresponding to a contemporary object in a supply chain scenario, wherein the historical time series includes data corresponding to a to-be-predicted item of the contemporary object at a historical time; The prediction module is used to predict the target time series of the contemporary object based on the historical time series and the text information through a prediction model, and the target time series includes data corresponding to the predicted items of the contemporary object at at least one future time.