Time series data prediction method, device, equipment and storage medium

By performing local and global feature extraction and fusion encoding on time series data, the problem of low accuracy in time series prediction is solved, resulting in more accurate predictions that are suitable for tasks such as equipment fault diagnosis and load forecasting.

CN116933125BActive Publication Date: 2026-05-01新奥新智科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310721940.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-16
Publication Date
2026-05-01
Estimated Expiration
2043-06-16

AI Technical Summary

Technical Problem

In existing technologies, the periodic and trend characteristics of the original time series overlap, resulting in low accuracy of time series data prediction.

Method used

By acquiring the time series to be processed, feature extraction is performed using a prediction model to obtain local feature data, global feature data, and fused feature data. Feature encoding is then performed to obtain the encoding results for classification prediction.

Benefits of technology

It improves the accuracy of forecasts and can capture short- and long-range periodic information of time series in a more granular manner, making it suitable for downstream tasks such as equipment fault diagnosis, outlier detection, and natural gas and power load forecasting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116933125B_ABST
    Figure CN116933125B_ABST
Patent Text Reader

Abstract

The application discloses a time series data prediction method and device, equipment and a storage medium. The method comprises the following steps: obtaining a time series to be processed; the time series to be processed is used for representing running data of a to-be-predicted object at a plurality of detection times; performing feature extraction processing on the time series to be processed through a prediction model to obtain local feature data, global feature data and fusion feature data of the time series to be processed; performing feature coding processing on the local feature data, the global feature data and the fusion feature data by using the prediction model to obtain a coding result, and performing classification prediction on the coding result to obtain a prediction result of the to-be-predicted object. The scheme can capture short-range periodic information and long-range periodic information of the time series to be processed in a more fine-grained manner, thereby combining more comprehensive time series representation information to perform classification prediction on a downstream task, and greatly improving the prediction accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Time series data prediction methods, apparatus, equipment and storage media Technical Field

[0001] This invention generally relates to the field of data processing technology, and specifically to a method, apparatus, device, and storage medium for time series data prediction. Background Technology

[0002] With the rapid development of information technology, industrial enterprises utilize IoT technology to collect and process large amounts of data in real time during production and operation. This data consists of time-series records, characterized by timestamps, structured format, lack of updates, and unique data sources. Time-series data processing has been widely applied in smart cities, IoT, connected vehicles, and the industrial internet. To better utilize time-series data for applications such as power monitoring, mechanical equipment fault detection, and intelligent operation and maintenance of equipment in the energy industry, predictive processing based on time-series data is crucial.

[0003] Currently, related technologies can decompose the original time series to extract time series features and then perform prediction processing based on these features to obtain prediction results. However, in real-world scenarios, the original time series usually has a superposition of periodic and trend features, which makes the time series information extracted in one decomposition relatively one-sided, resulting in low accuracy in predicting downstream tasks based on time series data. Summary of the Invention

[0004] In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide a method, apparatus, device and storage medium for time series data prediction.

[0005] In a first aspect, the present invention provides a method for predicting time series data, the method comprising:

[0006] Obtain the time series to be processed; the time series to be processed is used to characterize the running data of the object to be predicted at multiple detection times;

[0007] The time series to be processed is subjected to feature extraction processing through a prediction model to obtain local feature data, global feature data and fused feature data of the time series to be processed;

[0008] The prediction model is used to perform feature encoding on the local feature data, the global feature data, and the fused feature data to obtain the encoding result. The encoding result is then used for classification and prediction to obtain the prediction result for the object to be predicted.

[0009] In one embodiment, the prediction model includes a first feature extraction module, a second feature extraction module, and a feature fusion module. The prediction model performs feature extraction processing on the time series to be processed, obtaining local feature data, global feature data, and fused feature data of the time series to be processed, including:

[0010] The time series to be processed is continuously sampled by the first feature extraction module to obtain multiple consecutive segments, and the multiple consecutive segments are used as local feature data.

[0011] The time series to be processed is subjected to interval sampling processing by the second feature extraction module to obtain multiple non-continuous segments, and the multiple non-continuous segments are used as global feature data.

[0012] The local feature data and the global feature data are fused together by the feature fusion module to obtain fused feature data.

[0013] In one embodiment, the prediction model is used to perform feature encoding processing on the local feature data, the global feature data, and the fused feature data to obtain an encoding result, including:

[0014] The local feature data, the global feature data, and the fused feature data are processed in parallel by time projection to obtain the time dimension information of the local feature data, global feature data, and fused feature data after transformation.

[0015] Based on the time dimension information after the transformation of the local feature data, global feature data, and fused feature data, channel projection processing is performed to obtain the transformed channel dimension information.

[0016] The transformed time dimension information and the transformed channel dimension information are subjected to dimensionality reduction processing through a bottleneck layer to obtain dimensionality-reduced data;

[0017] The dimensionality-reduced data is then subjected to linear mapping to obtain local encoding results, global encoding results, and fusion encoding results.

[0018] In one embodiment, the training process of the prediction model includes the following steps:

[0019] Obtain the sample time series; the sample time series data is labeled with historical annotation results;

[0020] The sample time series was subjected to two data augmentation processes to obtain two sets of augmented data;

[0021] The two sets of enhanced data are processed by feature extraction and encoding through the initial feature extraction network of the initial prediction model to obtain local encoding information, global encoding information, local fusion encoding information and global fusion encoding information of the two sets of samples;

[0022] Based on the local coding information of the two sets of samples, the global coding information of the two sets of samples, the local fusion coding information, the global fusion coding information, and the historical annotation results, the initial classification network of the initial prediction model is iteratively trained to obtain the prediction model.

[0023] In one embodiment, the two sets of enhanced data are subjected to feature extraction and encoding processing to obtain two sets of sample local encoding information, two sets of sample global encoding information, local fusion encoding information, and global fusion encoding information, including:

[0024] The two sets of enhanced data are processed by feature extraction through the first encoding module in the initial feature extraction network to obtain local features of the two sets of samples. The two sets of enhanced data are then processed by feature extraction through the second encoding module in the initial feature extraction network in parallel to obtain global features of the two sets of samples.

[0025] The local features and global features of the two sets of samples are processed by feature fusion to obtain local fused features and global fused features;

[0026] Based on the local features of the two sets of samples, the global features of the two sets of samples, the local fusion features, and the global fusion features, the feature encoding module in the feature extraction network performs encoding processing to obtain the local encoding information of the two sets of samples, the global encoding information of the two sets of samples, the local fusion encoding information, and the global fusion encoding information.

[0027] In one embodiment, the initial classification network of the initial prediction model is iteratively trained based on the local coding information of the two sets of samples, the global coding information of the two sets of samples, the local fusion coding information, the global fusion coding information, and the historical annotation results to obtain the prediction model, including:

[0028] Based on the local encoding information of the two sets of samples, the global encoding information of the two sets of samples, the local fusion encoding information, and the global fusion encoding information, a contrastive loss function is constructed. The parameters of the first feature extraction module, the second feature extraction module, the feature fusion module, and the feature encoding module are iteratively trained according to minimizing the contrastive loss function to obtain the feature extraction network of the prediction model.

[0029] The initial classification network is iteratively trained based on the feature extraction network and the historical annotation results to obtain the prediction model.

[0030] In one embodiment, the initial classification network is iteratively trained based on the feature extraction network and the historical annotation results to obtain the prediction model, including:

[0031] The sample time series is processed by feature extraction through the first feature extraction module and the second feature extraction module in the feature extraction network to obtain local data and global data.

[0032] The local data and the global data are fused through the feature fusion module to obtain fused data. The fused data, the local data, and the global data are then encoded through the feature encoding module in the feature extraction network to obtain the fusion result.

[0033] The fusion result is then used to perform classification prediction through the initial classification network to obtain the output result;

[0034] Based on the output results and the historical annotation results, a classification loss function is constructed. The parameters of the initial classification network are iteratively trained according to minimizing the classification loss function to obtain the classification network of the prediction model. A prediction model is then constructed based on the feature extraction network and the classification network.

[0035] In one embodiment, the contrastive loss function includes a first component, a second component, and a third component;

[0036] The first component is used to characterize the difference loss between the local coding information of the two sets of samples;

[0037] The second component is used to characterize the difference loss between the global encoding information of the two sets of samples;

[0038] The third component is used to characterize the difference loss between the local fusion coding information and the global fusion coding information.

[0039] Secondly, embodiments of this application provide a time series data prediction apparatus, the apparatus comprising:

[0040] The acquisition module is used to acquire the time series to be processed; the time series to be processed is used to characterize the running data of the object to be predicted at multiple detection times;

[0041] The feature extraction module is used to extract features from the time series to be processed through a prediction model to obtain local feature data, global feature data, and fused feature data of the time series to be processed.

[0042] The classification prediction module is used to perform feature encoding processing on the local feature data, the global feature data, and the fused feature data using the prediction model to obtain the encoding result, and to perform classification prediction on the encoding result to obtain the prediction result of the object to be predicted.

[0043] Thirdly, embodiments of this application provide a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the time series data prediction method as described in the first aspect above.

[0044] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon for implementing the time series data prediction method of the first aspect above.

[0045] The time series data prediction method, apparatus, device, and storage medium provided in this application acquire a time series to be processed, and then perform feature extraction processing on the time series using a prediction model to obtain local feature data, global feature data, and fused feature data of the time series to be processed. Then, the prediction model is used to encode the local feature data, global feature data, and fused feature data to obtain the encoding result. The encoding result is then classified and predicted to obtain the prediction result for the object to be predicted. Compared with the prior art, on the one hand, this technical solution can extract local feature data, global feature data, and fused feature data of the time series to be processed from both global and local perspectives, thereby capturing the short-range and long-range periodic information of the time series to be processed with finer granularity, providing more accurate guidance information for subsequent classification and prediction. On the other hand, by encoding and classifying the local feature data, global feature data, and fused feature data, a more comprehensive set of features is combined to determine the prediction result, which can be applied to different downstream tasks such as equipment fault diagnosis, outlier detection, and natural gas and power load prediction, thus improving the accuracy of prediction. Attached Figure Description

[0046] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:

[0047] Figure 1 is a schematic diagram of the implementation environment of the time series data prediction method provided in the embodiments of this application;

[0048] Figure 2 is a flowchart illustrating the time series data prediction method provided in an embodiment of this application;

[0049] Figure 3 is a schematic diagram of the structure of time series data prediction provided in an embodiment of this application;

[0050] Figure 4 is a flowchart illustrating the method for determining encoding results provided in an embodiment of this application;

[0051] Figure 5 is a schematic diagram of the structure processed by the feature encoding module according to an embodiment of this application;

[0052] Figure 6 is a schematic flowchart of a method for training a prediction model according to an embodiment of this application;

[0053] Figure 7 is a schematic diagram of the training structure of the prediction model provided in the embodiment of this application;

[0054] Figure 8 is a schematic diagram comparing the computation speed of the algorithm of this application and the baseline model provided in the embodiments of this application;

[0055] Figure 9 is a flowchart illustrating the time series data prediction method provided in an embodiment of this application;

[0056] Figure 10 is a schematic diagram of the time series data prediction device provided in an embodiment of this application;

[0057] Figure 11 is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0058] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.

[0059] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0060] It's understandable that in industrial internet applications, contrastive learning, as an algorithm in machine learning, can effectively extract rich information from massive amounts of data, construct robust time series representations, and reduce the high costs associated with data labeling. Time series data, as a numerical sequence that arranges the values ​​of a phenomenon in chronological order, can be applied to various scenarios. Time series analysis uses the patterns in past numerical sequences to predict future numerical trends, typically used for predicting continuous sequences. Examples include: predicting the stock market index for the next trading day in the financial sector; predicting future weather conditions; predicting the sales volume of a certain product at the next moment; and predicting changes in movie box office revenue.

[0061] Currently, related technologies can decompose the original time series to extract time series features, and then perform prediction processing based on the time series features to obtain prediction results. However, in real-world scenarios, the original time series usually has periodic and trend features superimposed on each other, making the time series information extracted by a single decomposition relatively one-sided, resulting in low accuracy of prediction of downstream tasks based on time series data.

[0062] To address the aforementioned shortcomings, this application provides a time series data prediction method, apparatus, device, and storage medium. Compared with existing technologies, on the one hand, this technical solution can extract local feature data, global feature data, and fused feature data of the time series to be processed from both global and local perspectives. This allows for more granular capture of the short-range and long-range periodic information of the time series, providing more accurate guidance for subsequent classification and prediction. On the other hand, by encoding and classifying the local feature data, global feature data, and fused feature data, a more comprehensive set of features is used to determine the prediction results. This approach is applicable to various downstream tasks such as equipment fault diagnosis, outlier detection, and natural gas and electricity load prediction, thereby improving prediction accuracy.

[0063] Figure 1 is an implementation environment architecture diagram of a time series data prediction method provided in an embodiment of this application. As shown in Figure 1, the implementation environment architecture includes: a terminal 100 and a server 200.

[0064] In the field of time series data prediction, the process of predicting time series data can be executed either on terminal 100 or on server 200. For example, by obtaining the time series to be processed through terminal 100, the time series to be processed can be predicted locally on terminal 100 to obtain the prediction result of the object to be predicted; alternatively, the time series to be processed can be sent to server 200, so that server 200 can obtain the time series to be processed, perform prediction processing on the time series to be processed, obtain the prediction result of the object to be predicted, and then send the prediction result to terminal 100 to realize the prediction processing of time series data.

[0065] In addition, the terminal 100 may display an application interface through which users can obtain the time series to be processed uploaded by them, or send the uploaded time series to be processed to the server 200.

[0066] Optionally, terminal 100 can be a terminal device in various AI application scenarios. For example, terminal 100 can be a smart home device such as a smart TV or smart TV set-top box, or terminal 100 can be a mobile portable terminal such as a smartphone, tablet computer, or e-book reader, or terminal 100 can be a smart wearable device such as smart glasses or smartwatch. This embodiment does not specifically limit it in this way.

[0067] Server 200 can be a server device that provides backend services for the AI ​​applications installed in the aforementioned terminal 100. Server 20 can be a single server, a server cluster or distributed system consisting of several servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.

[0068] Terminal 100 and server 200 establish a communication connection via a wired or wireless network. Optionally, the aforementioned wireless or wired network uses standard communication technologies and / or protocols. The network is typically the Internet, but can also be any network, including but not limited to a Local Area Network (LAN), Metropolitan Area Network (MAN), Wide Area Network (WAN), mobile, wired or wireless network, private network, or any combination of virtual private network.

[0069] For ease of understanding and explanation, the time series data prediction method, apparatus, device and storage medium provided in the embodiments of this application are described in detail below with reference to Figures 2 to 11.

[0070] Figure 2 shows a flowchart of a time series data prediction method according to an embodiment of this application. This method can be executed by a computer device, which can be the server 200 or terminal 100 in the system shown in Figure 1, or a combination of terminal 100 and server 200. As shown in Figure 2, the method includes:

[0071] S101. Obtain the time series to be processed; the time series to be processed is used to characterize the running data of the object to be predicted at multiple detection times.

[0072] It should be noted that the aforementioned time series data were collected at different times and are used to describe how phenomena change over time. This type of data reflects the state or extent of change of a certain event or phenomenon over time. The aforementioned objects to be predicted refer to the main objects that need to be classified and predicted. The objects to be predicted and the time series data to be processed are different for different downstream task scenarios.

[0073] Taking fault detection as an example, the object to be predicted can be mechanical equipment, and the time series to be processed refers to the operating data of the mechanical equipment at multiple detection times. Taking electricity load detection as an example, the object to be predicted is the electricity value of different households, and the time series to be processed refers to the electricity load data of different households at multiple detection times. Taking natural gas load detection as an example, the object to be predicted is the natural gas value of different households, and the time series to be processed refers to the natural gas load data of different households at multiple detection times. For example, the time series to be processed could be the natural gas load data collected from users over 30 days.

[0074] In this embodiment of the application, when obtaining the time series to be processed, it can be obtained by calling a data acquisition device, by obtaining it through the cloud, by obtaining it through a database or blockchain, or by importing it through an external device.

[0075] S102. The time series to be processed is processed by feature extraction through the prediction model to obtain local feature data, global feature data and fused feature data of the time series to be processed.

[0076] It should be noted that the prediction model is a neural network model that takes the time series to be processed as input and outputs the prediction result of the object to be predicted. It has the ability to integrate information from both short-range and long-range periods of the time series and can predict the outcome of the object to be predicted. The model parameters are in an optimal state, meaning the time series to be processed can be input into the prediction model, and the prediction result of the object to be predicted will be output.

[0077] Please refer to Figure 3. The prediction model described above may include a first feature extraction module, a second feature extraction module, and a feature fusion module. The first feature extraction module may be a local feature extraction module, and the second feature extraction module may be a global feature extraction module. Specifically, the first feature extraction module performs local feature extraction on the time series to be processed, obtaining local feature data. The second feature extraction module performs global feature extraction on the time series to be processed, obtaining global feature data. The local feature data characterizes the short-range periodicity of the time series to be processed, the global feature data characterizes the long-range periodicity of the time series to be processed, and the fused feature data characterizes the fused short-range and long-range periodicity features of the time series to be processed.

[0078] The aforementioned local feature data, global feature data, and fused feature data can be represented in matrix or vector form.

[0079] After obtaining local and global feature data, the feature fusion module can be used to fuse them. When the local and global feature data are represented by vectors, information fusion can be performed by combining vectors to obtain fused feature data; when the local and global feature data are represented by matrices, information fusion can be performed by concatenating matrices to obtain the corresponding fused feature data.

[0080] In this embodiment, the time series to be processed is processed by feature extraction through a prediction model to obtain local feature data, global feature data, and fused feature data. This allows for more granular extraction of short-term and long-term dependencies of the time series to be processed, thereby providing good data guidance for subsequent classification prediction and improving the accuracy of prediction results.

[0081] S103. Use the prediction model to perform feature encoding on local feature data, global feature data and fused feature data to obtain the encoding result, and perform classification prediction on the encoding result to obtain the prediction result of the object to be predicted.

[0082] The aforementioned prediction model may also include a feature encoding module. As one possible implementation, the feature encoding module can include multiple processing layers that sequentially encode local feature data, global feature data, and fused feature data to obtain local encoding results, global encoding results, and fused encoding results. Taking the processing of local feature data as an example, the local feature data can be processed by channel projection and temporal projection through the first processing layer to extract the temporal and channel dimension information of the local feature data, and then dimensionality reduction processing is performed through the second processing layer to obtain the local encoding result. Similarly, the same processing method as for the local feature data can be used to obtain the global encoding result and the fused encoding result. These local encoding results, global encoding results, and fused encoding results can be represented in vector form.

[0083] Optionally, the feature encoding module mentioned above can be an encoder in a transformer model or an encoder in a convolutional neural network.

[0084] After determining the local encoding result, global encoding result, and fused encoding result, they can be processed by a classification network for classification prediction, such as by using fully connected layers and activation functions, to obtain the prediction result of the object to be predicted.

[0085] It should be noted that the prediction result for the object to be predicted refers to the processing result obtained after analyzing and extracting features from the time-domain and frequency-domain feature data. This result is used to identify the type information of the object to be predicted at multiple detection times, enabling rapid acquisition of the type information and attribute characteristics of the time series to be processed. Taking a fault detection application scenario as an example, the prediction result includes the fault type of the object to be predicted, or it may include multiple fault attributes of the object under the fault type.

[0086] The time series data prediction method provided in this application acquires the time series to be processed and performs feature extraction processing on the time series through a prediction model to obtain local feature data, global feature data, and fused feature data of the time series to be processed. Then, the prediction model is used to encode the local feature data, global feature data, and fused feature data to obtain the encoding result. The encoding result is then classified and predicted to obtain the prediction result of the object to be predicted. Compared with the prior art, on the one hand, this technical solution can extract local feature data, global feature data, and fused feature data of the time series to be processed from both global and local perspectives, thereby capturing the short-range periodic information and long-range periodic information of the time series to be processed in a more granular manner, providing more accurate guidance information for subsequent classification and prediction. On the other hand, by encoding and classifying the local feature data, global feature data, and fused feature data, a more comprehensive set of features is combined to determine the prediction result, which can be applied to different downstream tasks such as equipment fault diagnosis, outlier detection, and natural gas and power load prediction, thus improving the accuracy of prediction.

[0087] In one embodiment, this embodiment provides a specific implementation method for extracting features from a time series to be processed using a prediction model to obtain local feature data, global feature data, and fused feature data of the time series. The method includes:

[0088] The time series to be processed is continuously sampled by the first feature extraction module to obtain multiple continuous segments, which are used as local feature data. The time series to be processed is then subjected to interval sampling by the second feature extraction module to obtain multiple non-continuous segments, which are used as global feature data. Finally, the local and global feature data are fused by the feature fusion module to obtain fused feature data.

[0089] Specifically, the first feature extraction module is used to extract short-term or local features of the time series to be processed. A continuous sampling strategy can be adopted to sample the time series to be processed, dividing it into multiple consecutive time segments, and using these consecutive segments as local feature data. In this way, each time segment can effectively retain the local information of the time series itself.

[0090] The second feature extraction module is used to extract long-term or global features of the time series to be processed. An interval sampling strategy can be employed to sample the time series, for example, sampling at intervals of several time points to obtain multiple non-contiguous segments. These non-contiguous segments are then used as global feature data. Each segment is composed of a sequence formed by uniformly sampling one time point at a specified step size. Each segment effectively preserves the global information or long-range periodic information of the time series itself.

[0091] After obtaining local and global feature data, the feature fusion module can be used to fuse the local and global feature data to obtain fused feature data. This fused feature data includes not only the local information of the time series to be processed, but also the global information of the time series to be processed.

[0092] In this embodiment, the first feature extraction module, the second feature extraction module, and the feature fusion module of the prediction model can extract local feature data, global feature data, and fused feature data of the time series to be processed more comprehensively and with fine granularity, providing guidance information for subsequent feature encoding processing and improving the accuracy of prediction processing.

[0093] In one embodiment, a specific implementation method is also provided for using a prediction model to perform feature encoding processing on local feature data, global feature data, and fused feature data to obtain the encoding result, as shown in Figure 4. The method includes:

[0094] S201. Perform time projection processing on the local feature data, global feature data and fused feature data in parallel to obtain the time dimension information after the transformation of the local feature data, global feature data and fused feature data.

[0095] S202. Perform channel projection processing based on the time dimension information after transformation of local feature data, global feature data, and fused feature data to obtain the transformed channel dimension information.

[0096] S203. The transformed time dimension information and the transformed channel dimension information are processed by the bottleneck layer to reduce the dimensionality and obtain the dimensionality-reduced data.

[0097] S204. Perform linear mapping on the dimensionality-reduced data to obtain local coding results, global coding results, and fusion coding results.

[0098] It should be noted that the aforementioned local feature data, global feature data, and fused feature data can be represented by matrices. The temporal dimension information (temporal dim) refers to the quantity and characteristics of temporal information in the matrix, while the channel dimension information (channels dim) refers to the number of values ​​each element in the matrix has. For example, a 3x4 matrix with 12 elements is said to have 3 channels (channels = 3) if each element has three values. A common example is a color image with red, green, and blue channels. Similarly, a 3x4x5 matrix with dims = 3 and channels = 12 means: a three-dimensional matrix where each element has 12 values.

[0099] Specifically, as shown in Figure 5, the aforementioned feature encoder can adopt a Multi-Layer Perception (MLP) structure, which includes four parts: channel projection, temporal projection, bottleneck design, and output projection. Taking the processing of local feature data through the feature encoding module as an example, the temporal dimension information (temporal dim) and channel dimension information (channels dim) of the local feature data can be obtained. For example, the temporal dim is H, and the channel projection is W. Then, temporal projection processing is performed to transform the local feature data R... H Information exchange is achieved through a radial transformation along the time dimension, thereby obtaining the time dimension information F′ of the transformed local feature data. At this point, the local feature data is transformed by R. H Convert to R F′ That is, the time dimension H is transformed into the time dimension F′.

[0100] Then, the time dimension information of the transformed local feature data is processed by channel projection, and information is exchanged through a radial transformation of the channel dimension to obtain the transformed channel dimension information W. At this point, the local feature data is converted into R. W The transformed time dimension information F′ and the transformed channel dimension information are then subjected to dimensionality reduction processing through a bottleneck layer to obtain the corresponding dimension F. Therefore, the resulting dimensionality-reduced data is R. F Then, the dimensionality-reduced data is linearly mapped through (Output projection) to obtain the local encoding result.

[0101] Similarly, the same processing method as the local feature data described above can be used to encode the global feature data and the fused feature data to obtain the corresponding global encoding results and fused encoding results.

[0102] Understandably, the bottleneck layer described above uses a 1x1 convolutional neural network. It's called a bottleneck layer because its shape resembles a bottleneck. In this embodiment, the bottleneck layer is used to reduce the dimensionality between the two MLPs, thereby reducing the number of model parameters and improving the algorithm's computational efficiency. Through linear mapping, the learned local and global features can be radially transformed to a specified dimension, facilitating subsequent prediction processing.

[0103] In this embodiment, by performing feature encoding on local feature data, global feature data, and fused feature data, the corresponding encoding results can be accurately determined, thereby improving the accuracy of model prediction.

[0104] In one embodiment, this application also provides a schematic diagram of the training process for training the prediction model, as shown in Figure 6. The training process includes the following steps:

[0105] S301. Obtain the sample time series; the sample time series data has historical annotation results.

[0106] It should be noted that the above sample time series is the data required for training the prediction model. This sample time series is used to characterize the operational data of the sample object over multiple historical detection times. The corresponding sample time series differs in different application scenarios. Taking a fault detection scenario as an example, the sample object can be mechanical equipment, so the sample time series refers to the operational data of the mechanical equipment over multiple historical detection times; taking an electricity load detection scenario as an example, the sample object is electricity value, so the sample time series refers to the electricity load data of different households over multiple historical detection times.

[0107] For example, taking the natural gas load detection scenario as an example, the historical gas consumption data of 2,000 industrial and commercial users is collected. This historical gas consumption data includes detection time points at each hour. The above sample time series can be detection data within 30 days. The obtained sample time series can include 30×24 time points. After obtaining the sample time series, the sample time series can be subjected to two data augmentation processes to obtain two sets of augmented data.

[0108] The above sample time series data has historical annotation results. These historical annotation results can be the result of manual data annotation. Taking the equipment fault detection scenario as an example, the historical annotation results of the sample time series can be known fault type information.

[0109] In this embodiment, the sample time series can first be randomly divided into a training set and a validation set according to a certain proportion. Then, a prediction model is constructed using the training set and the validation set according to a training and learning algorithm. The training set is used to train the initial prediction model to obtain a trained prediction model, and the validation set is used to validate the trained prediction model to verify its performance. For example, 80% of the sample time series can be selected as the training set, and the remaining 20% ​​as the validation set.

[0110] In this embodiment of the application, when obtaining the sample time series, it can be obtained by calling a data acquisition device, by obtaining it through the cloud, by obtaining the time series to be processed through a database or blockchain, or by importing the sample time series through an external device.

[0111] S302. Perform two data augmentation processes on the sample time series to obtain two sets of augmented data.

[0112] The aforementioned augmented data refers to the data obtained after performing augmentation processing on the sample time series.

[0113] As one possible approach, either of the two sets of augmented data can be obtained by processing the sample time series using at least one of the following methods: upsampling, downsampling, adding noise, flipping, and decomposition. Specifically, this could involve upsampling and downsampling a segment of the sample time series, then concatenating the processed sequence with other sequences to obtain the augmented data. Alternatively, Gaussian noise can be randomly added to the original sample time series to obtain the augmented data. Reversing the sign of the sequence values ​​is also possible. Another approach is STL decomposition: decomposing the sample time series into period, trend, and residuals, performing augmentation processing on each, and finally merging them to obtain the augmented data.

[0114] As another possible approach, the amplitude and phase of the sample time series can be adjusted and perturbed to obtain enhanced data. Alternatively, enhanced data can be obtained by randomly erasing or adding principal components in the frequency domain to a segment of the sample time series. These two sets of enhanced data can include a first enhanced data set and a second enhanced data set. The enhanced data set is then used as a positive sample pair for the sample time series, while the other enhanced data sets are used as negative sample pairs.

[0115] In this embodiment, the sample time series is enhanced, thereby increasing the number of sample datasets and making the trained prediction model perform better, improving the model's robustness and effectiveness.

[0116] S303. The two sets of augmented data are processed by feature extraction and encoding through the initial feature extraction network of the initial prediction model to obtain local encoding information, global encoding information, local fusion encoding information and global fusion encoding information of the two sets of samples.

[0117] S304. Based on the local coding information of two sets of samples, the global coding information of two sets of samples, the local fusion coding information, the global fusion coding information, and the historical annotation results, the initial classification network of the initial prediction model is iteratively trained to obtain the prediction model.

[0118] Optionally, as shown in Figure 7, the initial prediction model may include an initial feature extraction network and an initial classification network. During the training of the initial prediction model using the training set, two sets of augmented data may be input into the initial feature extraction network. This initial feature extraction network includes a first feature extraction module, a second feature extraction module, and a feature fusion module. The first feature extraction module performs continuous sampling on the two sets of augmented data to obtain multiple continuous segments, which are then used as local feature data for the two sets of samples. The second feature extraction module performs interval sampling on the two sets of augmented data to obtain multiple non-continuous segments, which are then used as global feature data for the two sets of samples. The feature fusion module fuses the local feature data and the global feature data of the two sets of samples to obtain fused sample feature data, which may include local fusion encoding information and global fusion encoding information.

[0119] Specifically, the two sets of augmented data can be processed by feature extraction through the first encoding module in the initial feature extraction network to obtain two sets of sample local feature data. In parallel, the two sets of augmented data can be processed by feature extraction through the second encoding module in the initial feature extraction network to obtain two sets of sample global feature data. Then, the two sets of sample local feature data and the two sets of sample global feature data are processed by feature fusion to obtain sample fusion feature data, which includes local fusion features and global fusion features.

[0120] The initial feature extraction network may also include a feature encoding module. This module encodes local and global feature data from two sets of samples, along with local and global fusion features, to obtain local, global, and fusion encoding information for the two sets of samples. Then, a contrastive loss function is constructed based on this information. The parameters of the first, second, feature extraction, feature fusion, and feature encoding modules are iteratively trained to minimize the contrastive loss function, resulting in the feature extraction network for the prediction model. Finally, the initial classification network is iteratively trained based on the feature extraction network and historical annotation results to obtain the prediction model.

[0121] After obtaining the local encoding information of two sets of samples, the global encoding information of two sets of samples, the local fusion encoding information, and the global fusion encoding information, a local contrastive loss can be constructed based on the local encoding information of the two sets of samples, and a global contrastive loss can be constructed based on the global encoding information of the two sets of samples. Then, a fusion contrastive loss can be constructed based on the local fusion encoding information and the global fusion encoding information. A contrastive loss function can be constructed based on the local contrastive loss, the global contrastive loss, and the fusion contrastive loss. Then, the parameters of the first feature extraction module, the second feature extraction module, the feature fusion module, and the feature encoding module are iteratively trained according to minimizing the contrastive loss function to obtain the trained feature extraction network.

[0122] The aforementioned local contrast loss, global contrast loss, and fusion contrast loss can all be represented by the following InfoNCE:

[0123]

[0124] Among them, when l i,j When representing local contrast loss, x i and x j These represent two pairs of positive samples, i.e., local encoding information of the samples, where N represents the number of samples, and x represents the number of samples. k Indicates a negative sample; when l i,j When representing global contrastive loss, x i and x j These represent two pairs of positive samples, i.e., the global encoding information of the samples, x k Indicates a negative sample; when l i,j When representing the fusion contrast loss, x i and x j These represent two pairs of positive samples, namely, local fusion coding information and global fusion coding information, respectively. kThis indicates a negative sample.

[0125] In the process of iteratively training the initial feature extraction network by minimizing the contrastive loss function, it is necessary to continuously maximize the similarity between the local feature data of two samples, the global feature data of two samples, and the local fused data and the global fused data, while minimizing the similarity with other negative samples.

[0126] It should be noted that the iterative training of the first feature extraction module, the second feature extraction module, and the feature fusion module in this embodiment is three independent processing steps. Iterative training can be performed only on the first feature extraction module, only on the second feature extraction module, or only on the feature fusion module. Alternatively, iterative training can be performed on all three modules, and the execution order is not limited; they can be executed sequentially or in parallel within a single iterative training session.

[0127] After determining the trained feature extraction network, the parameters in the feature extraction network are kept unchanged, and the initial classification network is iteratively trained based on the feature extraction network and historical annotation results to obtain the prediction model.

[0128] Specifically, during the iterative training of the initial classification network, the sample time series can be processed by feature extraction network to obtain fusion results. Then, the fusion results are used to perform classification prediction through the initial classification network to obtain output results. Based on the output results and historical annotation results, a classification loss function is constructed. By minimizing the classification loss function, the parameters of the initial classification network are iteratively trained to obtain the classification network of the prediction model. The prediction model is then constructed based on the feature extraction network and the classification network.

[0129] The initial classification network, which performs classification or prediction, can be a two-layer MLP network used to predict downstream target tasks, such as equipment fault diagnosis prediction, load prediction, and outlier detection. The trained feature extraction network and the trained classification network can be used as the trained prediction model.

[0130] After training the prediction model using the training set, the validation set can be input into the trained prediction model for processing to obtain the output result. A performance metric is then determined to evaluate the prediction performance. When this metric exceeds a preset threshold, the corresponding trained prediction model is selected as the final prediction model. Furthermore, to test the performance of the scheme in this application, time-series data prediction can be performed using the natural gas load of 2000 industrial and commercial users as a scenario. The prediction accuracy distribution of different schemes, such as the baseline model and the algorithm of this application, can be calculated, as shown in Figure 8. The light-colored portion represents users where the algorithm proposed in this application outperforms the baseline model, and the dark-colored portion represents users where the algorithm proposed in this application is weaker than the baseline model. Clearly, the figure shows that the algorithm proposed in this application outperforms the baseline model in a larger number of users, indicating that the algorithm proposed in this application is superior to the baseline model. Simultaneously, the floating-point operations per second (FLOPS) of the algorithm of this application, baseline model 1, and baseline model 2 for short-sequence and long-sequence predictions can be calculated. FLOPS can be understood as computational speed, a metric for measuring hardware performance. Specific parameters are shown in the table below.

[0131] FLOPS short sequence prediction, long sequence prediction. This algorithm has a baseline model of 30328, a baseline model of 15078883, and a baseline model of 2116525078. surface

[0132] Clearly, the above data shows that the algorithm proposed in this application determines lower FLOPS compared to existing baseline models, meaning it outperforms the baseline models in both short-sequence and long-sequence prediction speeds.

[0133] In this embodiment, when training the feature extraction network, both local and global characteristics of the time series are fully considered, capturing both long-term and short-term dependencies of the sample time series. This allows the model to focus not only on the short-term features of the sample time series during training but also on the long-term features. By constructing global contrastive learning tasks, local contrastive learning tasks, and fusion contrastive learning tasks, the prediction model can extract time series features more comprehensively. Furthermore, the trained feature extraction network can be transferred to downstream time series prediction and classification tasks, such as natural gas load prediction, power load prediction, missing value imputation, outlier imputation, and rotating machinery equipment fault detection, improving the accuracy of task prediction.

[0134] In another embodiment of this application, a specific implementation of the contrastive loss function described above is also provided. In one possible implementation, the contrastive loss function may include a first component, a second component, and a third component. The first component is used to characterize the difference loss between the local coding information of the two sets of samples; the second component is used to characterize the difference loss between the global coding information of the two sets of samples; and the third component is used to characterize the difference loss between the locally fused coding information and the globally fused coding information.

[0135] The contrastive loss function constructed above can be the sum of the first, second, and third components. By setting the first, second, and third components in the contrastive loss function, the difference loss between the local encoding information of the two sets of samples, the difference loss between the global encoding information of the two sets of samples, and the difference loss between the locally fused encoding information and the globally fused encoding information can be reduced. This ensures that the sample's local encoding information and sample's global encoding information fuse the local and global features of the sample's time series, resulting in more optimized parameters in the feature extraction network.

[0136] In this embodiment, when constructing the contrastive loss function to obtain the feature extraction network, the differences between the local encoding information of the two sets of samples, the differences between the global encoding information of the two sets of samples, and the differences between the local fusion encoding information and the global fusion encoding information are integrated. Based on the contrastive loss function, the initial feature extraction network is trained, which can more accurately and comprehensively iteratively train the model parameters in the initial feature extraction network, making the obtained feature extraction network better, and thus making the accuracy of feature extraction higher.

[0137] Optionally, during the iterative training of the initial feature extraction network, reasonable weight coefficients can be assigned to the first, second, and third components of the loss function. This ensures that the model's prediction discrepancies closely match actual business needs, thereby improving model performance. In one possible implementation, the loss function can be determined by setting the weight coefficients of the first, second, and third components. Specifically, the weight coefficient of the first component is related to the importance of the locally fused encoding information; the weight coefficient of the second component is related to the importance of the globally fused encoding information; and the weight coefficient of the third component is related to the importance of the fused feature representation.

[0138] The first component, second component, third component, and loss function satisfy the following formula:

[0139] Y = a1*y1 + a2*y2 + a3*y3

[0140] Where Y is the contrastive loss function in the training process of the feature extraction network, y1 is the first component, a1 is the weight coefficient of the first component, y2 is the second component, a2 is the weight coefficient of the second component, y3 is the third component, and a3 is the weight coefficient of the third component. For example, a1, a2 and a3 can be 1 / 3 respectively.

[0141] In one embodiment, after the feature extraction network is trained, the sample time series can be processed by the first feature extraction module in the feature extraction network to obtain local data, and the sample time series can be processed by the second feature extraction module in the feature extraction network to obtain global data. Then, the local data and global data are fused by the feature fusion module to obtain fused data. Then, the local data, global data and fused data are encoded by the feature encoding module in the feature extraction network to obtain the fusion result. The fusion result is used for classification prediction by the initial classification network to obtain the output result. Based on the output result and the historical annotation result, a classification loss function is constructed. The parameters of the initial classification network are iteratively trained according to minimizing the classification loss function to obtain the classification network of the prediction model. Finally, a prediction model is constructed based on the feature extraction network and the classification network.

[0142] In the iterative training of the initial classification network by minimizing the classification loss function, gradient descent can be used, for example, for iterative training. During the iterative training of the initial classification network, the parameters in the initial classification network can be updated, such as the weight matrix and bias matrix. These weight and bias matrices include, but are not limited to, the matrix parameters in the self-attention layer, feedforward layer, and fully connected layer of the initial classification network.

[0143] When updating the parameters of the initial classification network using the classification loss function, if the initial classification network has not converged according to the loss function, the parameters of the initial classification network can be adjusted to make it converge, thus obtaining an adjusted initial classification network. Convergence of the initial classification network can be defined as the difference between the output result and the historical labeled result being less than a preset threshold, or the rate of change of the difference between the output result and the historical labeled result approaching a certain low value. When the calculated loss function is small, or the difference between the calculated loss function and the loss function output from the previous iteration approaches 0, the initial classification network is considered to have converged, and therefore the prediction model is considered to have converged. The trained feature extraction network and classification network are then used as the prediction model.

[0144] In this embodiment, by acquiring sample time series and performing enhancement processing on the sample time series to obtain enhanced data, and by iteratively training the initial prediction model based on the enhanced data and historical annotation results, the accuracy of the trained prediction model can be improved, thereby increasing the accuracy of the prediction model in determining the prediction results of the object to be predicted.

[0145] To better understand the embodiments of this application, the complete flowchart of the time series data prediction method proposed in this application will be further described below. As shown in Figure 9, the method may include the following steps:

[0146] S401. Obtain the time series to be processed. The time series to be processed is used to characterize the running data of the object to be predicted at multiple detection times.

[0147] Specifically, taking the natural gas load detection scenario as an example, a time series to be processed can be obtained. This time series to be processed can be, for example, the natural gas consumption of a user within 30 days, with one hour as a detection unit, which can include 30×24 time points.

[0148] S402. The time series to be processed is continuously sampled through the first feature extraction module to obtain multiple continuous segments, and the multiple continuous segments are used as local feature data.

[0149] S403. The time series to be processed is subjected to interval sampling processing through the second feature extraction module to obtain multiple non-continuous segments, and the multiple non-continuous segments are used as global feature data.

[0150] S404. The local feature data and global features are fused through the feature fusion module to obtain fused feature data.

[0151] In this embodiment, considering the need to predict future time series data, the time series to be processed is related not only to data at adjacent time points but also to certain historical time points. For example, the data at 12:00 today is related not only to the data at 11:00 and 13:00 today but also to the data at 12:00 the day before yesterday and 12:00 yesterday. Therefore, when predicting time series data, it is necessary to consider not only the short-term dependencies but also the long-term dependencies. Thus, this application designs a lightweight deep learning architecture based on MLP. The key idea of ​​this architecture is to apply a simple MLP structure to two sampling strategies, thereby achieving effective extraction of short-range and long-range information.

[0152] After obtaining the time series to be processed, the time series can be continuously sampled through the first feature extraction module in the prediction model to obtain multiple continuous segments, and these multiple continuous segments are used as local feature data. Then, the time series to be processed is subjected to interval sampling through the second feature extraction module in the prediction model to obtain multiple non-continuous segments, which are used as global feature data. Finally, the local feature data and global feature data are fused through the feature fusion module to obtain fused feature data.

[0153] S405. The local feature data, global feature data, and fused feature data are encoded in parallel through the feature encoding module to obtain the encoding result.

[0154] S406. The encoded results are classified and predicted through the classification network of the prediction model to obtain the prediction result of the object to be predicted.

[0155] After obtaining local feature data, global feature data, and fused feature data, the temporal dimension information (temporal dim) and channel dimension information (channels dim) of the local feature data can be obtained. For example, the temporal dim is H and the channel projection is W. Then, temporal projection processing is performed to transform the local feature data R... H Information exchange is achieved through a radial transformation along the time dimension, thereby obtaining the transformed time dimension information F′. At this point, the local feature data is obtained from R. H Convert to R F′ This involves transforming the time dimension H into a time dimension F′. Then, the transformed time dimension information of the local feature data undergoes channel projection processing, using a radial transformation of the channel dimension to exchange information and obtain the transformed channel dimension information W. At this point, the local feature data is transformed into R. W The transformed time dimension information F′ and the transformed channel dimension information are then subjected to dimensionality reduction processing through a bottleneck layer to obtain the corresponding dimension F. Therefore, the resulting dimensionality-reduced data is R. F The dimensionality-reduced data is then linearly mapped using Output Projection to obtain local encoding results. The same processing method used for the local feature data is then applied to the global feature data and the fused feature data to obtain the corresponding global encoding results and fused encoding results.

[0156] After determining the corresponding encoding result, the encoding result is then classified and predicted using the classification network of the prediction model. For example, the encoding result can be processed by a multi-classification function to output the natural gas anomaly detection type. Optionally, the multi-classification function can be a softmax function. The purpose of the multi-classification function is to incorporate nonlinear factors because the expressive power of the linear model is insufficient, and it can transform the continuous real values ​​of the input into an output between 0 and 1.

[0157] Taking three-class classification as an example, the multi-class classification function can output the probability of the corresponding natural gas anomaly detection type in the final result. The element value with the highest probability can be selected as the prediction result of the time series to be processed.

[0158] In this embodiment of the application, by performing feature extraction processing on the time series to be processed through the feature extraction network of the prediction model, the feature information of the time series to be processed can be extracted more comprehensively. This allows for the combination of more comprehensive information for classification and prediction, and the classification processing is performed through the classification network, resulting in a more accurate prediction result for the object to be predicted.

[0159] It should be noted that although the operations of the method of the present invention are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all of the operations shown must be performed to achieve the desired result. On the contrary, the steps depicted in the flowchart may be performed in a different order. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0160] On the other hand, Figure 10 is a schematic diagram of a time series data prediction device provided in an embodiment of this application. This device can be a device within a computer device. As shown in Figure 10, the device 400 includes:

[0161] The acquisition module 410 is used to acquire the time series to be processed; the time series to be processed is used to characterize the running data of the object to be predicted at multiple detection times;

[0162] The feature extraction module 420 is used to extract features from the time series to be processed through the prediction model to obtain local feature data, global feature data and fused feature data of the time series to be processed.

[0163] The classification prediction module 430 is used to perform feature encoding processing on local feature data, global feature data and fused feature data using the prediction model to obtain the encoding result, and to perform classification prediction on the encoding result to obtain the prediction result of the object to be predicted.

[0164] Optionally, the feature extraction module 420 described above is specifically used for:

[0165] The time series to be processed is continuously sampled through the first feature extraction module to obtain multiple continuous segments, which are then used as local feature data.

[0166] The time series to be processed is subjected to interval sampling processing through the second feature extraction module to obtain multiple non-continuous segments, which are then used as global feature data.

[0167] Local and global feature data are fused together using a feature fusion module to obtain fused feature data.

[0168] Optionally, the above classification prediction module 430 is specifically used for:

[0169] The local feature data, global feature data, and fused feature data are processed in parallel by temporal projection to obtain the temporal dimension information after the transformation of the local feature data, global feature data, and fused feature data;

[0170] Channel projection processing is performed based on the time dimension information after transformation of local feature data, global feature data, and fused feature data to obtain the transformed channel dimension information;

[0171] The transformed time dimension information and the transformed channel dimension information are processed by the bottleneck layer to reduce the dimensionality, resulting in dimensionality-reduced data.

[0172] The dimensionality-reduced data is then subjected to linear mapping to obtain local encoding results, global encoding results, and fused encoding results.

[0173] Optionally, the training process for the prediction model includes the following steps:

[0174] Obtain the sample time series; the sample time series data has historical annotation results;

[0175] Two sets of augmented data were obtained by performing two data augmentation processes on the sample time series.

[0176] The two sets of augmented data are processed by feature extraction and encoding through the initial feature extraction network of the initial prediction model to obtain local encoding information, global encoding information, local fusion encoding information and global fusion encoding information of the two sets of samples;

[0177] The initial classification network of the initial prediction model is iteratively trained based on the local coding information of the two sets of samples, the global coding information of the two sets of samples, the local fusion coding information, the global fusion coding information, and the historical annotation results to obtain the prediction model.

[0178] Optionally, the above-mentioned device is also used for:

[0179] The two sets of augmented data are processed by feature extraction through the first encoding module in the initial feature extraction network to obtain local features of the two sets of samples. The two sets of augmented data are processed by feature extraction through the second encoding module in the initial feature extraction network in parallel to obtain global features of the two sets of samples.

[0180] The local features and global features of the two sets of samples are processed by feature fusion to obtain local fused features and global fused features;

[0181] Based on the local features, global features, local fusion features, and global fusion features of the two sets of samples, the feature extraction network's feature encoding module performs encoding processing to obtain the local encoding information, global encoding information, local fusion encoding information, and global fusion encoding information of the two sets of samples.

[0182] Optionally, the above-mentioned device is also used for:

[0183] Based on the local coding information of two sets of samples, the global coding information of two sets of samples, the local fusion coding information, and the global fusion coding information, a contrastive loss function is constructed. The parameters of the first feature extraction module, the second feature extraction module, the feature fusion module, and the feature coding module are iteratively trained according to minimizing the contrastive loss function to obtain the feature extraction network of the prediction model.

[0184] The initial classification network is iteratively trained based on the feature extraction network and historical annotation results to obtain the prediction model.

[0185] Optionally, the above-mentioned device is also used for:

[0186] The sample time series is processed by feature extraction through the first and second feature extraction modules in the feature extraction network to obtain local and global data.

[0187] Local and global data are fused through a feature fusion module to obtain fused data. The fused data, local data, and global data are then encoded through a feature encoding module in the feature extraction network to obtain the fusion result.

[0188] The fusion result is then used to perform classification prediction through the initial classification network to obtain the output result;

[0189] A classification loss function is constructed based on the output results and historical annotation results. The parameters of the initial classification network are iteratively trained according to minimizing the classification loss function to obtain the classification network of the prediction model. The prediction model is then constructed based on the feature extraction network and the classification network.

[0190] Optionally, the contrastive loss function includes a first component, a second component, and a third component;

[0191] The first component is used to characterize the difference loss between the local coding information of the two sets of samples;

[0192] The second component is used to characterize the difference loss between the global encoding information of the two sets of samples;

[0193] The third component is used to characterize the difference loss between local fusion coding information and global fusion coding information.

[0194] The time series data prediction device provided in this application embodiment, compared with the prior art, has the following advantages: First, it can extract local feature data, global feature data, and fused feature data of the time series to be processed from both global and local perspectives. This allows for more granular capture of the short-range and long-range periodic information of the time series, providing more accurate guidance for subsequent classification and prediction. Second, by encoding and classifying the local feature data, global feature data, and fused feature data, it combines more comprehensive features to determine the prediction results. This makes it applicable to various downstream tasks such as equipment fault diagnosis, outlier detection, and natural gas and electricity load prediction, thus improving the accuracy of prediction.

[0195] On the other hand, the computer device provided in the embodiments of this application includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the time series data prediction method as described above.

[0196] Referring now to FIG11, FIG11 is a schematic diagram of the structure of the computer system of the computer device according to an embodiment of the present application.

[0197] As shown in Figure 11, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 602 or programs loaded from storage portion 603 into random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of the system 600. The CPU 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0198] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.

[0199] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a machine-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 603, and / or installed from removable medium 611. When the computer program is executed by central processing unit (CPU) 601, it performs the functions defined above in the system of this application.

[0200] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0201] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0202] The units or modules described in the embodiments of this application can be implemented in software or hardware. The described units or modules can also be housed in a processor; for example, it can be described as: a processor including: an acquisition module, a feature extraction module, and a classification prediction module. The names of these units or modules do not necessarily limit the unit or module itself; for example, the acquisition module can also be described as "used to acquire a time series to be processed; the time series to be processed is used to characterize the running data of the object to be predicted at multiple detection times."

[0203] In another aspect, this application also provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The aforementioned computer-readable storage medium stores one or more programs, which, when used by one or more processors, execute the time-series data prediction method described in this application:

[0204] Obtain the time series to be processed; the time series to be processed is used to characterize the running data of the object to be predicted at multiple detection times;

[0205] The time series to be processed is subjected to feature extraction processing through a prediction model to obtain local feature data, global feature data and fused feature data of the time series to be processed;

[0206] The prediction model is used to perform feature encoding on the local feature data, the global feature data, and the fused feature data to obtain the encoding result. The encoding result is then used for classification and prediction to obtain the prediction result for the object to be predicted.

[0207] In summary, the time series data prediction method, apparatus, device, and storage medium provided in this application acquire a time series to be processed, and then perform feature extraction processing on the time series using a prediction model to obtain local feature data, global feature data, and fused feature data of the time series to be processed. Then, the prediction model is used to encode the local feature data, global feature data, and fused feature data to obtain the encoding result. The encoding result is then classified and predicted to obtain the prediction result for the object to be predicted. Compared with the prior art, on the one hand, this technical solution can extract local feature data, global feature data, and fused feature data of the time series to be processed from both global and local perspectives, thereby capturing the short-range and long-range periodic information of the time series to be processed with finer granularity, providing more accurate guidance information for subsequent classification and prediction. On the other hand, by encoding and classifying the local feature data, global feature data, and fused feature data, a more comprehensive set of features is combined to determine the prediction result, making it applicable to different downstream tasks such as equipment fault diagnosis, outlier detection, and natural gas and electricity load prediction, thus improving the accuracy of prediction.

[0208] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the inventive concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.

Claims

1. A method for predicting time series data, characterized in that, The method includes: acquiring a time series to be processed; the time series to be processed is used to characterize the operational data of the object to be predicted at multiple detection times; wherein, the time series to be processed is natural gas load data of different households at multiple detection times, and the object to be predicted is the natural gas value of different households; performing feature extraction processing on the time series to be processed through a prediction model to obtain local feature data, global feature data, and fused feature data of the time series to be processed; using the prediction model to perform feature encoding processing on the local feature data, the global feature data, and the fused feature data to obtain encoding results, and performing classification prediction on the encoding results to obtain the prediction result of the object to be predicted; its In this context, the prediction result is a natural gas anomaly detection type; the prediction model includes a first feature extraction module, a second feature extraction module, and a feature fusion module. The time series to be processed is subjected to feature extraction processing through the prediction model to obtain local feature data, global feature data, and fused feature data of the time series to be processed. This includes: continuously sampling the time series to be processed through the first feature extraction module to obtain multiple continuous segments, and using these multiple continuous segments as local feature data; performing interval sampling processing on the time series to be processed through the second feature extraction module to obtain multiple non-continuous segments, and using these multiple non-continuous segments as global feature data; and then... The local feature data and the global feature data are fused through the feature fusion module to obtain fused feature data; the local feature data, the global feature data, and the fused feature data are then fused using the prediction model to obtain an encoding result, including: performing time projection processing on the local feature data, the global feature data, and the fused feature data in parallel to obtain the transformed time dimension information of the local feature data, the global feature data, and the fused feature data; performing channel projection processing based on the transformed time dimension information of the local feature data, the global feature data, and the fused feature data to obtain the transformed channel dimension information; and combining the transformed time dimension information with the... The transformed channel dimension information is dimensionality-reduced through a bottleneck layer to obtain dimensionality-reduced data; the dimensionality-reduced data is then linearly mapped to obtain local encoding results, global encoding results, and fusion encoding results; the training process of the prediction model includes the following steps: acquiring sample time series; the sample time series data is labeled with historical annotation results; the sample time series consists of historical natural gas consumption data from 2000 industrial and commercial users, the historical natural gas consumption data includes detection data within 30 days, the sample time series includes 30×24 time points; the sample time series undergoes two data augmentation processes to obtain two sets of augmented data;The two sets of augmented data are processed through the initial feature extraction network of the initial prediction model for feature extraction and encoding, resulting in local encoding information, global encoding information, local fusion encoding information, and global fusion encoding information for the two sets of samples. Based on the local encoding information, global encoding information, local fusion encoding information, global fusion encoding information, and the historical annotation results, the initial classification network of the initial prediction model is iteratively trained to obtain the prediction model.

2. The method according to claim 1, characterized in that, The two sets of enhanced data are processed by feature extraction and encoding through the initial feature extraction network of the initial prediction model to obtain two sets of sample local encoding information, two sets of sample global encoding information, local fusion encoding information, and global fusion encoding information. This includes: processing the two sets of enhanced data separately through the first feature extraction module in the initial feature extraction network to obtain two sets of sample local features; processing the two sets of enhanced data in parallel through the second feature extraction module in the initial feature extraction network to obtain two sets of sample global features; processing the two sets of sample local features and the two sets of sample global features through a feature fusion module to obtain local fusion features and global fusion features; and encoding the two sets of sample local features, the two sets of sample global features, the local fusion features, and the global fusion features through the feature encoding module in the feature extraction network to obtain two sets of sample local encoding information, two sets of sample global encoding information, local fusion encoding information, and global fusion encoding information.

3. The method according to claim 2, characterized in that, The initial classification network of the initial prediction model is iteratively trained based on the local coding information of the two sets of samples, the global coding information of the two sets of samples, the local fusion coding information, the global fusion coding information, and the historical annotation results to obtain the prediction model. This includes: constructing a contrastive loss function based on the local coding information of the two sets of samples, the global coding information of the two sets of samples, the local fusion coding information, and the global fusion coding information; iteratively training the parameters of the first feature extraction module, the second feature extraction module, the feature fusion module, and the feature encoding module according to minimizing the contrastive loss function to obtain the feature extraction network of the prediction model; and iteratively training the initial classification network based on the feature extraction network and the historical annotation results to obtain the prediction model.

4. The method according to claim 3, characterized in that, The prediction model is obtained by iteratively training the initial classification network based on the feature extraction network and the historical annotation results, including: extracting features from the sample time series through the first and second feature extraction modules in the feature extraction network to obtain local data and global data; fusing the local data and the global data through the feature fusion module to obtain fused data; encoding the fused data, the local data, and the global data through the feature encoding module in the feature extraction network to obtain a fusion result; performing classification prediction on the initial classification network using the fusion result to obtain an output result; constructing a classification loss function based on the output result and the historical annotation results; iteratively training the parameters of the initial classification network according to minimizing the classification loss function to obtain the classification network of the prediction model; and constructing the prediction model based on the feature extraction network and the classification network.

5. The method according to claim 3, characterized in that, The contrast loss function includes a first component, a second component, and a third component; the first component is used to characterize the difference loss between the local coding information of the two sets of samples; the second component is used to characterize the difference loss between the global coding information of the two sets of samples; and the third component is used to characterize the difference loss between the local fused coding information and the global fused coding information.

6. A time series data prediction device, characterized in that, The apparatus for implementing the time series data prediction method as described in any one of claims 1-5 includes: an acquisition module for acquiring a time series to be processed; the time series to be processed is used to characterize the running data of the object to be predicted at multiple detection times; a feature extraction module for performing feature extraction processing on the time series to be processed through a prediction model to obtain local feature data, global feature data, and fused feature data of the time series to be processed; and a classification prediction module for using the prediction model to perform feature encoding processing on the local feature data, the global feature data, and the fused feature data to obtain an encoding result, and performing classification prediction on the encoding result to obtain a prediction result for the object to be predicted.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the time series data prediction method as described in any one of claims 1-5.

8. A computer-readable storage medium having a computer program stored thereon for implementing the time series data prediction method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Sequence action positioning method, system and device based on set prediction and medium

    CN114708523A

  • Image classification method and training method and device of image classification model

    CN114863229A