Time series data prediction method, device, electronic device and storage medium
By performing similarity retrieval in the data set to obtain similar data and combining it with a pre-trained time series prediction model, the problem of low accuracy in time series data prediction in the existing technology is solved, and higher prediction accuracy is achieved.
Patent Information
- Application Number
- CN202411798846.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2044-12-06
AI Technical Summary
In the existing technology, only the current time series data is used to predict the time series data, and the prediction accuracy is not high.
By obtaining the current time series data of the target indicator, similarity retrieval is performed in the data set to obtain similar data, and a pre-trained time series prediction model is used to make predictions, and similar data is combined to make time series data predictions.
The accuracy of time series data prediction is improved. Similar data of the current time series data is retrieved from the data set through similarity retrieval, and similar data is used to assist time-related data in prediction, thereby improving the accuracy of prediction.
Smart Images

Figure CN119646240B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, in particular to artificial intelligence fields such as big data and deep learning, and specifically to a time series data prediction method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of big data and artificial intelligence technologies, time series data prediction plays an increasingly important role in traffic flow prediction, economic and financial analysis, weather forecasting and other fields. Summary of the Invention
[0003] The present application provides a time series data prediction method, device, electronic device and storage medium.
[0004] According to one aspect of the present application, a time series data prediction method is provided, comprising:
[0005] Acquire time-related data of the target indicator; wherein the time-related data includes current time series data of the target indicator;
[0006] Performing similarity search in a data set based on the current time series data to obtain similar data to the current time series data;
[0007] Time series data is predicted based on the time-related data and the similar data to obtain time series prediction data of the target indicator.
[0008] According to another aspect of the present application, a time series data prediction device is provided, comprising:
[0009] An acquisition module, configured to acquire time-related data of a target indicator; wherein the time-related data includes current time series data of the target indicator;
[0010] A retrieval module, configured to perform similarity retrieval in a data set based on the current time series data to obtain data similar to the current time series data;
[0011] The prediction module is used to perform time series data prediction based on the time-related data and the similar data to obtain time series prediction data of the target indicator.
[0012] According to another aspect of the present application, an electronic device is provided, including:
[0013] at least one processor; and
[0014] a memory communicatively connected to the at least one processor; wherein,
[0015] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the above embodiment.
[0016] According to another aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method according to the above embodiment.
[0017] According to another aspect of the present application, a computer program product is provided, including a computer program, which implements the steps of the method described in the above embodiment when executed by a processor.
[0018] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present application.
[0020] Figure 1 A schematic diagram of a flow chart of a time series data prediction method provided in one embodiment of the present application;
[0021] Figure 2 A schematic flow chart of a time series data prediction method provided in another embodiment of the present application;
[0022] Figure 3 A schematic flow chart of a time series data prediction method provided in another embodiment of the present application;
[0023] Figure 4 A schematic diagram of the structure of a time series data prediction device provided in one embodiment of the present application;
[0024] Figure 5 It is a block diagram of an electronic device used to implement the time series data prediction method of the embodiment of the present application. DETAILED DESCRIPTION
[0025] The following description of exemplary embodiments of the present application is made in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0026] It should be noted that the acquisition, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations and do not violate public order and good morals.
[0027] The following describes the time series data prediction method, device, electronic device, and storage medium according to embodiments of the present application with reference to the accompanying drawings.
[0028] In some embodiments, the current time series data of the indicator can be used to predict the time series data. However, if only the current time series data is used to predict the time series data, the prediction accuracy is not high.
[0029] Figure 1 A flowchart of a time series data prediction method provided in one embodiment of the present application.
[0030] The time series data prediction method of the embodiment of the present application can be executed by the time series data prediction device of the embodiment of the present application, and the device can be configured in an electronic device.
[0031] Among them, the electronic device can be any device with computing capabilities, such as a personal computer, mobile terminal, server, etc. The mobile terminal can be, for example, a vehicle-mounted device, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, and other hardware devices with various operating systems, touch screens and / or display screens.
[0032] like Figure 1 As shown, the time series data prediction method includes:
[0033] Step 101: Obtain time-related data of the target indicator.
[0034] For example, the target indicator may be air temperature, air humidity, traffic flow, or other indicators, which are not limited thereto.
[0035] In this application, the time-related data of the target indicator may include the current time series data of the target indicator, and may also include relevant text of the current time series data. The relevant text may be text related to the current time series data within the time length of the current time series data.
[0036] For example, if the target indicator is temperature, the current time series data is the temperature of the past week, and the related text can be the weather news of the past week.
[0037] Step 102: perform similarity search in the data set based on the current time series data to obtain data similar to the current time series data.
[0038] The similar data may include similar text, similar time series data, etc. Similar text may be text similar to text related to the current time series data, and similar time series data may be time series data similar to the current time series data. In addition, similar text may be text related to the similar time series data within the time length of the similar time series data.
[0039] It can be understood that similar time series data is also time series data of the target indicator, and similar text is text related to the target indicator.
[0040] For example, the current time series data is the temperature of the past week, and the related text may be the weather news of the past week. The similar time series data may be the temperature of an earlier week, and the similar text may be the weather news of the earlier week.
[0041] It should be noted that the time lengths of the similar time series data and the current time series data may be the same or different, and there is no limitation on this.
[0042] For example, the dataset may include pairs of candidate time series data and candidate texts. Alternatively, the dataset may include candidate time series data for multiple indicators and the corresponding candidate texts. It should be noted that the multiple indicators here can be indicators of the same field or indicators of different fields, and there can be one or more indicators in the same field.
[0043] For example, a similarity search can be performed in the data set based on the current time series data to obtain time series data similar to the current time series data, and then similar data can be obtained based on the time series data similar to the current time series data.
[0044] Step 103: perform time series data prediction based on the time-related data and similar data to obtain time series prediction data of the target indicator.
[0045] In this application, time-related data and similar data can be input into a pre-trained time series prediction model to perform time series data prediction, thereby obtaining time series prediction data for the target indicator. The time length between the time series prediction data and the current time series data can be the same or different, and there is no limitation on this.
[0046] For example, the time series prediction model can be a prediction model based on the Transformer structure. The prediction model based on the Transformer structure can effectively capture the global and local dependencies in the time series data through the self-attention mechanism, thereby further improving the accuracy and effect of the prediction.
[0047] Exemplarily, time series data prediction can be performed based on current time series data and similar data in the time-related data to obtain time series prediction data.
[0048] Exemplarily, the time-related data may also include relevant text of the current time series data. Time series data prediction may be performed based on the current time series data, the relevant text of the current time series data, and similar data to obtain time series prediction data.
[0049] In the embodiment of the present application, by obtaining time-related data of a target indicator, performing a similarity search based on the current time series data of the target indicator in the time-related data to obtain similar data, and then performing time series data prediction based on the time-related data and the similar data to obtain time series prediction data. Thus, similar data similar to the current time series data is retrieved from the data set through similarity search, and the similar data is used to assist the time-related data in performing time series data prediction, thereby improving the accuracy of time series data prediction.
[0050] Figure 2 A flowchart of a time series data prediction method provided in another embodiment of the present application.
[0051] like Figure 2 As shown, the time series data prediction method includes:
[0052] Step 201: Obtain time-related data of the target indicator.
[0053] In the present application, step 201 can be implemented in any of the embodiments of the present application, so it will not be described in detail here.
[0054] Step 202 : Based on the current time series data, similarity search is performed on the candidate texts corresponding to the candidate time series data in the data set to obtain similar texts corresponding to the current time series data.
[0055] Among them, the paired candidate time series data and candidate texts in the dataset are data within the same time.
[0056] As a possible implementation method, relevant texts of the current time series data can be obtained, the similarity between the relevant texts and each candidate text can be calculated, and based on the similarity, similar texts can be determined from each candidate text. For example, the candidate text with the highest similarity can be used as the similar text.
[0057] Therefore, based on the relevant texts of the current time series data, similar texts can be found in each candidate text in the data set based on similarity retrieval, thereby improving the accuracy of similar texts.
[0058] In addition, since similar texts are retrieved based on related texts of the current time series data, similar texts are also related to the current time series data, so similar texts retrieved based on text retrieval can supplement the current time series data.
[0059] As another possible implementation method, the first Euclidean distance between the current time series data and the candidate time series data can be calculated, and based on the first Euclidean distance corresponding to the candidate time series data, similar time series data can be determined from each candidate time series data, and then the candidate text corresponding to the similar time series data can be determined as the similar text.
[0060] For example, the candidate time series data having the smallest first Euclidean distance to the current time series data may be regarded as the similar time series data.
[0061] Therefore, based on the Euclidean distance between the current time series data and each candidate time series data in the data set, time series data similar to the current time series data can be retrieved from the data set, and then the candidate texts corresponding to the similar time series data can be used as similar texts, enriching the method of obtaining similar texts.
[0062] In addition, since similar texts are texts corresponding to similar time series data of the current time series data, similar texts are also related to the current time series data, so similar texts retrieved based on the Euclidean distance of the time series can supplement the current time series data.
[0063] Since the time lengths between the current time series data and the candidate time series data may be the same or different, we can determine the first time length of the current time series data and the second time length of the candidate time series data. Based on the first and second time lengths, we can calculate the first Euclidean distance between the current time series data and the candidate time series data. This allows us to calculate the Euclidean distance between two time series data in different scenarios.
[0064] Exemplarily, if the first time length is the same as the second time length, the first Euclidean distance between the current time series data and the candidate time series data is calculated directly based on the index value of the target index at the corresponding time points of the current time series data and the candidate time series data.
[0065] For example, if the first time length is greater than the second time length, multiple first sub-time series data can be extracted from the current time series data according to the second time length, where the length of the first sub-time series data is the same as the second time length, and the second Euclidean distance between the first sub-time series data and the candidate time series data is calculated. Then, the first Euclidean distance is determined based on the multiple second Euclidean distances. For example, the smallest second Euclidean distance among the multiple second Euclidean distances can be used as the first Euclidean distance between the current time series data and the candidate time series data.
[0066] When intercepting the first sub-time series data, the second time length can be used as the window length, the window can be slid on the current time series data, and the time series data within the window can be used as the first sub-time series data, so that multiple first sub-time series data can be intercepted through the sliding window.
[0067] Therefore, when the time length of the current time series data is greater than the time length of the candidate time series data, the current time series data can be intercepted to obtain multiple time series data with the same time length as the candidate time series data, and the Euclidean distance between the intercepted time series data and the candidate time series data is calculated, thereby obtaining the Euclidean distance between the current time series data and the candidate time series data, which meets the requirement for calculating the Euclidean distance between the two time series data in the scenario where the time length of the current time series data is greater than the time length of the candidate time series data.
[0068] For example, if the second time length is greater than the first time length, multiple second sub-time series data are extracted from the candidate time series data according to the first time length, where the length of the second sub-time series data is the same as the first time length, and the third Euclidean distance between the second sub-time series data and the candidate time series data is calculated. The first Euclidean distance is then determined based on the multiple third Euclidean distances. For example, the smallest third Euclidean distance among the multiple third Euclidean distances can be used as the first Euclidean distance between the current time series data and the candidate time series data.
[0069] When intercepting the second sub-time series data, the first time length can be used as the window length, the window can be slid on the candidate time series data, and the time series data within the window can be used as the second sub-time series data, so that multiple second sub-time series data can be intercepted through the sliding window.
[0070] Therefore, when the time length of the candidate time series data is greater than the time length of the current time series data, the candidate time series data can be intercepted to obtain multiple time series data with the same time length as the current time series data, and the Euclidean distance between the intercepted time series data and the current time series data is calculated, thereby obtaining the Euclidean distance between the current time series data and the candidate time series data, which meets the requirement for calculating the Euclidean distance between the two time series data in the scenario where the time length of the candidate time series data is greater than the time length of the current time series data.
[0071] Step 203 : Based on the current time series data, similarity search is performed in each candidate time series data to obtain time series data similar to the current time series data.
[0072] As a possible implementation method, the first Euclidean distance between the current time series data and the candidate time series data can be calculated. Then, based on the first Euclidean distances corresponding to the candidate time series data, similar time series data can be determined from the candidate time series data. For example, the candidate time series data with the smallest first Euclidean distance to the current time series data can be selected as the similar time series data.
[0073] The calculation method of the first Euclidean distance may refer to the method described in the above embodiment, which will not be described in detail here.
[0074] Therefore, based on the Euclidean distance between the current time series data and each candidate time series data in the data set, time series data similar to the current time series data can be retrieved from the data set through similarity retrieval, thereby improving the accuracy of similar time series data and further improving the accuracy of time series data prediction.
[0075] As another possible implementation method, relevant text of the current time series data can be obtained, and the similarity between the relevant text and the candidate text corresponding to the candidate time series data can be calculated. Based on the similarity, similar text can be determined from each candidate text, and then the candidate time series data corresponding to the similar text can be determined as similar time series data.
[0076] Therefore, based on the relevant text of the current time series data, similar texts can be obtained through similarity retrieval, and then the candidate time series data corresponding to the similar texts can be used as the similar time series data of the current time series data, enriching the method of obtaining similar time series data.
[0077] In addition, since similar text is text similar to the relevant text of the current time series data, the candidate time series data corresponding to the similar text is also similar to the current time series data, so the similar time series data can assist the current time series data in time series data prediction.
[0078] Step 204: Determine similar data based on similar texts and / or similar time series data.
[0079] The similar data may include similar texts, or may include similar time series data, or may include similar texts and similar time series data, which is not limited.
[0080] Since the dataset may include candidate time series data of multiple different indicators and their corresponding candidate texts, in order to improve the retrieval efficiency, as a possible implementation method, we can first determine the candidate time series data of the target indicator from the dataset based on the semantic similarity between the target indicator and the indicator name in each candidate time series data in the dataset, and then perform similarity search on the candidate time series data of the target indicator and the candidate texts corresponding to the candidate time series data of the target indicator based on the current time series data to obtain similar data.
[0081] Exemplarily, candidate time series data with semantic similarity greater than a similarity threshold may be used as candidate time series data of the target indicator, thereby screening out candidate time series data of the target indicator and its corresponding candidate text from the data set.
[0082] Among them, the method of performing similarity search among the candidate time series data of the target indicator and the candidate texts corresponding to the candidate time series data of the target indicator based on the current time series data can refer to the search method recorded in the above embodiment, so it will not be repeated here.
[0083] Therefore, based on the semantic similarity between the target indicator and the indicator name in the candidate time series data in the dataset, the candidate time series data of the target indicator and its corresponding candidate text can be screened out from the dataset, and then similarity search can be performed on the screened candidate time series data and its corresponding candidate text, thereby narrowing the search scope and improving the search efficiency.
[0084] Step 205 , performing time series data prediction based on the time-related data and similar data to obtain time series prediction data of the target indicator.
[0085] In this application, a pre-trained time series prediction model can be used to predict time series data to obtain time series prediction data of the target indicator.
[0086] For example, if a time series prediction model is trained based on time series data and similar text within the time series data, the current time series data and similar text within the similar data can be input into the time series prediction model for prediction, yielding predicted time series data. This allows the similar text to supplement the current time series data, thereby improving prediction accuracy.
[0087] For example, the current time series data is the weather in the past week, and the similar text is weather news from an earlier time. These two pieces of information can be used to predict the weather in the next week.
[0088] For example, the time series prediction model can encode the current time series data to obtain a first time series feature, encode the similar text to obtain a first text feature, fuse the first time series feature with the first text feature to obtain a first fused feature, and then predict the time series data based on the first fused feature to obtain time series prediction data. Thus, the features of the two modalities, the current time series data and the similar text, are fused, and the time series data is predicted based on the fused features, thereby improving the accuracy of the prediction.
[0089] For example, a BERT (Bidirectional Encoder Representations from Transformers) encoder can be used to encode similar texts to obtain first text features, thereby converting similar texts into high-dimensional vector representations.
[0090] Since the first time series feature and the first text feature are features of different modalities, the first time series feature can be normalized to obtain a first standard feature, the first text feature can be normalized to obtain a second standard feature, and the first standard feature and the second standard feature can be fused to obtain a first fused feature. This allows features of different modalities to be normalized before fusion, improving the accuracy of the fused feature.
[0091] For example, if the time series prediction model is trained based on time series data and time series data similar to the time series data, then the current time series data and similar time series data in the similar data can be input into the time series prediction model for prediction to obtain time series prediction data.
[0092] For example, the current time series data is the weather of the past week, and the similar time series data is the weather of an earlier week. These two pieces of information can be used to predict the weather for the next week.
[0093] Exemplarily, the current time series data can be encoded to obtain a first time series feature, similar time series data can be encoded to obtain a second time series feature, the first time series feature and the second time series feature can be fused, and time series data can be predicted based on the fused features to improve the accuracy of the prediction.
[0094] For example, if the time series prediction model is trained based on time series data and its related texts as well as similar texts of the time series data, then the current time series data and its related texts as well as similar texts in the similar data can be input into the time series prediction model for prediction to obtain time series prediction data.
[0095] For example, if the time series prediction model is trained based on time series data and its related text as well as time series data similar to the time series data, then the current time series data and its related text as well as similar time series data in the similar data can be input into the time series prediction model for prediction to obtain time series prediction data.
[0096] For example, the current time series data is the weather of the past week, the related text is the weather news of the past week, and the similar time series data is the weather of an earlier week. These three types of information can be used to predict the weather of the next week.
[0097] For example, if the time series prediction model is trained based on time series data and its related text, text similar to the related text, and time series data similar to the time series data, then the current time series data and its related text, as well as similar text and similar time series data in the similar data can be input into the time series prediction model for prediction to obtain time series prediction data.
[0098] For example, the current time series data is the weather of the past week, the related text is the weather news of the past week, the similar time series data is the weather of an earlier week, and the similar text is the weather news of an earlier week. These four types of information can be used to predict the weather for the next week.
[0099] In an embodiment of the present application, similarity search is performed on the candidate texts corresponding to each candidate time series data in the data set based on the current time series data to obtain similar texts, and similarity search is performed on each candidate time series data to obtain similar time series data, so that similar data can be obtained based on the retrieval results of the similarity search, thereby improving the accuracy of the similar data, and then based on the use of similar data to assist time-related data to predict time series data, the accuracy of the prediction is improved.
[0100] Figure 3 A flowchart of a time series data prediction method provided in another embodiment of the present application.
[0101] like Figure 3 As shown, the time series data prediction method includes:
[0102] Step 301: Obtain time-related data of the target indicator.
[0103] Step 302: perform similarity search in the data set based on the current time series data to obtain data similar to the current time series data.
[0104] In the present application, steps 301 and 302 can be implemented in any of the embodiments of the present application, so they will not be described in detail here.
[0105] Step 303: Encode the current time series data to obtain a first time series feature.
[0106] Exemplarily, the current time series data can be segmented to obtain multiple time series segments, and each time series segment can be encoded to obtain a sub-time series feature. Then, according to the time order between the multiple time series segments, the sub-sequence features corresponding to the multiple time series segments can be spliced to obtain the first time series feature.
[0107] For example, if the current time series data is the temperature over the past 10 days, the temperature over two consecutive days can be taken as a time series segment, which can be divided into five time series segments.
[0108] It should be noted that the time lengths of the multiple time series segments may be the same or different, and there is no limitation on this.
[0109] Therefore, by dividing the current time series data into multiple time series segments for encoding, local and global information can be captured, thereby improving the accuracy of the prediction.
[0110] Step 304: Encode the similar time series data to obtain a second time series feature.
[0111] Exemplarily, similar time series data may be divided into multiple time series segments, and then the time series segments are encoded, and then the subsequence features of the multiple time series segments are spliced to obtain the second time series feature.
[0112] Step 305: Encode the similar texts and the related texts respectively to obtain a first text feature and a second text feature.
[0113] Exemplarily, a BERT encoder may be used to encode similar texts and related texts to obtain first text features and second text features, thereby converting similar texts and related texts into high-dimensional vector representations.
[0114] Step 306 : Fusing the first time series feature, the second time series feature, the first text feature, and the second text feature to obtain a second fused feature.
[0115] Exemplarily, the first time series feature, the second time series feature, the first text feature, and the second text feature may be subjected to standard processing respectively to obtain corresponding standard features, and then these standard features may be fused to obtain the second fused feature.
[0116] Since the dimensions of the features of each modal data may be different, the dimensions of the features can be made consistent through padding operations and then fused to obtain the second fused feature.
[0117] Step 307: predict the time series data based on the second fusion feature to obtain time series prediction data.
[0118] Exemplarily, feature extraction may be performed on the second fusion feature, and then the extracted feature may be decoded to obtain time series prediction data.
[0119] In the embodiments of the present application, similar time series data and similar text can be used to assist in time series data prediction for the current time series data and related text, thereby fully utilizing similar time series data and similar text to improve the accuracy and comprehensiveness of time series data prediction. In addition, by encoding features for the current time series data and similar time series data separately, and fusing the features encoded for similar text and related text, and performing prediction based on the fused features, the accuracy of the prediction can be improved.
[0120] The time series data prediction method of the embodiment of the present application can be applied to a variety of scenarios, and is also suitable for fields that need to handle complex time series prediction tasks. For example, the application fields and scenarios can be as follows:
[0121] Traffic flow prediction: By combining historical traffic data with relevant text information, such as traffic news and incident reports, more accurate traffic flow predictions can be achieved to optimize traffic management and scheduling.
[0122] Economic and financial analysis: Using time series data of economic indicators and text data such as financial news and policy documents can improve the ability to predict market changes.
[0123] Social welfare project evaluation: Combining time series data of social welfare projects with related news can predict project effects and impacts and optimize resource allocation.
[0124] In order to implement the above embodiment, the embodiment of the present application also proposes a time series data prediction device. Figure 4 A schematic diagram of the structure of a time series data prediction device provided in one embodiment of the present application.
[0125] like Figure 4 As shown, the time series data prediction device 400 includes:
[0126] An acquisition module 410 is configured to acquire time-related data of a target indicator; wherein the time-related data includes current time series data of the target indicator;
[0127] A retrieval module 420 is configured to perform similarity retrieval in a data set based on the current time series data to obtain data similar to the current time series data;
[0128] The prediction module 430 is configured to perform time series data prediction based on the time-related data and the similar data to obtain time series prediction data of the target indicator.
[0129] Optionally, the retrieval module 420 is configured to:
[0130] Based on the current time series data, similarity search is performed on candidate texts corresponding to each candidate time series data in the data set to obtain similar texts corresponding to the current time series data;
[0131] Perform similarity search on each candidate time series data according to the current time series data to obtain similar time series data to the current time series data;
[0132] The similar data is determined according to the similar texts and / or the similar time series data.
[0133] Optionally, the retrieval module 420 is configured to:
[0134] Obtaining the relevant text of the current time series data;
[0135] Calculating the similarity between the relevant text and the candidate text corresponding to the candidate time series data;
[0136] The similar text is determined from the candidate texts according to the similarity.
[0137] Optionally, the retrieval module 420 is configured to:
[0138] Calculating a first Euclidean distance between the current time series data and the candidate time series data;
[0139] determining the similar time series data from the candidate time series data according to the first Euclidean distance corresponding to the candidate time series data;
[0140] The candidate text corresponding to the similar time series data is determined as the similar text.
[0141] Optionally, the retrieval module 420 is configured to:
[0142] Calculating a first Euclidean distance between the current time series data and the candidate time series data;
[0143] The similar time series data is determined from the candidate time series data according to the first Euclidean distance corresponding to the candidate time series data.
[0144] Optionally, the retrieval module 420 is configured to:
[0145] Determining a first time length of the current time series data and a second time length of the candidate time series data;
[0146] A first Euclidean distance between the current time series data and the candidate time series data is calculated according to the first time length and the second time length.
[0147] Optionally, the retrieval module 420 is configured to:
[0148] In response to the first time length being greater than the second time length, intercepting a plurality of first sub-time series data from the current time series data according to the second time length, wherein the length of the first sub-time series data is the same as the second time length;
[0149] Calculating a second Euclidean distance between the first sub-time series data and the candidate time series data;
[0150] The first Euclidean distance is determined according to a plurality of the second Euclidean distances.
[0151] Optionally, the retrieval module 420 is configured to:
[0152] In response to the second time length being greater than the first time length, intercepting a plurality of second sub-time series data from the candidate time series data according to the first time length, wherein the length of the second sub-time series data is the same as the first time length;
[0153] Calculating a third Euclidean distance between the second sub-time series data and the candidate time series data;
[0154] The first Euclidean distance is determined according to a plurality of the third Euclidean distances.
[0155] Optionally, the retrieval module 420 is configured to:
[0156] Obtaining the relevant text of the current time series data;
[0157] Calculating the similarity between the relevant text and the candidate text corresponding to the candidate time series data;
[0158] Determining the similar text from the candidate texts according to the similarity;
[0159] The candidate time series data corresponding to the similar text is determined as the similar time series data.
[0160] Optionally, the retrieval module 420 is configured to:
[0161] Determining candidate time series data of the target indicator from the data set based on semantic similarity between the target indicator and the indicator name in each candidate time series data in the data set;
[0162] Based on the current time series data, a similarity search is performed on the candidate time series data of the target indicator and the candidate texts corresponding to the candidate time series data of the target indicator to obtain the similar data.
[0163] Optionally, the similar data includes similar texts, and the prediction module 430 is configured to:
[0164] Encoding the current time series data to obtain a first time series feature;
[0165] Encoding the similar text to obtain a first text feature;
[0166] fusing the first time series feature and the second text feature to obtain a first fused feature;
[0167] Time series data is predicted based on the first fusion feature to obtain the time series prediction data.
[0168] Optionally, the prediction module 430 is configured to:
[0169] performing standardization processing on the first time series feature to obtain a first standard feature;
[0170] performing standardization processing on the first text feature to obtain a second standard feature;
[0171] The first standard feature and the second standard feature are fused to obtain the first fused feature.
[0172] Optionally, the time-related data further includes text related to the current time series data. The prediction module 430 is configured to:
[0173] Encoding the current time series data to obtain a first time series feature;
[0174] Encoding the similar time series data to obtain a second time series feature;
[0175] Encode the similar text and the related text respectively to obtain a first text feature and a second text feature;
[0176] fusing the first time series feature, the second time series feature, the first text feature, and the second text feature to obtain a second fused feature;
[0177] Time series data is predicted based on the second fusion feature to obtain the time series prediction data.
[0178] Optionally, the prediction module 430 is configured to:
[0179] Segmenting the current time series data to obtain multiple time series segments;
[0180] Encoding each of the time series segments to obtain sub-time series features;
[0181] According to the time sequence between the multiple time series segments, the subsequence features corresponding to the multiple time series segments are spliced to obtain the first time series feature.
[0182] It should be noted that the explanations of the aforementioned embodiment of the time series data prediction method are also applicable to the time series data prediction device of this embodiment, and therefore will not be repeated here.
[0183] In the embodiment of the present application, by obtaining time-related data of a target indicator, performing a similarity search based on the current time series data of the target indicator in the time-related data to obtain similar data, and then performing time series data prediction based on the time-related data and the similar data to obtain time series prediction data. Thus, similar data similar to the current time series data is retrieved from the data set through similarity search, and the similar data is used to assist the time-related data in performing time series data prediction, thereby improving the accuracy of time series data prediction.
[0184] According to an embodiment of the present application, the present application also provides an electronic device, a readable storage medium and a computer program product.
[0185] Figure 5A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or claimed herein.
[0186] like Figure 5 As shown, the device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 502 or a computer program loaded from a storage unit 508 into a RAM (Random Access Memory) 503. Various programs and data required for the operation of the device 500 can also be stored in the RAM 503. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An I / O (Input / Output) interface 505 is also connected to the bus 504.
[0187] Various components in device 500 are connected to I / O interface 505, including: an input unit 506, such as a keyboard, mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a magnetic disk, optical disk, etc.; and a communication unit 509, such as a network card, modem, wireless communication transceiver, etc. The communication unit 509 allows device 500 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0188] The computing unit 501 can be various general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Unit), various specialized AI (Artificial Intelligence) computing chips, various computing units that run machine learning model algorithms, a DSP (Digital Signal Processor), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as the time series data prediction method. For example, in some embodiments, the time series data prediction method can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the time series data prediction method described above can be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to execute the time series data prediction method in any other appropriate manner (for example, by means of firmware).
[0189] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application-Specific Standard Products), SOCs (System on Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0190] The program code for implementing the methods of the present application can be written in any combination of one or more programming languages. Such program code can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the program code is executed by the processor or controller, the functions / operations specified in the flow charts and / or block diagrams are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0191] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or apparatus. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more wires, a portable computer disk, a hard disk, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0192] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0193] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.
[0194] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact via a communication network. The client-server relationship is established by computer programs running on the respective computers and establishing a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, a host product within the cloud computing service ecosystem that addresses the management difficulties and poor scalability of traditional physical hosts and VPS services. The server may also be a server in a distributed system or a server integrated with blockchain.
[0195] According to an embodiment of the present application, the present application also provides a computer program product, which, when an instruction processor in the computer program product is executed, executes the time series data prediction method proposed in the above embodiment of the present application.
[0196] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this application can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this application can be achieved. This is not a limitation herein.
[0197] The above specific embodiments do not constitute a limitation on the scope of protection of this application. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application shall be included within the scope of protection of this application.
Claims
1. A time series data prediction method, comprising: Acquire time-related data of the target indicator; wherein the time-related data includes current time series data and related text of the target indicator, wherein the related text is text related to the current time series data within the time length of the current time series data; Performing a similarity search in a data set based on the current time series data and the related text to obtain similar data, wherein the data set includes candidate time series data and candidate texts corresponding to the candidate time series data, and the similar data includes similar texts and similar time series data; Encoding the current time series data to obtain a first time series feature; Encoding the similar time series data to obtain a second time series feature; Encode the similar text and the related text respectively to obtain a first text feature and a second text feature; fusing the first time series feature, the second time series feature, the first text feature, and the second text feature to obtain a second fused feature; Time series data is predicted based on the second fusion feature to obtain time series prediction data.
2. The method according to claim 1, wherein The performing similarity search in the data set based on the current time series data and the related text to obtain similar data includes: Calculating a first Euclidean distance between the current time series data and the candidate time series data; Determining the similar time series data from each candidate time series data according to the first Euclidean distance corresponding to the candidate time series data; The candidate text corresponding to the similar time series data is determined as the similar text.
3. The method according to claim 1, wherein The performing similarity search in the data set based on the current time series data and the related text to obtain similar data includes: Calculating a first Euclidean distance between the current time series data and the candidate time series data; The similar time series data is determined from each candidate time series data according to the first Euclidean distance corresponding to the candidate time series data.
4. The method according to claim 2 or 3, wherein: The calculating the first Euclidean distance between the current time series data and the candidate time series data includes: Determining a first time length of the current time series data and a second time length of the candidate time series data; A first Euclidean distance between the current time series data and the candidate time series data is calculated according to the first time length and the second time length.
5. The method according to claim 4, wherein: The calculating, based on the first time length and the second time length, a first Euclidean distance between the current time series data and the candidate time series data includes: In response to the first time length being greater than the second time length, intercepting a plurality of first sub-time series data from the current time series data according to the second time length, wherein the length of the first sub-time series data is the same as the second time length; Calculating a second Euclidean distance between the first sub-time series data and the candidate time series data; The first Euclidean distance is determined according to a plurality of the second Euclidean distances.
6. The method according to claim 5, wherein: The calculating, based on the first time length and the second time length, a first Euclidean distance between the current time series data and the candidate time series data includes: In response to the second time length being greater than the first time length, intercepting a plurality of second sub-time series data from the candidate time series data according to the first time length, wherein the length of the second sub-time series data is the same as the first time length; Calculating a third Euclidean distance between the second sub-time series data and the candidate time series data; The first Euclidean distance is determined according to a plurality of the third Euclidean distances.
7. The method of claim 1, wherein: The performing similarity search in the data set based on the current time series data and the related text to obtain similar data includes: Calculating the similarity between the relevant text and the candidate text corresponding to the candidate time series data; Determining the similar text from the candidate texts according to the similarity; The candidate time series data corresponding to the similar text is determined as the similar time series data.
8. The method of claim 1, wherein: The performing similarity search in the data set based on the current time series data and the related text to obtain similar data includes: Determining candidate time series data of the target indicator from the data set based on semantic similarity between the target indicator and the indicator name in each candidate time series data in the data set; Based on the current time series data, a similarity search is performed on the candidate time series data of the target indicator and the candidate texts corresponding to the candidate time series data of the target indicator to obtain the similar data.
9. The method of claim 1, wherein: The current time series data is encoded to obtain a first time series feature, including: Segmenting the current time series data to obtain multiple time series segments; Encoding each of the time series segments to obtain sub-time series features; According to the time sequence between the multiple time series segments, the subsequence features corresponding to the multiple time series segments are spliced to obtain the first time series feature.
10. A time series data prediction device, comprising: An acquisition module, configured to acquire time-related data of a target indicator; wherein the time-related data includes current time series data and related text of the target indicator, wherein the related text is text related to the current time series data within the time length of the current time series data; a retrieval module, configured to perform similarity retrieval in a data set based on the current time series data and the related text to obtain similar data, wherein the data set includes candidate time series data and candidate texts corresponding to the candidate time series data, and the similar data includes similar texts and similar time series data; Prediction module, used to: Encoding the current time series data to obtain a first time series feature; Encoding the similar time series data to obtain a second time series feature; Encode the similar text and the related text respectively to obtain a first text feature and a second text feature; fusing the first time series feature, the second time series feature, the first text feature, and the second text feature to obtain a second fused feature; Time series data is predicted based on the second fusion feature to obtain time series prediction data.
11. The device according to claim 10, wherein The retrieval module is used to: Calculating a first Euclidean distance between the current time series data and the candidate time series data; Determining the similar time series data from each candidate time series data according to the first Euclidean distance corresponding to the candidate time series data; The candidate text corresponding to the similar time series data is determined as the similar text.
12. The device according to claim 10, wherein The retrieval module is used to: Calculating a first Euclidean distance between the current time series data and the candidate time series data; The similar time series data is determined from each candidate time series data according to the first Euclidean distance corresponding to the candidate time series data.
13. The device according to claim 11 or 12, wherein: The retrieval module is used to: Determining a first time length of the current time series data and a second time length of the candidate time series data; A first Euclidean distance between the current time series data and the candidate time series data is calculated according to the first time length and the second time length.
14. The apparatus of claim 13, wherein: The retrieval module is used to: In response to the first time length being greater than the second time length, intercepting a plurality of first sub-time series data from the current time series data according to the second time length, wherein the length of the first sub-time series data is the same as the second time length; Calculating a second Euclidean distance between the first sub-time series data and the candidate time series data; The first Euclidean distance is determined according to a plurality of the second Euclidean distances.
15. The apparatus of claim 13, wherein: The retrieval module is used to: In response to the second time length being greater than the first time length, intercepting a plurality of second sub-time series data from the candidate time series data according to the first time length, wherein the length of the second sub-time series data is the same as the first time length; Calculating a third Euclidean distance between the second sub-time series data and the candidate time series data; The first Euclidean distance is determined according to a plurality of the third Euclidean distances.
16. The apparatus of claim 10, wherein: The retrieval module is used to: Calculating the similarity between the relevant text and the candidate text corresponding to the candidate time series data; Determining the similar text from the candidate texts according to the similarity; The candidate time series data corresponding to the similar text is determined as the similar time series data.
17. The apparatus of claim 10, wherein: The retrieval module is used to: Determining candidate time series data of the target indicator from the data set based on semantic similarity between the target indicator and the indicator name in each candidate time series data in the data set; Based on the current time series data, a similarity search is performed on the candidate time series data of the target indicator and the candidate texts corresponding to the candidate time series data of the target indicator to obtain the similar data.
18. The apparatus of claim 10, wherein: The prediction module is used to: Segmenting the current time series data to obtain multiple time series segments; Encoding each of the time series segments to obtain sub-time series features; According to the time sequence between the multiple time series segments, the subsequence features corresponding to the multiple time series segments are spliced to obtain the first time series feature.
19. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 9.
20. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 9.
21. A computer program product comprising a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Method and device for detecting abnormal data in time sequence
CN113850418A
Multimedia data delivery prediction method and device, electronic equipment and storage medium
CN114638643A