Sequence reconstruction model training method and apparatus, and sequence reconstruction method and apparatus
By using an adversarial learning-based sequence reconstruction model training method, and updating the encoding module with dual decoding modules of normal and abnormal samples, the problem of insufficient anomaly detection accuracy in existing technologies is solved, and more accurate sequence reconstruction and anomaly detection are achieved in the presence of abnormal data.
Patent Information
- Application Number
- PCT/CN2025/114568
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-09-13
- Filing Date
- 2025-08-14
- Publication Date
- 2026-03-19
AI Technical Summary
Existing time series anomaly detection schemes struggle to achieve accurate sequence reconstruction when abnormal data exists within normal samples. Furthermore, the accuracy of existing methods for anomaly detection needs improvement, particularly when data volume is insufficient and manual annotation costs are high, which impacts the robustness of the models.
A sequence reconstruction model training method based on adversarial learning is adopted. By setting up two decoding modules to learn normal samples and abnormal samples respectively, the encoding module is updated using normal samples, and adversarial learning is performed using abnormal samples. This reduces the learning of data distribution of abnormal samples and improves the model's ability to reconstruct normal sequences.
This technology enables the model to reconstruct normal sequences more accurately in the presence of anomalous data, improving the accuracy of anomaly detection and the model's generalization ability, thus adapting to various application scenarios.
Smart Images

Figure CN2025114568_19032026_PF_FP_ABST
Abstract
Description
A sequence reconstruction model training method, a sequence reconstruction method and device
[0001] The present application claims priority to the Chinese patent application No. CN202411295502.1, filed on September 13, 2024, entitled "A sequence reconstruction model training method, a sequence reconstruction method and device", the whole content of which is incorporated herein by reference. TECHNICAL FIELD
[0002] The present application relates to the field of sequence processing, in particular to a sequence reconstruction model training method, a sequence reconstruction method and device. BACKGROUND
[0003] Abnormality detection is widely used in various fields, such as finance, network, industry or energy, etc., and can be used for abnormality detection of time series. The commonly used time series abnormality detection still has many problems. For example, the amount of data in the real scene is too small to meet the required amount of data for training, and the cost of manual annotation is very high. And the existing scheme needs to further improve the checking accuracy of time series anomaly.
[0004] For example, in an existing time series anomaly detection scheme (referred to as DCdetector), a contrast learning strategy in unsupervised learning is used for modeling, and its core idea is based on the premise that normal sample points have a very close relationship with other sample points, and abnormal sample points have a weak relationship with other sample points. It uses a contrast learning framework for time series anomaly value detection. However, the representation of abnormal sample points between different perspectives is close, which will destroy the robustness of the model itself, so it is very limited to clean training sets without abnormal points, and it is difficult to exist in real scenes under such premise assumptions, so it is very difficult to implement.
[0005] Therefore, how to obtain a model that can accurately reconstruct sequences in the case of abnormal data in normal samples has become a problem to be solved. SUMMARY
[0006] The embodiments of the present application provide a sequence reconstruction model training method, a sequence reconstruction method and device, which are used for training a model that can be used for sequence reconstruction based on normal samples and abnormal samples, and specifically, the reconstruction ability of the model for normal sequences can be improved based on adversarial learning.
[0007] In a first aspect, an embodiment of the present application provides a sequence reconstruction model training method, including: obtaining a first training set, the first training set including normal samples and abnormal samples, the normal samples and the abnormal samples including at least one element arranged according to a generation time sequence, the normal samples including sequences without abnormal points, and the abnormal samples including sequences with abnormal points, the meaning of the element in the sample may be different in different scenarios, and can be determined according to an actual application scenario; then updating an initial sequence reconstruction model using the first training set to obtain an updated sequence reconstruction model, the updated sequence reconstruction model being used to output a reconstructed sequence, the sequence reconstruction model including an encoding module, a first decoding module and a second decoding module, the first decoding module being used to perform a first update on the encoding module using the normal samples, and the second decoding module being used to perform a second update on the encoding module based on the abnormal samples through adversarial learning.
[0008] In an embodiment of the present application, two decoding modules are arranged in the sequence reconstruction model, the first decoding module learns normal samples, and the second decoding module learns abnormal samples, the encoding model and the decoding modules are normally updated using the normal samples, and the encoding model and the second decoding module are updated using the abnormal samples, so that the encoding model can learn the data distribution of the normal samples, the data distribution learning of the encoding model for the abnormal samples is reduced, the model has stronger reconstruction capability for normal sequences, and a more accurate output sequence is reconstructed.
[0009] In a possible implementation, any one iteration learning process of the foregoing adversarial learning on the initial sequence reconstruction model includes: when the sample input to the encoding module is a normal sample, the normal sample is encoded by the encoding module, and the encoded data is input to the first decoding module, a corresponding first sequence is output, and the encoding module and the first decoding module are updated through a first loss value between the first sequence and the normal sample; when the sample input to the encoding module is an abnormal sample, the abnormal sample is encoded by the encoding module, and the encoded data is input to the second decoding module, a corresponding second sequence is output, and the encoding module and the second decoding module are adversarially learned according to a second loss value between the second sequence and the abnormal sample.
[0010] In an embodiment of the present application, the data distribution characteristics in the sequence can be learned using the normal samples, and the adversarial learning can be performed using the abnormal samples, the learned model can more accurately distinguish the normal samples and the abnormal samples, so that the sequence reconstruction model has stronger sequence reconstruction capability, and a more accurate reconstructed sequence is output.
[0011] In a possible implementation, the aforementioned adversarial learning of the encoding module and the second decoding module according to the second loss value between the second sequence and the abnormal sample includes: calculating a gradient value according to the second loss value between the second sequence and the abnormal sample, and updating the encoding module after inverse transformation of the gradient value.
[0012] In the embodiments of the present application, the encoding module can be updated by gradient value inversion, and the adversarial learning of the encoding module and the second decoding module can also be implemented by derivative transformation or gradient value reduction, so as to learn the sequence distribution characteristics in the normal sample by adversarial learning, avoid learning the abnormal sequence distribution characteristics in the abnormal sample, improve the sequence encoding capability of the encoding module, and make the encoding data output by the encoding module more close to the data distribution characteristics in the normal sample.
[0013] In a possible implementation, the aforementioned sequence reconstruction model further includes a routing layer and a plurality of feature extraction networks, the input end of the plurality of feature extraction networks is connected to the output end of the encoding model, the output end of the plurality of feature extraction networks is connected to the first encoding module or the second encoding module, the plurality of feature extraction networks are used to extract features from the input data, the features extracted by the plurality of feature extraction networks have different compression degrees, and the routing layer is used to determine the weight corresponding to the output feature of each feature extraction network in the plurality of feature extraction networks.
[0014] In the embodiments of the present application, the feature extraction networks with different feature compression ratios can be set, and the weights of the feature extraction networks are determined by the routing layer, so that the feature compression ratio of the output feature is more adaptive to the input data. For example, in different scenarios, the adaptive feature compression ratio can be different, and the adaptive feature compression ratio for the input data can be configured by the embodiments of the present application, so that the sequence reconstruction model is more adaptive to the actual application scenario and has stronger generalization capability.
[0015] In a possible implementation, the input of the aforementioned routing layer is a sample input into the sequence reconstruction model or encoding data output by the encoding model. In the embodiments of the present application, the routing layer can be connected to the encoding module, or can be directly connected to the input end, that is, parallel to the encoding module. The specific connection mode of the encoding module can be determined according to the actual application scenario, and the present application does not limit the same.
[0016] In a possible implementation, the foregoing updating the initial sequence reconstruction model by using the first training set to perform adversarial learning to obtain an updated sequence reconstruction model, specifically includes: when the sample input to the encoding module is a normal sample, the normal sample is encoded by the encoding module, and the encoded data is input to the first decoding module to output a corresponding first sequence; the first loss value between the first sequence and the normal sample is used to update the encoding module, the routing layer, the plurality of feature extraction networks, and the first decoding module; when the sample input to the encoding module is an abnormal sample, the abnormal sample is encoded by the encoding module, and the encoded data is input to the second decoding module to output a corresponding second sequence; the second loss value between the second sequence and the abnormal sample is used to perform adversarial learning on the encoding module, the routing layer, the plurality of feature extraction networks, and the second decoding module. In the implementation of the present application, the normal sample and the abnormal sample enter different processing branches in the sequence reconstruction model, the normal sample can be used to enable the encoding module and the first decoding module to learn the data distribution characteristics of the normal sample, and the abnormal sample can be used to enable the encoding module and the first decoding module to perform adversarial learning, so that the first decoding module learns the data distribution characteristics of the abnormal sample, and the encoding module reduces the possibility of learning the abnormal data distribution characteristics in the manner of adversarial learning, thereby improving the sequence reconstruction capability of the encoding module.
[0017] In a possible implementation, the foregoing sample in the first training set can include a sample collected from at least one scene. In the implementation of the present application, the training set used for training the sequence reconstruction model can include samples collected from one or more scenes, and when there are samples collected from multiple scenes in the first training set, the sequence reconstruction model obtained after training can have sequence reconstruction capability in multiple scenes and can be applied to multiple application scenarios.
[0018] In a possible implementation, the foregoing method further includes: obtaining a second training set, the second training set including samples in an application scenario in which the sequence reconstruction model is deployed; and using the second training set to fine-tune the updated sequence reconstruction model to obtain a fine-tuned sequence reconstruction model. In the implementation of the present application, the samples collected from the actual deployment scenario of the sequence reconstruction model can be used for fine-tuning, so that the model performs better in the actual application scenario.
[0019] In a possible implementation, the foregoing using the second training set to fine-tune the updated sequence reconstruction model to obtain a fine-tuned sequence reconstruction model, specifically includes: using the second training set to perform adversarial learning on the updated sequence reconstruction model to obtain the fine-tuned sequence reconstruction model. In the implementation of the present application, similar to the pre-training stage, the fine-tuning stage can also perform adversarial learning, thereby further improving the sequence reconstruction capability of the sequence reconstruction model.
[0020] In a possible implementation, the foregoing fine-tuning the updated sequence reconstruction model using the second training set to obtain a fine-tuned sequence reconstruction model further includes: in a case where the sequence reconstruction model is provided with the routing layer and the plurality of feature extraction networks, updating the routing layer and the plurality of feature extraction networks using the second training set.
[0021] In the implementation of the present application, in a case where the sequence reconstruction model is provided with the routing layer and the plurality of feature extraction networks, the routing layer and the plurality of feature extraction networks can also be fine-tuned using the second training set, so that the fine-tuned routing layer and the plurality of feature extraction networks are more suitable for the actual application scenario.
[0022] In a possible implementation, the foregoing obtaining the first training set can include: obtaining at least one normal sample; adding noise to each normal sample to obtain an abnormal sample corresponding to each normal sample, and the first training set can include the at least one normal sample and the abnormal sample corresponding to each normal sample. In the implementation of the present application, the abnormal sample can be obtained by injecting noise into the normal sample, so that the encoding module and the second decoding module can be subjected to adversarial learning using the abnormal sample, so as to improve the sequence reconstruction capability of the sequence reconstruction model.
[0023] In a possible implementation, the foregoing inputting the sample in the first training set to the encoding module can include: performing a masking operation on the sample in the first training set to obtain at least one sample after the masking operation; and inputting the at least one sample after the masking operation to the encoding module.
[0024] In the implementation of the present application, in the training process, the sample input to the sequence reconstruction model can be input to the sequence reconstruction model after being subjected to one or more masking operations, so that the model can reconstruct the masked area, so as to update the model based on the reconstruction result of the model, and make the model have the sequence reconstruction capability.
[0025] In a possible implementation, the foregoing method further includes: obtaining an input sequence, the input sequence including at least one element arranged in a generation time sequence, the element possibly representing different meanings in different scenarios; inputting the input sequence to the sequence reconstruction model to obtain an output sequence; and then determining whether an abnormal point exists in the input sequence according to the output sequence. Therefore, in the implementation of the present application, the trained sequence reconstruction model can be applied to an abnormal detection scenario, so that the sequence reconstruction capability of the trained sequence reconstruction model is utilized to reconstruct the input sequence in a downstream inference task, and a more accurate normal sequence is obtained.
[0026] In a possible implementation, the foregoing inputting the input sequence into the sequence reconstruction model to obtain an output sequence includes: performing at least one mask processing on the input sequence to obtain at least one first subsequence; inputting the at least one first subsequence into the sequence reconstruction model as input, and outputting a second subsequence corresponding to each first subsequence, wherein the output sequence includes the second subsequence corresponding to each first subsequence.
[0027] In the implementation, the input sequence can be input into the sequence reconstruction model after being masked one or more times to obtain a corresponding subsequence, so that the sequence reconstruction model can reconstruct the masked area, and determine whether the corresponding area in the input sequence has an abnormal point based on the reconstruction result of the masked area.
[0028] In a possible implementation, the foregoing determining, according to the output sequence, whether the input sequence has an abnormal point includes: determining, according to the second subsequence corresponding to each first subsequence, a stability degree corresponding to each element in the input sequence, where the stability degree can be used to measure the stability degree of the element in the sequence or the stability degree determined by the elements of the same timestamp in the plurality of reconstructed structures; and then determining, according to the stability degree corresponding to each element in the second subsequence, whether the input sequence has an abnormal point. In the implementation, whether the input sequence has an abnormal point can be identified based on the stability degree of each element in the reconstructed sequence output by the sequence reconstruction model, so that whether the input sequence has an abnormal point can be accurately identified.
[0029] In a possible implementation, the foregoing determining, according to the second subsequence corresponding to each first subsequence, a stability degree corresponding to each element in the input sequence includes: in a case where the number of the second subsequences corresponding to the input sequence is one, determining, according to a difference between each element and a neighboring element in the second subsequence, the stability degree corresponding to each element in the input sequence; and in a case where the number of the second subsequences corresponding to the input sequence is a plurality, obtaining a variance of elements of the same timestamp in the plurality of second subsequences, where the variance is used to represent the stability degree corresponding to the elements of the same timestamp. In the implementation, a plurality of ways of calculating the stability degree are provided, and the way of calculating the stability degree can be determined according to an actual application scenario, so as to adapt to more application scenarios.
[0030] In a second aspect, the present application provides a sequence reconstruction method, comprising: obtaining an input sequence, the input sequence comprising at least one element arranged in a generation time sequence, such as a sequence to be detected for anomaly, or a sequence to be predicted, etc.; then inputting the input sequence into a sequence reconstruction model to obtain an output sequence, the sequence reconstruction model comprising an encoding module and a first decoding module, the encoding module being configured to encode the input sequence, the encoding module being a module obtained based on a second update, the second update being a parameter update step of adversarial learning using an anomaly sample and a second decoding module, and the first decoding module being configured to decode the encoded data and output a reconstructed sequence.
[0031] In the embodiments of the present application, the sequence reconstruction capability of the trained sequence reconstruction model is utilized to reconstruct the input sequence in the downstream inference task, so as to obtain a more accurate normal sequence.
[0032] In a possible implementation, the foregoing method further comprises: determining whether there is an abnormal point in the input sequence according to the output sequence. In the embodiments of the present application, the trained sequence reconstruction model can be applied to an anomaly detection scenario, so as to utilize the sequence reconstruction capability of the trained sequence reconstruction model to reconstruct the input sequence in the downstream inference task, so as to obtain a more accurate normal sequence.
[0033] In a possible implementation, the foregoing inputting the input sequence into the sequence reconstruction model to obtain the output sequence comprises: performing at least one mask processing on the input sequence to obtain at least one first sub-sequence; inputting the at least one first sub-sequence into the sequence reconstruction model as an input of the sequence reconstruction model, outputting a second sub-sequence corresponding to each first sub-sequence, and the output sequence comprising the second sub-sequence corresponding to each first sub-sequence. In the embodiments of the present application, the input sequence can be input into the sequence reconstruction model after being masked one or more times to obtain the corresponding sub-sequence, so that the sequence reconstruction model can reconstruct the masked area, and determine whether the corresponding area in the input sequence has an abnormal point based on the reconstruction result of the masked area.
[0034] In a possible implementation, the foregoing determining whether there is an abnormal point in the input sequence comprises: determining a stability degree of each element in the input sequence according to the second sub-sequence corresponding to each first sub-sequence; and determining whether there is an abnormal point in the input sequence according to the stability degree of each element in the second sub-sequence. In the embodiments of the present application, whether there is an abnormal point in the input sequence can be identified based on the stability degree of each element in the reconstructed sequence output by the sequence reconstruction model, so as to accurately identify whether there is an abnormal point in the input sequence.
[0035] In a possible implementation, the determining, according to each second subsequence corresponding to each first subsequence, of the stability degree corresponding to each element in the input sequence includes: in a case where the number of the second subsequences corresponding to the input sequence is one, determining the stability degree corresponding to each element in the input sequence according to a difference between each element and a neighboring element in the second subsequence; and in a case where the number of the second subsequences corresponding to the input sequence is multiple, obtaining a variance of elements belonging to a same timestamp in the multiple second subsequences, and the variance is used to represent the stability degree corresponding to the elements belonging to the same timestamp. In this embodiment of the application, multiple ways of calculating the stability degree are provided, and the way of calculating the stability degree can be determined according to an actual application scenario, thereby adapting to more application scenarios.
[0036] In a third aspect, the application provides a sequence reconstruction model training apparatus, including:
[0037] The obtaining module is configured to obtain a first training set, the first training set including normal samples and abnormal samples, the normal samples and the abnormal samples including at least one element arranged in a generation time sequence, the normal samples including sequences without abnormal points, and the abnormal samples including sequences with abnormal points.
[0038] The training module is configured to update an initial sequence reconstruction model by using the first training set to obtain an updated sequence reconstruction model, the updated sequence reconstruction model being configured to output a reconstructed sequence, the sequence reconstruction model including an encoding module, a first decoding module, and a second decoding module, the first decoding module being configured to perform a first update on the encoding module by using the normal samples, and the second decoding module being configured to perform a second update on the encoding module by using the abnormal samples through adversarial learning.
[0039] Effects achieved by the third aspect or any optional implementation of the third aspect can refer to the effects of the first aspect or any optional implementation of the first aspect, which will not be described here.
[0040] In a possible implementation, the training module is specifically configured to: when the sample input to the encoding module is a normal sample, the normal sample is encoded by the encoding module, and the encoded data is input to the first decoding module to output a corresponding first sequence, and the encoding module and the first decoding module are updated through a first loss value between the first sequence and the normal sample; and when the sample input to the encoding module is an abnormal sample, the abnormal sample is encoded by the encoding module, and the encoded data is input to the second decoding module to output a corresponding second sequence, and the encoding module and the second decoding module are subjected to adversarial learning according to a second loss value between the second sequence and the abnormal sample.
[0041] In a possible implementation, the aforementioned adversarial learning of the encoding module and the second decoding module according to the second loss value between the second sequence and the abnormal sample can include: calculating a gradient value according to the second loss value between the second sequence and the abnormal sample, and updating the encoding module after inverse transformation of the gradient value.
[0042] In a possible implementation, the aforementioned sequence reconstruction model further includes a routing layer and a plurality of feature extraction networks, input ends of the plurality of feature extraction networks are connected to output ends of the encoding model, output ends of the plurality of feature extraction networks are connected to the first encoding module or the second encoding module, the plurality of feature extraction networks are configured to extract features from input data, the features extracted by the plurality of feature extraction networks have different compression degrees, and the routing layer is configured to determine a weight corresponding to an output feature of each feature extraction network in the plurality of feature extraction networks.
[0043] In a possible implementation, the aforementioned input of the routing layer is a sample input into the sequence reconstruction model or encoded data output by the encoding model.
[0044] In a possible implementation, the aforementioned training module is specifically configured to: when the sample input into the encoding module is a normal sample, the normal sample is encoded by the encoding module, and the encoded data is input into the first decoding module, a corresponding first sequence is output, and the encoding module, the routing layer, the plurality of feature extraction networks, and the first decoding module are updated according to a first loss value between the first sequence and the normal sample; and when the sample input into the encoding module is an abnormal sample, the abnormal sample is encoded by the encoding module, and the encoded data is input into the second decoding module, a corresponding second sequence is output, and the encoding module, the routing layer, and the plurality of feature extraction networks, and the second decoding module are subjected to adversarial learning according to a second loss value between the second sequence and the abnormal sample.
[0045] In a possible implementation, the aforementioned samples in the first training set include samples collected from at least one scene.
[0046] In a possible implementation, the aforementioned training module is further configured to: obtain a second training set, the second training set including samples in an application scene in which the sequence reconstruction model is deployed; and fine-tune the updated sequence reconstruction model using the second training set to obtain a fine-tuned sequence reconstruction model.
[0047] In a possible implementation, the aforementioned training module is further configured to: perform adversarial learning on the updated sequence reconstruction model using the second training set to obtain the fine-tuned sequence reconstruction model.
[0048] In a possible implementation, the training module is further configured to: update the routing layer and the plurality of feature extraction networks using the second training set in the case that the routing layer and the plurality of feature extraction networks are set in the sequence reconstruction model.
[0049] In a possible implementation, the obtaining module is specifically configured to: obtain at least one normal sample; add noise to each normal sample to obtain an abnormal sample corresponding to each normal sample, and the first training set includes the at least one normal sample and the abnormal sample corresponding to each normal sample.
[0050] In a possible implementation, the training module is specifically configured to: perform a mask operation on the samples in the first training set to obtain at least one sample after the mask operation; and input the at least one sample after the mask operation to the encoding module.
[0051] In a possible implementation, the device further includes an inference module configured to: obtain an input sequence, the input sequence including at least one element arranged in a generation time sequence; input the input sequence to the sequence reconstruction model to obtain an output sequence; and determine whether an abnormal point exists in the input sequence according to the output sequence.
[0052] In a possible implementation, the inference module is specifically configured to: perform at least one mask processing on the input sequence to obtain at least one first sub-sequence; input the at least one first sub-sequence as an input of the sequence reconstruction model, output a second sub-sequence corresponding to each first sub-sequence, and the output sequence includes the second sub-sequence corresponding to each first sub-sequence.
[0053] In a possible implementation, the inference module is specifically configured to: determine a stability degree corresponding to each element in the input sequence according to the second sub-sequence corresponding to each first sub-sequence; and determine whether an abnormal point exists in the input sequence according to the stability degree corresponding to each element in the second sub-sequence.
[0054] In a possible implementation, the inference module is specifically configured to: in the case that the number of the second sub-sequences corresponding to the input sequence is one, determine the stability degree corresponding to each element in the input sequence according to a difference between each element and a neighboring element in the second sub-sequence; and in the case that the number of the second sub-sequences corresponding to the input sequence is a plurality, obtain a variance of elements belonging to a same timestamp in the plurality of second sub-sequences, and the variance is used to represent the stability degree corresponding to the elements belonging to the same timestamp.
[0055] In a fourth aspect, the present application provides a sequence reconstruction device, including:
[0056] The input module is configured to obtain an input sequence, the input sequence including at least one element arranged in a generation time sequence.
[0057] a sequence reconstruction module, configured to input the input sequence into the sequence reconstruction model to obtain an output sequence, the sequence reconstruction model comprising an encoding module and a first decoding module, the encoding module being configured to encode the input sequence, the encoding module being a module obtained based on a second update, the second update being a parameter update step of adversarial learning using an abnormal sample and a second decoding module, and the first decoding module being configured to decode the encoded data to output a reconstructed sequence.
[0058] Effects of the fourth aspect or any possible implementation of the fourth aspect can refer to the effects of the second aspect or any possible implementation of the second aspect, which will not be described here.
[0059] In a possible implementation, the sequence reconstruction module is further configured to: an abnormality detection module, configured to determine whether there is an abnormal point in the input sequence according to the output sequence.
[0060] In a possible implementation, the sequence reconstruction module is specifically configured to: perform at least one mask processing on the input sequence to obtain at least one first sub-sequence; input the at least one first sub-sequence into the sequence reconstruction model to output a second sub-sequence corresponding to each first sub-sequence, and the output sequence comprises the second sub-sequence corresponding to each first sub-sequence.
[0061] In a possible implementation, the sequence reconstruction module is specifically configured to: determine a stability degree corresponding to each element in the input sequence according to the second sub-sequence corresponding to each first sub-sequence; and determine whether there is an abnormal point in the input sequence according to the stability degree corresponding to each element in the second sub-sequence.
[0062] In a possible implementation, the sequence reconstruction module is specifically configured to: in a case where the number of the second sub-sequences corresponding to the input sequence is one, determine the stability degree corresponding to each element in the input sequence according to a difference between each element and a neighboring element in the second sub-sequence; and in a case where the number of the second sub-sequences corresponding to the input sequence is a plurality, obtain a variance of elements belonging to a same timestamp in the plurality of second sub-sequences, the variance being used to represent the stability degree corresponding to the elements belonging to the same timestamp.
[0063] In a fifth aspect, an embodiment of the present application provides a computing device, comprising a processor and a memory; the processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device performs the method steps in the first aspect and any implementation thereof.
[0064] In a sixth aspect, an embodiment of the present application provides a computing device, comprising a processor and a memory; the processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device performs the method steps in the first aspect and any implementation manner thereof.
[0065] In a seventh aspect, an embodiment of the present application provides a computer program product comprising instructions which, when executed by a computing device, cause the computing device to perform the method in the first aspect or any implementation manner of the first aspect.
[0066] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium comprising computer program instructions, which, when executed by a computing device, cause the computing device to perform the method in the first aspect or any implementation manner of the second aspect.
[0067] In a ninth aspect, an embodiment of the present application provides a chip, comprising at least one processor and an interface; the at least one processor is configured to acquire program instructions or data through the interface; the at least one processor is configured to execute the program instructions, so as to implement the method in the first aspect or any implementation manner of the second aspect. BRIEF DESCRIPTION OF DRAWINGS
[0068] FIG. 1 is a schematic diagram of a system architecture provided by an embodiment of the present application;
[0069] FIG. 2 is another schematic diagram of a system architecture provided by an embodiment of the present application;
[0070] FIG. 3 is a schematic diagram of a sequence reconstruction model training method provided by an embodiment of the present application;
[0071] FIG. 4 is a schematic diagram of a structure of a sequence reconstruction model provided by an embodiment of the present application;
[0072] FIG. 5 is a schematic diagram of a structure of another sequence reconstruction model provided by an embodiment of the present application;
[0073] FIG. 6 is a schematic diagram of a structure of another sequence reconstruction model provided by an embodiment of the present application;
[0074] FIG. 7 is a schematic diagram of an old sequence reconstruction model training method provided by an embodiment of the present application;
[0075] FIG. 8 is a schematic diagram of a structure of another sequence reconstruction model provided by an embodiment of the present application;
[0076] FIG. 9 is a schematic diagram of a structure of another sequence reconstruction model provided by an embodiment of the present application;
[0077] FIG. 10 is a schematic diagram of a sequence reconstruction method provided by an embodiment of the present application;
[0078] FIG. 11 is a schematic diagram of an effect according to an embodiment of the present application;
[0079] FIG. 12 is a schematic diagram of a structure of a sequence reconstruction model training apparatus according to an embodiment of the present application;
[0080] FIG. 13 is a schematic diagram of a structure of a sequence reconstruction apparatus according to an embodiment of the present application;
[0081] FIG. 14 is a schematic diagram of a structure of a computing device according to an embodiment of the present application. DETAILED DESCRIPTION
[0082] The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.
[0083] For ease of understanding, some concepts or explanations involved in the embodiments of the present application will be explained first.
[0084] (1) Deep neural network
[0085] A deep neural network (DNN), also known as a multi-layer neural network, can be understood as a neural network with multiple intermediate layers. According to the position of different layers, the neural network inside the DNN can be divided into three categories: input layer, intermediate layer, and output layer. Generally, the first layer is the input layer, the last layer is the output layer, and the number of intermediate layers is the number of intermediate layers, or the hidden layer. The layers are fully connected, that is, any neuron in the i-th layer is connected to any neuron in the i+1-th layer.
[0086] Although the DNN looks very complex, each layer can be expressed as a linear relationship expression: wherein, is an input vector, is an output vector, is an offset vector or bias parameter, w is a weight matrix (also called coefficient), and a() is an activation function. Each layer is only a simple operation on the input vector to obtain the output vector Due to the large number of layers of the DNN, the number of coefficients W and offset vectors is also relatively large. These parameters in the DNN are defined as follows: taking the coefficient w as an example: assuming that in a three-layer DNN, the linear coefficient of the fourth neuron in the second layer to the second neuron in the third layer is defined as The superscript 3 represents the number of layers in which the coefficient W is located, and the subscript corresponds to the third layer index 2 of the output and the second layer index 4 of the input.
[0087] In summary, the coefficient of the k-th neuron of the L-1-th layer to the j-th neuron of the L-th layer is defined as
[0088] It should be noted that the input layer has no W parameter. In a deep neural network, more intermediate layers enable the network to better depict complex situations in the real world. In theory, the more parameters a model has, the higher its complexity and the greater its "capacity", which means it can complete more complex learning tasks. Training a deep neural network is a process of learning weight matrices, and the ultimate goal is to obtain the weight matrices of all layers of the trained deep neural network (weight matrices formed by many layers of vectors W).
[0089] (2) Loss function
[0090] In the process of training a deep neural network, because the output of the deep neural network is expected to be as close as possible to the value that is truly intended to be predicted, the weight vectors of each layer of the neural network can be updated according to the difference between the current network prediction value and the truly intended target value. (Of course, before the first update, there is usually an initialization process, that is, the parameters of each layer in the deep neural network are pre-configured), for example, if the network prediction value is high, adjust the weight vector to predict lower, and constantly adjust until the deep neural network can predict the truly intended target value or a value very close to the truly intended target value. Therefore, it is necessary to define "how to compare the difference between the prediction value and the target value", which is the loss function or the objective function, which is an important equation for measuring the difference between the prediction value and the target value. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, and then the training of the deep neural network becomes a process of trying to minimize this loss. The loss function can generally include error square mean square, cross entropy, logarithm, exponential, etc. For example, the error mean square can be used as the loss function, which is defined as The specific loss function can be selected according to the actual application scenario.
[0091] (3) Pre-training
[0092] Pre-training generally refers to pre-training a model through a large amount of multi-field data before performing a downstream task, thereby obtaining a basic model that has learned corresponding knowledge.
[0093] (4) Fine-tuning (Finetune)
[0094] is to adjust the model parameters for the specified downstream task scenario using a certain amount of current task scenario data, so as to expect the model to learn some information contained in the current task, thereby improving the accuracy of the current task. There are many methods of model parameter adjustment, which are not listed one by one.
[0095] (5) Zero-shot learning
[0096] is to use the pre-trained model directly without fine-tuning it with the current scenario data for the current task scenario, so as to achieve the effect of quickly carrying out business.
[0097] (6) Information bottleneck
[0098] Information bottleneck theory is a method of information theory used to explain and analyze the complexity of data. This theory believes that the information in the data can be divided into two parts: useful information and useless information. Useful information refers to the part that can be used to predict or explain the data, while useless information refers to the part that cannot provide any predictive or explanatory value. The core idea of information bottleneck theory is to extract the key information in the data by minimizing the difference between useful information and useless information. This difference is called "information bottleneck" because it is the bottleneck that limits data compression and prediction ability.
[0099] (7) Adversarial learning
[0100] Adversarial learning originated from game theory, and generative adversarial learning in current deep learning uses this idea more. In the adversarial learning network architecture, taking the image generation task as an example, for an image generation task, a discriminator and a generator need to be learned. The generator generates pictures that do not exist in the original data, which belong to "fake images", and the discriminator needs to judge whether the current image is "real image" or "fake image". The overall optimization goal of the model is adversarial, which needs to make the discriminator make correct judgments as much as possible, that is, to judge the real pictures as true and the generated pictures as false; while the goal of the generator is to make the discriminator unable to judge the true and false of the pictures it generates as much as possible. Through this adversarial learning and optimization process, the optimization purpose is achieved, and a high-quality generator can generate pictures close to the real world. Based on this idea, adversarial learning is a process of mutual progress between two parties, so as to ultimately achieve a certain purpose. In this application, the adversarial learning idea is to hope that the Encoder learns the normal pattern information common to abnormal data and normal data, so as to distinguish normal data from abnormal data.
[0101] (8)transformer
[0102] The transformer structure is a feature extraction network including an encoder and a decoder. Of course, in some cases, the transformer structure can not include an encoder, but includes a decoder.
[0103] Encoder: learn features in a global receptive field through self-attention, such as pixel features.
[0104] Decoder: learn features of the required module through self-attention and cross-attention, such as output frame features.
[0105] Exemplarily, the structure of the Transformer layer in an existing scheme can include a multi-head attention network and a forward network module. Taking natural language processing as an example, the multi-head attention network obtains corresponding weight values by calculating the correlation between words and words to obtain context-related word representations, which is the core part of the Transformer structure. The forward network further transforms the obtained representations to obtain the final output of the Transformer layer. In addition to the two important components, a residual layer (ADD) and a linear normalization (Norm) are stacked on the two components, respectively, to optimize the output of the Transformer layer.
[0106] (9) Attention mechanism
[0107] The attention mechanism can quickly extract important features of sparse data. The attention mechanism provides an effective modeling method for capturing global context information through QKV. Assuming that the input is Q (query), and the context is stored in the form of key-value pair (K, V). Then the attention mechanism is actually a mapping function from query to a series of key-value pairs. The essence of the attention function can be described as a mapping from a query to a series of (key, value) pairs. Attention essentially assigns a weight coefficient to each element in the sequence, which can also be understood as soft addressing. If each element in the sequence is stored in the form of (K, V), then attention completes the addressing by calculating the similarity between Q and K. The similarity calculated by Q and K reflects the importance of the extracted V value, that is, the weight, and then the weighted sum is obtained to obtain the final feature value.
[0108] The calculation of attention mainly includes three steps. The first step is to calculate the similarity between the query and each key to obtain a weight. Common similarity functions include dot product, concatenation, and perception, etc. Then, the second step is to normalize these weights using a softmax function (on the one hand, it can be normalized to obtain a probability distribution whose sum of all weight coefficients is 1. On the other hand, the characteristic of the softmax function can highlight the weight of important elements); and finally, the weighted sum of the weights and the corresponding key values value is obtained to obtain the final feature value. The specific calculation formula can be as follows:
[0109] Wherein, d is the dimension of matrix Q, K.
[0110] In addition, attention includes self-attention and cross-attention. Self-attention can be understood as a special attention, that is, the input of QKV is consistent. While the input of QKV in cross-attention is inconsistent. Attention uses the similarity (such as inner product) between features as a weight to integrate the queried feature as the updated value of the current feature. Self-attention is an attention extracted based on the attention of the feature map itself.
[0111] For convolution, the setting of the convolution kernel limits the size of the receptive field, resulting in the need for multiple layers of stacking to focus on the entire feature map. The advantage of self-attention is that its attention is global, and it can obtain the global spatial information of the feature map through simple query and assignment.
[0112] (10) Mask
[0113] The mask can be understood as a label of the data, which can also be called a mask. By fusing the data and the corresponding mask, the attention degree of part of the data can be higher. Generally, the mask can be used to extract the region of interest (ROI). For example, a pre-made mask of the region of interest is fused with the image to be processed to obtain a region of interest image. The image values in the region of interest remain unchanged, and the image values outside the region are all 0. The mask can also have a shielding effect. For example, the mask is used to shield some areas on the image, so that they do not participate in the processing or the calculation of the processing parameters, or only the non-shielded area is processed or counted.
[0114] The method provided by the embodiments of the present application can be applied to a time series-based anomaly detection scene, such as a financial, network operation, industrial, or energy scene. The data generated in the scene is arranged according to the generation time to generate a time series, and whether there is an abnormal situation is detected based on the time series.
[0115] Existing time series anomaly detection schemes include modeling strategies optimized for model architecture or learning method, but existing time series anomaly detection algorithms are limited to case-by-case modeling methods, i.e., for each task scenario, the model is trained according to the data of the current task scenario to obtain an anomaly detection model strongly related to the current business scenario. There is still a lot of room for improvement in downstream detection performance and generalization performance. The "pre-training-fine-tuning" paradigm can effectively solve the problem of downstream task performance, but for the problem of cold start in the scene of no (or few) annotation and no (or few) sample, it becomes a problem to be solved urgently.
[0116] For example, in an existing time series anomaly detection scheme, called DCdetector, it is necessary to determine whether each sample point in the time series or the entire time series is abnormal. DCdetector is modeled based on the contrast learning strategy in unsupervised learning, and its core idea is based on the premise that normal sample points have a very close relationship with other sample points, and that abnormal sample points have a weak relationship with other sample points. The sample point representation can be learned from different angles. If the sample point representations in different angles are similar, it means that the sample point has a close relationship with other sample points in the context, and it is a normal point, otherwise it is an abnormal point.
[0117] Specifically, the main structure of the DCdetector adopts a double-tower encoder for dual-view learning, and then obtains dual-view point-level representations through upsampling for contrastive learning. The learning process includes: channel-independent patching: for multi-dimensional time series, it is split into channels for single-channel modeling, and patching is performed for local information enhancement and extraction; dual-tower dual-view attention mechanism: the core idea of this module is to interact information between dual views. Based on the obtained patch data, two views are used for information representation. The first is patch-wise representation, and the second is in-patch representation. Patch-wise representation is based on patch granularity to learn sequence representation. After mapping each patch sequence to an embedding, the relationship between multiple patches is modeled using a Transformer, and finally fused together to form a sequence vector representation. In-patch representation uses a Transformer to establish the relationship between sample points at the same position within each patch, and finally also fused into a sequence vector representation; representation contrastive learning: based on the dual attention mechanism, patch-wise and in-patch level representation extraction is performed, and finally the representation needs to be aligned to each time step, so upsampling is needed. The patch-wise output is the representation of each patch, which needs to be mapped to the representation of each sample point, which uses the repeat method directly. The in-patch output is the representation of each sample point pair, which combines the sample points to obtain the representation of each patch. The inner product of the corresponding vectors at each time step is calculated to perform contrastive learning; abnormal point determination: after the trained encoder generates vectors for two views, the KL divergence between each time point is calculated, and if it is greater than a certain threshold, the current time point is determined to be an abnormal point. However, in the DCdetector, the representation of abnormal sample points between different views is pulled in, which can destroy the robustness of the model itself, so it is very limited to the training set without abnormal points. It is difficult to exist such a premise assumption in the real scene; and DCdetector still needs to use full data based on specific business scenarios for modeling to match specific business scenarios, and cannot be used for fast business expansion in the few-sample or no-sample scenarios.
[0118] For example, D3R is a dynamic decomposition diffusion reconstruction solution that performs data decomposition to solve the distribution shift problem, while based on an external noise injection method to control the information bottleneck. D3R performs dual-view information extraction based on the attention mechanism, and the main framework is composed of a Dynamic Decomposition module and a Diffusion Reconstruction module. The process of D3R includes: data preprocessing: this module first performs data preprocessing, and in order to further improve the information source, the time stamp of the original time series data is hard coded to supplement the time stamp dimension information. In order to alleviate the distribution shift caused by non-stationary data, the trend item is extracted by moving average to calculate the stationary component for modeling. In order to enhance the robustness of the model, a small random disturbance is added to the stationary component; Dynamic Decomposition module: the dynamic decomposition module is composed of a data encoder, a time encoder, and a stack of multiple decomposition blocks and a final offset subtraction. The data encoder models the stationary component, and uses dual-view information interaction, that is, spatio-temporal interaction, which updates information in the temporal and spatial dimensions. The time encoder updates information in the time dimension. Each layer of the decomposition block performs MixAttention information interaction. This interaction method calculates the attention coefficient based on the original data and time information to refresh the variable and obtain the updated information representation from the original data dimension and the time stamp information dimension. The offset subtraction module removes the volatility of the data to obtain the corresponding stationary component and trend component; Diffusion Reconstruction module: the diffusion reconstruction module mainly includes noise diffusion and reconstruction network architecture. Noise diffusion adds external noise to the stationary component obtained by the Dynamic Decomposition module to interfere and increase the robustness of the model, and then reconstructs the original sequence information based on the reconstruction module. D3R increases the robustness of the model by adding external noise, but the amount of noise added has a great influence on the overall modeling. Too much noise will cause modeling failure, and the model cannot capture any time series pattern information. Too little noise cannot increase the robustness of the model, so the model is not robust enough. Moreover, D3R needs to model case by case through full training set data of downstream task scenarios, and still cannot solve the cold start problem in the case of few samples or no samples.
[0119] Therefore, the embodiment of the present application provides a model training method. Under the premise that normal data points and abnormal data points are mixed in the training sample set, a sequence reconstruction model of time series is constructed to solve the cold start problem and ensure high-performance abnormal detection accuracy of the model.
[0120] The method provided in the embodiments of the present application can be divided into a training phase of a sequence reconstruction model and an inference phase, or a training method and a sequence reconstruction method. The training phase and the inference phase can be deployed in the same device or in different devices.
[0121] Exemplarily, as shown in FIG. 1, the training phase in the method provided in the embodiments of the present application can be deployed in a server. The training set used for training the model can include user input data or data collected in the running process of the device. The server can train the model by using the training data in combination with the sequence reconstruction model training method provided in the embodiments of the present application, to obtain a sequence reconstruction model that can be used for anomaly detection of a time sequence.
[0122] The trained sequence reconstruction model can be deployed in a server, such as a local server or a cloud server, or on an end side.
[0123] For example, as shown in FIG. 2, the sequence reconstruction model output by the training phase after training can be deployed in a cloud server.
[0124] The cloud server can be connected to one or more terminals. The terminal can collect data generated in the running process, arrange the data according to the generation time to generate a time sequence, and send the time sequence to the cloud server.
[0125] The cloud server receives the time sequence from the end side, inputs the time sequence into the sequence reconstruction model, and identifies whether there is an abnormal point in the input time sequence according to the reconstruction sequence output by the sequence reconstruction model. The cloud server can send the reconstruction sequence to the terminal, or analyze the reconstruction sequence and the input time sequence to determine whether there is an abnormal point, and then send the analysis result to the terminal.
[0126] Further, in different application scenarios, the generated time sequence can also be different. For example, the method provided in the embodiments of the present application can be applied to industrial equipment anomaly detection or financial anomaly detection, energy anomaly detection, etc. Specifically, for example, it can be applied to chemical centrifugal pump anomaly detection, fan fault anomaly detection, computer CPU usage anomaly detection, etc. or KPI anomaly detection in network operation scenarios. Accordingly, the time sequence generated in different scenarios can be different.
[0127] The flow of the training phase and the inference phase in the method provided in the embodiments of the present application will be introduced below.
[0128] I. Training phase
[0129] Referring to FIG. 3, a flowchart of a sequence reconstruction model training method provided in the embodiments of the present application is as follows.
[0130] 301、obtain a first training set, which includes normal samples and abnormal samples.
[0131] The first training set can include a plurality of samples, and the normal samples and the abnormal samples each include at least one element arranged in a generation time sequence, that is, an event sequence. The normal samples include sequences without abnormal points, and the abnormal samples include sequences with abnormal points, which are usually outlier points or user-determined abnormal points.
[0132] The samples in the first training set can be obtained by collecting data generated during operation of a device or a product, or can be constructed samples. The first training set can be collected according to an actual application scenario.
[0133] Optionally, a normal sample generated during operation of a device or a product can be collected, and noise can be injected into the normal sample to obtain one or more abnormal samples. For example, after a normal sample is collected, noise can be injected into a certain element point in the sequence, such as changing the value of the certain element point to make the value of the element point outlier, or inverting or dithering the value of the certain element point, so that the value of the element point is abnormal, to obtain an abnormal sample.
[0134] Optionally, to improve the generalization of the sequence reconstruction model, data can be collected from multiple scenarios when the training set is obtained, such as time series collected in financial, network operation, industrial, or energy scenarios, so that the abnormal detection learning model can learn the sequence reconstruction capability in multiple scenarios.
[0135] 302、update an initial sequence reconstruction model by using the first training set to obtain an updated sequence reconstruction model, and the updating process includes performing adversarial learning on an encoding module in the sequence reconstruction model by using the abnormal samples.
[0136] The sequence reconstruction model can be used for reconstruction, prediction, or classification based on an input sequence. Based on different inference functions, a head for performing different tasks can be set in the sequence reconstruction model, such as a head for performing sequence prediction or sequence classification can be added based on sequence reconstruction, to adapt to more inference task scenarios.
[0137] Specifically, the sequence reconstruction model includes an encoding module, a first decoding module and a second decoding module. The first decoding module is configured to perform a first update on the encoding module using normal samples. The second decoding module is configured to perform a second update on the encoding module based on abnormal samples through adversarial learning. The first update can generally be calculating a loss value using an output value of the first decoding module, calculating a gradient using the loss value, and updating parameters of the first decoding module and the encoding module. The second update can generally be calculating a loss value using an output value of the second decoding module, calculating a gradient using the loss value, and performing adversarial learning on the second decoding module and the encoding module, such as transforming the gradient value of the encoding module, so as to reduce the data distribution of the encoding module learning abnormal samples. The updated sequence reconstruction model can be used to perform inference tasks in downstream tasks.
[0138] In the embodiments of the present application, the sequence construction method is learned from normal samples based on adversarial learning, so that the model has stronger sequence reconstruction capability. The sequence construction method is avoided to be learned from abnormal samples through adversarial learning, so that the sequence constructed by the model is farther away from the abnormal samples, the reconstructed sequence output by the model is closer to the normal samples, and the normal sample reconstruction capability of the model is enhanced. Therefore, the sequence reconstruction model trained by the method provided in the embodiments of the present application has very strong sequence reconstruction capability, and can reconstruct more accurate output sequences. The difference between the input sequence and the output sequence can be used to determine whether there is an abnormal point in the input sequence. Therefore, based on the more accurate output sequence, whether there is an abnormal point in the input sequence can be more accurately detected.
[0139] Further, the structure of the sequence reconstruction model in the training stage can be as shown in FIG. 4, which can include an encoding module 41, a first decoding module 42 and a second decoding module 43. The encoding module 41 can be configured to encode the input data and output encoded data. When the input is a normal sample, the encoded data output by the encoding module 41 is input into the first decoding module 42. When the input is an abnormal sample, the encoded data output by the encoding module 41 is input into the second decoding module 43.
[0140] The updating process of the sequence reconstruction model is one or multiple iterations. Taking any iteration as an example, when the input is a normal sample, the normal sample is encoded by the encoding module and the encoded data is input into the first decoding module, and the corresponding first sequence is output. The first loss value between the first sequence and the normal sample is used to update the encoding module and the second decoding module. When the input is an abnormal sample, the abnormal sample is encoded by the encoding module and the encoded data is input into the second decoding module, and the corresponding second sequence is output. The second loss value between the second sequence and the abnormal sample is used to calculate the gradient value. Then, the gradient value is transformed to update the encoding module. The purpose of the transformation is to weaken the learning of the encoding module on the abnormal sample. For example, the transformation mode can include inversion, reduction, or taking derivative of the gradient value. The specific gradient transformation mode can be determined according to the actual application scenario.
[0141] In the training stage of the sequence reconstruction model, the second decoding module is introduced to perform adversarial learning on the encoding module, so that the encoding module can improve the encoding ability of the normal sequence from the normal sample, and the adversarial learning from the abnormal sample avoids learning the abnormal sequence of the encoding ability of the abnormal sample. It is equivalent to improving the encoding ability of the encoding module for the normal sequence, and weakening the encoding ability of the encoding sample for the abnormal sequence, so that the finally obtained sequence reconstruction model has stronger normal sequence reconstruction ability.
[0142] Generally, the information compression ratio when extracting features from the input data of the model in different application scenarios may be different. Therefore, in the application embodiment, a routing layer and a plurality of feature extraction networks can be optionally set in the sequence reconstruction model. The plurality of feature extraction networks are respectively used to extract features from the input encoded data, and the information compression ratios of the plurality of feature extraction networks are different, that is, the structures of the plurality of feature extraction networks are different or the weight parameters used are different. The output features of the plurality of feature extraction networks are fused and input into the first decoding module or the second decoding module. The routing layer can be used to determine the weight of the output features of each feature extraction network in the fusion. Therefore, in the application embodiment, a plurality of feature extraction networks with different information compression ratios are set to extract features with different information compression ratios, and the routing layer is used to determine the weight of the output features of each feature extraction network in the fusion. The appropriate weight value can be selected in different application scenarios, so that the feature extraction can be adapted to different application scenarios, and the sequence reconstruction model provided by the application embodiment has better generalization ability and can be applied to abnormal detection in various scenarios or as a basic model in various types of abnormal detection scenarios.
[0143] Optionally, the input of the routing layer can be the encoded data output by the encoding module, or the input sample input to the input of the sequence reconstruction model can be directly used as the input of the routing layer, which has very strong flexibility. That is, the input end of the routing layer can be connected to the output end of the encoding module, or can be directly connected to the input port, forming a structure parallel to the encoding module, and the position of the routing layer in the sequence reconstruction model can be determined according to the actual application scenario.
[0144] For example, the structure of the sequence reconstruction model with the routing layer and the plurality of feature extraction networks can be as shown in FIG. 5 and FIG. 6. The difference between FIG. 5 and FIG. 6 is the position of the routing layer.
[0145] Correspondingly, in the training process, when the sample input to the encoding module is a normal sample, the normal sample is encoded by the encoding module, and the encoded data is input to the first decoding module, and the corresponding first sequence is output, and the encoding module, the routing layer, the plurality of feature extraction networks and the first decoding module are updated through the first loss value between the first sequence and the normal sample; when the sample input to the encoding module is an abnormal sample, the abnormal sample is encoded by the encoding module, and the encoded data is input to the second decoding module, and the corresponding second sequence is output, and the encoding module, the routing layer and the plurality of feature extraction networks, and the second decoding module are subjected to adversarial learning according to the second loss value between the second sequence and the abnormal sample.
[0146] That is, for the plurality of feature extraction networks, adversarial learning can also be used for updating, so that the plurality of feature extraction networks have stronger feature extraction capability for normal samples, and weaken the feature extraction capability of the plurality of feature extraction networks for abnormal samples, so that the sequence reconstruction model reconstructs a more normal output sequence.
[0147] In addition, in the process of inputting the sample in the first training set to the encoding module, in order to form the true value of each region in the sequence, the input sample can be subjected to a mask operation. One or more mask samples can be obtained after a sample is subjected to a mask operation, and when there are a plurality of mask samples for one input sample, the mask regions of the plurality of samples are usually not completely the same; then at least one sample after the mask operation is input to the encoding module to reconstruct the sequence by the sequence reconstruction model, especially for the mask region. In the training stage, the difference between the reconstructed value in the mask region and the initial value can be used to calculate the loss value, and the sequence reconstruction model is updated using the loss value.
[0148] In a possible implementation, to make the sequence reconstruction model perform better in the downstream task, the updated sequence reconstruction model can also be updated using samples related to the downstream task. For example, the training can be performed in combination with the pre-training and fine-tuning mode. In the training stage, the first training set is used to update the sequence reconstruction model. In the fine-tuning stage, the second training set can be obtained, which includes samples in the application scenario in which the sequence reconstruction model is deployed, that is, samples of the downstream task. The second training set is used to fine-tune the updated sequence reconstruction model to obtain a fine-tuned sequence reconstruction model. Therefore, in the embodiments of the present application, the sequence reconstruction model can also be fine-tuned using samples of the downstream task, so that the obtained sequence reconstruction model is more suitable for the downstream task.
[0149] Specifically, in the fine-tuning stage, the updated sequence reconstruction model can also be subjected to adversarial learning using the second training set to obtain a fine-tuned sequence reconstruction model. Thus, the sequence reconstruction model can also be subjected to adversarial learning in the fine-tuning stage to learn the distribution characteristics of the normal samples of the downstream task and improve the reconstruction capability of the sequence reconstruction model in the downstream task.
[0150] Further, in the case where the routing layer and the plurality of feature extraction networks are provided in the sequence reconstruction model, the routing layer and the plurality of feature extraction networks are updated using the second training set. Thus, the features output by the plurality of feature extraction networks are more suitable for the downstream task.
[0151] The training stage of the method provided in the embodiments of the present application will be further introduced below in combination with a specific application scenario.
[0152] First, the architecture of the training stage in the embodiments of the present application can be as shown in FIG. 7, which can be divided into pre-training and fine-tuning steps. For ease of understanding, the training stage in the method provided in the embodiments of the present application will be introduced in multiple modules, such as an adversarial learning module, a self-adaptive bottleneck module, a fine-tuning module, and the like.
[0153] 1. Data preprocessing
[0154] First, the training set is collected, which can specifically collect time series generated in one or more fields, such as one or more fields in energy, transportation, nature, society, and the like. The time series includes one or more elements arranged according to the generation time or other time dimensions.
[0155] Each element in the time series generated in each field can include one or more dimensions of values. For ease of subsequent processing, in the case where there are multiple dimensions in the time series, the time series can be split into multiple groups of one-dimensional sequences.
[0156] Specifically, for example, the collected multi-field time series data set can be used, including the training sets of multiple open source data sets in the anomaly detection task (KPI, UCR, Yahoo, GHL, OPPORTUNITY, SVDB, ECG, MITDB, etc.), and the data set Monash in the time series prediction field (covering multiple fields such as energy, transportation, nature, and society), totaling 462M points. For different field data dimensions, they are split into one-dimensional data for pre-training.
[0157] 2. Adversarial learning.
[0158] Generally, since the cost of labeling abnormal points is high, the collected time series data is mixed with normal sample points and abnormal sample points, and the input sample is noisy. With the increase of the proportion of abnormal sample points, if the information extraction capability of the encoder is too strong and the decoding capability of the decoder is too strong, the abnormal mode can be well modeled, so that the normal points and the abnormal points cannot be distinguished, which affects the effect of anomaly detection. To solve the problem of damage to the robustness of the model caused by unmarked abnormal points in the training sample.
[0159] In the embodiment of the application, noise is injected into the samples in the training set to form normal-abnormal sample pairs, and a training set containing abnormal samples is obtained. For example, by adjusting the value of one or more elements in the normal sample, an abnormal sample can be obtained. For example, the original normal data X norm Generate abnormal adversarial data X adv The problem of label scarcity in the anomaly detection field is avoided by the abnormal injection method.
[0160] Exemplarily, the structure of the sequence reconstruction model and the training process of the model can be as shown in FIG. 8.
[0161] First, before inputting into the sequence reconstruction model, the input sample can also be subjected to a masking operation, and generally a plurality of sequences can be generated by a symmetric masking operation. For example, for a certain sample, multiple masking operations can be performed, and the masking regions of each masking operation are not completely the same, for example, the masking regions of multiple masking operations can be merged to cover all or most of the regions of the sample, and one or more samples after masking are input into the sequence reconstruction model.
[0162] In the sequence reconstruction model, a plurality of modules are provided, which can specifically include but are not limited to an encoder, an intermediate layer, and two decoders (decoder), i.e., the normal decoder and the abnormal decoder shown in FIG. 8.
[0163] The encoder can be used to encode the input sequence, usually into an embedding, and input to the intermediate layer;
[0164] The intermediate layer can be used to extract features from the received embedding, to obtain extracted features;
[0165] The two encoders can be used to decode the input features, to output reconstructed sequences.
[0166] Specifically, in the training phase, different decoders are usually used to decode normal samples and abnormal samples, and the update method when the model is updated in the opposite direction is also different. For example, if the input is a normal sample, the model can be updated in the opposite direction after decoding by the normal decoder; if the input sample is an abnormal sample, the encoder and the abnormal decoder can be learned in an adversarial manner, such as adjusting the gradient value of the encoder, such as reversing, taking the derivative, or reducing, so that the encoder has stronger encoding ability for normal samples based on adversarial learning.
[0167] For example, for normal samples, represented as X norm After the mask operation obtains one or more sequences, the one or more sequences are input to the encoder, and the encoding corresponding to each sequence is output; the encoding data output by the encoder is input to the intermediate layer, and the intermediate layer is used to extract features; the features extracted by the intermediate layer are input to the normal decoder, and the reconstructed sequence is output, such as two mask operations, and two reconstructed sequences are output accordingly, represented as: and The loss value is calculated using the difference between and and the input sequence, represented as L norm , and then the gradient value of the normal decoder is calculated and the gradient value of the normal decoder is updated; and the gradient value of the encoder is calculated θ G The parameters of the encoder are represented, and the parameters of the encoder are updated.
[0168] For abnormal samples, represented as X advAfter the one or more sequences are obtained by the mask operation, the one or more sequences are input to the encoder, and the encoding corresponding to each sequence is output; the encoding data output by the encoder is input to the intermediate layer, and the intermediate layer performs feature extraction; the features extracted by the intermediate layer are input to the abnormal decoder, and the reconstructed sequence is output, for example, two reconstructed sequences are output by performing the mask operation twice, which are represented as: and The loss value is calculated using the difference between and and the input sequence, represented as L adv , and then the gradient value of the abnormal decoder is calculated and the gradient value of the abnormal decoder is updated; the gradient value of the encoder is calculated and inverted, represented as θ G represents the parameters of the encoder, and the parameters of the encoder are updated.
[0169] Therefore, the model structure of Encoder-Dual Decoder (i.e., there are two Decoder decoders) is adopted, X norm shares the weights of the encoder with X adv . The representation obtained from X norm is reconstructed by the normal Decoder learning the normal sequence pattern, and the representation obtained from X adv is reconstructed by the abnormal Decoder capturing the abnormal sequence pattern, and the Encoder performs common normal pattern information extraction through the adversarial learning between the abnormal Decoder and the Encoder.
[0170] In addition, the aforementioned inversion of the gradient to achieve adversarial learning is an exemplary way, in addition to the inversion of the gradient, taking the derivative or reducing, etc. can also be performed, and the specific learning method can be selected according to the actual application scenario, and the present application does not limit it.
[0171] Therefore, in the embodiments of the present application, the adversarial sample is generated by the abnormal injection method to alleviate the problem of the scarcity of labeled samples in the anomaly detection field. In the training phase, two Decoders are set to decode normal and abnormal patterns respectively, and the model is guided to perform adversarial learning based on the abnormal sample, the Encoder and the abnormal Decoder, so that the Encoder performs common normal pattern information extraction, which is helpful to distinguish normal points and abnormal sample points.
[0172] 3. Adaptive bottleneck module
[0173] Generally, the compression degree of the extracted features can be different in different scenarios. If the same compression degree is used for feature extraction, the compression degree of the extracted features for different scenarios can not be suitable. Therefore, in the embodiments of the present application, in order to improve the generalization of the sequence reconstruction model as a base model, a routing layer and a plurality of feature extraction networks can be set in the sequence reconstruction model. The features output by the plurality of feature extraction networks are fused and input into the next layer decoder. The routing layer can be used to determine the weight of each feature extraction network in the fusion, so as to adapt to different application scenarios and improve the generalization of the model provided in the embodiments of the present application. The routing layer and the plurality of feature extraction networks provided in the embodiments of the present application are introduced below.
[0174] In the anomaly detection task, the information compression requirements of different fields and different scenarios are inconsistent. When learning based on multi-source data, the conflict of multi-source data needs to be considered. According to the information bottleneck theory, information compression is essentially a process of extracting useful information in the model encoding and decoding process. The case by case modeling method in the existing scheme cannot generally be applied to the information compression requirements of different fields. Therefore, in order to adapt to the compression requirements brought by the data specificity of different fields, a plurality of feature extraction networks of different sizes, denoted as Bottleneck, are set in the sequence reconstruction model in the embodiments of the present application, and a router layer is also set to adaptively select the weight of each Bottleneck, thereby enhancing the sequence reconstruction capability of the model in different fields.
[0175] For example, the model structure provided in the embodiments of the present application which sets multiple Bottlenecks can be as shown in FIG. 9. A Bottleneck pool is set in the sequence reconstruction model. The Bottleneck pool includes S Bottlenecks of different sizes, which are used for feature extraction based on different information compression ratios, that is, S different degrees of feature compression. S is a hyperparameter and can be a value determined based on historical data or a value set by a user, etc. For example, it can be based on the scenario in which the model needs to be applied. The Bottleneck can specifically use CNN or DNN or other network structures that can perform feature extraction, which is not limited in the present application. The router can be used to select the weight of the S Bottlenecks for each input sample, so as to weight and fuse the features output by the S Bottlenecks. For example, the Top-k Bottlenecks can be selected according to the descending order of the weights, and the Top-k output features are aggregated according to the weights. In order to add certain randomness, a certain noise disturbance is added to the weights generated by the router.
[0176] For example, set S as 10, i.e. set 10 Bottlenecks as an example, where Bottleneck refers to the intermediate feature representation dimension, and different representation dimensions represent different Bottleneck sizes. Different Bottleneck sizes represent 10 different degrees of feature compression. After obtaining 10 Bottlenecks, the Router layer selects an appropriate information compression path for each sample to obtain the weights of the 10 Bottlenecks. The Top-k (3 in this example) Bottlenecks with the largest weights are selected, and the Top-3 output representations are aggregated according to the weights. The aggregated representation result is input to the corresponding Decoder module for decoding. To add randomness, a certain amount of noise disturbance is added to the weights generated by the Router.
[0177] Correspondingly, when updating the Bottleneck and the router layer, if the input sample is a normal sample, the reverse update can be performed according to the above-mentioned process of updating the normal decoder and the encoder. If the input sample is an abnormal sample, the Bottleneck and the router layer can be subjected to adversarial learning with the abnormal decoder according to the above-mentioned adversarial learning method of updating the abnormal decoder and the encoder, thereby enhancing the feature extraction capability of the Bottleneck and the router layer for normal sequences.
[0178] The sequence reconstruction model obtained through the pre-training stage can be applied to various downstream tasks. In the embodiments of the present application, the pre-training and the downstream task are decoupled. After pre-processing large-scale multi-domain data, relevant modeling operations are performed. The symmetric Mask-reconstruction task is used as a model training task. The original data noise is injected based on the Encoder-Dual Decoder adversarial learning module. The normal-abnormal sample pair is constructed. The normal sample and the abnormal sample are reconstructed by the double Decoder respectively. The abnormal Decoder focuses on the recovery of the abnormal pattern, and simultaneously performs adversarial learning between the abnormal Decoder and the Encoder, thereby enhancing the recognition of the common normal pattern by the Encoder module.
[0179] Meanwhile in the anomaly detection task, the information compression requirements of different fields and different scenes are inconsistent, and when learning based on multi-source data, the conflicts of multi-source data need to be considered. According to the information bottleneck theory, in the model coding and decoding process, information compression is essentially a process of extracting useful information. In order to solve the compression requirements brought by the specificity of data in different fields in the pre-training task, S different size bottlenecks are designed, and the appropriate bottleneck is adaptively selected to enhance the reconstruction ability of the model to massive multi-source data.
[0180] Therefore, in the embodiments of the present application, in view of the modeling challenges of massive, heterogeneous and compression requirement different multi-field data faced in the pre-training stage, the adaptive bottleneck module utilizes the unique dynamic adaptability of the Router to dynamically match the optimal compression level required by various data, giving the model greater flexibility and more significant efficiency.
[0181] 4. Fine-tuning module.
[0182] The fine-tuning module is an optional module. To improve the accuracy of anomaly detection in real downstream business scenarios, the model is usually fine-tuned. In order to further improve the performance of the pre-trained model in the downstream task, the pre-trained model can be fine-tuned based on part of the data of the downstream task scenario. The fine-tuning process is similar to the pre-training process, the difference is that the input samples during training are different. In the fine-tuning stage, the data related to the downstream task can be used as the training set for training, thereby improving the performance of the model in the downstream task.
[0183] For example, in the adversarial learning module, after preprocessing the downstream task data, the Encoder-Dual Decoder adversarial learning module enhances the knowledge injection of the corresponding downstream task. This process is similar to the pre-training process. For the adaptive bottleneck module, similar to the pre-training process, the downstream task data is also fine-tuned, thereby improving the anomaly detection ability of the model in specific business scenarios.
[0184] II. Inference phase
[0185] After the model is trained through the foregoing training phase, the trained sequence reconstruction model can be deployed to execute specific downstream inference tasks through the sequence reconstruction model provided by the embodiments of the present application, which can include but is not limited to chemical centrifugal pump anomaly detection, fan fault anomaly detection, computer CPU usage anomaly detection, or KPI anomaly detection in network operation scenarios, etc.
[0186] Specifically, based on the sequence reconstruction model provided in the foregoing, after the training of the sequence reconstruction model is completed, the trained sequence reconstruction model can be deployed in a device performing an inference task. The sequence reconstruction model in the training stage can be deployed in the inference device as a whole, or part of the modules thereof can be pruned and then deployed in the inference device. For example, when deploying the sequence reconstruction model, to reduce the resource occupancy of the sequence reconstruction model, the encoding module, the intermediate layer, and the first decoding module can be deployed in the inference device, that is, the second decoding module can not need to be deployed.
[0187] Next, the flow of the sequence reconstruction method provided in the embodiments of the present application, that is, the flow of performing a downstream inference task by using the trained model, is introduced in combination with the sequence reconstruction model obtained in the foregoing training stage.
[0188] Referring to FIG. 10, a flowchart of a sequence reconstruction method provided in an embodiment of the present application is as follows.
[0189] 1001. An input sequence is obtained.
[0190] The input sequence includes at least one element arranged in a generation time sequence, and each element can include values in one or more dimensions. To facilitate model processing, if the elements in the initial input sequence include values in multiple dimensions, the initial input sequence can be optionally preprocessed to split it into multiple input sequences in one dimension.
[0191] The sequence reconstruction model trained in the foregoing training stage of the embodiments of the present application can be applied to various anomaly detection scenarios and has very strong generalization. Accordingly, the meanings of the elements in the input sequence generated in different scenarios are different.
[0192] For example, in a chemical centrifugal pump anomaly detection scenario, the elements in the input sequence can include, but are not limited to, flow rate, rotating speed, shaft power, or lift arranged in a generation time sequence; in a fan fault anomaly detection scenario, the elements in the input sequence can include, but are not limited to, air volume, total pressure, static pressure, rotating speed, noise arranged in a generation time sequence; in a computer CPU usage rate anomaly detection scenario, the elements in the input sequence can include, but are not limited to, CPU usage rate or other CPU consumption arranged in a generation time sequence; and in a KPI anomaly detection scenario in a network operation scenario, the elements in the input sequence can include, but are not limited to, network availability, fault resolution time, network performance indicators, and case event quantity arranged in a generation time sequence.
[0193] 1002. The input sequence is input into the sequence reconstruction model to obtain an output sequence.
[0194] The sequence reconstruction model includes an encoding module and a first decoding module. The encoding module is configured to encode the input sequence. The encoding module is based on a second update. The second update is a parameter update step of adversarial learning using the abnormal sample and the second decoding module. The first decoding module is configured to decode the input encoded data and output a reconstructed sequence.
[0195] Optionally, to facilitate subsequent determination of whether an abnormal point exists in the input sequence using the output of the sequence reconstruction model, the input sequence can be subjected to at least one mask processing to obtain at least one first sub-sequence. Then, the at least one first sub-sequence is input into the sequence reconstruction model to output a second sub-sequence corresponding to each first sub-sequence. The output sequence can include the second sub-sequence corresponding to each first sub-sequence.
[0196] 1003. Determine whether an abnormal point exists in the input sequence according to the output sequence.
[0197] After the output sequence is calculated, whether an abnormal point exists in the input sequence can be determined according to the difference or similarity between the output sequence and the input sequence.
[0198] Therefore, in the embodiments of the present application, the sequence reconstruction model trained using normal samples and abnormal samples in the training stage can be used for sequence reconstruction, so as to reconstruct a normally distributed sequence by using the reconstruction capability of the sequence reconstruction model for normal sequences, and more accurately determine whether an abnormal point exists in the input sequence based on the difference or similarity between the reconstructed output sequence and the input sequence.
[0199] In a possible implementation, the determination of whether an abnormal point exists in the input sequence can include determining a stability degree of each element in the input sequence according to the second sub-sequence corresponding to each first sub-sequence, and determining whether an abnormal point exists in the input sequence according to the stability degree of each element in the second sub-sequence.
[0200] In the embodiments of the present application, the reconstructed sequence corresponding to the word sequence of the input sequence subjected to at least one mask operation can be used to determine whether an abnormal point exists in the input sequence, so that the mask operation can mask the region in the input sequence, the sequence reconstruction model can reconstruct the specified region, and the stability degree of the reconstructed region can be evaluated based on the reconstruction result, so as to determine whether an abnormal point exists in the reconstructed region in the input sequence. It is equivalent to scoring the stability of each element in each region in the input sequence, so as to determine whether the region is an abnormal point based on the stability of each element, and the abnormal point in the input sequence can be accurately identified.
[0201] Further, optionally, the aforementioned determining, according to the second subsequence corresponding to each first subsequence, the stability degree corresponding to each element in the input sequence, can comprise: in a case where the number of the second subsequence corresponding to the input sequence is one, determining, according to the difference between each element and the adjacent element in the second subsequence, the stability degree corresponding to each element in the input sequence; in a case where the number of the second subsequence corresponding to the input sequence is multiple, obtaining the variance of the elements belonging to the same timestamp in the multiple second subsequence, and the variance is used to represent the stability degree corresponding to the elements belonging to the same timestamp.
[0202] Therefore, in the embodiments of the present application, each reconstruction result can be scored, and specifically, the variance can be used for scoring, for example, when the variance is large, it can be considered that there is an abnormal point in the input sequence, so that the sequence reconstruction model can reconstruct each region in the input sequence based on multiple masking operations, and by performing stability evaluation on each reconstruction result, whether there is an abnormal point in each region in the input sequence can be accurately identified.
[0203] For example, in a specific embodiment, real-time monitoring can be performed based on online input business data. In the inference stage, the difference from the aforementioned training stage is that the abnormal sample is not constructed with noise, but the reconstruction is directly performed based on the original data. Optionally, in the inference stage, multiple pairs of symmetric Mask copies are generated for reconstruction (10 pairs are taken as an example in the present embodiment). For each timestamp, that is, the unit element in the input sequence, the variance of the values of each element in all copies is calculated, and the variance is taken as the abnormal score. A corresponding threshold is set, and the variance of the values obtained by the abnormal point under different Mask reconstructions is usually large, while the variance of the normal point is usually small. Based on the threshold and the abnormal score, the abnormal point is determined, so that whether there is an abnormal point in the input sequence can be accurately identified.
[0204] In addition, in addition to performing the aforementioned step 1003 of the abnormality detection step, other downstream tasks such as time series prediction, time series classification, etc. can also be performed based on the sequence reconstruction capability of the model. Specifically, a head for performing a time series prediction or a time series classification task, etc. can be added in the model. For example, the reconstruction head in the model can be replaced with a prediction head or a prediction head can be added, and a time series prediction task such as product sales prediction can be performed, for example, the element value corresponding to the next timestamp is predicted by using the input sequence; for another example, the reconstruction head can be replaced with a classification head or a classification head can be added, and a classification task such as target gesture detection classification or other sequence classification can be performed.
[0205] The flow of the training stage and the inference stage in the method provided by the embodiments of the present application is introduced above, and the effect of the method provided by the embodiments of the present application is exemplarily introduced below in combination with a specific data set.
[0206] For example, the Encoder-Dual Decoder adversarial learning solves the damage to the robustness of the model caused by the unlabeled abnormal points in the training samples, so that the Encoder extracts the information of the common normal mode, thereby avoiding excessive fitting of the abnormal mode and causing the inability to distinguish normal and abnormal points; meanwhile, based on the adaptive bottleneck module, the compression requirements caused by the specificity of different domain data are adapted, this module is beneficial to the joint training of multi-domain data sets in the pre-training process, and at the same time in the downstream task stage, for specific downstream task scenarios, the appropriate bottleneck path is selected for the downstream task to perform information compression coding, and the abnormal detection precision in the specific task scenario is improved.
[0207] Exemplarily, zero-shot learning is performed in a plurality of public data sets including PSM, SMD, MSL, SMAP, SWAT, etc., and some existing schemes are compared, such as MEMTO, AnomalyTrans, DCdetector, D3R and GPT4TS. At the same time, the performance test of gradually increasing the fine-tuning data ratio of SMD and MSL data sets is performed, and the evaluation index is F1-score. In the case of zero-shot, that is, in four data sets, the SOTA (State-Of-The-Art) effect is achieved, and the comparison mode is 100% training set data, and full data single scene modeling is performed. The comparison results are shown in Table 1.
[0208] Table 1
[0209] That is, the method provided by the embodiment of the application can be directly used for site cold start without being based on the downstream business scenario data set, and the effect even exceeds the existing full data set modeling method. In order to further verify the gain brought by fine-tune, the SMD and MSL data sets are verified by gradually increasing the fine-tuning data amount, and the verification results are shown in FIG. 11. For the “site cold start” problem, when both are in the initial state without specific field fine-tuning, that is, in the zero sample situation, the method provided by the embodiment of the application can realize better detection capability, and can meet the site start requirement with the least training data. Secondly, with the gradual increase of the fine-tuning degree, that is, from no to completely adapt to the process of the downstream data set, the application continues to maintain its performance advantage and stability.
[0210] For example, further, fine-tuning is performed using different downstream task datasets in the fine-tuning stage. Validation is performed in the conference and workshop on neural information processing systems (NeurIPS) time series anomaly detection dataset, as shown in Table 2. In the case of zero-shot testing, the method provided in the embodiments of the present application can achieve better applicability than the existing Case by Case modeling method, and can be extended to various business scenario anomaly detection tasks in the time series field and provide better performance.
[0211] Table 2
[0212] The foregoing describes the method provided in the embodiments of the present application, and the structure of the device for executing the foregoing method is described below.
[0213] Referring to FIG. 12, the structure of a sequence reconstruction model training device provided in the embodiments of the present application includes:
[0214] The acquisition module 1201 is configured to acquire a first training set, the first training set including normal samples and abnormal samples, the normal samples and the abnormal samples including at least one element arranged in a generation time sequence, the normal samples including sequences without abnormal points, and the abnormal samples including sequences with abnormal points.
[0215] The training module 1202 is configured to update an initial sequence reconstruction model using the first training set to obtain an updated sequence reconstruction model, the reconstructed sequence output by the updated sequence reconstruction model being used to determine whether an abnormal point exists in an input sequence, the sequence reconstruction model including an encoding module, a first decoding module, and a second decoding module, the first decoding module being configured to update the encoding module using the normal samples, and the second decoding module being configured to update the encoding module based on the abnormal samples through adversarial learning.
[0216] In a possible implementation, the training module 1202 described above is specifically configured to: when a sample input to the encoding module is a normal sample, the normal sample is encoded by the encoding module, and the encoded data is input to the first decoding module, a corresponding first sequence is output, and the encoding module and the first decoding module are updated through a first loss value between the first sequence and the normal sample; when a sample input to the encoding module is an abnormal sample, the abnormal sample is encoded by the encoding module, and the encoded data is input to the second decoding module, a corresponding second sequence is output, and the encoding module and the second decoding module are updated through adversarial learning according to a second loss value between the second sequence and the abnormal sample.
[0217] In a possible implementation, the training module 1202 is specifically configured to calculate gradient values based on the second loss value between the second sequence and the abnormal sample, and update the encoding module after inverse transformation of the gradient values.
[0218] In a possible implementation, the sequence reconstruction model further includes a routing layer and a plurality of feature extraction networks. The input ends of the plurality of feature extraction networks are connected to the output end of the encoding model. The output ends of the plurality of feature extraction networks are connected to the first decoding module or the second decoding module. The plurality of feature extraction networks are configured to extract features from the input data. The features extracted by the plurality of feature extraction networks have different compression degrees. The routing layer is configured to determine weights corresponding to the output features of each feature extraction network in the plurality of feature extraction networks.
[0219] In a possible implementation, the input of the routing layer is the sample input into the sequence reconstruction model or the encoded data output by the encoding model.
[0220] In a possible implementation, the training module 1202 is specifically configured to: when the sample input into the encoding module is a normal sample, input the encoded data obtained by encoding the normal sample by the encoding module into the first decoding module, output a corresponding first sequence, and update the encoding module, the routing layer, the plurality of feature extraction networks, and the first decoding module based on a first loss value between the first sequence and the normal sample; and when the sample input into the encoding module is an abnormal sample, input the encoded data obtained by encoding the abnormal sample by the encoding module into the second decoding module, output a corresponding second sequence, and perform adversarial learning on the encoding module, the routing layer, the plurality of feature extraction networks, and the second decoding module based on a second loss value between the second sequence and the abnormal sample.
[0221] In a possible implementation, the samples in the first training set include samples collected from at least one scene.
[0222] In a possible implementation, the training module 1202 is further configured to: obtain a second training set, the second training set including samples in an application scene in which the sequence reconstruction model is deployed; and fine-tune the updated sequence reconstruction model using the second training set to obtain a fine-tuned sequence reconstruction model.
[0223] In a possible implementation, the training module 1202 is further configured to: perform adversarial learning on the updated sequence reconstruction model using the second training set to obtain the fine-tuned sequence reconstruction model.
[0224] In a possible implementation, the training module 1202 is further configured to: in a case where the routing layer and the plurality of feature extraction networks are set in the sequence reconstruction model, update the routing layer and the plurality of feature extraction networks using the second training set.
[0225] In a possible implementation, the acquisition module 1201 is specifically configured to: acquire at least one normal sample; add noise to each normal sample to obtain an abnormal sample corresponding to each normal sample, and the first training set includes the at least one normal sample and the abnormal sample corresponding to each normal sample.
[0226] In a possible implementation, the training module 1202 is specifically configured to: perform a mask operation on the samples in the first training set to obtain at least one sample after the mask operation; and input the at least one sample after the mask operation to the encoding module.
[0227] In a possible implementation, the apparatus further includes an inference module 1203, configured to: acquire an input sequence, the input sequence including at least one element arranged in a generation time sequence; input the input sequence to a sequence reconstruction model to obtain an output sequence; and determine whether an abnormal point exists in the input sequence according to the output sequence.
[0228] In a possible implementation, the inference module 1203 is specifically configured to: perform at least one mask processing on the input sequence to obtain at least one first sub-sequence; input the at least one first sub-sequence as an input of the sequence reconstruction model, output a second sub-sequence corresponding to each first sub-sequence, and the output sequence includes the second sub-sequence corresponding to each first sub-sequence.
[0229] In a possible implementation, the inference module 1203 is specifically configured to: determine a stability degree corresponding to each element in the input sequence according to the second sub-sequence corresponding to each first sub-sequence; and determine whether an abnormal point exists in the input sequence according to the stability degree corresponding to each element in the second sub-sequence.
[0230] In a possible implementation, the inference module 1203 is specifically configured to: in a case where the number of the second sub-sequences corresponding to the input sequence is one, determine the stability degree corresponding to each element in the input sequence according to a difference between each element and a neighboring element in the second sub-sequence; and in a case where the number of the second sub-sequences corresponding to the input sequence is a plurality, acquire a variance of elements belonging to a same timestamp in the plurality of second sub-sequences, and the variance is used to represent the stability degree corresponding to the elements belonging to the same timestamp.
[0231] Referring to FIG. 13, a structural schematic diagram of a sequence reconstruction apparatus is provided, including:
[0232] An input module 1301 is configured to acquire an input sequence, the input sequence including at least one element arranged in a generation time sequence;
[0233] The sequence reconstruction module 1302 is configured to input the input sequence into the sequence reconstruction model to obtain an output sequence, the sequence reconstruction model comprising an encoding module and a first decoding module, the encoding module being configured to encode the input sequence, the encoding module being a module obtained based on a second update, the second update being a parameter update step of adversarial learning using an abnormal sample and a second decoding module, and the first decoding module being configured to decode the encoded data to output a reconstructed sequence.
[0234] In a possible implementation, the sequence reconstruction module 1302 is further configured to: an abnormality detection module configured to determine whether there is an abnormal point in the input sequence according to the output sequence.
[0235] In a possible implementation, the sequence reconstruction module 1302 is specifically configured to: perform at least one mask processing on the input sequence to obtain at least one first subsequence; input the at least one first subsequence into the sequence reconstruction model to output a second subsequence corresponding to each first subsequence, and the output sequence comprises the second subsequence corresponding to each first subsequence.
[0236] In a possible implementation, the sequence reconstruction module 1302 is specifically configured to: determine a stability degree corresponding to each element in the input sequence according to the second subsequence corresponding to each first subsequence; and determine whether there is an abnormal point in the input sequence according to the stability degree corresponding to each element in the second subsequence.
[0237] In a possible implementation, the sequence reconstruction module 1302 is specifically configured to: in a case where the number of the second subsequences corresponding to the input sequence is one, determine the stability degree corresponding to each element in the input sequence according to a difference between each element and a neighboring element in the second subsequence; and in a case where the number of the second subsequences corresponding to the input sequence is a plurality, obtain a variance of elements belonging to a same timestamp in the plurality of second subsequences, the variance being used to represent the stability degree corresponding to the elements belonging to the same timestamp.
[0238] As shown in FIG. 14, FIG. 14 is a hardware structure schematic diagram of a computing device 140 provided by an embodiment of the present application. The computing device 140 can be used to implement the steps of the methods in FIGS. 3-10.
[0239] The computing device 140 shown in FIG. 14 can include a processor 1401, a memory 1402, a communication interface 1403, and a bus 1404. The processor 1401, the memory 1402, and the communication interface 1403 can be connected through the bus 1404.
[0240] The processor 1401 is a control center of the computing device 140, and can be a general central processing unit (CPU), or other general-purpose processor, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc., and can specifically include a GPU or an NPU, etc., and can be adaptively set according to an actual application scenario.
[0241] As an example, the processor 1401 can include one or more CPUs, and can also include other processors, such as the CPU, NPU or GPU shown in FIG. 14, etc.
[0242] The memory 1402 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, and can also be an electrically erasable programmable read-only memory (EEPROM), a magnetic disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program codes in the form of instructions or data structures and capable of being accessed by a computer, but is not limited thereto.
[0243] In one possible implementation, the memory 1402 can exist independently of the processor 1401. The memory 1402 can be connected to the processor 1401 through the bus 1404, and is used to store data, instructions or program codes. When the processor 1401 invokes and executes the instructions or program codes stored in the memory 1402, the method provided by the embodiments of the present application can be implemented, for example, the methods shown in FIGS. 3 to 10.
[0244] In another possible implementation, the memory 1402 can also be integrated with the processor 1401.
[0245] The communication interface 1403 is used for the computing device 140 to be connected with other devices through a communication network, which can be an Ethernet, a radio access network (RAN), a wireless local area network (WLAN), etc. The communication interface 1403 can include a receiving unit for receiving data, and a sending unit for sending data.
[0246] The bus 1404 can be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, an extended industry standard architecture (EISA) bus, or other bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used to represent the bus in FIG. 14, but it does not mean that there is only one bus or only one type of bus.
[0247] It should be noted that the structure shown in FIG. 14 does not constitute a limitation on the computing device 140. In addition to the components shown in FIG. 14, the computing device 140 can include more or fewer components than shown, or combine certain components, or different arrangements of components.
[0248] From the above description of the embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software and the necessary universal hardware, and of course can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. Generally, functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure for implementing the same function can also be various, such as analog circuits, digital circuits or special circuits, etc. However, for the present application, software program implementation is a better embodiment. Based on this understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc., including a plurality of instructions for causing an apparatus (which can be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments of the present application.
[0249] In the above embodiments, all or part can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in the form of a computer program product in whole or in part.
[0250] The embodiments of the present application also provide a computer readable storage medium, which stores a program for training a model or performing an inference task, and when the program is run on a computer, the computer is caused to perform all or part of the steps of the method described in the foregoing embodiments of FIG. 3 to FIG. 10.
[0251] The embodiments of the present application also provide a digital processing chip. The digital processing chip integrates a circuit for implementing the processor or the function of the processor and one or more interfaces. When the digital processing chip integrates a memory, the digital processing chip can complete the method steps of any one or more of the foregoing embodiments. When the digital processing chip does not integrate a memory, the digital processing chip can be connected with an external memory through a communication interface. The digital processing chip implements the method steps of any one or more of the foregoing embodiments according to the program code stored in the external memory.
[0252] The embodiments of the present application also provide a computer program product, which includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer readable storage medium can be any available medium that a computer can store or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)) and the like.
[0253] The data comparison device provided by the embodiments of the present application can be a chip, which comprises a processing unit, for example, a processor, and a communication unit, for example, an input / output interface, a pin, a circuit or the like. The processing unit can execute computer execution instructions stored in a storage unit, so that the chip in the server executes the method described in the embodiments shown in FIG. 3 to FIG. 10. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache or the like. The storage unit can also be a storage unit outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or the like.
[0254] Specifically, the foregoing processing unit or processor can be a central processing unit (CPU), a neural-network processing unit (NPU), a graphics processing unit (GPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC) or a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor or the like.
[0255] In addition, it should be noted that the apparatus embodiments described above are merely illustrative, and the units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place or distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments. In addition, in the apparatus embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which can be implemented as one or more communication buses or signal lines.
[0256] Those skilled in the art can clearly understand that the application can be implemented by means of software plus necessary universal hardware, and of course can also be implemented by means of dedicated hardware including special-purpose integrated circuits, special-purpose CPUs, special-purpose memories, special-purpose components, etc. Generally, any function completed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure for implementing the same function can also be various, such as analog circuits, digital circuits, or special-purpose circuits, etc. However, for the present application, software program implementation is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a readable storage medium, such as a floppy disk, a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc., and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present application.
[0257] In the above embodiments, all or part can be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part can be implemented in the form of a computer program product.
[0258] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another, for example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)), etc.
[0259] The terms "first", "second", and the like in the description and in the claims of the present application and above drawings are used for distinguishing between similar objects and not necessarily for describing a specific sequential or chronological order. It is to be understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of orderly or inverse order, depending upon the circumstances. The term "and / or" in the present application is merely used to represent an association between associated objects, and it is possible that three relationships exist, for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone. In addition, the character " / " in the present application generally represents an "or" relationship between the associated objects. Furthermore, the terms "comprising" and "having" and any variations thereof are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device that includes a list of steps or modules as an example is not necessarily limited to those steps or modules that are clearly listed, but can include other steps or modules that are not clearly listed or inherent to such process, method, product or device. The naming or numbering of steps in the present application does not mean that the steps in the method flow must be executed in the time / logical order indicated by the naming or numbering, and the named or numbered flow steps can be executed in a different order according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved. The division of modules in the present application is a logical division, and in actual application, there can be another division manner, for example, multiple modules can be combined or integrated in another system, or some features can be ignored or not executed, in addition, the coupling or direct coupling or communication connection between the displayed or discussed modules can be through some ports, and the indirect coupling or communication connection between the modules can be electrical or other similar forms, which are not limited in the present application. Furthermore, the modules or sub-modules described as separate components can or can not be physically separated, and can or can not be physical modules, or can be distributed to multiple circuit modules, and part or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the present application.
Claims
1. A method for training a sequence reconstruction model, characterized in that, The method comprises: obtaining a first training set, the first training set comprising normal samples and abnormal samples, the normal samples and the abnormal samples comprising at least one element arranged in generation time sequence, the normal samples comprising sequences without abnormal points, and the abnormal samples comprising sequences with abnormal points; updating an initial sequence reconstruction model by using the first training set to obtain an updated sequence reconstruction model, the updated sequence reconstruction model being used to output a reconstructed sequence, the sequence reconstruction model comprising an encoding module, a first decoding module and a second decoding module, the first decoding module being used to perform first updating on the encoding module by using the normal samples, and the second decoding module being used to perform second updating on the encoding module by using the abnormal samples through adversarial learning.
2. The method of claim 1, wherein, Any one iteration learning process of performing adversarial learning on the initial sequence reconstruction model comprises: when the sample input to the encoding module is the normal sample, the normal sample is encoded by the encoding module, and the encoded data is input to the first decoding module to output a corresponding first sequence, and the encoding module and the first decoding module are updated by using a first loss value between the first sequence and the normal sample; when the sample input to the encoding module is the abnormal sample, the abnormal sample is encoded by the encoding module, and the encoded data is input to the second decoding module to output a corresponding second sequence, and the encoding module and the second decoding module are updated through adversarial learning according to a second loss value between the second sequence and the abnormal sample.
3. The method of claim 2, wherein, The updating of the encoding module and the second decoding module through adversarial learning according to the second loss value between the second sequence and the abnormal sample comprises: calculating a gradient value according to the second loss value between the second sequence and the abnormal sample, and updating the encoding module after inverse transformation of the gradient value.
4. The method according to any one of claims 1-3, characterized in that, The sequence reconstruction model further comprises a routing layer and a plurality of feature extraction networks, an input end of the plurality of feature extraction networks being connected to an output end of the encoding module, and an output end of the plurality of feature extraction networks being connected to the first decoding module or the second decoding module, the plurality of feature extraction networks being used to extract features from input data, the features extracted by the plurality of feature extraction networks having different compression degrees, and the routing layer being used to determine weights corresponding to output features of each feature extraction network in the plurality of feature extraction networks.
5. The method of claim 4, wherein, An input of the routing layer is a sample input to the sequence reconstruction model or encoded data output by the encoding module.
6. The method according to claim 4 or 5, characterized in that, The updating of the initial sequence reconstruction model by using the first training set to obtain the updated sequence reconstruction model specifically comprises: when the sample input to the encoding module is the normal sample, the normal sample is encoded by the encoding module, and the encoded data is input to the first decoding module to output a corresponding first sequence, and the encoding module, the routing layer, the plurality of feature extraction networks and the first decoding module are updated by using a first loss value between the first sequence and the normal sample. When the sample input into the encoding module is the abnormal sample, the encoding module encodes the abnormal sample, inputs the encoded data into the second decoding module, outputs a corresponding second sequence, and performs adversarial learning on the encoding module, the routing layer and the plurality of feature extraction networks, and the second decoding module according to a second loss value between the second sequence and the abnormal sample.
7. The method of any one of claims 1-6, wherein, the samples in the first training set comprise samples collected from at least one scene.
8. The method according to any one of claims 1-7, characterized in that, The method further comprises: obtaining a second training set comprising samples in an application scenario in which the sequence reconstruction model is deployed; fine-tuning the updated sequence reconstruction model using the second training set to obtain a fine-tuned sequence reconstruction model.
9. The method of claim 8, wherein, The fine-tuning of the updated sequence reconstruction model using the second training set to obtain a fine-tuned sequence reconstruction model comprises: performing adversarial learning on the updated sequence reconstruction model using the second training set to obtain a fine-tuned sequence reconstruction model.
10. The method according to claim 8 or 9, characterized in that, The fine-tuning of the updated sequence reconstruction model using the second training set to obtain a fine-tuned sequence reconstruction model further comprises: in the case where the sequence reconstruction model is provided with a routing layer and a plurality of feature extraction networks, updating the routing layer and the plurality of feature extraction networks using the second training set.
11. The method according to any one of claims 1-10, characterized in that, The obtaining of the first training set comprises: obtaining at least one normal sample; adding noise to each normal sample to obtain an abnormal sample corresponding to each normal sample, and the first training set comprises at least one normal sample and the abnormal sample corresponding to each normal sample.
12. The method of claims 1-11, wherein, The inputting of the samples in the first training set into the encoding module comprises: performing a masking operation on the samples in the first training set to obtain at least one masked sample; inputting the at least one masked sample into the encoding module.
13. The method according to any one of claims 1-12, characterized in that, The method further comprises: obtaining an input sequence comprising at least one element arranged in a generation time sequence; inputting the input sequence into the sequence reconstruction model to obtain an output sequence; determining whether there is an abnormal point in the input sequence according to the output sequence.
14. The method of claim 13, wherein, The inputting of the input sequence into the sequence reconstruction model to obtain an output sequence comprises: performing at least one masking operation on the input sequence to obtain at least one first sub-sequence; inputting the at least one first sub-sequence into the sequence reconstruction model as an input, outputting a second sub-sequence corresponding to each first sub-sequence, and the output sequence comprises the second sub-sequence corresponding to each first sub-sequence.
15. The method of claim 14, wherein, The determination of whether there is an abnormal point in the input sequence according to the output sequence comprises: determining a stability degree of each element in the input sequence according to the second sub-sequence corresponding to each first sub-sequence; determining whether there is an abnormal point in the input sequence according to the stability degree of each element in the second sub-sequence.
16. The method of claim 15, wherein, The method further comprises: determining whether there is an abnormal point in the input sequence according to the output sequence. The method further comprises:
17. A sequence reconstruction method, characterized by, masking the input sequence at least once to obtain at least one first sub-sequence; inputting the at least one first sub-sequence into the sequence reconstruction model as input of the sequence reconstruction model, and outputting a second sub-sequence corresponding to each first sub-sequence, wherein the output sequence comprises the second sub-sequence corresponding to each first sub-sequence. determining whether there is an abnormal point in the input sequence according to the second sub-sequence corresponding to each first sub-sequence.
18. The method of claim 17, wherein, The method further comprises: determining whether there is an abnormal point in the input sequence according to the second sub-sequence corresponding to each first sub-sequence.
19. The method of claim 17 or 18, wherein, The method further comprises: determining whether there is an abnormal point in the input sequence according to the second sub-sequence corresponding to each first sub-sequence. The method further comprises:
20. The method of claim 19, wherein, in a case where the number of the second sub-sequences corresponding to the input sequence is one, determining the stability degree of each element in the input sequence according to the difference between each element and the adjacent element in the second sub-sequence; in a case where the number of the second sub-sequences corresponding to the input sequence is multiple, obtaining the variance of the elements belonging to the same timestamp in the multiple second sub-sequences, and the variance is used to represent the stability degree of the elements belonging to the same timestamp. The method further comprises:
21. The method of claim 20, wherein, an obtaining module configured to obtain a first training set, wherein the first training set comprises normal samples and abnormal samples, the normal samples and the abnormal samples each comprise at least one element arranged in a generation time sequence, the normal samples comprise sequences without abnormal points, and the abnormal samples comprise sequences with abnormal points; 22. A sequence reconstruction model training apparatus, characterized by comprising: The training module is configured to update an initial sequence reconstruction model by using the first training set to obtain an updated sequence reconstruction model, the updated sequence reconstruction model being configured to output a reconstructed sequence, the sequence reconstruction model comprising an encoding module, a first decoding module and a second decoding module, the first decoding module being configured to perform a first update on the encoding module by using the normal samples, and the second decoding module being configured to perform a second update on the encoding module by using the abnormal samples through adversarial learning.
23. A sequence reconstruction apparatus, characterized by The method comprises: The input module is configured to obtain an input sequence, the input sequence comprising at least one element arranged in a generation time sequence; The sequence reconstruction module is configured to input the input sequence into the sequence reconstruction model to obtain an output sequence, the sequence reconstruction model comprising an encoding module and a first decoding module, the encoding module being configured to encode the input sequence, the encoding module being a module obtained through a second update, the second update being a parameter update step of adversarial learning by using abnormal samples and a second decoding module, and the first decoding module being configured to decode the input encoded data to output a reconstructed sequence.
24. A computing device, comprising: A processor and a memory; The processor is configured to execute instructions stored in the memory, so that the computing device performs the processing steps of the method according to any one of claims 1 to 16 or 17 to 21.
25. A computer program product comprising instructions, wherein: The instructions, when executed by a computing device, cause the computing device to perform the processing steps of the method according to any one of claims 1 to 16 or 17 to 21.
26. A computer-readable storage medium, characterized in that, Computer program instructions, when executed by a computing device, cause the computing device to perform the processing steps of the method according to any one of claims 1 to 16 or 17 to 21.
Citation Information
Patent Citations
GCN-LSTM and attention mechanism-based anomaly detection method and system
CN115168443A
Multivariate time sequence anomaly detection method and system based on mask graph neural network model
CN115935285A
Industrial internet time series data anomaly detection method and device
CN116522265A
Pseudo-abnormal sample surface defect detection method and device with antagonism training
CN116805303A
Defect detection model construction method, defect detection method, device and equipment
CN117830781A