Method and device for time domain prediction, electronic equipment and storage medium

By introducing supervised learning in the frequency domain during the training of the timing prediction model, and using the predicted frequency domain data adjustment model, the low prediction accuracy problem caused by ignoring the frequency domain characteristics in the prior art is solved, and a higher timing prediction accuracy is achieved.

CN119939245APending Publication Date: 2025-05-06CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411998238.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

When predicting time series, the prior art ignores the frequency domain characteristics, resulting in low prediction accuracy.

Method used

By inputting the time series data to be predicted into the trained time series prediction model, the model adjusts the reference predicted time series data and the first reference predicted frequency domain data during the training process, and introduces supervised learning in the frequency domain.

Benefits of technology

The accuracy of timing prediction is improved, so that the sequence data output by the trained time domain prediction model not only conforms to the time domain characteristics of the timing data to be predicted, but also conforms to its frequency domain characteristics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119939245A_ABST
    Figure CN119939245A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a method and device for time domain prediction, electronic equipment and a storage medium. The method comprises the following steps: acquiring to-be-predicted time series data; inputting to-be-predicted time sequence data into the trained time sequence prediction model; wherein the trained time sequence prediction model is obtained by training the pre-trained time sequence prediction model through preset to-be-trained time sequence data; in the training process, the time sequence prediction model is adjusted through the reference prediction time sequence data and the first reference prediction frequency domain data; the reference prediction time sequence data and the first reference prediction frequency domain data are obtained by predicting the to-be-trained time sequence data; and determining the sequence data output by the time domain prediction model as a prediction result corresponding to the to-be-predicted time sequence data. Therefore, supervised learning of the frequency domain is introduced, so that the sequence data output by the trained time domain prediction model not only conforms to the time domain characteristics of the time sequence data to be predicted, but also conforms to the frequency domain characteristics of the time sequence data, and the accuracy of time sequence prediction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data prediction, and in particular to a method and device, electronic device, and storage medium for time domain prediction. Background Art

[0002] In the existing technology, the purpose of predicting time series is to capture the characteristics of historical data series in order to predict future trends. Accurate time series prediction can help make better decisions, allocate resources, and resolve risks. Therefore, time domain prediction plays a key role in various industries such as signal processing and weather forecasting, healthcare, finance, traffic management, and energy consumption optimization.

[0003] However, in the related art, when predicting time series, usually only the time domain characteristics of the data to be predicted are focused on, and the frequency domain characteristics of the data to be predicted are ignored, resulting in low prediction accuracy. Summary of the invention

[0004] To solve the above technical problems, the embodiments of the present application provide a method and device, an electronic device, and a storage medium for time domain prediction, which can improve the accuracy of time domain prediction.

[0005] According to one aspect of an embodiment of the present application, a method for time domain prediction is provided, comprising: obtaining time series data to be predicted; inputting the time series data to be predicted into a trained time series prediction model; wherein the trained time series prediction model is obtained by training a pre-trained time series prediction model with preset time series data to be trained; during the training process, the time series prediction model is adjusted with reference to predicted time series data and first reference predicted frequency domain data; the reference predicted time series data and the first reference predicted frequency domain data are obtained by predicting the time series data to be trained; and the sequence data output by the time domain prediction model is determined as the prediction result corresponding to the time series data to be predicted.

[0006] In some embodiments, the pre-trained time series prediction model includes: an embedding matrix acquisition module, a large language model module and a complex domain adapter; the trained time series prediction model is trained in the following manner: the time series data to be trained and the real time series data corresponding to the time series data to be trained are input into the embedding matrix acquisition module to obtain the input embedding matrix corresponding to the time series data to be trained; the input matrix is ​​input into a preset large language model for prediction to obtain an output embedding matrix; the output embedding matrix is ​​input into a preset complex domain adapter to extract the reference predicted time series data and the first reference predicted frequency domain data from the output embedding matrix; the pre-trained time series prediction model is adjusted according to the real time series data, the reference predicted time series data and the first reference predicted frequency domain data to obtain the trained time series prediction model.

[0007] In some embodiments, the step of inputting the time series data to be trained into the embedding matrix acquisition module to obtain the input embedding matrix corresponding to the time series data to be trained includes: obtaining the time series data embedding matrix corresponding to the time series data to be trained; extracting feature information of the time series data to be trained to obtain a time series feature embedding matrix; and concatenating the time series data embedding matrix and the time series feature embedding matrix to obtain the input embedding matrix.

[0008] In some embodiments, extracting the reference prediction time series data and the first reference prediction frequency domain data from the output embedding matrix includes: performing a dimension conversion on the output embedding matrix to obtain a time domain embedding matrix; converting the time domain embedding matrix from the time domain to the frequency domain to obtain a frequency domain embedding matrix corresponding to the time series data to be trained; performing a frequency analysis on the frequency domain embedding matrix to obtain the first reference prediction frequency domain data and the reference prediction time domain data.

[0009] In some embodiments, the pre-trained time series prediction model is adjusted according to the real time series data, the reference predicted time series data and the first reference predicted frequency domain data to obtain a trained time series prediction model, including: obtaining the difference between the real time series data and the reference predicted time series data to obtain a time domain loss value; obtaining the real frequency domain data corresponding to the real time series data; obtaining the difference between the real frequency domain data and the first reference predicted frequency domain data to obtain a first frequency domain loss value; obtaining the loss value of the pre-trained time series prediction model according to the time domain loss value and the first frequency domain loss value; and adjusting the pre-trained time series prediction model according to the loss value to obtain a trained time series prediction model.

[0010] In some embodiments, the loss value of the pre-trained time series prediction model is obtained based on the time domain loss value and the first frequency domain loss value, including: converting the reference prediction time series data to the frequency domain to obtain second reference prediction frequency domain data; obtaining the difference between the real frequency domain data and the second reference prediction frequency domain data to obtain a second frequency domain loss value; weighting the time domain loss value, the first frequency domain loss value and the second frequency domain loss value to obtain the loss value.

[0011] In some embodiments, the method of adjusting the pre-trained timing prediction model according to the loss value to obtain a trained timing prediction model includes: obtaining the model parameters to be adjusted in the pre-trained timing prediction model; when the loss value is greater than a preset reference loss value, adjusting the model parameters; and replacing the pre-adjusted model parameters in the pre-trained timing prediction model with the adjusted model parameters to obtain a trained timing prediction model.

[0012] According to one aspect of an embodiment of the present application, there is provided a device for time domain prediction, comprising: a data acquisition module, configured to acquire time series data to be predicted; a prediction module, configured to input the time series data to be predicted into a trained time series prediction model; wherein the trained time series prediction model is obtained by training a pre-trained time series prediction model with preset time series data to be trained; during the training process, the time series prediction model is adjusted with reference to predicted time series data and first reference predicted frequency domain data; the reference predicted time series data and the first reference predicted frequency domain data are obtained by predicting the time series data to be trained; a determination module, configured to determine the sequence data output by the time domain prediction model as the prediction result corresponding to the time series data to be predicted.

[0013] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements the above-mentioned method for time domain prediction.

[0014] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the above-mentioned method for time domain prediction.

[0015] In the technical solution provided in the embodiment of the present application, the time series data to be predicted is input into the time series prediction model obtained by training the time series data to be trained, and then the sequence data output by the time series prediction model is determined as the prediction result corresponding to the time series data to be predicted. During the training process of the time series prediction model, the time series prediction model is adjusted by using the reference predicted time series data obtained by predicting the time series data to be trained and the first reference predicted frequency domain data. It can be seen that the time series prediction model realizes the supervised learning of the model through the time domain data obtained by predicting the time series data to be trained, that is, the reference predicted time series data, and the frequency domain data obtained by predicting the time series data to be trained, that is, the first reference predicted frequency domain data. In this way, compared with the prior art of using the model obtained only by supervised learning in the time domain for time series prediction, the time series prediction model of this scheme also introduces supervised learning in the frequency domain, which enhances the analysis of the frequency domain characteristics of the time series data to be predicted by the time series prediction model, so that the sequence data output by the trained time domain prediction model not only meets the time domain characteristics of the time series data to be predicted, but also meets its frequency domain characteristics, thereby improving the accuracy of time series prediction.

[0016] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0018] Figure 1 is a schematic diagram of an implementation environment for time domain prediction shown in an exemplary embodiment of the present application;

[0019] Figure 2 is a flow chart of a method for time domain prediction shown in an exemplary embodiment of the present application;

[0020] Figure 3 is a flowchart of a method for training a time series prediction model shown in an exemplary embodiment of the present application;

[0021] Figure 4 is a flowchart of a method for extracting reference prediction time series data and first reference prediction frequency domain data by a complex domain adapter shown in an exemplary embodiment of the present application;

[0022] Figure 5 is a flow chart of a method for adjusting a time series prediction model shown in an exemplary embodiment of the present application;

[0023] Figure 6 is a schematic diagram of the structure of a trained time domain prediction model shown in an exemplary embodiment of the present application;

[0024] Figure 7 is a block diagram of a device for time domain prediction shown in an exemplary embodiment of the present application;

[0025] Figure 8 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION

[0026] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.

[0027] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0028] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0029] The term "multiple" as used in this application refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.

[0030] See also Figure 1 , Figure 1 1 is a schematic diagram of an implementation environment involved in the present application, which includes a terminal device 110 and a server 120. The terminal device 110 and the server 120 communicate with each other through a wired or wireless network, and the terminal device 110 can upload its own data to the server 120 or obtain data from the server 120.

[0031] Among them, the terminal device 110 may include but is not limited to mobile phones, tablets, laptops, computers, voice interaction devices, home appliances, vehicle-mounted terminals, aircraft, remote driving terminals, etc.; the server 120 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network) and big data and artificial intelligence platforms. The specific forms of terminal devices and servers are not restricted here.

[0032] It should be noted that Figure 1 The number of terminal devices 110 and servers 120 in the figure is only for illustration, and any number of terminal devices 110 and servers 120 may be provided according to actual needs.

[0033] In an exemplary embodiment, the method for time domain prediction provided by the embodiment of the present application can be executed by the terminal device 110. Exemplarily, the terminal device 110 can first obtain the time series data to be predicted, and then input the time series data to be predicted into the trained time series prediction model. Among them, the trained time series prediction model is obtained by training the pre-trained time series prediction model through the preset time series data to be trained; during the training process, the time series prediction model is adjusted by reference to the predicted time series data and the first reference predicted frequency domain data; the reference predicted time series data and the first reference predicted frequency domain data are obtained by predicting the time series data to be trained. Finally, the sequence data output by the time domain prediction model is determined as the prediction result corresponding to the time series data to be predicted. Since the query process not only refers to the sparse vector of the query text, but also refers to the dense vector of the query text, and the sparse vector of the text can represent the word frequency, importance, etc. of the words in the text, and the dense vector of the text can represent the word order, contextual semantics, etc. of the words in the text, so that the relevance between the result text and the query text can be improved, thereby improving the accuracy of the text query.

[0034] In another exemplary embodiment, the server 120 may have similar functions to the terminal device 110, so as to execute the method for time domain prediction provided in the embodiment of the present application. Exemplarily, the server 120 may first obtain the time series data to be predicted, and then input the time series data to be predicted into the trained time series prediction model. Among them, the trained time series prediction model is obtained by training the pre-trained time series prediction model with the preset time series data to be trained; during the training process, the time series prediction model is adjusted by reference to the predicted time series data and the first reference predicted frequency domain data; the reference predicted time series data and the first reference predicted frequency domain data are obtained by predicting the time series data to be trained. Finally, the sequence data output by the time domain prediction model is determined as the prediction result corresponding to the time series data to be predicted.

[0035] In another exemplary embodiment, the terminal device 110 and the server 120 may also jointly execute the method for time domain prediction provided by the embodiment of the present application. Exemplarily, after acquiring the time series data to be predicted, the terminal device 110 may send the time series data to be predicted to the server 120; the server 120 receives the time series data to be predicted sent by the terminal device 110, and inputs the time series data to be predicted into the trained time series prediction model; wherein the trained time series prediction model is obtained by training the pre-trained time series prediction model with the preset time series data to be trained; during the training process, the time series prediction model is adjusted by the reference prediction time series data and the first reference prediction frequency domain data; the reference prediction time series data and the first reference prediction frequency domain data are obtained by predicting the time series data to be trained, and the sequence data output by the time domain prediction model is determined as the prediction result corresponding to the time series data to be predicted, and the prediction result is sent to the terminal device 110; the terminal device 110 displays the prediction result.

[0036] The method for time domain prediction in the embodiments of the present application can be applied to various scenarios for time domain prediction, such as weather forecast scenarios, financial forecast scenarios, energy consumption forecast optimization, and other scenarios.

[0037] See also Figure 2 , Figure 2 is a flowchart of a method for time domain prediction shown in an exemplary embodiment of the present application. The method can be applied to Figure 1 The implementation environment shown, which can be Figure 1 The terminal device 110 in the implementation environment shown in the figure may also be executed by Figure 1 The server 120 in the implementation environment shown in the figure may also execute the command. Figure 1 The terminal device 110 and the server 120 in the illustrated implementation environment execute together.

[0038] It should be understood that the method may also be applicable to other exemplary implementation environments and may be specifically executed by devices in other implementation environments. This embodiment does not limit the implementation environment to which the method is applicable.

[0039] like Figure 2 As shown, in an exemplary embodiment, the method for time domain prediction includes at least steps S210 to S230, which are described in detail as follows:

[0040] Step S210, obtaining time series data to be predicted.

[0041] It should be noted that the time series data to be predicted is the data that needs to be predicted. The time series data to be predicted is historical data. In order to predict the historical data, it is necessary to input the historical data into the trained time series prediction model, and determine the sequence data output by the time domain prediction model as the prediction result corresponding to the historical data.

[0042] In some embodiments, the time series data to be predicted may be univariate time series data X1. 1×M , that is, the time series data to be predicted are all real number set R data, including a single variable and the data values ​​of the variable at M different time points; R is a real number set. In the time series data to be predicted, each data value is sorted in the order of time points. M is a positive integer greater than 1, and its specific value can be set according to the actual situation and is not limited here.

[0043] In some other embodiments, the time series data to be predicted may be multivariate time series data X2, for example: X2∈R H ×M , that is, the time series data to be predicted contains H variables and the data values ​​of the H variables at M different time points. In the time series data to be predicted, the data values ​​corresponding to each variable are sorted in the order of time points. M and H are both positive integers greater than 1, and their specific values ​​can be set according to actual conditions and are not limited here.

[0044] Step S220, input the time series data to be predicted into the trained time series prediction model; wherein the trained time series prediction model is obtained by training the time series prediction model before training through the preset time series data to be trained; during the training process, the time series prediction model is adjusted through the reference prediction time series data and the first reference prediction frequency domain data; the reference prediction time series data and the first reference prediction frequency domain data are obtained by predicting the time series data to be trained.

[0045] It should be noted that the trained time series prediction model can predict the time series data to be predicted. If the time series data to be predicted is multivariate time series data, the trained time series prediction model can divide the time series data to be predicted into univariate time series data, and predict each univariate time series data separately to obtain the prediction result of the multivariate time series data.

[0046] It should be noted that the time series data to be trained is data used to train the time series prediction model. The time series data to be trained is historical data, and at the same time, it has subsequent real time series data. Specifically, the historical data with multiple data values ​​at one end can be divided into two segments of time series data, for example, the historical data A is divided into a first segment of time series data A1 and a second segment of time series data A2. Among them, the first data value of the second segment of time series data A2 is continuous with the time point of the last data value of the first segment of time series data A1. Then, the first segment of time series data A1 can be the time series data to be trained; the second segment of time series data A2 can be the real time series data corresponding to the time series data to be trained. The time series data to be trained and the real time series data corresponding to the time series data to be trained can be obtained by other methods, which are not limited here.

[0047] In some embodiments, the time series data to be trained may be univariate time series data X3. 1×M , that is, the time series data to be trained includes a single variable and the data values ​​of the variable at M different time points. In the time series data to be trained, each data value is sorted in the order of the time points. M is a positive integer greater than 1, and its specific value can be set according to the actual situation and is not limited here.

[0048] In some other embodiments, the time series data to be trained may be multivariate time series data X4, for example: X4∈R H ×M , that is, the time series data to be trained contains H variables and the data values ​​of the H variables at M different time points. In the time series data to be trained, the data values ​​corresponding to each variable are sorted in the order of time points. M and H are both positive integers greater than 1, and their specific values ​​can be set according to actual conditions and are not limited here.

[0049] In an exemplary embodiment, the pre-trained time series prediction model includes: an embedding matrix acquisition module, a large language model module, and a complex domain adapter.

[0050] See also Figure 3 , Figure 3 Flowchart of the training method for the time series prediction model.

[0051] like Figure 3 As shown, the method for training a time series prediction model includes at least steps S301 to S304, which are described in detail as follows:

[0052] Step S301, input the time series data to be trained and the real time series data corresponding to the time series data to be trained into an embedding matrix acquisition module to obtain an input embedding matrix corresponding to the time series data to be trained.

[0053] Furthermore, the time series data to be trained is input into the embedding matrix acquisition module to obtain the input embedding matrix corresponding to the time series data to be trained, including: obtaining the time series data embedding matrix corresponding to the time series data to be trained; extracting the feature information of the time series data to be trained to obtain the time series feature embedding matrix; splicing the time series data embedding matrix and the time series feature embedding matrix to obtain the input embedding matrix.

[0054] In this way, the input embedding matrix includes the data information and feature information of the time series data to be trained, so that the large language model can use the data information and feature information in the input embedding matrix to make predictions and obtain the output embedding matrix, thereby improving the accuracy of the large language model prediction.

[0055] It should be noted that the embedding matrix acquisition module includes a data embedding matrix acquisition submodule and a time series feature embedding matrix acquisition submodule. The data embedding matrix acquisition submodule is used to acquire the time series data embedding matrix corresponding to the time series data to be trained. The time series feature embedding matrix acquisition submodule is used to obtain the feature information of the time series data to be trained and obtain the time series feature embedding matrix.

[0056] In some embodiments, the time series data to be trained can be first input into the data embedding matrix acquisition submodule to obtain the time series data embedding matrix corresponding to the time series data to be trained. Specifically, the data embedding matrix acquisition submodule can first normalize the time series data to be trained to scale each eigenvalue in the time series data to be trained to the same range, usually between 0 and 1. This can eliminate the impact of scale differences between different eigenvalues, making it easier for the model to learn and understand the laws of the data during the training process. Then the data embedding matrix acquisition submodule can perform block processing and block re-editing on the normalized time series data to be trained to obtain the time series data embedding matrix corresponding to the time series data to be trained.

[0057] Among them, the block processing is used to cut the continuous time series data to be trained into multiple sub-sequence data.

[0058] The block re-editing process is used to calculate the multi-head attention between each sub-sequence data and the preset training words, so as to reorganize each sub-sequence data according to the multi-head attention and obtain the time series data embedding matrix, so that the mode of the time series data embedding matrix is ​​aligned with the natural language, so that the large language model module can receive and process the time series data embedding matrix.

[0059] In some embodiments, the time series data to be trained is also input into the time series feature embedding matrix acquisition submodule. A prompt word database is stored in the time series feature embedding matrix acquisition submodule. The prompt word database stores a plurality of prompt words for describing the input time series data, prompt words for describing the details of the prediction task, and prompt words for describing the statistical information of the input time series data. In this way, the rich information in the prompt words provides comprehensive guidance for the large model, enabling it to perform the prediction task.

[0060] The time series feature embedding matrix acquisition submodule can first use the prompt word database to extract the statistical features and descriptive features of the time series data to be trained, and obtain the feature text corresponding to the time series data to be trained. The statistical features include: the maximum value, minimum value, lag value, median, data trend, data length of the time series data to be trained, and the length of the predicted result of the time series data to be trained. The data length of the time series data to be trained and the length of the predicted result of the time series data to be trained are extracted through the prompt words used to describe the details of the prediction task.

[0061] Then, the feature text corresponding to the time series data to be trained is segmented. The segmented feature text is then projected into a vector representation to obtain the time series feature embedding matrix.

[0062] Furthermore, the time series data embedding matrix and the time series feature embedding matrix are concatenated to obtain the input embedding matrix, that is, the time series data embedding matrix and the time series feature embedding matrix are concatenated vertically or horizontally to obtain the input embedding matrix. The specific concatenation method is subject to the input and processing of the large language model, and is not limited here.

[0063] Step S302: input the input matrix into a preset large language model for prediction to obtain an output embedding matrix.

[0064] It should be noted that large language models (LLMs) are artificial intelligence models trained with large data sets, designed to understand and generate natural language text. Due to their powerful reasoning and pattern recognition capabilities, large models are applied to time series forecasting tasks. They can identify patterns in time series data in a similar way to capturing complex language structures, thus providing a more flexible and scalable approach for forecasting in different fields.

[0065] It should be noted that the output embedding matrix output by the large language model may include prediction information corresponding to the time series data to be trained.

[0066] Step S303: input the output embedding matrix into a preset complex domain adapter to extract reference prediction time series data and first reference prediction frequency domain data from the output embedding matrix.

[0067] It should be noted that the complex domain adapter is used to mine the prediction information in the frequency domain in the output embedding matrix, and then extract the reference prediction time series data and the first reference prediction frequency domain data.

[0068] See also Figure 4 , Figure 4 A flowchart of a method for extracting reference prediction time series data and first reference prediction frequency domain data for a complex domain adapter.

[0069] like Figure 4 As shown, the flowchart of the method for the complex domain adapter to extract reference prediction time series data and first reference prediction frequency domain data includes at least steps S401 to S403, which are described in detail as follows:

[0070] Step S401, perform dimension conversion on the output embedding matrix to obtain a time domain embedding matrix.

[0071] It should be noted that the output embedding matrix O, where O∈R p×d0 , that is, the output embedding matrix is ​​a matrix with p rows and d0 columns; p is the preset number of blocks; d0 is the preset embedding dimension.

[0072] Specifically, the output embedding matrix is ​​dimensionally transformed to obtain a time domain embedding matrix, including: inputting the output embedding matrix into a flattening layer, a linear layer, and a feature embedding processing layer in sequence to obtain a time domain embedding matrix.

[0073] Among them, the flattening layer is used to flatten the output embedding matrix, which is used to flatten the output embedding matrix into a one-dimensional vector; the linear layer is used to perform linear transformation on the flattened one-dimensional vector; the feature embedding processing layer is used to transform the dimension of the vector after the linear transformation to obtain the time domain embedding matrix of the time domain dimension.

[0074] It should be noted that the time domain embedding matrix is ​​T. Where T∈R N×d , that is, the time-domain embedding matrix is ​​a matrix with N rows and d columns; N is the length of the prediction result of the time series data to be trained; d is the embedding dimension of each time step.

[0075] Step S402, converting the time domain embedding matrix from the time domain to the frequency domain to obtain the frequency domain embedding matrix corresponding to the time series data to be trained.

[0076] It should be noted that the time domain embedding matrix is ​​converted from the time domain to the frequency domain to obtain the frequency domain embedding matrix corresponding to the time series data to be trained, that is, the time domain embedding matrix is ​​projected to the frequency domain through Fourier transform or fast Fourier transform to obtain the frequency domain embedding matrix.

[0077] It should be noted that the time series data can be decomposed and represented as a combination of different frequency components through the Real-Valued Fast Fourier Transform (RFFT). For a real-valued time domain signal C = [C0, C1, ..., C E-1 ], which contains E time sample points. RFFT converts the real-valued time domain signal C into the frequency domain as follows: Among them, τ k is the kth frequency domain component decomposed from the real-valued time domain signal C; C e is the e-th value of the real-valued time domain signal C; π is the circumference of a circle; k = 0, 1, 2, 3, ..., E / 2; e = 0, 1, 2, ..., E-1; k, e, E are all integers; i is an imaginary unit. Finally, we get K frequency domain representations of the real-valued time domain signal C: τ = [τ0, τ1, ..., τ K ], where K=E / 2.

[0078] It can be seen that the frequency domain representation shows that the real-valued time domain signal C is a combination of a cosine wave signal and a sine wave signal, and each frequency domain representation has a different frequency and amplitude, corresponding to different periodic features in the real-valued time domain signal C. Therefore, analyzing the frequency properties of the frequency domain representation helps to identify the main frequencies and potential periodic patterns in the signal.

[0079] Similarly, the time domain embedding matrix can be projected into the frequency domain through the fast Fourier transform to obtain the frequency domain embedding matrix. It should be noted that the frequency domain embedding matrix includes the first frequency domain real part embedding matrix and the first frequency domain imaginary part embedding matrix. Among them, the first frequency domain real part embedding matrix τ r ∈R K×d ; The first frequency domain imaginary part embedding matrix τ i ∈R K×d K is the number of decomposed frequency domain representations.

[0080] Step S403: Perform frequency analysis on the frequency domain embedding matrix to obtain first reference prediction frequency domain data and reference prediction time domain data.

[0081] Furthermore, frequency analysis is performed on the frequency domain embedding matrix to obtain first reference predicted frequency domain data and reference predicted time domain data, including: performing frequency analysis on the frequency domain embedding matrix to obtain a second frequency domain real part embedding matrix and a second frequency domain imaginary part embedding matrix; and obtaining the first reference predicted frequency domain data and reference predicted time domain data according to the second frequency domain real part embedding matrix and the second frequency domain imaginary part embedding matrix.

[0082] Specifically, frequency analysis is performed on the frequency domain embedding matrix to obtain a second frequency domain real part embedding matrix and a second frequency domain imaginary part embedding matrix, including: by calculating Get the second frequency domain real part embedding matrix. Among them, is the second frequency domain real part embedding matrix; τ r is the first frequency domain real part embedding matrix; τ i is the first frequency domain imaginary embedding matrix; W1 is the first preset weight matrix with a dimension of d×d; W2 is the second preset weight matrix with a dimension of d×d; B1 is the first bias parameter with a dimension of d; φ represents the activation function. By calculating Get the second frequency domain imaginary part embedding matrix. Among them, is the second frequency domain imaginary part embedding matrix; B2 is the second bias parameter with dimension d.

[0083] It should be noted that φ can represent a single activation function or a mixed function of multiple activation functions. For example, φ can represent a Leaky ReLU (Leaky Rectified Linear Unit) activation function, a soft shrink activation function, or a mixed function of first performing a Leaky ReLU activation function and then performing a softshrink activation function. There is no limitation here.

[0084] Specifically, obtaining the first reference predicted frequency domain data and the reference predicted time domain data according to the second frequency domain real part embedding matrix and the second frequency domain imaginary part embedding matrix includes: performing de-embedding operation, linear transformation operation and normalization operation on the second frequency domain real part embedding matrix and the second frequency domain imaginary part embedding matrix to obtain the first reference predicted frequency domain data. Performing inverse Fourier transformation on the second frequency domain real part embedding matrix and the second frequency domain imaginary part embedding matrix to derive a new time embedding matrix from the second frequency domain real part embedding matrix and the second frequency domain imaginary part embedding matrix; performing residual connection on the new time embedding matrix and the time domain embedding matrix. Then performing de-embedding operation, linear transformation operation and normalization operation on the residual connected embedding matrix to obtain the reference predicted time domain data.

[0085] It should be noted that for the frequency domain representation: τ=[τ0,τ1,…,τ K ], where K = E / 2. When converted to the time domain, the inverse transformation process is as follows: Among them, C e is the e-th value of the real-valued time domain signal C; is the kth frequency domain representation τ k The real part of data; is the kth frequency domain representation τ k imaginary part data; π is the circumference of a circle; k = 0, 1, 2, 3, ..., E / 2; e = 0, 1, 2, ..., E-1; k, e, E are all integers; i is the imaginary unit.

[0086] Similarly, by embedding the real part of the second frequency domain into the matrix and the second frequency domain imaginary part embedding matrix Performing an inverse Fourier transform, the real part of the second frequency domain can be embedded into the matrix and the second frequency domain imaginary part embedding matrix Derive the new time embedding matrix in, The time-domain embedding matrix is ​​a matrix with N rows and d columns; N is the length of the prediction result of the time series data to be trained; d is the embedding dimension of each time step.

[0087] Embedding time into a matrix Perform residual connection with the time domain embedding matrix T, and then perform de-embedding operation, linear transformation operation and normalization operation on the embedding matrix after residual connection to obtain reference prediction time domain data.

[0088] It should be noted that the first reference predicted frequency domain data is the prediction result of the frequency domain obtained by predicting the training time series data. The reference predicted time domain data is the prediction result obtained by performing time series prediction on the training time series data. The reference predicted time domain data Y is an N-dimensional time series sequence, that is, N is the number of data values ​​of the reference predicted time domain data.

[0089] exist Figure 4 In the embodiment shown, the output embedding matrix is ​​dimensionally converted to obtain a time domain embedding matrix, and then the time domain embedding matrix is ​​converted from the time domain to the frequency domain to obtain a frequency domain embedding matrix corresponding to the time series data to be trained, and then the frequency domain embedding matrix is ​​frequency analyzed to obtain the first reference predicted frequency domain data and the reference predicted time domain data, thereby realizing the prediction of the time series data to be trained in the time domain and the prediction in the frequency domain. In order to adjust the time series prediction model based on the first reference predicted frequency domain data and the reference predicted time domain data, supervised learning in the frequency domain is introduced, so that the sequence data output by the trained time domain prediction model not only conforms to the time domain characteristics of the time series data to be predicted, but also conforms to its frequency domain characteristics, thereby improving the accuracy of time series prediction.

[0090] Step S304, adjusting the pre-trained time series prediction model according to the real time series data, the reference predicted time series data and the first reference predicted frequency domain data to obtain the trained time series prediction model.

[0091] exist Figure 3In the illustrated embodiment, the input embedding matrix corresponding to the time series data to be trained and the real time series data corresponding to the time series data to be trained is input into the embedding matrix acquisition module to obtain the input embedding matrix corresponding to the time series data to be trained; the input matrix is ​​input into the preset large language model for prediction to obtain the output embedding matrix; the output embedding matrix is ​​input into the preset complex domain adapter to extract the reference predicted time series data and the first reference predicted frequency domain data from the output embedding matrix; the time series prediction model before training is adjusted according to the real time series data, the reference predicted time series data and the first reference predicted frequency domain data to obtain the trained time series prediction model. In this way, compared with the prior art that performs time series prediction by using the model obtained by supervised learning in the time domain only, the time series prediction model of this scheme also introduces supervised learning in the frequency domain, which enhances the analysis of the frequency domain characteristics of the time series data to be predicted by the time series prediction model, so that the sequence data output by the trained time domain prediction model not only conforms to the time domain characteristics of the time series data to be predicted, but also conforms to its frequency domain characteristics, thereby improving the accuracy of time series prediction.

[0092] It should be noted that the real time series data is the subsequent data of the time series data to be trained. It is an N-dimensional time series.

[0093] Furthermore, the pre-trained time series prediction model is adjusted according to the real time series data, the reference predicted time series data and the first reference predicted frequency domain data to obtain the trained time series prediction model, including: obtaining the difference between the real time series data and the reference predicted time series data to obtain the time domain loss value; obtaining the real frequency domain data corresponding to the real time series data; obtaining the difference between the real frequency domain data and the first reference predicted frequency domain data to obtain the first frequency domain loss value; obtaining the loss value of the pre-trained time series prediction model according to the time domain loss value and the first frequency domain loss value; adjusting the pre-trained time series prediction model according to the loss value to obtain the trained time series prediction model.

[0094] In this way, the time domain loss value is obtained by the difference between the real time series data and the reference predicted time series data, and the first frequency domain loss value is obtained by the difference between the real frequency domain data corresponding to the real time series data and the first reference predicted frequency domain data, so as to obtain the loss value of the time series prediction model before training, and then adjust the time series prediction model according to the loss value. The model is adjusted by combining the loss conditions in the time domain and frequency domain, introducing supervised learning in the frequency domain, and enhancing the analysis of the frequency domain characteristics of the time series data to be predicted by the time series prediction model, so that the sequence data output by the trained time domain prediction model not only meets the time domain characteristics of the time series data to be predicted, but also meets its frequency domain characteristics, thereby improving the accuracy of time series prediction.

[0095] Further, the difference between the real time series data and the reference predicted time series data is obtained to obtain the time domain loss value, including: by calculating Get the time domain loss value. Among them, L t is the time domain loss value; N is the number of data values ​​in the real time series data or the reference prediction time series data; is the nth data value of the real time series data; Y n is the nth data value of the reference prediction time series data; “|| F "Characterizes the Frobenius norm algorithm.

[0096] It should be noted that to obtain the real frequency domain data corresponding to the real time series data, the real time series data is converted into the frequency domain, for example: Fourier transform, fast Fourier transform, real fast Fourier transform, etc., to obtain the real frequency domain data.

[0097] Further, obtaining the difference between the real frequency domain data and the first reference predicted frequency domain data to obtain the first frequency domain loss value includes: calculating Obtain the first frequency domain loss value. Among them, is the first frequency domain loss value; K is the number of data values ​​in the first reference predicted frequency domain data or the real frequency domain data; is the real frequency domain data, which represents the real time series data Perform RFFT (Real Fast Fourier Transform); is the kth frequency domain representation of the real frequency domain data; is the real number part of the kth data value of the first reference prediction frequency domain data; is the imaginary part of the kth data value of the first reference prediction frequency domain data; “||” represents the modulus of the calculated complex number.

[0098] Optionally, the loss value of the time series prediction model before training is obtained according to the time domain loss value and the first frequency domain loss value, including: weighting the time domain loss value and the first frequency domain loss value to obtain the loss value of the time series prediction model before training.

[0099] Optionally, the loss value of the pre-trained time series prediction model is obtained based on the time domain loss value and the first frequency domain loss value, including: converting the reference prediction time series data to the frequency domain to obtain second reference prediction frequency domain data; obtaining the difference between the real frequency domain data and the second reference prediction frequency domain data to obtain the second frequency domain loss value; weighting the time domain loss value, the first frequency domain loss value and the second frequency domain loss value to obtain the loss value.

[0100] In this way, the loss value of the time domain is obtained by the difference between the real time series data and the reference predicted time series data, the first frequency domain loss value is obtained by the difference between the real frequency domain data corresponding to the real time series data and the first reference predicted frequency domain data, and the second frequency domain loss value is obtained by the difference between the real frequency domain data and the second reference predicted frequency domain data of the reference predicted time series data in the frequency domain, and the loss value of the time series prediction model before training is obtained, and then the time series prediction model is adjusted according to the loss value. Further frequency supervision is provided, so that the trained time series prediction model can more deeply explore the frequency domain characteristics of the time series data to be predicted, thereby further improving the accuracy of time series prediction.

[0101] Furthermore, by calculating The second frequency domain loss value is obtained. is the second frequency domain loss value; K is the number of data values ​​in the real frequency domain data; is the real frequency domain data, which represents the real time series data Perform RFFT (Real Fast Fourier Transform); is the kth frequency domain representation of the real frequency domain data; RFFT(Y) is the second reference predicted frequency domain data, which represents the RFFT of the reference predicted time series data to convert from the time domain to the frequency domain; RFFT(Y) k is the kth frequency domain representation of the second reference predicted frequency domain data; “||” represents the modulus of the calculated complex number.

[0102] Further, determining the sum of the time domain loss value, the first frequency domain loss value, and the second frequency domain loss value as the loss value includes: calculating Get the loss value. Where Loss is the loss value; is a preset first weight coefficient; is a preset second weight coefficient; is the preset third weight coefficient.

[0103] Furthermore, the time series prediction model before training is adjusted according to the loss value to obtain the time series prediction model after training, including: obtaining the model parameters to be adjusted in the time series prediction model before training; when the loss value is greater than the preset reference loss value, adjusting the model parameters; replacing the model parameters before adjustment in the time series prediction model before training with the adjusted model parameters to obtain the time series prediction model after training.

[0104] In this way, when the loss value is greater than the preset reference loss value, the model parameters to be adjusted in the time series prediction model before training are adjusted to replace the model parameters before adjustment, thereby obtaining the time series prediction model after training. Since the loss value combines the loss conditions in the two dimensions of time domain and frequency domain, the supervised learning in the frequency domain is introduced on the basis of the supervised learning in the time domain, which enhances the analysis of the frequency domain characteristics of the time series data to be predicted by the time series prediction model, so that the sequence data output by the trained time domain prediction model not only meets the time domain characteristics of the time series data to be predicted, but also meets its frequency domain characteristics, thereby improving the accuracy of time series prediction.

[0105] It should be noted that when the loss value is less than or equal to the preset reference loss value, it can be determined that the training is completed.

[0106] It should be noted that the model parameters to be adjusted are the model parameters in the data embedding matrix acquisition submodule and the complex domain adapter. Exemplarily, the model parameters in the data embedding matrix acquisition submodule include the parameters in the block processing and block re-editing processing; the model parameters in the complex domain adapter include: the parameters in the linear transformation operations, feature embedding processing operations, de-embedding operations in the complex domain adapter and the weight parameters, such as: W1, W2, B1, B2.

[0107] See also Figure 5 , Figure 5 A flowchart of a method for adjusting a time series forecasting model.

[0108] like Figure 5 As shown, the method for adjusting the time series prediction model at least includes steps S501 to S511, which are described in detail as follows:

[0109] Step S501, obtaining the difference between the real time series data and the reference predicted time series data to obtain the time domain loss value.

[0110] Step S502, obtaining real frequency domain data corresponding to the real time series data.

[0111] Step S503: Obtain the difference between the actual frequency domain data and the first reference predicted frequency domain data to obtain a first frequency domain loss value.

[0112] Step S504: convert the reference prediction time series data into the frequency domain to obtain second reference prediction frequency domain data.

[0113] Step S505: Obtain the difference between the actual frequency domain data and the second reference predicted frequency domain data to obtain a second frequency domain loss value.

[0114] Step S506: weight the time domain loss value, the first frequency domain loss value, and the second frequency domain loss value to obtain a loss value.

[0115] Step S507, obtaining model parameters to be adjusted in the time series prediction model before training.

[0116] Step S508, determining whether the loss value is greater than a preset reference loss value, if so, executing step S509; if not, executing step S511.

[0117] Step S509: adjusting the model parameters.

[0118] Step S510, using the adjusted model parameters to replace the model parameters before adjustment in the time series prediction model before training.

[0119] Step S511, training is completed.

[0120] In this embodiment, the loss value of the time series prediction model before training is obtained by obtaining the time domain loss value through the difference between the real time series data and the reference predicted time series data, the first frequency domain loss value is obtained through the difference between the real frequency domain data corresponding to the real time series data and the first reference predicted frequency domain data, and the second frequency domain loss value is obtained through the difference between the real frequency domain data and the second reference predicted frequency domain data of the reference predicted time series data in the frequency domain, and then when the loss value is greater than the preset reference loss value, the model parameters to be adjusted in the time series prediction model before training are adjusted to replace the model parameters before adjustment to obtain the trained time series prediction model. In this way, since the loss value combines the loss conditions in the two dimensions of time domain and frequency domain, the supervised learning in the frequency domain is also introduced on the basis of the supervised learning in the time domain, which enhances the analysis of the frequency domain characteristics of the time series data to be predicted by the time series prediction model, so that the sequence data output by the trained time domain prediction model not only conforms to the time domain characteristics of the time series data to be predicted, but also conforms to its frequency domain characteristics, thereby improving the accuracy of time series prediction.

[0121] At the same time, during the training process, by converting the time series to the frequency domain and using an orthogonal and independent Fourier basis combination to represent the time series data, and then supervising the prediction of the time series in the frequency domain, the time domain prediction model's analysis of the periodic characteristics of the time series data is improved, the prediction performance is improved, and the accuracy of the time series prediction of the time domain prediction model after training is improved.

[0122] It should be noted that when training the time series prediction model, if the time series data to be trained is multivariate time series data, the time series prediction model can divide the time series data to be trained into univariate time series data, and make separate predictions for each univariate time series data, and adjust the time series prediction model before training based on the reference prediction time series data and the first reference prediction frequency domain data for each prediction. Then, the adjusted time series prediction model is used again as the time series prediction model before training to make separate predictions for the next univariate time series data until all variables in the multivariate time series data are trained.

[0123] Step S230, determining the sequence data output by the trained time domain prediction model as the prediction result corresponding to the time series data to be predicted.

[0124] In this embodiment, the time series data to be predicted is input into the time series prediction model obtained by training the time series data to be trained, and then the sequence data output by the time series prediction model is determined as the prediction result corresponding to the time series data to be predicted. During the training process of the time series prediction model, the time series prediction model is adjusted by using the reference predicted time series data obtained by predicting the time series data to be trained and the first reference predicted frequency domain data. It can be seen that the time series prediction model realizes the supervised learning of the model through the time domain data obtained by predicting the time series data to be trained, that is, the reference predicted time series data, and the frequency domain data obtained by predicting the time series data to be trained, that is, the first reference predicted frequency domain data. In this way, compared with the prior art that uses the model obtained by supervised learning in the time domain only for time series prediction, the time series prediction model of this scheme also introduces supervised learning in the frequency domain, which enhances the analysis of the frequency domain characteristics of the time series data to be predicted by the time series prediction model, so that the sequence data output by the trained time domain prediction model not only meets the time domain characteristics of the time series data to be predicted, but also meets its frequency domain characteristics, thereby improving the accuracy of time series prediction.

[0125] It should be noted that in recent years, large language models have been increasingly used in time series prediction tasks because they have demonstrated general capabilities in a wide range of tasks in the field of natural language processing and have shown strong small-sample learning and zero-sample learning capabilities. Related methods for using large language models for time series prediction include: using a two-stage optimization method to align the GPT-2 (Generative Pre-Training 2.0) model with time series data and fine-tune it for time series prediction tasks; freezing the self-attention and feedforward layers in the GPT-2 residual block and fine-tuning the model for time series tasks; the GPT4TS (Generative Pre-Training for Time Series) model; a large model framework based on prompt words to integrate text data into time series datasets; a CALF (Cross-modal Adjusted Large Language Model) model that solves the distribution difference problem between text data and time data by aligning the cross-modal matching module of the input distribution. Framework, a cross-modal large language model fine-tuning framework); a TEST (test) model that converts time series data into a model-friendly representation so that the pre-trained large model can process time series data; it includes a frozen LLaMA (Large Language Model Meta AI, a large-scale language model released by Meta AI) model, which is used to reprogram the input time series data into a text prototype representation, thereby facilitating the time series data to adapt to the large model for effective prediction. Time-LLM (Time Series Forecasting by Reprogramming Large Language Models) model.

[0126] In some embodiments, see Figure 6 , Figure 6 Schematic diagram of the structure of the time domain prediction model after training.

[0127] like Figure 6As shown, the trained time domain prediction model includes a data embedding matrix acquisition submodule 601, a time series feature embedding matrix acquisition submodule 602, a large language model module 603 and a complex domain adapter 604. The time series data to be predicted is input into the data embedding matrix acquisition submodule to obtain the time series data embedding matrix corresponding to the time series data to be predicted. At the same time, the time series data to be predicted is input into the time series feature embedding matrix acquisition submodule to extract the feature information of the time series data to be predicted and obtain the time series feature embedding matrix. After splicing the time series data embedding matrix and the time series feature embedding matrix, they are input into the large language model module for prediction to obtain the output embedding matrix. The output embedding matrix is ​​input into the complex domain adapter to extract the reference predicted time series data corresponding to the time series data to be predicted from the output embedding matrix. The reference predicted time series data is the sequence data output by the trained time domain prediction model, that is, the prediction result corresponding to the time series data to be predicted.

[0128] In this way, the time series data to be predicted is input into the time series prediction model trained by the time series data to be trained, and then the sequence data output by the time series prediction model is determined as the prediction result corresponding to the time series data to be predicted. During the training process of the time series prediction model, the time series prediction model is adjusted by using the reference predicted time series data predicted by the time series data to be trained and the first reference predicted frequency domain data. It can be seen that the time series prediction model realizes the supervised learning of the model through the time domain data predicted by the time series data to be trained, that is, the reference predicted time series data, and the frequency domain data predicted by the time series data to be trained, that is, the first reference predicted frequency domain data. In this way, compared with the prior art that uses the model obtained only through supervised learning in the time domain for time series prediction, the time series prediction model of this scheme also introduces supervised learning in the frequency domain, which enhances the analysis of the frequency domain characteristics of the time series data to be predicted by the time series prediction model, so that the sequence data output by the trained time domain prediction model not only meets the time domain characteristics of the time series data to be predicted, but also meets its frequency domain characteristics, thereby improving the accuracy of time series prediction.

[0129] In this embodiment, a complex domain adapter is introduced, and a complex domain neural network is used to enhance the output embedding matrix of the large language model to promote analysis and reasoning in the frequency domain. Specifically, Fourier transform and complex number calculation are used to enable the large language model to perform sequence analysis and prediction on the time series data to be predicted in both the time domain and the frequency domain, and effectively identify the intrinsic attributes and correlations in the time series data to be predicted from a global perspective, so as to facilitate mechanical energy prediction based on the intrinsic attributes and correlations in the time series data to be predicted, thereby improving the time series prediction performance of the model.

[0130] Figure 7 is a block diagram of a device for time domain prediction shown in an exemplary embodiment of the present application. The device can be applied to Figure 1The device may also be applicable to other exemplary implementation environments and specifically configured in other devices, and this embodiment does not limit the implementation environment to which the device is applicable.

[0131] like Figure 7 As shown, the exemplary device for time domain prediction includes:

[0132] A data acquisition module 701 is configured to acquire time series data to be predicted;

[0133] The prediction module 702 is configured to input the time series data to be predicted into the trained time series prediction model; wherein the trained time series prediction model is obtained by training the time series prediction model before training through the preset time series data to be trained; during the training process, the time series prediction model is adjusted through the reference prediction time series data and the first reference prediction frequency domain data; the reference prediction time series data and the first reference prediction frequency domain data are obtained by predicting the time series data to be trained;

[0134] The determination module 703 is configured to determine the sequence data output by the time domain prediction model as the prediction result corresponding to the time series data to be predicted.

[0135] In an exemplary embodiment, the apparatus for time domain prediction further includes: a model training module, including:

[0136] An input embedding matrix acquisition submodule is configured to input the time series data to be trained and the real time series data corresponding to the time series data to be trained into the embedding matrix acquisition module to obtain an input embedding matrix corresponding to the time series data to be trained;

[0137] An output embedding matrix acquisition submodule is configured to input the input matrix into a preset large language model for prediction to obtain an output embedding matrix;

[0138] an extraction submodule configured to input the output embedding matrix into a preset complex domain adapter to extract reference prediction time series data and first reference prediction frequency domain data from the output embedding matrix;

[0139] The adjustment submodule is configured to adjust the pre-trained time series prediction model according to the real time series data, the reference prediction time series data and the first reference prediction frequency domain data to obtain the trained time series prediction model.

[0140] In an exemplary embodiment, the input embedding matrix acquisition submodule includes:

[0141] A time series data embedding matrix acquisition submodule is configured to acquire a time series data embedding matrix corresponding to the time series data to be trained;

[0142] A time series feature embedding matrix acquisition submodule is configured to extract feature information of the time series data to be trained and obtain a time series feature embedding matrix;

[0143] The concatenation submodule is configured to concatenate the time series data embedding matrix and the time series feature embedding matrix to obtain an input embedding matrix.

[0144] In an exemplary embodiment, the extraction submodule includes:

[0145] A first conversion submodule is configured to perform dimension conversion on the output embedding matrix to obtain a time domain embedding matrix;

[0146] A second conversion submodule is configured to convert the time domain embedding matrix from the time domain to the frequency domain to obtain a frequency domain embedding matrix corresponding to the time series data to be trained;

[0147] The frequency analysis submodule is configured to perform frequency analysis on the frequency domain embedding matrix to obtain first reference predicted frequency domain data and reference predicted time domain data.

[0148] In an exemplary embodiment, the adjustment submodule includes:

[0149] A time domain loss value acquisition submodule is configured to obtain the difference between the real time series data and the reference predicted time series data to obtain the time domain loss value;

[0150] A real frequency domain data acquisition submodule, configured to acquire real frequency domain data corresponding to real time series data;

[0151] A first frequency domain loss value acquisition submodule, configured to obtain a difference between the real frequency domain data and the first reference predicted frequency domain data to obtain a first frequency domain loss value;

[0152] A loss value acquisition submodule, configured to acquire a loss value of a time series prediction model before training according to a time domain loss value and a first frequency domain loss value;

[0153] The model adjustment submodule is configured to adjust the time series prediction model before training according to the loss value to obtain the time series prediction model after training.

[0154] In an exemplary embodiment, the loss value acquisition submodule includes:

[0155] A third conversion submodule is configured to convert the reference prediction time series data into the frequency domain to obtain second reference prediction frequency domain data;

[0156] A second frequency domain loss value acquisition submodule, configured to obtain a difference between the real frequency domain data and the second reference predicted frequency domain data to obtain a second frequency domain loss value;

[0157] The weighting submodule is configured to weight the time domain loss value, the first frequency domain loss value and the second frequency domain loss value to obtain a loss value.

[0158] In an exemplary embodiment, the model adjustment submodule includes:

[0159] A model parameter acquisition submodule, configured to obtain model parameters to be adjusted in a time series prediction model before training;

[0160] A parameter adjustment submodule, configured to adjust the model parameters when the loss value is greater than a preset reference loss value;

[0161] The replacement submodule is configured to use the adjusted model parameters to replace the model parameters before adjustment in the time series prediction model before training, so as to obtain the trained time series prediction model.

[0162] It should be noted that the device for time domain prediction provided in the above embodiment and the method for time domain prediction provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment, and will not be repeated here. In practical applications, the device for time domain prediction provided in the above embodiment can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.

[0163] An embodiment of the present application also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the electronic device implements the method for time domain prediction provided in the above-mentioned embodiments.

[0164] Figure 8 The structure diagram of the computer system suitable for implementing the electronic device of the embodiment of the present application is shown. It should be noted that: Figure 8 The computer system 800 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0165] like Figure 8As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 802 or the program loaded from the storage part 808 to the random access memory (RAM) 803, such as executing the method described in the above embodiment. In the RAM 803, various programs and data required for system operation are also stored. The CPU 801, ROM 802 and RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0166] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed so that a computer program read therefrom is installed into the storage section 808 as needed.

[0167] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 809, and / or installed from a removable medium 811. When the computer program is executed by a central processing unit (CPU) 801, various functions defined in the system of the present application are executed.

[0168] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0169] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0170] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0171] Another aspect of the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the method for time domain prediction as described above when the computer program is executed by a processor. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.

[0172] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method for time domain prediction provided in each of the above embodiments.

[0173] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.

Claims

1. A method for time domain prediction, characterized in that: include: Obtain the time series data to be predicted; Input the time series data to be predicted into the trained time series prediction model; wherein the trained time series prediction model is obtained by training the time series prediction model before training through the preset time series data to be trained; during the training process, the time series prediction model is adjusted through the reference prediction time series data and the first reference prediction frequency domain data; the reference prediction time series data and the first reference prediction frequency domain data are obtained by predicting the time series data to be trained; The sequence data output by the time domain prediction model is determined as the prediction result corresponding to the time series data to be predicted.

2. The method according to claim 1, characterized in that The time series prediction model before training includes: an embedding matrix acquisition module, a large language model module and a complex domain adapter; the time series prediction model after training is obtained by training in the following manner: Inputting the time series data to be trained and the real time series data corresponding to the time series data to be trained into the embedding matrix acquisition module to obtain the input embedding matrix corresponding to the time series data to be trained; Input the input matrix into a preset large language model for prediction to obtain an output embedding matrix; Inputting the output embedding matrix into a preset complex domain adapter to extract the reference prediction time series data and the first reference prediction frequency domain data from the output embedding matrix; The pre-trained time series prediction model is adjusted according to the real time series data, the reference predicted time series data and the first reference predicted frequency domain data to obtain a trained time series prediction model.

3. The method according to claim 2, characterized in that The step of inputting the time series data to be trained into the embedding matrix acquisition module to obtain the input embedding matrix corresponding to the time series data to be trained includes: Obtaining a time series data embedding matrix corresponding to the time series data to be trained; Extracting feature information of the time series data to be trained to obtain a time series feature embedding matrix; The time series data embedding matrix and the time series feature embedding matrix are concatenated to obtain the input embedding matrix.

4. The method according to claim 2, characterized in that: The extracting the reference prediction time series data and the first reference prediction frequency domain data from the output embedding matrix comprises: Performing dimension conversion on the output embedding matrix to obtain a time domain embedding matrix; Convert the time domain embedding matrix from the time domain to the frequency domain to obtain a frequency domain embedding matrix corresponding to the time series data to be trained; Perform frequency analysis on the frequency domain embedding matrix to obtain the first reference prediction frequency domain data and the reference prediction time domain data.

5. The method according to claim 2, characterized in that: The step of adjusting the pre-trained time series prediction model according to the real time series data, the reference predicted time series data and the first reference predicted frequency domain data to obtain a trained time series prediction model includes: Obtaining a difference between the real time series data and the reference predicted time series data to obtain a time domain loss value; Acquire real frequency domain data corresponding to the real time series data; Obtaining a difference between the actual frequency domain data and the first reference predicted frequency domain data to obtain a first frequency domain loss value; Obtaining a loss value of the pre-trained time series prediction model according to the time domain loss value and the first frequency domain loss value; The pre-trained time series prediction model is adjusted according to the loss value to obtain a trained time series prediction model.

6. The method according to claim 5, characterized in that The acquiring the loss value of the pre-trained time series prediction model according to the time domain loss value and the first frequency domain loss value includes: Converting the reference prediction time series data into the frequency domain to obtain second reference prediction frequency domain data; Obtaining a difference between the actual frequency domain data and the second reference predicted frequency domain data to obtain a second frequency domain loss value; The time domain loss value, the first frequency domain loss value, and the second frequency domain loss value are weighted to obtain the loss value.

7. The method according to claim 5, characterized in that The step of adjusting the pre-trained time series prediction model according to the loss value to obtain the trained time series prediction model includes: Obtaining model parameters to be adjusted in the pre-trained time series prediction model; When the loss value is greater than a preset reference loss value, adjusting the model parameters; The adjusted model parameters are used to replace the model parameters before adjustment in the time series prediction model before training to obtain the time series prediction model after training.

8. A device for time domain prediction, characterized in that: include: A data acquisition module, configured to acquire time series data to be predicted; A prediction module, configured to input the time series data to be predicted into a trained time series prediction model; wherein the trained time series prediction model is obtained by training a pre-trained time series prediction model with preset time series data to be trained; during the training process, the time series prediction model is adjusted with reference to the predicted time series data and the first reference predicted frequency domain data; the reference predicted time series data and the first reference predicted frequency domain data are obtained by predicting the time series data to be trained; The determination module is configured to determine the sequence data output by the time domain prediction model as the prediction result corresponding to the time series data to be predicted.

9. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the method for time domain prediction as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the method for time-domain prediction according to any one of claims 1 to 7.