Time series data prediction method and device, electronic equipment and storage medium
By performing similarity search in the prediction of time series data, and using the current time series data to predict, the problem of low prediction accuracy in the prior art is solved, and higher prediction accuracy is achieved.
Patent Information
- Application Number
- CN202411798846.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-12-06
AI Technical Summary
The prior art uses only the current time series data to predict time series data, and the prediction accuracy is not high.
By obtaining the time-related data of the target indicator, a similarity search is performed to obtain similar data of the current time series data, and time-related data and similar data are combined to predict the time series data.
The accuracy of time series data prediction is improved, and the performance of the prediction model is enhanced through the assistance of similar data.
Smart Images

Figure CN119646240A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, in particular to the field of artificial intelligence 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 is playing 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] Perform similarity search in the data set according to the current time series data to obtain similar data to the current time series data;
[0007] Time series data prediction is performed 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, used to acquire time-related data of the target indicator; wherein the time-related data includes current time series data of the target indicator;
[0010] A retrieval module, used to perform similarity retrieval in a data set according to the current time series data, so as to obtain similar data to the current time series data;
[0011] The prediction module is used to predict the time series data according to the time-related data and the similar data to obtain the time series prediction data of the target indicator.
[0012] According to another aspect of the present application, there is provided an electronic device, 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 so that the at least one processor can 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, wherein the computer program 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 used to better understand the present solution 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 diagram of a flow chart of a time series data prediction method provided by another embodiment of the present application;
[0022] Figure 3 A schematic diagram of a flow chart of a time series data prediction method provided by 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 is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can 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, the description of well-known functions and structures is 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 of the embodiments of the present application with reference to the accompanying drawings.
[0028] In some embodiments, the current time series data of the indicator may 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 schematic diagram of a flow chart 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, a mobile terminal, a 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, obtaining time-related data of the target indicator.
[0034] Exemplarily, the target indicator may be air temperature, air humidity, traffic flow, or other indicators, which are not limited thereto.
[0035] In the present 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 according to the current time series data to obtain similar data to the current time series data.
[0038] The similar data may include similar texts, similar time series data, etc. The similar texts may be texts similar to the texts related to the current time series data, and the similar time series data may be time series data similar to the current time series data. In addition, the similar texts may be texts 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] Exemplarily, the data set may include paired candidate time series data and candidate texts, and the data set may also include candidate time series data of multiple indicators and candidate texts corresponding to the candidate time series data. It should be noted that the multiple indicators here may be indicators of one field or indicators of different fields, and there may be one or more indicators in the same field.
[0043] Exemplarily, a similarity search may be performed in a data set based on the current time series data to obtain time series data similar to the current time series data, and similar data may be obtained based on the time series data similar to the current time series data.
[0044] Step 103, predicting time series data based on 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 predict time series data and obtain time series prediction data of 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 may 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 text related to the current time series data, and time series data prediction may be performed based on the current time series data, text related to the current time series data, and similar data to obtain time series prediction data.
[0049] In the embodiment of the present application, by acquiring the time-related data of the target indicator, similarity retrieval is performed based on the current time series data of the target indicator in the time-related data to obtain similar data, and then time series data prediction is performed based on the time-related data and the similar data to obtain time series prediction data. Thus, similar data of the current time series data is retrieved from the data set through similarity retrieval, and the similar data is used to assist the time-related data in predicting the time series data, thereby improving the accuracy of the time series data prediction.
[0050] Figure 2 A schematic flow chart 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, obtaining 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 among candidate texts corresponding to each 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 text in the dataset are data within the same time.
[0056] As a possible implementation method, the relevant text of the current time series data can be obtained, the similarity between the relevant text and each candidate text can be calculated, and the similar text can be determined from each candidate text according to the similarity. For example, the candidate text with the highest similarity can be used as the similar text.
[0057] Therefore, based on the relevant text 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 relevant texts of the current time series data, similar texts are also relevant to the current time series data, so similar texts retrieved based on texts 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 with the current time series data may be taken 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 text is text corresponding to similar time series data of the current time series data, similar text is also related to the current time series data, so similar text 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, based on this, the first time length of the current time series data and the second time length of the candidate time series data can be determined, and the first Euclidean distance between the current time series data and the candidate time series data can be calculated based on the first time length and the second time length. Thus, the calculation of the Euclidean distance between two time series data in different scenarios can be satisfied.
[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] Exemplarily, if the first time length is greater than the second time length, multiple first sub-time series data can be intercepted 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, and the second Euclidean distance between the first sub-time series data and the candidate time series data is calculated, and 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 in 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] Exemplarily, if the second time length is greater than the first time length, multiple second sub-time series data are intercepted 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, and the third Euclidean distance between the second sub-time series data and the candidate time series data is calculated, and then the first Euclidean distance is determined according to 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 in the window can be used as the second sub-time series data, so that multiple second sub-time series data can be intercepted by sliding the 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: 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.
[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, and then similar time series data can be determined from each candidate time series data according to the first Euclidean distance corresponding to 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 used 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, the similarity between the relevant text and the candidate text corresponding to the candidate time series data can be calculated, and 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 text can be obtained through similarity retrieval, and then the candidate time series data corresponding to the similar text 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, determining 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, and there is no limitation on this.
[0080] Since the data set 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, the candidate time series data of the target indicator can be first determined from the data set based on the semantic similarity between the target indicator and the indicator name in each candidate time series data in the data set, and then a similarity search can be 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 based on the current time series data to obtain similar data.
[0081] Exemplarily, the candidate time series data with semantic similarity greater than a similarity threshold may be used as the candidate time series data of the target indicator, thereby screening out the 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 according to 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 data set, the candidate time series data of the target indicator and its corresponding candidate text can be screened out from the data set, 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, predicting time series data 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 the time series prediction model is trained based on time series data and similar texts of the time series data, the current time series data and similar texts in the similar data can be input into the time series prediction model for prediction to obtain time series prediction data. Thus, the current time series data can be supplemented with information through similar texts, thereby improving the accuracy of the prediction.
[0087] For example, the current time series data is the weather in the past week, and the similar text is the weather news in an earlier time. These two kinds of information can be used to predict the weather in the next week.
[0088] Exemplarily, the time series prediction model can encode the current time series data to obtain the first time series feature, encode the similar text to obtain the first text feature, and fuse the first time series feature with the first text feature to obtain the first fused feature, and then predict the time series data based on the first fused feature to obtain the time series prediction data. Thus, the features of the two modalities of 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 may 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 standardized to obtain a first standard feature, the first text feature can be standardized to obtain a second standard feature, and then the first standard feature and the second standard feature can be fused to obtain a first fused feature. In this way, features of different modalities can be standardized before being fused, thereby improving the accuracy of the fused feature.
[0091] Exemplarily, 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 in the past week, and the similar time series data is the weather in an earlier week. These two types of information can be used to predict the weather in 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, thereby improving the accuracy of the prediction.
[0094] Exemplarily, if the time series prediction model is trained based on time series data and its related text as well as similar text of the time series data, then the current time series data and its related text as well as similar text in similar data can be input into the time series prediction model for prediction to obtain time series prediction data.
[0095] Exemplarily, 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 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 for the next week.
[0097] Exemplarily, 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 in similar data and similar time series 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, by performing a similarity search on the candidate texts corresponding to each candidate time series data in the data set according to the current time series data, similar texts are obtained, and by performing a similarity search on each candidate time series data, similar time series data are obtained, 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 predicting the time series data based on the use of similar data to assist time-related data, thereby improving the accuracy of the prediction.
[0100] Figure 3 A schematic flow chart 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, obtaining time-related data of the target indicator.
[0103] Step 302: perform similarity search in the data set according to the current time series data to obtain similar data to the current time series data.
[0104] In the present application, step 301-step 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 a 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: Fuse 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 a padding operation and then fused to obtain a second fused feature.
[0117] Step 307: predict the time series data according to the second fusion feature to obtain the time series prediction data.
[0118] Exemplarily, feature extraction may be performed on the second fused features, and then the extracted features may be decoded to obtain time series prediction data.
[0119] In the embodiment of the present application, similar time series data and similar texts can be used to assist the current time series data and related texts in predicting time series data, so that similar time series data and similar texts can be fully utilized to improve the accuracy and comprehensiveness of time series data prediction. In addition, the current time series data and similar time series data are respectively encoded to obtain features, and the features encoded to the similar text and the related text are fused, and prediction is performed based on the fused features, which can improve the accuracy of the prediction.
[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 applicable to 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 prediction 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 the 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] The acquisition module 410 is used to acquire time-related data of the target indicator; wherein the time-related data includes current time series data of the target indicator;
[0127] A retrieval module 420 is used to perform similarity retrieval in a data set according to the current time series data to obtain similar data to the current time series data;
[0128] The prediction module 430 is used to perform time series data prediction based on the time-related data and the similar data to obtain the time series prediction data of the target indicator.
[0129] Optionally, the retrieval module 420 is used to:
[0130] According to the current time series data, similarity search is performed on the 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] According to the current time series data, similarity search is performed in each candidate time series data to obtain similar time series data of 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 used 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] According to the similarity, the similar text is determined from each of the candidate texts.
[0137] Optionally, the retrieval module 420 is used 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 used 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 used to:
[0145] Determine a first time length of the current time series data and a second time length of the candidate time series data;
[0146] According to 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 is calculated.
[0147] Optionally, the retrieval module 420 is used to:
[0148] In response to the first time length being greater than the second time length, a plurality of first sub-time series data are intercepted 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 used to:
[0152] In response to the second time length being greater than the first time length, a plurality of second sub-time series data are intercepted 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 used 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 each of 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 used to:
[0161] Determining candidate time series data of the target indicator from the data set according to the semantic similarity between the target indicator and the indicator name in each candidate time series data in the data set;
[0162] According to the current time series data, a similarity search is performed 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 to obtain the similar data.
[0163] Optionally, the similar data includes similar texts, and the prediction module 430 is used 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 according to the first fusion feature to obtain the time series prediction data.
[0168] Optionally, the prediction module 430 is used to:
[0169] Performing standardization processing on the first time series feature to obtain a first standard feature;
[0170] Standardizing 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, and the prediction module 430 is used 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 according to the second fusion feature to obtain the time series prediction data.
[0178] Optionally, the prediction module 430 is used 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 respectively corresponding to the multiple time series segments are spliced to obtain the first time series feature.
[0182] It should be noted that the explanation of the aforementioned time series data prediction method embodiment is also applicable to the time series data prediction device of this embodiment, so it will not be repeated here.
[0183] In the embodiment of the present application, by acquiring the time-related data of the target indicator, similarity retrieval is performed based on the current time series data of the target indicator in the time-related data to obtain similar data, and then time series data prediction is performed based on the time-related data and the similar data to obtain time series prediction data. Thus, similar data of the current time series data is retrieved from the data set through similarity retrieval, and the similar data is used to assist the time-related data in predicting the time series data, thereby improving the accuracy of the 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 an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required 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 to a RAM (Random Access Memory) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. 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] A number of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0188] The computing unit 501 may be a variety of general and / or special 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 Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate 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 may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on 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 may 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 (eg, by means of firmware).
[0189] Various embodiments of the systems and techniques described above herein may 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 may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may 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 method of the present application can be written in any combination of one or more programming languages. These program codes 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 the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[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 equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, 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 may 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 a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: 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 the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services (Virtual Private Server). The server may also be a server of a distributed system, or a server combined with a 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 executes, 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 processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.
[0197] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope 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 of the target indicator; Perform similarity search in the data set according to the current time series data to obtain similar data to the current time series data; Time series data prediction is performed based on the time-related data and the similar data to obtain time series prediction data of the target indicator.
2. The method of claim 1, wherein: The performing similarity search in the data set according to the current time series data to obtain similar data to the current time series data includes: According to the current time series data, similarity search is performed on the candidate texts corresponding to each candidate time series data in the data set to obtain similar texts corresponding to the current time series data; According to the current time series data, similarity search is performed in each candidate time series data to obtain similar time series data of the current time series data; The similar data is determined according to the similar texts and / or the similar time series data.
3. The method of claim 2, wherein: The method of performing similarity search on the candidate texts corresponding to each candidate time series data in the data set according to the current time series data to obtain similar texts corresponding to the current time series data includes: Obtaining the relevant text of the current time series data; Calculating the similarity between the relevant text and the candidate text corresponding to the candidate time series data; According to the similarity, the similar text is determined from each of the candidate texts.
4. The method of claim 2, wherein: The method of performing similarity search on the candidate texts corresponding to each candidate time series data in the data set according to the current time series data to obtain similar texts corresponding to the current time series 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 the 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.
5. The method of claim 2, wherein: The performing similarity search in each candidate time series data according to the current time series data to obtain similar time series data to the current time series 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 the candidate time series data according to the first Euclidean distance corresponding to the candidate time series data.
6. The method according to claim 4 or 5, wherein: The calculating the first Euclidean distance between the current time series data and the candidate time series data includes: Determine a first time length of the current time series data and a second time length of the candidate time series data; According to 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 is calculated.
7. The method of claim 6, wherein: The calculating, according to 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 comprises: In response to the first time length being greater than the second time length, a plurality of first sub-time series data are intercepted 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.
8. The method of claim 6, wherein: The calculating, according to 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 comprises: In response to the second time length being greater than the first time length, a plurality of second sub-time series data are intercepted 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.
9. The method of claim 2, wherein: The performing similarity search in each candidate time series data according to the current time series data to obtain similar time series data to the current time series data includes: Obtaining the relevant text of the current time series data; Calculating the similarity between the relevant text and the candidate text corresponding to the candidate time series data; Determining the similar text from each of 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.
10. The method of claim 1, wherein: The performing similarity search in the data set according to the current time series data to obtain similar data to the current time series data includes: Determining candidate time series data of the target indicator from the data set according to the semantic similarity between the target indicator and the indicator name in each candidate time series data in the data set; According to the current time series data, a similarity search is performed 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 to obtain the similar data.
11. The method of claim 1, wherein: The similar data includes similar texts, and the time series data prediction is performed based on the time-related data and the similar data to obtain the time series prediction data of the target indicator, including: Encoding the current time series data to obtain a first time series feature; Encoding the similar text to obtain a first text feature; fusing the first time series feature and the second text feature to obtain a first fused feature; Time series data is predicted according to the first fusion feature to obtain the time series prediction data.
12. The method of claim 11, wherein: The fusing the first time series feature and the second text feature to obtain a first fused feature includes: Performing standardization processing on the first time series feature to obtain a first standard feature; Standardizing the first text feature to obtain a second standard feature; The first standard feature and the second standard feature are fused to obtain the first fused feature.
13. The method of claim 1, wherein: The time-related data also includes the related text of the current time series data, the similar data includes similar time series data and similar text, and the time series data prediction is performed based on the time-related data and the similar data to obtain the time series prediction data of the target indicator, including: 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 according to the second fusion feature to obtain the time series prediction data.
14. The method according to any one of claims 11 to 13, 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 respectively corresponding to the multiple time series segments are spliced to obtain the first time series feature.
15. A time series data prediction device, comprising: An acquisition module, used to acquire time-related data of the target indicator; wherein the time-related data includes current time series data of the target indicator; A retrieval module, used to perform similarity retrieval in a data set according to the current time series data, so as to obtain similar data to the current time series data; The prediction module is used to predict the time series data according to the time-related data and the similar data to obtain the time series prediction data of the target indicator.
16. The device of claim 15, wherein: The retrieval module is used to: According to the current time series data, similarity search is performed on the candidate texts corresponding to each candidate time series data in the data set to obtain similar texts corresponding to the current time series data; According to the current time series data, similarity search is performed in each candidate time series data to obtain similar time series data of the current time series data; The similar data is determined according to the similar texts and / or the similar time series data.
17. The device of claim 16, wherein: The retrieval module is used to: Obtaining the relevant text of the current time series data; Calculating the similarity between the relevant text and the candidate text corresponding to the candidate time series data; According to the similarity, the similar text is determined from each of the candidate texts.
18. The device of claim 16, 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 the 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.
19. The device of claim 16, 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 the candidate time series data according to the first Euclidean distance corresponding to the candidate time series data.
20. The device according to claim 18 or 19, wherein The retrieval module is used to: Determine a first time length of the current time series data and a second time length of the candidate time series data; According to 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 is calculated.
21. The device of claim 20, wherein: The retrieval module is used to: In response to the first time length being greater than the second time length, a plurality of first sub-time series data are intercepted 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.
22. The device of claim 20, wherein: The retrieval module is used to: In response to the second time length being greater than the first time length, a plurality of second sub-time series data are intercepted 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.
23. The apparatus of claim 16, wherein: The retrieval module is used to: Obtaining the relevant text of the current time series data; Calculating the similarity between the relevant text and the candidate text corresponding to the candidate time series data; Determining the similar text from each of 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.
24. The apparatus of claim 15, wherein: The retrieval module is used to: Determining candidate time series data of the target indicator from the data set according to the semantic similarity between the target indicator and the indicator name in each candidate time series data in the data set; According to the current time series data, a similarity search is performed 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 to obtain the similar data.
25. The apparatus of claim 15, wherein: The similar data includes similar texts, and the prediction module is used to: Encoding the current time series data to obtain a first time series feature; Encoding the similar text to obtain a first text feature; fusing the first time series feature and the second text feature to obtain a first fused feature; Time series data is predicted according to the first fusion feature to obtain the time series prediction data.
26. The device of claim 25, wherein: The prediction module is used to: Performing standardization processing on the first time series feature to obtain a first standard feature; Standardizing the first text feature to obtain a second standard feature; The first standard feature and the second standard feature are fused to obtain the first fused feature.
27. The apparatus of claim 15, wherein: The time-related data also includes text related to the current time series data, and the prediction module is 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 according to the second fusion feature to obtain the time series prediction data.
28. The device of any one of claims 25 to 27, 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 respectively corresponding to the multiple time series segments are spliced to obtain the first time series feature.
29. 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 14.
30. 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-14.
31. 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 14.
Citation Information
Patent Citations
Knowledge extraction method and device, equipment and medium
CN111522928A
Multi-person session emotion prediction method using similar scenes and mixed attention
CN113688204A
Method and device for detecting abnormal data in time sequence
CN113850418A
Multimedia data delivery prediction method and device, electronic equipment and storage medium
CN114638643A
Knowledge retrieval method and device, electronic equipment and computer readable storage medium
CN115269815A