Time sequence prediction method, model construction method and device
By selecting relevant sample objects associated with the target sample object and introducing distribution distance loss value parameter adjustment, the problem of poor training effect of the time series prediction model when the amount of time series data is small is solved, and the prediction accuracy and efficiency are improved.
Patent Information
- Application Number
- CN202310202186.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-03
- Publication Date
- 2024-09-03
AI Technical Summary
When the amount of time series data is small, it is difficult to train a time series prediction model with good prediction effect using existing technology. Especially when there is a large distribution difference between the existing time series data set and the pre-trained model, it is difficult to obtain targeted fine-tuning. An effective prediction model for target commodities.
By selecting relevant sample objects associated with the target sample object, a transfer learning model is constructed, and the distribution distance loss value between the target sample object and the relevant sample object is introduced during the training process to adjust parameters to determine the parameters of the time series prediction model.
Constructing an effective time series prediction model when the number of target samples is small improves the prediction accuracy and efficiency and ensures the accuracy of the time series prediction model.
Smart Images

Figure CN118586533A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of machine learning technology, and specifically to a method and device for constructing a time series prediction model, a time series prediction method, a time series prediction device, a time series prediction model, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] Currently, there is a need to predict related tasks in various business or commercial fields in order to adaptively adjust current business or future plans. For example, it may be necessary to predict the sales volume of a product to understand the market demand for the product and the effectiveness of promotional activities.
[0003] However, in the related art, time series data is usually predicted by training a time series prediction model. However, when the amount of time series data is small, it is difficult to train a model with good prediction effect.
[0004] The methods described in this section are not necessarily methods that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any method described in this section is considered to be prior art simply because it is included in this section. Similarly, unless otherwise indicated, the issues mentioned in this section should not be considered to have been recognized in any prior art. Summary of the invention
[0005] The present disclosure provides a method and device for constructing a time series prediction model, a time series prediction method, a time series prediction device, a time series prediction model, an electronic device, a computer-readable storage medium, and a computer program product.
[0006] According to one aspect of the present disclosure, a method for constructing a time series prediction model is provided, comprising: obtaining first historical time series feature data of a target sample object and second historical time series feature data of a plurality of candidate sample objects; using at least the second historical time series feature data of the plurality of candidate sample objects as a model input for pre-training to obtain a transfer learning model, wherein the output of the transfer learning model includes the predicted time series feature data of the plurality of candidate sample objects; determining relevant sample objects associated with the target sample object from the plurality of candidate sample objects; inputting at least the first historical time series feature data of the target sample object and the second historical time series feature data of the relevant sample objects into the transfer learning model to obtain the first predicted time series feature data of the target sample object and the second predicted time series feature data of the relevant sample objects, as well as a distribution distance value between the target sample object and the relevant sample objects, wherein the distribution distance value is used to characterize the similarity between the first historical time series feature data and the second historical time series feature data; adjusting the parameters of the transfer learning model based on the first predicted time series feature data, the second predicted time series feature data and the distribution distance value; and determining the model parameters of the time series prediction model based on the parameters of the transfer learning model after the parameter adjustment.
[0007] According to another aspect of the present disclosure, there is provided a time series prediction model trained by the construction method according to the present disclosure, wherein the time series prediction model is used to predict predicted time series feature data of a target object within a preset time, the target object has historical time series feature data before the preset time, and the time series prediction model comprises: a time series feature encoder, used to encode the historical time series feature data to obtain a historical time series feature encoding of the target object; a feature decoder, used to obtain a time series feature decoding of the target object based at least on the historical time series feature encoding; and a prediction output layer, used to determine the predicted time series feature data of the target object within the preset time based on the time series feature decoding.
[0008] According to another aspect of the present disclosure, a time series prediction method is provided, comprising: acquiring historical time series feature data of a target object; and inputting at least the historical time series feature data of the target object into a time series prediction model according to the present disclosure to obtain predicted time series feature data of the target object within a preset time.
[0009] According to another aspect of the present disclosure, a device for constructing a time series prediction model is provided, comprising: a first acquisition module, the first acquisition module being configured to acquire first historical time series feature data of a target sample object and second historical time series feature data of a plurality of candidate sample objects; a pre-training module, the pre-training module being configured to use the second historical time series feature data of the plurality of candidate sample objects as model input for pre-training to obtain a transfer learning model, the output of the transfer learning model comprising the predicted time series feature data of the plurality of candidate sample objects; a first determination module, the first determination module being configured to determine relevant sample objects associated with the target sample object from the plurality of candidate sample objects; and a first input module, the first input module being configured to use at least the first historical time series feature data of the target sample object as a model input for pre-training to obtain a transfer learning model, the output of the transfer learning model comprising the predicted time series feature data of the plurality of candidate sample objects. The historical time series feature data and the second historical time series feature data of the related sample object are input into the transfer learning model to obtain the first predicted time series feature data of the target sample object and the second predicted time series feature data of the related sample object and the distribution distance value between the target sample object and the related sample object, and the distribution distance value is used to characterize the similarity between the first historical time series feature data and the second historical time series feature data; a parameter adjustment module, which is configured to adjust the parameters of the transfer learning model based on the first predicted time series feature data, the second predicted time series feature data and the distribution distance value; and a second determination module, which is configured to determine the model parameters of the time series prediction model based on the parameters of the transfer learning model after the parameter adjustment.
[0010] According to another aspect of the present disclosure, a time series prediction device is provided, comprising: a second acquisition module, the second acquisition module is configured to acquire historical time series feature data of a target object; and a second input module, the second input module is configured to input at least the historical time series feature data of the target object into a time series prediction model according to the present disclosure, so as to obtain predicted time series feature data of the target object within a preset time.
[0011] According to another aspect of the present disclosure, an electronic device is provided, comprising: a memory, a processor, and a computer program stored on the memory, wherein the processor is configured to execute the computer program to implement the steps of the construction method according to the present disclosure and / or the timing prediction method according to the present disclosure.
[0012] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the construction method according to the present disclosure and / or the time series prediction method according to the present disclosure are implemented.
[0013] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program implements the steps of the construction method according to the present disclosure and / or the timing prediction method according to the present disclosure when executed by a processor.
[0014] In one or more embodiments of the present disclosure, a related sample object associated with a target sample object is selected from the candidate sample objects to be used as a training sample together with the target sample object, a transfer learning model constructed using the candidate sample objects is trained, and then the model parameters of the time series prediction model are determined based on the parameters of the trained transfer learning model. Thus, it is possible to construct an effective time series prediction model when the number of target samples is small, thereby improving the efficiency of obtaining the time series prediction model and the prediction accuracy of the time series prediction model. In addition, when training the transfer learning model, the distribution distance loss value of the target sample object and the related sample object is introduced to adjust the parameters of the time series prediction model, so that the accuracy of the time series prediction model obtained using the target sample object and the related sample object can be higher.
[0015] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0017] Figure 1 A structural block diagram of a time series prediction model according to some exemplary embodiments of the present disclosure is shown;
[0018] Figure 2 A structural block diagram of a transfer learning model according to some other exemplary embodiments of the present disclosure is shown;
[0019] Figure 3 A flowchart of a method for constructing a time series prediction model according to some exemplary embodiments of the present disclosure is shown;
[0020] Figure 4 A flowchart of a time series prediction method according to some exemplary embodiments of the present disclosure is shown;
[0021] Figure 5 A structural block diagram of a device for constructing a time series prediction model according to some exemplary embodiments of the present disclosure is shown;
[0022] Figure 6 A structural block diagram of a time series prediction device according to some exemplary embodiments of the present disclosure is shown; and
[0023] Figure 7 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0024] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0025] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, timing relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.
[0026] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations.
[0027] In the related art, when training a time series prediction model for the sales of a target product, a new time series prediction model is usually trained using the time series data set of the target product, or an existing pre-trained model is fine-tuned using the time series data set of the target product to obtain a new time series prediction model. However, the above method of training a new time series prediction model is difficult to train a model with good prediction effect when the amount of data in the time series data set is small. And the above method of fine-tuning an existing pre-trained model is difficult to obtain a model with good prediction effect for the target product through fine-tuning when the distribution difference between the existing time series data set and the data set used for training the pre-trained model is large.
[0028] To solve the above problems, the present disclosure provides a method for constructing a time series prediction model. Relevant sample objects associated with a target sample object are selected from candidate sample objects to be used as training samples together with the target sample object, and a transfer learning model constructed using the candidate sample objects is trained, and then the parameters of the time series prediction model are determined based on the model parameters of the trained transfer learning model. Thus, it is possible to construct an effective time series prediction model when the number of target samples is small, thereby improving the efficiency of obtaining the time series prediction model and the prediction accuracy of the time series prediction model. In addition, when training the transfer learning model, the distribution distance loss value between the target sample object and the relevant sample object is introduced to adjust the parameters of the time series prediction model, so that the accuracy of the time series prediction model constructed using the target sample object and the relevant sample object can be higher.
[0029] In this article, "target object", "target sample object" and "candidate sample object" may include objects involving time series feature data such as commodity sales, for example, sales of a type of commodity (for example, sales of a brand of commodity), sales of a commodity, or sales of commodities in a store. In addition, "target object", "target sample object" and "candidate sample object" may also be objects involving time series feature data such as product shipments and product purchases. "Time series feature data" refers to data that changes over time for target objects, target sample objects and candidate sample objects over a period of time. For example, when the target object is commodity sales, time series feature data refers to data that changes over time for commodity sales over a period of time (that is, the sales volume of commodities over a period of time). "Historical time series feature data" refers to the time series feature data of target objects, target sample objects and candidate sample objects before a preset time period. "Predicted time series feature data" refers to the time series feature data of target objects, target sample objects and candidate sample objects in a preset time period.
[0030] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0031] Figure 1 The structural block diagram of a time series prediction model 1000 according to some exemplary embodiments of the present disclosure is shown. The time series prediction model 1000 is used to predict the predicted time series feature data of a target object within a preset time period. The target object has historical time series feature data before the preset time. Figure 1As shown, the time series prediction model 1000 may include a time series feature encoder 110. The time series feature encoder 110 is used to encode the historical time series feature data of the input target object to obtain the historical time series feature encoding of the target object. The time series feature encoder can use any network structure for time series feature encoding, such as an RNN network structure, a Wavenet network structure, or other network structures based on a time series feature extraction layer (e.g., based on a 1-dimensional convolutional layer). Figure 1 In the example, the input target object is the sales of brand O products, which has historical time series feature data The time series feature encoder 110 is derived from the product sales D of brand O. o Historical time series feature data Extracting historical time series feature codes Herein, g represents the dimension of the temporal feature encoder 110, and n refers to n time periods before a preset time period.
[0032] In some embodiments, the time series prediction model 1000 may further include a feature decoder 140. The feature decoder 140 is used to obtain the time series feature decoding of the target object based on at least the historical time series feature encoding extracted by the time series feature encoder 110, so as to be input into the prediction output layer 150 to obtain the predicted time series feature data.
[0033] In some embodiments, the time series prediction model 1000 may further include a prediction output layer 150. The prediction output layer 150 is used to determine the predicted time series feature data of the target object within a preset time based on the time series feature decoding. The prediction output layer 150 may adopt a model such as an MLP (Multilayer Perceptron) multilayer perceptron, a classification model, etc. Figure 1 In the example of FIG. 1 , the prediction output layer 150 is based on at least the historical time series feature encoding The obtained time series feature decoding determines the predicted time series feature data Here, m refers to m time periods in the preset time.
[0034] In some embodiments, when the target object also has attribute information, the time series prediction model 1000 may also include a static feature encoder 130. The attribute information includes information used to describe the static attribute characteristics of the target object. For example, when the target object represents commodity sales, the attribute information may include the type, color, weight and other attributes of the commodity itself that are related to the commodity sales. The static feature encoder 130 is used to encode the attribute information of the target object to obtain the attribute feature encoding of the target object. Its main purpose is to encode discrete static features into numerical feature vectors for subsequent calculations. Figure 1In the example of FIG. 1 , the static feature encoder 130 receives the sales data D of the product of brand O from the input o Attribute information o Extract the attribute feature code k o In some examples, the time series prediction model 1000 may further include a fusion layer 160 for fusing at least the historical time series feature encoding and the attribute feature encoding to obtain a fusion vector of the target object. At this time, the feature decoder 140 is used to decode the fusion vector to obtain a time series feature decoding of the target object for inputting into the prediction output layer 150.
[0035] In some other embodiments, the target object also has preset event information within a preset time, wherein the preset event information includes information for describing events set by the target object in a preset time period that can change its time series feature data. For example, when the target object represents commodity sales, the preset event information may include preset promotional activities, preset promotional activities, festivals and other events related to commodity sales within a preset time period. At this time, the fusion layer 160 is used to fuse at least the historical time series feature encoding and the preset event text vector of the preset event information to obtain a fusion vector of the target object. The feature decoder 140 is used to decode the fusion vector to obtain the time series feature decoding of the target object, so as to be input into the prediction output layer 150 to obtain the predicted time series feature data.
[0036] In the case where the target object has attribute information and a preset event text vector of preset event information within a preset time, the fusion layer 160 is used to fuse the historical temporal feature encoding, the attribute feature encoding, and the preset event text vector of the preset event information to obtain a fusion vector of the target object. The feature decoder 140 is used to decode the fusion vector to obtain a temporal feature decoding of the target object, and input the temporal feature decoding into the prediction output layer for determining the predicted temporal feature data. Figure 1 In the example of o Historical time series feature encoding Attribute feature encoding k o And the text vector of the preset event information The fusion is performed to obtain a fusion vector, and then the fusion vector is input into the feature decoder 140 to obtain the time series feature decoding for the sales of goods of brand O, and then the time series feature decoding is input into the prediction output layer 150 to obtain the predicted time series feature data of the sales of goods of brand O within a preset time.
[0037] Figure 2 FIG. 2 shows a transfer learning model 2000 constructed during the training of the time series prediction model 1000. Figure 2As shown, the transfer learning model 2000 may include: a time series feature encoder 210. The structure of the time series feature encoder 210 is the same as the structure of the time series feature encoder 110 in the time series prediction model 1000. Figure 2 In the example of FIG. 1 , the temporal feature encoder 210 obtains the sales volume D of the product of the target sample object brand T from t The first historical time series feature data Extract the first historical time series feature code and the sales of goods D from the relevant sample objects related goods S The second historical time series feature data Extract the second historical time series feature code Wherein, g represents the dimension of the temporal feature encoder 210.
[0038] In some embodiments, the transfer learning model 2000 may further include a distribution distance determination layer 220. The distribution distance determination layer 220 is used to calculate the distribution distance between the historical time series feature codes extracted by the time series feature encoder 210 from the historical time series feature data of the target sample object and the related sample object, and specifically, to calculate the distribution distance between the first historical time series feature code and the second historical time series feature code. The calculated distribution distances include but are not limited to relative entropy, JS divergence, Wasserstein distance, COS similarity, etc. Figure 2 In the example of the distribution distance determination layer 220, the first historical time series feature code is calculated. and the second historical time series feature encoding The distribution distance between Among them, i=1~g.
[0039] In some embodiments, the transfer learning model 2000 may further include a feature decoder 240. The feature decoder 240 is used to determine the temporal feature decoding of the target object based at least on the historical temporal feature encoding extracted by the temporal feature encoder 210. The structure of the feature decoder 240 is the same as that of the feature decoder 140 in the temporal prediction model 1000.
[0040] In some embodiments, the transfer learning model 2000 may further include a prediction output layer 250. The prediction output layer 250 is used to determine the predicted time series feature data of a preset time period based on the time series feature decoding. The structure of the prediction output layer 250 is the same as the structure of the prediction output layer 150 in the time series prediction model 1000. Figure 2 In the example of FIG. 1 , the prediction output layer 250 encodes at least the first historical time series feature of the input Determine the first prediction time series feature data And based on the second historical time series feature encoding Determine the second prediction time series feature data
[0041] In some embodiments, when the target sample object also has first attribute information and the related sample object also has second attribute information, the transfer learning model 2000 may further include a static feature encoder 230. The first attribute information and the second attribute information include information for describing the static attribute characteristics of the target sample object and the related sample objects. For example, when the target sample object and the related sample object represent commodity sales, the first attribute information and the second attribute information may include the type, color, weight and other attributes inherent to the commodity itself related to the commodity sales. The static feature encoder 230 is used to encode the attribute information of the target sample object and the related sample objects. The main purpose is to encode discrete static features into numerical feature vectors for subsequent calculations. The structure of the static feature encoder 230 is the same as that of the static feature encoder 130 in the time series prediction model 1000. Figure 2 In the example of FIG. 1 , the static feature encoder 230 receives the sales data D of the product of brand T from the input T The first attribute information e t Extract the first attribute feature code k t , and sales of related products from the input S The second attribute information e s Extract the second attribute feature code k s At this time, the transfer learning model 2000 may also include a fusion layer 260 for fusing the first historical time series feature code and the first attribute feature code of the target sample object, and fusing the second historical feature code and the second attribute feature code of the related sample object, so as to obtain a first fusion vector for inputting the prediction output layer 250, the target sample object, and a second fusion vector for the related sample object. The prediction output layer 250 may determine the first predicted time series feature data of the target sample object and the second predicted time series feature data of the related sample object for a preset time period based on the first fusion vector and the second fusion vector.
[0042] In some embodiments, the target sample object also has first preset event information and the related sample object also has second preset event information. The first preset event information and the second preset event information include information for describing preset events that can change the time series feature data of the target sample object and the related sample object in a preset time period, etc. For example, when the target sample object and the related sample object represent commodity sales, the first preset event information and the second preset event information may include preset promotion activities, preset promotion activities, festivals and other events related to commodity sales in a preset time period. At this time, the transfer learning model 2000 also includes a fusion layer 260, which is used to fuse the first historical time series feature encoding of the target sample object and the text vector of the first preset event information, and to fuse the second historical time series feature encoding of the related sample object and the text vector of the second preset event information to obtain the first fusion vector of the target sample object and the second fusion vector of the related sample object for input into the feature decoder 240. The feature decoder 240 is used to decode the first fusion vector and the second fusion vector respectively to determine the first time series feature decoding of the target sample object and the second time series feature decoding of the related sample object respectively. The structure of the feature decoder 240 is the same as that of the feature decoder 140 in the time series prediction model 1000 .
[0043] In some embodiments, when the target sample object also has first preset event information and first attribute information and the related sample object also has second preset event information and second attribute information, the fusion layer 260 is used to fuse the first historical temporal feature coding of the target sample object and the text vector of the first preset event information and the first attribute feature coding, and to fuse the second historical temporal feature coding of the related sample object and the text vector of the second preset event information and the second attribute feature coding, so as to obtain a first fusion vector of the target sample object and a second fusion vector of the related sample object for input into the feature decoder. The feature decoder 240 is used to decode the first fusion vector and the second fusion vector, respectively, to determine the first temporal feature decoding of the target sample object and the second temporal feature decoding of the related sample object. The structure of the feature decoder 240 is the same as that of the feature decoder 140 in the temporal prediction model 1000. Figure 2 In the example of t The first historical temporal feature encoding The first attribute feature code k t And the text vector of the preset event information The fusion is performed to obtain the first fusion vector, and the product sales D for the related products is s The second historical temporal feature encoding The second attribute feature code k sAnd the text vector of the preset event information The first fusion vector and the second fusion vector are then input into the feature decoder 240 to obtain the product sales D for brand T. t The first time series feature decoding and the commodity sales D for related commodities S The second time series feature decoding is then input into the prediction output layer 250 to obtain the first prediction time series feature data. And the second prediction time series feature data
[0044] In some embodiments, the transfer learning model 2000 is constructed based on the time series prediction model 1000. In this case, except for the distribution distance determination layer 220, the other structural parameters of the transfer learning model 2000 are the same as the structural parameters of the time series prediction model 1000. Among them, the structural parameters refer to the parameters related to the structure of the model, for example, how many layers the model has, the output data dimension of each layer, and the activation function used in each layer.
[0045] It should be understood that the transfer learning model 2000 constructed during training can be directly used as the time series prediction model for the target sample object, or the transfer learning model 2000 without the distribution distance determination layer 220 can be used as the time series prediction model for the target sample object. Figure 1 The time series prediction model 1000 shown in FIG. 1 is then used to copy the model parameters of the trained transfer learning model 2000 to Figure 1 In the time series prediction model 1000 shown, a time series prediction model for a target sample object is obtained. The model parameters refer to the parameter weights used for calculation in the network structure.
[0046] Figure 3 A flowchart of a method 3000 for constructing a time series prediction model (eg, the time series prediction model 1000 described above) according to some exemplary embodiments of the present disclosure is shown. Figures 1 to 3, describing in detail each step of the construction method 3000. As shown in the figure, the construction method 3000 may include: step S301, obtaining the first historical time series feature data of the target sample object and the second historical time series feature data of multiple candidate sample objects; step S302, at least using the second historical time series feature data of multiple candidate sample objects as model input for pre-training to obtain a transfer learning model, the output of the transfer learning model includes the predicted time series feature data of multiple candidate sample objects; step S303, determining the relevant sample objects associated with the target sample object from the multiple candidate sample objects; step S304, at least using the first historical time series feature data of the target sample object and the relevant The second historical time series feature data of the sample object is input into the transfer learning model to obtain the first predicted time series feature data of the target sample object, the second predicted time series feature data of the related sample object and the distribution distance value between the target sample object and the related sample object, and the distribution distance value is used to characterize the similarity between the first historical time series feature data and the second historical time series feature data; step S305, based on the first predicted time series feature data, the second predicted time series feature data and the distribution distance value, the transfer learning model is adjusted; and step S306, based on the parameters of the transfer learning model after the adjustment, the model parameters of the time series prediction model are determined.
[0047] In step S301, first historical time series feature data of a target sample object and second historical time series feature data of a plurality of candidate sample objects are acquired.
[0048] In some embodiments, the target sample object may be an object involving time series feature data, such as sales of a type of commodity (e.g., sales of a brand of commodity), sales of a commodity, or sales of commodities in a store. In addition, the target sample object may also be product shipments, product purchases, etc. In some examples, when the target sample object is commodity sales, the time series feature data refers to data on changes in commodity sales over time within a period of time. In some examples, the target sample object may also include real time series feature data, which refers to the real sales volume of commodity sales within a preset time period. Historical time series feature data refers to the historical sales volume of commodity sales before the preset time period. Specifically, for example, in Figure 2 In the example, the target sample object refers to the sales volume of brand T’s product D t , where the first real time series feature data of the sales of brand T products in a preset time period The first historical time series feature data of brand T’s product sales before the preset time period
[0049] In some embodiments, the candidate sample objects may be objects involving time series feature data, such as sales of a type of goods (e.g., sales of a brand of goods), sales of a commodity, or sales of goods in a store. In some examples, when the candidate sample object is sales of goods, the time series feature data refers to data on changes in sales of goods (i.e., sales volume) over time over a period of time. In addition, the candidate sample objects may also include real time series feature data, which refers to the real sales volume of goods within a preset time period. Historical time series feature data refers to the historical sales volume of goods before the preset time period. Specifically, in Figure 2 In the example, the candidate sample object refers to the product sales of brand B, and the multiple candidate sample objects refer to the product sales of at least one product in brand B. B The second real time series feature data of the sales of a product of brand B in a preset time period The second historical time series feature data before the preset time period
[0050] It should be understood here that although in the above examples, the historical time periods of the historical time series feature data selected for the target sample object and the candidate sample object are the same, both are 1 to n time periods, the historical time periods of the historical time series feature data of the target sample object and the candidate sample object may also be different, for example, the historical time period of the historical time series feature data of the candidate sample object is longer or shorter than the historical time period of the historical time series feature data of the target sample object.
[0051] In some embodiments, the candidate sample objects may be sample objects that have a certain correlation or similarity with the target sample object. For example, when the target sample object refers to the sale of new coffee, the candidate sample object may be selected as the sale of old coffee. Alternatively or additionally, multiple candidate sample objects may come from the training data set used in the training of the pre-trained time series prediction model, thereby using the transfer learning method to migrate the pre-trained time series prediction model to the time series prediction model for the target sample object.
[0052] In step S302, at least the second historical time series feature data of multiple candidate sample objects are used as model input for pre-training to obtain a transfer learning model.
[0053] In some examples, the transfer learning model can be a transfer learning model (e.g., transfer learning model 2000) constructed based on a time series prediction model (e.g., time series prediction model 1000) pre-trained based on multiple candidate sample objects, or it can be a completely new transfer learning model that directly uses multiple candidate sample objects for pre-training.
[0054] In step S303, relevant sample objects associated with the target sample object are determined from a plurality of candidate sample objects.
[0055] The determined related sample objects may refer to one or more candidate sample objects. Figure 2 In the example, the product sales D of at least one product of brand B B Determine the sales volume of goods with brand T t Product sales of related products D S In the above steps, the relevant sample objects associated with the target sample object are determined from multiple candidate sample objects, which can avoid the sample objects that are not associated with the target sample object from being mixed into the training process of the time series prediction model for the target sample object, so that the prediction effect of the trained time series prediction model for the target sample object decreases instead of increases, thereby leading to the phenomenon of negative transfer.
[0056] In step S304, at least the first historical time series feature data of the target sample object and the second historical time series feature data of the related sample object are input into the transfer learning model to obtain the first predicted time series feature data of the target sample object, the second predicted time series feature data of the related sample object, and the distribution distance value between the target sample object and the related sample object.
[0057] Specifically, in Figure 2 In the example, at least D t The first historical time series feature data Sales of related products S The second historical time series feature data Input into the transfer learning model 2000 to obtain the product sales D of brand T t The first predicted time series feature data in the preset time period Product sales of related products D S The second prediction time series feature data in the preset time period And the sales of brand T products D t Sales of related products S The distribution distance between them.
[0058] In step S305, the transfer learning model is adjusted based on the first prediction time series feature data, the second prediction time series feature data and the distribution distance value.
[0059] Among them, the gradient descent method can be used to minimize the loss value (for example, the difference between the predicted data and the real data) and the distribution distance value to train the parameters of the pre-trained model.
[0060] In step S306, the model parameters of the time series prediction model are determined based on the parameters of the transfer learning model after parameter adjustment.
[0061] For example, the model parameters of a specific layer of the transfer learning model can be copied to the model parameters of the corresponding layer of the time series prediction model. Figure 2 The model parameters of the temporal feature encoder in are copied to Figure 1 In the model parameters of the timing encoder in Figure 2 The model parameters of the feature decoder in are copied to Figure 1 The model parameters of the feature decoder in are medium.
[0062] By selecting the relevant sample objects associated with the target sample objects from the candidate sample objects as the training samples of the pre-trained transfer learning model together with the target sample objects, it is possible to effectively construct a time series prediction model for the target sample objects when the number of target samples is small, so as to improve the efficiency of the time series prediction model construction and the prediction accuracy of the time series prediction model. That is to say, when constructing a time series prediction model for the target sample object, for example, using the existing time series prediction model pre-trained using the candidate sample objects as the migration object, the results of the pre-trained time series prediction model are migrated to the newly constructed migration learning model, so that the previously existing pre-trained model can be reused, reducing the amount of calculation for model training and the cost of the resources used. At this time, the pre-trained time series prediction model can be directly used as a transfer learning model, or as a transfer learning model after adding a distribution distance determination layer, or its structural parameters and model parameters can be copied to the transfer learning model. In addition, when training the time series prediction model, the distribution distance loss value of the target sample object and the relevant sample object is introduced to adjust the parameters of the transfer learning model, so that the accuracy of the final time series prediction model can be higher.
[0063] In some embodiments, when the transfer learning model includes a time series feature encoder, step S304 includes: inputting the first historical time series feature data of the target sample object and the second historical time series feature data of the related time series sample into the time series feature encoder to obtain the first historical time series feature encoding of the first historical time series feature data and the second historical time series feature encoding of the second historical time series feature data; obtaining the first predicted time series feature data of the target sample object and the second predicted time series feature data of the related sample object based at least on the first historical time series feature encoding and the second historical time series feature encoding; and determining the distribution distance value between the target sample object and the related sample object based on the first historical time series feature encoding and the second historical time series feature encoding. Figure 2 In the example, brand T's products are sold as D t The first historical time series feature data Sales of related productsS The second historical time series feature data Input the time series feature encoder 210 to obtain the product sales D of brand T t The first historical temporal feature encoding and sales of related products D S The second historical temporal feature encoding Then at least D based on the product sales of brand T t The first historical temporal feature encoding and sales of related products D S The second historical temporal feature encoding Get sales of brand T's product D t The first predicted time series feature data in the preset time period Product sales of related products D S The second prediction time series feature data in the preset time period And based on the first historical time series feature encoding And the second historical time series feature coding Determine the sales volume of brand T's product D t Sales of related products S The distribution distance between Wherein, i=1~g. Thus, it is easy to adjust the parameters of the transfer learning model by using the distribution distance value and the prediction loss value, thereby increasing the accuracy of the final time series prediction model.
[0064] In some embodiments, when the transfer learning model further includes a distribution distance determination layer, determining the distribution distance value between the target sample object and the related sample object based on the first historical time series feature code and the second historical time series feature code may include: inputting the first historical time series feature code and the second historical time series feature code into the distribution distance determination layer to obtain the distribution distance value between the target sample object and the related sample object. Figure 2 In the example, the first historical time series feature is encoded And the second historical time series feature coding The input distribution distance determination layer 220 determines the sales volume D of the product of brand T. t Sales of related products S The distribution distance between This makes it easier to use the model to calculate the distribution distance value between the target sample object and the related sample objects, thereby increasing the accuracy of the final time series prediction model.
[0065] In some embodiments, step S305 may include: determining a time series prediction loss value based on the first predicted time series feature data, the second predicted time series feature data, the first real time series feature data, and the second real time series feature data; and adjusting parameters of the transfer learning model based on the time series prediction loss value and the distribution distance value. The time series prediction loss value may be selected according to the prediction target of the model, including but not limited to the mean absolute error, cross entropy loss, etc. Specifically, in the case of Figure 2 In the example, based on the sales of product D of brand T t The first predicted time series feature data in the preset time period And the first real time series feature data Product sales of related products D S The second prediction time series feature data in the preset time period And the second real time series feature data Determining the Time Series Forecasting Loss Value Wherein, i=1-m. The gradient descent method can be used to minimize the time series prediction loss value and the distribution distance value to train the parameters of the transfer learning model.
[0066] In some embodiments, step S305 may include: determining the total loss function of the transfer learning model based on the time series prediction loss value and the distribution distance value, wherein the total loss function is set to be the sum of the distribution distance value defined at least based on the first historical time series feature code of the target sample object and the second historical time series feature code of the related sample object, the prediction loss value defined based on the first predicted time series feature data and the first real time series feature data of the target sample object, and the prediction loss value defined based on the second predicted time series feature data and the second real time series feature data of the related sample object; and adjusting the parameters of the transfer learning model based on the total loss function until the total loss function reaches a preset accuracy. Figure 2 In the example of , the total loss function of the transfer learning model can be, for example, in, The total loss function proposed above takes into account two aspects of loss. On the one hand, it is the distribution distance loss between the time series feature codes encoded by the time series feature encoder for the target sample object and the related sample object, so that the distribution of the historical time series feature codes encoded by the time series feature encoder for the target sample object and the related sample object is closer, so as to facilitate the use of the target sample object and the candidate sample object to fine-tune the transfer learning model, thereby quickly training a time series prediction model for the target sample object.
[0067] In some embodiments, the distribution distance value is defined based on the first historical temporal feature code of the target sample object, the second temporal feature code of the related sample object, and the parameters of the distribution distance determination layer. Specifically, for example, the distribution distance value is defined based on the distribution distance between the first historical temporal feature code of the target sample object and the second temporal feature code of the related sample object, and the model parameters of the distribution distance determination layer. The model parameters refer to the parameter weights used for calculation in the network structure. Figure 2 As shown, the model parameters of the distribution distance determination layer 220 are At this time, the distribution distance loss value may be defined as, for example, the sum of the products of the model parameters and the distribution distances of the target sample object and the related sample objects. Specifically, for example, This can increase the accuracy of the time series prediction model finally obtained. In the above situation, the distribution distance determination layer can also be further adjusted.
[0068] In some embodiments, when the transfer learning model also includes a feature decoder and a prediction output layer, obtaining the first predicted time series feature data of the target sample object and the second predicted time series feature data of the related sample object based at least on the first historical time series feature code and the second historical time series feature code may include: inputting at least the first historical time series feature code and the second historical time series feature code into the feature decoder to obtain the first time series feature decoding of the target sample object and the second time series feature decoding of the related sample object; and inputting the first time series feature decoding and the second time series feature decoding into the prediction output layer to obtain the first predicted time series feature data of the target sample object and the second predicted time series feature data of the related sample object. Figure 2 In the example, at least the first historical time series feature is encoded And the second historical time series feature coding The feature decoder 240 is input to obtain the first time series feature decoding and the second time series feature decoding respectively, and then the first time series feature decoding and the second time series feature decoding are respectively input to the prediction output layer 250 to obtain the product sales D of brand T. t The first predicted time series feature data in the preset time period Product sales of related products D S The second prediction time series feature data in the preset time period In this way, the accuracy of the final time series prediction model can be further improved.
[0069] In some embodiments, when the transfer learning model also includes a static feature encoder, the target sample object also has first attribute information, and multiple candidate sample objects also have second attribute information, at least the first historical temporal feature encoding and the second historical temporal feature encoding are input into the feature decoder to obtain the first temporal feature decoding of the target sample object and the second temporal feature decoding of the related sample objects. The decoding may include: inputting the first attribute information of the target sample object and the second attribute information of the related sample object into the static feature encoder to obtain the first attribute feature encoding of the target sample object and the second attribute feature encoding of the related sample object; obtaining a first fusion vector for the target sample object based on at least the first historical temporal feature encoding and the first attribute feature encoding; obtaining a second fusion vector for the related sample objects based on at least the second historical temporal feature encoding and the second attribute feature encoding; and inputting the first fusion vector and the second fusion vector into the feature decoder to obtain the first temporal feature decoding of the target sample object and the second temporal feature decoding of the related sample objects. Figure 2 In the example, brand T's products are sold as D T The first attribute information e t and sales of related products D S The second attribute information e s Input into the static feature encoder 230 to obtain the product sales D of brand T T The first attribute feature encoding k t , and sales of related products D S The second attribute feature encoding k s ; Encode at least the first historical time series feature and the first attribute feature code k t Merge to obtain product sales D for brand T T The first fusion vector of and the second attribute feature encoding k s Merge to obtain product sales D for related products S and inputting the first fusion vector and the second fusion vector into the feature decoder 240 to obtain the product sales D of brand T t The first time series feature decoding and commodity sales of related commodities D S The second time series feature decoding is performed. In the above implementation, attribute information is introduced, thereby improving the accuracy of the final time series prediction model.
[0070] In some embodiments, when the transfer learning model also includes a feature decoder, the target sample object also has first preset event information within a preset time period, and multiple candidate sample objects also have second preset event information within a preset time period, at least the first historical temporal feature encoding and the second historical temporal feature encoding are input into the feature decoder to obtain the first temporal feature decoding of the target sample object and the second temporal feature decoding of the related sample objects. The decoding may include: obtaining the first preset event text vector of the first preset event information and the second preset event text vector of the second preset event information; obtaining a third fusion vector for the target sample object based at least on the first historical temporal feature encoding and the first preset event text vector; obtaining a fourth fusion vector for the related sample objects based at least on the second historical temporal feature encoding and the second preset event text vector; inputting the third fusion vector and the fourth fusion vector into the feature decoder to obtain the first temporal feature decoding for the target sample object and the second temporal feature decoding for the related sample objects. Figure 2 In the example, at least the first historical time series feature is encoded And the text vector of the preset event information The third fusion vector is obtained by fusion, and the second historical time series feature is encoded And the text vector of the preset event information The third fusion vector and the fourth fusion vector are then input into the feature decoder 240 to obtain the product sales D for brand T, respectively. t The first time series feature decoding and the commodity sales D for related commodities S The second time series feature decoding, and then the first time series feature decoding and the second time series feature decoding are input into the prediction output layer 250 to obtain the first prediction time series feature data And the second prediction time series feature data The above implementation introduces preset event information for training, thereby improving the accuracy of the ultimately obtained time series prediction model.
[0071] In some embodiments, when the target sample object and the candidate sample object have both attribute information and preset event information, the fusion layer 260 may fuse the historical temporal feature encoding, the attribute feature encoding, and the preset event text vector of the preset event information to obtain a fusion vector input to the prediction output layer 250 .
[0072] In some embodiments, step S303 may include: determining similarity information between multiple candidate sample objects and the target sample object based on the first historical time series feature data of the target sample object and the second historical time series feature data of at least one candidate time series sample; and determining related sample objects associated with the target sample object from multiple candidate sample objects based on the similarity information between the multiple candidate sample objects and the target sample object. Wherein, the similarity information may refer to the distribution distance between the first historical time series feature data and the second historical time series feature data, which may be selected according to the actual data distribution characteristics, including but not limited to relative entropy, JS divergence, excavator distance, COS similarity, etc. The similarity information may include a similarity value, thereby, multiple candidate sample objects may be sorted according to the size of the similarity value, and a specific number of candidate sample objects arranged in front may be selected as related sample objects of the target sample object. Alternatively, for each candidate sample object, it may be determined whether its similarity value is greater than a similarity threshold, and when the similarity value is greater than the similarity threshold, the candidate sample object is used as a related sample object. The above-mentioned statistical-based method can quickly select data associated with the target sample object from a large amount of candidate data, thereby ensuring the correlation between the determined related sample objects and the target sample objects, and avoiding the problem of negative migration, where the effect of the time series prediction model on the target sample object decreases instead of increases due to the introduction of related sample objects.
[0073] In some embodiments, the target sample object also has first attribute information, and the plurality of candidate sample objects also have second attribute information, and step S303 may include: determining the similarity between the first attribute information of the target sample object and the second attribute information of the plurality of candidate sample objects; based on the similarity, determining the related sample objects associated with the target sample object from the plurality of candidate sample objects. At this time, a machine learning model may be used to calculate the correlation between the first attribute information of the target sample object and the second attribute information of the plurality of candidate sample objects, thereby determining the related sample objects associated with the target sample object. Alternatively, the related sample objects may be determined by manual selection based on the correlation between the first attribute information and the second attribute information. In this way, the correlation between the determined related sample objects and the target sample objects can be ensured, thereby avoiding the problem that the effect of the time series prediction model on the target sample object decreases instead of increases due to the introduction of the related sample objects, i.e., the generation of negative migration.
[0074] In some embodiments, the above two methods of determining related sample objects can be combined to determine related sample objects. For example, the target sample object and a candidate sample object have a certain type of identical or similar attribute features. Although the distribution distance of their historical time series feature data may be far, data with high attribute feature correlation can be selected from multiple candidate sample objects based on experience and added to the target sample object. For example, when migrating time series prediction models between different brands (such as migrating the sales of brand A's coffee products as source data to the sales forecast of brand B's coffee products), related sample objects with the same or similar attribute features can be selected, for example, brand A's hot latte data can be used as related data for brand B's hot latte data.
[0075] Since the statistical method can quickly select the data that may be needed from a large amount of data, if only the statistical method is used, the causal rationality between the target sample object and the related sample object may be weak. For example, by calculating the distribution distance, the sandwich sales data of brand A can be obtained as the related data of the coffee sales data of brand B. Although this is statistically reasonable, it is causally unreasonable. Therefore, the above-mentioned method of determining related sample objects based on attribute information can be introduced to increase the causal rationality when determining related sample objects.
[0076] According to another aspect of the present disclosure, a time series prediction model is provided, which is obtained by training by executing the construction method 3000. Specifically, the transfer learning model 2000 constructed during training can be used as the time series prediction model for the target sample object, or the transfer learning model 2000 without the distribution distance determination layer can be used as the time series prediction model for the target sample object. Alternatively, a time series prediction model such as Figure 1 The time series prediction model 1000 shown in FIG. 1 is then used to copy the model parameters of the trained transfer learning model 2000 to Figure 1 In the time series prediction model 1000 shown, a time series prediction model for the target sample object is obtained.
[0077] Figure 4 A flowchart of a time series prediction method 4000 according to some exemplary embodiments of the present disclosure is shown. The time series prediction method 4000 may include: step S401, obtaining historical time series feature data of a target object; and step S402, at least inputting the historical time series feature data of the target object into the time series prediction model 1000 to obtain predicted time series feature data of the target object within a preset time.
[0078] The characteristics of the above target objects and historical time series feature data are Figure 1 The target object described in and the characteristics of the historical time series feature data are the same, and for the sake of brevity, they will not be described in detail here.
[0079] The above implementation can improve the accuracy of calculating the predicted time series feature data of the target object within a preset time. Figure 5 A structural block diagram of a construction device 5000 for a time series prediction model according to an exemplary embodiment of the present disclosure is shown. The construction device 5000 may include: a first acquisition module 501, a pre-training module 502, a first determination module 503, a first input module 504, a parameter adjustment module 505, and a second determination module 506. The first acquisition module 501 is configured to acquire first historical time series feature data of a target sample object and second historical time series feature data of a plurality of candidate sample objects. The pre-training module 502 is configured to perform pre-training using the second historical time series feature data of a plurality of candidate sample objects as model input to obtain a transfer learning model, the output of the transfer learning model including the predicted time series feature data of a plurality of candidate sample objects. The first determination module 503 is configured to determine related sample objects associated with the target sample object from a plurality of candidate sample objects. The first input module 504 is configured to input at least the first historical time series feature data of the target sample object and the second historical time series feature data of the related sample object into the transfer learning model to obtain the first predicted time series feature data of the target sample object and the second predicted time series feature data of the related sample object and the distribution distance value between the target sample object and the related sample object, and the distribution distance value is used to characterize the similarity between the first historical time series feature data and the second historical time series feature data. The parameter adjustment module 505 is configured to adjust the parameters of the transfer learning model based on the first predicted time series feature data, the second predicted time series feature data and the distribution distance value. The second determination module 506 is configured to determine the model parameters of the time series prediction model based on the parameters of the transfer learning model after the parameter adjustment.
[0080] It should be understood that Figure 5 The various modules of the device 5000 shown in FIG. Figure 3 The steps in the construction method 3000 described above correspond to each other. Therefore, the operations, features and advantages described above for the construction method 3000 are also applicable to the device 5000 and the modules included therein. For the sake of brevity, some operations, features and advantages are not repeated here.
[0081] Figure 6 The structural block diagram of a time series prediction device 6000 according to an exemplary embodiment of the present disclosure is shown. The time series prediction device 6000 may include: a second acquisition module 601 and a second input module 602. The second acquisition module 601 is configured to acquire historical time series feature data of a target object. The second input module 602 is configured to at least input the historical time series feature data of the target object into the time series prediction model obtained by executing the construction method 3000, so as to obtain the predicted time series feature data of the target object within a preset time.
[0082] It should be understood that Figure 6 The various modules of the device 6000 shown in FIG. Figure 4 The steps in the described time series prediction method 4000 correspond to each other. Therefore, the operations, features and advantages described above for the time series prediction method 4000 are also applicable to the apparatus 6000 and the modules included therein. For the sake of brevity, some operations, features and advantages are not repeated here.
[0083] According to another aspect of the present disclosure, an electronic device is also provided, comprising: a memory, a processor, and a computer program stored in the memory, wherein the processor is configured to execute the computer program to implement the steps of the construction method 3000 and / or the steps of the timing prediction method 4000.
[0084] According to another aspect of the present disclosure, a computer-readable storage medium is further provided, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the construction method 3000 and / or the steps of the timing prediction method 4000 are implemented.
[0085] According to another aspect of the present disclosure, a computer program product is also provided, including a computer program, wherein the computer program implements the steps of the construction method 3000 and / or the steps of the timing prediction method 4000 when executed by a processor.
[0086] See also Figure 7 , a structural block diagram of an electronic device 7000 that can be used as the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device can be different types of computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0087] Figure 7 1 shows a block diagram of an electronic device according to an embodiment of the present disclosure. Figure 7 As shown, the electronic device 7000 may include at least one processor 701 , a working memory 702 , an I / O device 704 , a display device 705 , a storage device 706 , and a communication interface 707 that can communicate with each other via a system bus 703 .
[0088] The processor 701 may be a single processing unit or multiple processing units, all of which may include a single or multiple computing units or multiple cores. The processor 701 may be implemented as one or more microprocessors, microcomputers, microcontrollers, digital signal processors, central processing units, state machines, logic circuits, and / or any device that manipulates signals based on operating instructions. The processor 701 may be configured to obtain and execute computer-readable instructions stored in a working memory 702, a storage device 706, or other computer-readable media, such as program codes of an operating system 702a, program codes of an application 702b, and the like.
[0089] The working memory 702 and the storage device 706 are examples of computer-readable storage media for storing instructions, which are executed by the processor 701 to implement the various functions described above. The working memory 702 may include both volatile memory and non-volatile memory (e.g., RAM, ROM, etc.). In addition, the storage device 706 may include a hard disk drive, a solid-state drive, a removable medium, including external and removable drives, a memory card, a flash memory, a floppy disk, an optical disk (e.g., CD, DVD), a storage array, a network attached storage, a storage area network, etc. The working memory 702 and the storage device 706 may all be collectively referred to herein as memory or computer-readable storage media, and may be a non-transitory medium capable of storing computer-readable, processor-executable program instructions as computer program code, which may be executed by the processor 701 as a specific machine configured to implement the operations and functions described in the examples herein.
[0090] The I / O device 704 may include an input device and / or an output device. The input device may be any type of device capable of inputting information to the electronic device 7000, and may include but is not limited to a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and / or a remote controller. The output device may be any type of device capable of presenting information, and may include but is not limited to a video / audio output terminal, a vibrator, and / or a printer.
[0091] The communication interface 707 allows the electronic device 7000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver and / or a chipset, such as a Bluetooth™ device, an 802.11 device, a WiFi device, a WiMax device, a cellular communication device and / or the like.
[0092] The application 702b in the working register 702 can be loaded to execute the various methods and processes described above, such as Figure 3In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 7000 via the storage device 706 and / or the communication interface 707. When the computer program is loaded and executed by the processor 701, one or more steps of the multi-product sales forecasting method described above may be executed.
[0093] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0094] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0095] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0096] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0097] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0098] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on corresponding computers and having a client-server relationship with each other.
[0099] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0100] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but only by the claims after authorization and their equivalent scope. Various elements in the embodiments or examples can be omitted or replaced by their equivalent elements. In addition, each step can be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples can be combined in various ways. It is important that with the evolution of technology, many elements described herein can be replaced by equivalent elements that appear after the present disclosure.
Claims
1. A method for constructing a time series prediction model, comprising: Acquire first historical time series feature data of a target sample object and second historical time series feature data of a plurality of candidate sample objects; At least the second historical time series feature data of the plurality of candidate sample objects are used as a model input for pre-training to obtain a transfer learning model, wherein the output of the transfer learning model includes the predicted time series feature data of the plurality of candidate sample objects; Determine a related sample object associated with the target sample object from the multiple candidate sample objects; At least the first historical time series feature data of the target sample object and the second historical time series feature data of the related sample object are input into the transfer learning model to obtain the first predicted time series feature data of the target sample object and the second predicted time series feature data of the related sample object and a distribution distance value between the target sample object and the related sample object, wherein the distribution distance value is used to characterize the similarity between the first historical time series feature data and the second historical time series feature data; Adjusting parameters of the transfer learning model based on the first prediction time series feature data, the second prediction time series feature data, and the distribution distance value; as well as Based on the parameters of the transfer learning model after parameter adjustment, the model parameters of the time series prediction model are determined.
2. The construction method according to claim 1, wherein: The transfer learning model includes a time series feature encoder, wherein at least the first historical time series feature data of the target sample object and the second historical time series feature data of the related sample object are input into the transfer learning model to obtain the first predicted time series feature data of the target sample object and the second predicted time series feature data of the related sample object and the distribution distance value between the target sample object and the related sample object, including: Inputting the first historical time series feature data of the target sample object and the second historical time series feature data of the related time series sample into the time series feature encoder to obtain a first historical time series feature code of the first historical time series feature data and a second historical time series feature code of the second historical time series feature data; Based at least on the first historical time series feature code and the second historical time series feature code, obtaining first predicted time series feature data of the target sample object and second predicted time series feature data of the related sample object; and Based on the first historical time series feature code and the second historical time series feature code, a distribution distance value between the target sample object and the related sample object is determined.
3. The construction method according to claim 2, wherein: The transfer learning model further includes a distribution distance determination layer, and based on the first historical time series feature code and the second historical time series feature code, determining the distribution distance value between the target sample object and the related sample object includes: The first historical time series feature code and the second historical time series feature code are input into the distribution distance determination layer to obtain the distribution distance value between the target sample object and the related sample object.
4. The construction method according to claim 2, wherein: The target sample object has first real time series feature data, the related sample object has second real time series feature data, and based on the first predicted time series feature data, the second predicted time series feature data and the distribution distance value, adjusting the parameters of the transfer learning model includes: Determine a time series prediction loss value based on the first predicted time series feature data, the second predicted time series feature data, the first real time series feature data, and the second real time series feature data; and Based on the time series prediction loss value and the distribution distance value, the transfer learning model is adjusted.
5. The construction method according to claim 4, wherein: Based on the time series prediction loss value and the distribution distance value, adjusting parameters of the transfer learning model includes: Based on the time series prediction loss value and the distribution distance value, determining a total loss function of the transfer learning model, wherein the total loss function is set to be the sum of at least a distribution distance value defined based on a first historical time series feature code of the target sample object and a second historical time series feature code of the related sample object, a prediction loss value defined based on a first predicted time series feature data and a first real time series feature data of the target sample object, and a prediction loss value defined based on a second predicted time series feature data and a second real time series feature data of the related sample object; and The transfer learning model is adjusted based on the total loss function until the total loss function reaches a preset accuracy.
6. The construction method according to claim 4, wherein: The transfer learning model also includes a distribution distance determination layer for determining the distribution distance value, and the distribution distance value is defined based on the first historical temporal feature coding of the target sample object, the second temporal feature coding of the related sample object and the parameters of the distribution distance determination layer.
7. The construction method according to claim 2, wherein: The transfer learning model further includes a feature decoder and a prediction output layer, and obtaining first predicted time series feature data of the target sample object and second predicted time series feature data of the related sample object based at least on the first historical time series feature code and the second historical time series feature code includes: Inputting at least the first historical temporal feature code and the second historical temporal feature code into the feature decoder to obtain a first temporal feature decoding of the target sample object and a second temporal feature decoding of the related sample object; and The first time series feature decoding and the second time series feature decoding are input into the prediction output layer to obtain the first predicted time series feature data of the target sample object and the second predicted time series feature data of the related sample object.
8. The construction method according to claim 7, in, The transfer learning model further includes a static feature encoder, the target sample object further has first attribute information, and the related sample object further has second attribute information. The step of at least inputting the first historical temporal feature code and the second historical temporal feature code into the feature decoder to obtain the first temporal feature decoding of the target sample object and the second temporal feature decoding of the related sample object comprises: Inputting the first attribute information of the target sample object and the second attribute information of the related sample object into the static feature encoder to obtain the first attribute feature code of the target sample object and the second attribute feature code of the related sample object; Obtaining a first fusion vector for the target sample object based at least on the first historical time series feature code and the first attribute feature code; obtaining a second fusion vector for the relevant sample object based at least on the second historical time series feature code and the second attribute feature code; and The first fusion vector and the second fusion vector are input into the feature decoder to obtain a first temporal feature decoding of the target sample object and a second temporal feature decoding of the related sample object.
9. The construction method according to claim 7, in, The target sample object also has first preset event information, the related sample object also has second preset event information, and The step of at least inputting the first historical temporal feature code and the second historical temporal feature code into the feature decoder to obtain the first temporal feature decoding of the target sample object and the second temporal feature decoding of the related sample object comprises: Acquire a first preset event text vector of the first preset event information and a second preset event text vector of the second preset event information; Obtaining a third fusion vector for the target sample object based at least on the first historical time series feature code and the first preset event text vector; Obtaining a fourth fusion vector for the relevant sample object based at least on the second historical time series feature code and the second preset event text vector; The third fusion vector and the fourth fusion vector are input into the feature decoder to obtain a first temporal feature decoding for the target sample object and a second temporal feature decoding for the related sample object.
10. The construction method according to any one of claims 1 to 9, wherein: Determining a related sample object associated with the target sample object from the multiple candidate sample objects comprises: Determining similarity information between the plurality of candidate sample objects and the target sample object based on the first historical time series feature data of the target sample object and the second historical time series feature data of the plurality of candidate time series samples; and Based on the similarity information between the multiple candidate sample objects and the target sample object, a related sample object associated with the target sample object is determined from the multiple candidate sample objects.
11. The construction method according to any one of claims 1 to 9, wherein: When the target sample object further has first attribute information, and the plurality of candidate sample objects further have second attribute information, determining the relevant sample object associated with the target sample object from the plurality of candidate sample objects comprises: Determining the similarity between the first attribute information of the target sample object and the second attribute information of the plurality of candidate sample objects; and Based on the similarity, a related sample object associated with the target sample object is determined from the multiple candidate sample objects.
12. The construction method according to any one of claims 1 to 9, wherein: The target sample objects and the candidate sample objects include commodity sales.
13. A time series prediction model trained by the construction method according to any one of claims 1 to 12, the time series prediction model is used to predict the predicted time series feature data of a target object within a preset time, the target object has historical time series feature data before the preset time, and the time series prediction model comprises: A time series feature encoder, used for encoding the historical time series feature data to obtain the historical time series feature code of the target object; A feature decoder, configured to obtain a temporal feature decoding of the target object based at least on the historical temporal feature encoding; as well as The prediction output layer is used to determine the predicted time series feature data of the target object within the preset time based on the time series feature decoding.
14. The time series prediction model according to claim 13, wherein: The target object also has attribute information, and the time series prediction model further includes: A static feature encoder, used for encoding the attribute information of the target object to obtain an attribute feature code of the target object; and A fusion layer is used to fuse at least the historical temporal feature coding and the attribute feature coding of the target object to obtain a fusion vector of the target object. The feature decoder decodes the fusion vector to obtain a temporal feature decoding of the target object.
15. The time series prediction model according to claim 13, wherein: The target object also has a preset event text vector of preset event information within a preset time, and the time series prediction model further includes: A fusion layer is used to fuse at least the historical temporal feature encoding of the target object and the preset event text vector to obtain a fusion vector of the target object, The feature decoder decodes the fusion vector to obtain a temporal feature decoding of the target object.
16. A time series prediction method, comprising: Obtain historical time series feature data of the target object; as well as At least the historical time series feature data of the target object is input into the time series prediction model according to any one of claims 13 to 15 to obtain the predicted time series feature data of the target object within a preset time.
17. A device for constructing a time series prediction model, comprising: A first acquisition module, wherein the first acquisition module is configured to acquire first historical time series feature data of a target sample object and second historical time series feature data of a plurality of candidate sample objects; A pre-training module, wherein the pre-training module is configured to perform pre-training using the second historical time series feature data of the plurality of candidate sample objects as a model input to obtain a transfer learning model, wherein an output of the transfer learning model includes the predicted time series feature data of the plurality of candidate sample objects; a first determining module, the first determining module being configured to determine, from the plurality of candidate sample objects, a related sample object associated with the target sample object; A first input module, wherein the first input module is configured to input at least the first historical time series feature data of the target sample object and the second historical time series feature data of the related sample object into the transfer learning model to obtain the first predicted time series feature data of the target sample object and the second predicted time series feature data of the related sample object, and a distribution distance value between the target sample object and the related sample object, wherein the distribution distance value is used to characterize the similarity between the first historical time series feature data and the second historical time series feature data; A parameter adjustment module, wherein the parameter adjustment module is configured to adjust the parameters of the transfer learning model based on the first prediction time series feature data, the second prediction time series feature data and the distribution distance value; as well as The second determination module is configured to determine the model parameters of the time series prediction model based on the parameters of the transfer learning model after parameter adjustment.
18. A time series prediction device, comprising: A second acquisition module, wherein the second acquisition module is configured to acquire historical time series feature data of the target object; as well as The second input module is configured to input at least the historical time series feature data of the target object into the time series prediction model according to any one of claims 13 to 15 to obtain the predicted time series feature data of the target object within a preset time.
19. An electronic device comprising: a memory, a processor and a computer program stored on the memory, Wherein, the processor is configured to execute the computer program to implement the steps of the model building method described in any one of claims 1 to 12 and / or the time series prediction method described in claim 16.
20. A computer-readable storage medium having a computer program stored thereon, wherein: The computer program is executed by a processor according to any one of the construction methods of claims 1 to 12 and / or the steps of the time series prediction method of claim 16.
21. A computer program product comprising a computer program, wherein: When the computer program is executed by a processor, the steps of the construction method described in any one of claims 1 to 12 and / or the time series prediction method described in claim 16 are implemented.
Citation Information
Cited By
Dragging type 3D digital space modeling method and system and medium
CN120475395A
