A non-intrusive abnormal current detection method
A non-invasive abnormal current detection method using a GAN-BiLSTM model and anomaly scoring fusion function solves the problem of reliance on manual detection in spectral analyzers, enabling automatic early warning and precise anomaly location, thus improving detection accuracy and equipment maintenance efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2026-04-10
AI Technical Summary
Existing spectrometers rely on manual observation for anomaly detection, making it difficult to identify potential problems in a timely manner, which affects the accuracy and reliability of scientific research data, and lacks an automatic early warning system.
A non-invasive abnormal current detection method based on deep learning is adopted. Data is collected through a non-invasive current detection sensor, and an abnormal current is detected using a GAN-BiLSTM model. Combined with feature extraction and anomaly scoring fusion function, automatic early warning is achieved.
It improves the accuracy and robustness of anomaly detection in the spectrometer, enabling timely detection of equipment problems, ensuring the scientific validity and continuity of experimental results, and reducing maintenance costs.
Smart Images

Figure CN118885790B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to abnormal current detection, in particular, the present application relates to a non-invasive abnormal current detection method. BACKGROUND
[0002] Frequently used instruments and equipment are often prone to damage and failure, which affects normal use. Abnormalities may have occurred before the instrument fails, and these abnormal states are often difficult to be immediately identified and maintenance measures are taken due to their concealment. Manual detection of such abnormalities not only consumes a lot of time, but also requires a large amount of human resources. Therefore, it is particularly important to implement fine instrument anomaly monitoring, aiming to detect and intervene potential problems in advance, thereby effectively reducing the frequency of instrument failure and prolonging the service life of scientific instruments. Obtaining the working current of instruments and equipment through the Internet of Things can help us monitor the abnormal conditions that may occur during instrument operation.
[0003] Nowadays, only a few advanced spectral analyzers are equipped with automatic warning systems that can report abnormal working conditions in real time during operation, while most spectral analyzers still rely on managers to subjectively identify possible abnormal signs based on past use experience. This management mode that relies on manual observation rather than automatic warning makes it difficult to immediately identify and correct potential problems, thereby threatening the accuracy and reliability of scientific data. Realistic abnormal reasons for spectral analyzers often manifest as equipment failure, human adjustment parameter errors, insufficient environmental conditions, etc., while in current data, they manifest as abnormal fluctuations, trend deviations, decreased stability, or increased change rates. Therefore, if these abnormal current patterns can be efficiently identified and extracted from massive current data, it will greatly promote the early warning ability of spectral analyzer abnormal conditions, provide a scientific basis for timely intervention and maintenance, and ensure the continuity of scientific activities and the effectiveness of data. SUMMARY
[0004] In order to solve the problem of low efficiency of artificial detection of instrument and equipment abnormity, the application aims to provide an abnormal current detection method and application, which uses a non-invasive abnormal current detection method based on deep learning. The method provided by the application is applied to a spectrometer, and can automatically warn some abnormal working conditions of the spectrometer. Taking an atomic absorption spectrometer as an embodiment, the running current data of the atomic absorption spectrometer is collected by a non-invasive current detection sensor, and data labeling processing is performed, the data is then used as an input vector for training a time series anomaly detection model, aiming at identifying abnormal current points in the operation process. Further, the feature extraction technology is used to deeply mine the local features of the current input vector, and the key information is fully refined. Finally, through an abnormal score fusion function, the abnormal current change point can be accurately positioned and scored, and the possible problems of the atomic absorption spectrometer can be found and handled in time, so as to ensure the accuracy and scientificity of the experimental results. A non-invasive abnormal current detection method, characterized in that the method comprises the following steps:
[0005] (1) Instrument and equipment current data acquisition and dataset establishment:
[0006] The data in the dataset is the current data of the instrument and equipment including two labels, and the two labels are label one and label two;
[0007] The label one includes normal and abnormal working states of the instrument and equipment;
[0008] The label two is the time of collecting the current;
[0009] The current data of the instrument and equipment is arranged according to time to obtain time series current data;
[0010] The time series current data is processed by using a normalization method, and the time series current data is mapped to a unified interval [0, 1];
[0011] The method obtains a large amount of historical monitoring current data through an instrument monitoring platform, and obtains a historical monitoring current dataset in a normal running state through screening. Then, the abnormal current sequence is obtained through the feedback of the user, and the typical abnormal current sequence is generated, the abnormal data set is supplemented, and finally the initial sample set is generated in combination with the two data sets. The time series current data is mapped to a unified interval [0, 1] by using a min-max normalization method, mainly to avoid that the difference between different features is too large, so that the proportion of some features in the calculation process is too large. Through the min-max normalization method, the data can be compressed to a specific range, and the value range of different features can be mapped to a unified interval [0, 1].
[0012] (2) An algorithm model is built based on a GAN network and a BiLSTM algorithm, and a GAN-BiLSTM model is obtained;
[0013] The GAN-BiLSTM model takes a cycle-consistent generative adversarial network as an algorithm framework, and the cycle-consistent generative adversarial network is composed of a forward adversarial network and a reverse adversarial network, and the forward adversarial network is denoted as forward GAN; the reverse adversarial network is denoted as reverse GAN;
[0014] Both the forward GAN and the reverse GAN include a generator and a discriminator; the generator of the algorithm framework is constructed based on a CNN feature extraction module and a BiLSTM algorithm; and the discriminator is composed of a fully connected layer;
[0015] The generators of the forward GAN and the reverse GAN are generator G and generator ε respectively;
[0016] The discriminators of the forward GAN and the reverse GAN are discriminator D x and discriminator D z respectively;
[0017] The internal structure of the generator is composed of a bidirectional long short-term memory (BiLSTM) and a CNN feature extraction module as basic units, the CNN feature extraction module is used to mine the local characteristics of the input vector, and then the BiLSTM is used to process the data after feature extraction, so as to effectively capture and integrate the dynamic change trend of the time sequence, and finally realize the generation of highly realistic data sequence samples by combining the normal data set and the random sampling white noise. The BiLSTM network used in the application includes two forward and reverse LSTM layers, and when processing data, it is processed from the start point to the end point and from the end point to the start point, so that the change trend of the time sequence can be more accurately captured.
[0018] The internal structure of the discriminator is composed of a fully connected layer as a basic unit, and the output is the difference between the real sample and the generator output sample and the probability of evaluating the input data as a real sample.
[0019] The overall structure model is built on an optimized GAN network structure, and the GAN framework is composed of two generators and two discriminators. The internal structure of the generator is composed of a CNN and a BiLSTM as a basic unit, and the discriminator adopts a fully connected layer to identify the difference between the generated sample and the real sample.
[0020] (3) The trained GAN-BiLSTM model is used to process the current sequence, and the current sequence is specifically the time sequence of the instrument equipment current data; the reconstruction error and the discriminator output are obtained respectively, and based on the reconstruction error and the discriminator output, the abnormal current data points in the current sequence are obtained.
[0021] Preferably, the training process of the GAN-BiLSTM model comprises the following steps:
[0022] extracting training data x from the data set obtained from step (1);
[0023] inputting the training data x and the randomly sampled white noise z into the CNN feature extraction module to mine the local characteristics of the input vector and obtain the data after feature extraction;
[0024] processing the data after feature extraction by the BiLSTM algorithm in a bidirectional manner to capture and integrate the dynamic change trend of the time series, and finally realize the combination of the input training data and the randomly sampled white noise to obtain realistic sequence data;
[0025] inputting the sequence data and the data in the training set into the discriminator to output the difference between the sequence data from the training data x and the generator output, and output the probability of the input data being the data in the training set;
[0026] In the specific training, the parameters of the generator and the discriminator in the model are first initialized, the objective function Loss is constructed, the discriminator is trained with the generator fixed and the generator is trained with the discriminator fixed, and the iterative optimization is performed in a loop until the objective function Loss tends to be stable.
[0027] Preferably, the construction of the objective function Loss comprises the following steps:
[0028] generating an adversarial objective function based on the training data x and the sequence data G(z) output by the generator
[0029] wherein, X is the input data domain, P X is the distribution of X, is a set of 1-Lipschitz continuous functions;
[0030] generating an adversarial objective function based on the sequence data ε(x) generated by the generator ε of the latent vector space Z and its discriminator D z
[0031]
[0032] minimizing the L2 norm of the training data x and the reconstructed sample G(ε(x)), and the adversarial objective function is as follows:
[0033]
[0034] Combining the above three losses, the final objective function Loss is as follows:
[0035] Preferably, in step (3), the method for obtaining the reconstruction error includes the following steps:
[0036] Given two time series X = (x0, x1, ..., x2) n )and Calculate X and X using the following formula Distance between any two points in the middle:
[0037]
[0038] Where i∈{1,2,…,n}, j∈{1,2,…,n};
[0039] The resulting distance matrix:
[0040]
[0041] Next, we use dynamic programming to find the optimal regular path for W, as shown in the following equation:
[0042] P best ={p1,p2,…,p k ,…,p K}
[0043] Where, p k Indicates the position of the regular path, i.e., p k =(i,j) k x represents i and Alignment, n≤k≤2n-1;
[0044] p k By constructing the cost matrix, the matrix element γ(i,j) is defined as follows:
[0045] γ(i,j)=d(i,j)+min[γ(i-1,j-1),γ(i-1,j),γ(i,j-1)]
[0046] Among them, i∈{1,2,…,b}, j∈{1,2,…,n}, γ(0,0)=0, γ(i,0)=γ(0,j)=∞;
[0047] Optimal regularization path P best Dynamic time warping distance Make X and The cumulative distance value is minimized; the reconstruction error is calculated using dynamic time warping distance. As shown in the following formula:
[0048] Preferably, in step (3), the abnormal current data points in the current sequence are obtained based on the reconstruction error and the discriminator output, comprising the following steps:
[0049] (3.1) fusing the reconstruction error and the discriminator output to obtain a set of abnormal scores D;
[0050] The reconstruction error and the discriminator output are normalized respectively by using the z-score standardization method to obtain abnormal indicators Z rec (x) and Z dx (x);
[0051] Each element in the set of abnormal scores D is an abnormal score score, and the calculation method of the abnormal score is as shown in the following formula, and the value of λ is 0.5;
[0052] score = λZ rec (x) + (1-λ)Z dx (x)
[0053] (3.2) constructing an abnormal threshold and optimizing the abnormal threshold according to the Gini index
[0054] The error mean E μ and the error standard deviation E σ of the training data x and the sequence data G(z) output by the generator are counted, and the tolerance limit for abnormal detection is taken as 3 times the standard deviation to obtain an initial abnormal threshold thres, as shown in the following formula:
[0055] thres = E μ + 3E σ
[0056] The set of abnormal scores D is traversed, and each abnormal score score obtained by traversal is compared with the threshold thres, and D is divided into two parts according to the rule that the abnormal score is less than or equal to the threshold and the abnormal score is greater than the threshold, that is, D1 = {x | x ≤ thres} and D2 = {x | x > thres};
[0057] The Gini index of the set D is calculated in the following formula:
[0058]
[0059] After the threshold thres is used to perform a division operation on the set D, the Gini(D, thres) can describe the uncertainty level of the set D divided by the threshold, and the initial abnormal threshold is optimized by minimizing the Gini index to obtain an optimized threshold.
[0060] Preferably, the instrument device is an atomic absorption spectrometer.
[0061] The determination of the abnormal score is based on two key factors. First, a well-trained discriminator can effectively identify whether the current sample meets the normal standard. Second, a trained generator can perform the encoding and decoding tasks of the current sequence, and by comparing the differences between the original sequence and the reconstructed sequence by the generator, the abnormality of the input sample is determined.
[0062] The two abnormal scores are fused to obtain the standardized abnormal score, and the abnormal state is accurately located by traversing each time current sequence point. By applying the z-score standardization technique, the error regularization processing is realized, and the comparison between errors is simplified. Finally, the reconstructed score Z rec (x) and the discriminator score Z dx (x) are obtained. By calculating the Gini index of the different abnormal score sets corresponding to each time series data point, the abnormal division effect of the threshold is compared.
[0063] The main beneficial effects of the present application are:
[0064] 1) The present application uses a GAN-BiLSTM model. GAN can identify abnormal points by learning the distribution of normal data, while BiLSTM can analyze abnormal patterns in sequences. The combination of the two can effectively identify abnormal behaviors in time series data. In engineering value, it can detect signs of equipment failure in advance and reduce maintenance costs.
[0065] 2) The present application proposes to fuse two abnormal scores. By combining information from two different sources, the model can evaluate the abnormality of data points from multiple angles, improving the detection accuracy and robustness of the model.
[0066] 3) The present method optimizes the abnormal score threshold to effectively judge the abnormal detection task under abnormal training data, so that the abnormal judgment is no longer limited by the fixed value, is easy to implement and has good generalization ability. BRIEF DESCRIPTION OF DRAWINGS
[0067] Figure 1 It is a schematic diagram of the overall process of the present application.
[0068] Figure 2 It is an atomic absorption spectrometer abnormal current diagram generated by AGOTS.
[0069] Figure 3 It is a step diagram for generating abnormal current data sets.
[0070] Figure 4 It is a schematic diagram of the initial algorithm model structure of the present application.
[0071] Figure 5 The abnormal current detection overall algorithm model structure schematic diagram of the application.
[0072] Figure 6 The simulation result schematic diagram of the abnormal detection algorithm model of the application. DETAILED DESCRIPTION
[0073] In order to describe the application more specifically, the technical solutions of the application are described in detail below in combination with the drawings and examples.
[0074] The implementation of the application is based on the multiple atomic absorption spectrometer current data collected by the instrument management system, and the method is as shown in Figure 1 The specific process is as follows:
[0075] Step 1) Atomic absorption spectrometer historical current data acquisition and initial sample set establishment, the process is as follows:
[0076] 1.1) Obtain the original historical monitoring data through the scientific research instrument state monitoring platform, select multiple groups of current sequences of the atomic absorption spectrometer in the normal working state from the background database, and establish a normal current data set.
[0077] 1.2) Feedback records from the atomic absorption spectrometer equipment users or operation and maintenance personnel through the small program, select multiple groups of current sequences in the normal working state from the background database, and in order to fully simulate other abnormal situations and verify the generalization of the model, use the AGOTS tool to simulate various abnormal current situations. AGOTS is a tool specially used for generating abnormal time series, which can be used to generate special situations such as spikes, trends, drifts, and variances. The typical current is as shown in Figure 2 All generated abnormal currents are embedded in the normal current, and after artificial checking, they are combined into an abnormal current data set. The abnormal current data set generation process is as shown in Figure 3 .
[0078] 1.3) After normal current verification, automatic labeling can be performed, and abnormal current is manually labeled through the data label interface of the platform according to the feedback of the small program or the construction data. Assuming that the current data corresponding to the normal working state of a certain atomic absorption spectrometer is D = {0.57, 2.73, 2.61, 2.13, 2.15, 1.67, 0.91, 0.52, 0.11, 0.15}, the reconstructed data S = {0.13, 0.07, 0.47, 2.68, 2.59, 2.13, 2.15, 1.52, 0.82, 0.53} is obtained through the synthesized abnormal current data set, the integrated current data set C = {0.57, 2.73, 2.61, 2.13, 2.15, 1.67, 0.91, 0.52, 0.11, 0.15, 0.13, 0.07, 0.47, 2.68, 2.59, 2.13, 2.15, 1.52, 0.82, 0.53} is obtained, and the label set K = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} is obtained, wherein label 0 represents a normal current category, and label 1 represents an abnormal current category.
[0079] 1.4) In order to deeply analyze the data characteristics and optimize the accuracy of model training and prediction, the normalization processing of input data is implemented in this research. Through the min-max normalization method, the data value is mapped to the interval [0, 1], effectively reducing the influence of extreme values in the original data, accelerating the training process of the model and improving the accuracy of the prediction result. As shown in the following formula:
[0080]
[0081] wherein x min , x max respectively represent the minimum value and the maximum value in the current value x.
[0082] 1.5) The preprocessed data is divided into training set and test set according to the proportion of 7:3.
[0083] Step 2) Build a GAN-BiLSTM unsupervised algorithm model, train the training set based on the GAN-BiLSTM network, and the process is as follows:
[0084] 2.1) Build an initial bidirectional CycleGAN algorithm model, and the process is as follows:
[0085] The general generative adversarial network is a one-way generative network, that is, it contains a generator and a discriminator. The present application is completed by cooperation of two generative adversarial networks (GAN). The left side is a forward network composed of a generator ε and a discriminator D x . The right side is a reverse network composed of a generator G and a discriminator D z .
[0086] As shown in Figure 4 , a self-encoding initial model structure is constructed, that is, a generator ε: X→Z and a generator G: Z→X. Where X is the input data domain, that is, the real sample Where is a continuous time sequence composed of l time points starting from i time point and including its after. Z is the hidden vector space, and the random vector z sampled according to the standard normal distribution is used as white noise, that is, z ~ P Z =N(0, 1). In the encoding-decoding self-encoder structure, the input sample x is converted into the corresponding hidden vector z through the compression encoding process of the encoder ε, and then the hidden vector z is reconstructed through the decoding process of the generator G to obtain the reconstructed sample G(ε(x)). On this basis, the network parameters are updated by the back propagation method to minimize the difference between the input sample x and its corresponding reconstructed sample, as shown in the following formula.
[0087] x→ε(x)→G(ε(x))≈x (2)
[0088] This structure is applied to the current sequence in this embodiment, and the two generators ε and G are regarded as bidirectional self-encoders. By calculating and analyzing the reconstruction error of the self-encoder generation result and the original current sequence, the possibility of the sample being an abnormal current is inferred.
[0089] The discriminators corresponding to the two generators are D x and D z , and the role of the discriminator D x is to identify the difference between the real data sample from X and the false data sample G(z) generated by the generator G. The generator G generates highly realistic data samples to deceive the discriminator D x , so as to realize the balance of confrontation. And the role of the discriminator D z is to evaluate the generation ability of the generator ε in the hidden space mapping conversion process.
[0090] With the training, the parameter update becomes difficult to manage, so the Wasserstein loss is introduced to optimize the GAN, and the Wasserstein distance is used to ensure the Lipschitz continuity of the discriminator.
[0091] Therefore, the generation confrontation objective function of the training data x and the sequence data G(z) output by the generator
[0092]
[0093] Where, P X is the distribution of X, is a set of 1-Lipschitz continuous functions.
[0094] This embodiment adds a gradient penalty term when training the GAN to ensure that the discriminator satisfies the 1-Lipschitz continuity, keeping the function smooth.
[0095] Using the above method, the sequence data ε(x) generated by the generator ε of the latent vector space Z and its discriminator D z The adversarial objective function is as follows.
[0096]
[0097] When training the generator network composed of ε and G, it is necessary to minimize the L2 norm of the real sample x and the reconstructed sample G(ε(x)). The adversarial objective function is as follows.
[0098]
[0099] Combining the above three losses, the final objective function Loss is as follows.
[0100]
[0101] 2.2) BiLSTM is used as the basic component unit of the generator in the overall algorithm framework, the process is as follows:
[0102] When processing text or time series data, the traditional GAN generator may not be able to capture the time series dependence of the data. Therefore, it is essential to use LSTM as part of the generator, which can effectively process sequence data.
[0103] In view of the limitation of one-way information processing of LSTM network, and considering the time continuity of current sequence, BiLSTM network is used to integrate forward and reverse sequence information as the autoencoder of the two generators ε and G in the GAN structure in 2.1). The BiLSTM model is composed of 2 LSTM networks, which is calculated as follows, where LSTM f and LSTM b process the forward and backward features in the sequence data x t , w i is the shared weight, and the new hidden vector is obtained by calculating the forward hidden vector and the reverse hidden vector , and further obtains the current time output h t by merging the outputs of the two hidden vectors. The formula is as follows:
[0104]
[0105] 2.3) CNN optimizes BiLSTM, the process is as follows:
[0106] By leveraging the local perceptual nature of CNNs, we can delve into the local features of current data and sensitively record subtle changes in the data. Based on this, BiLSTM can model current sequences at a deeper level.
[0107] The process of extracting features using a parallel CNN is shown in the following equation, assuming that the input consists of N current sequences {a1, a2, ..., a...} N}. Here, CNN1() and CNN2() are the computation functions of a parallel CNN, which process a current sequence a through different branches of the CNN. t Convert to feature vector b 1t and b 2t The || operator concatenates two feature vectors and outputs x. t .
[0108] b 1t =CNN1(a t (8)
[0109] b 2t =CNN2(a t (9)
[0110] x t =b 1t ||b 2t (10)
[0111] 2.4) Overall Structure
[0112] The complete architecture of the anomaly detection model is in Figure 5 The model is built upon an optimized GAN. In this model, the latent space dimension is set to 20 to enhance the model's expressive power. The GAN framework consists of two generators and two discriminators. Each generator's internal structure comprises CNN and BiLSTM layers, where the CNN has a kernel size of 3 and the BiLSTM contains 100 hidden units. The other generator uses a two-layer BiLSTM structure with 64 hidden units. The discriminators employ fully connected layers to identify and distinguish subtle differences between sequences generated by the model and actually observed sequences.
[0113] 2.5) The training process is as follows:
[0114] Input the normal operation process current signal data set, initialize the parameters of the generator and discriminator in the GAN-BiLSTM model, and set the number of iterations. Randomly sample n sequence samples from the data set, and extract n random vectors from the normal distribution of random noise. Use the generator to generate n generated samples. Train the discriminator by fixing the generator; train the generator by fixing the discriminator. Loop the above training steps until the loss function values of the generator and the discriminator in the model tend to be stable.
[0115] Step 3) Use the trained GAN-BiLSTM model to score the current sequence based on the reconstruction error and the discriminator output respectively. The process is as follows:
[0116] 3.1) Abnormal score based on reconstruction error
[0117] The model generates a reconstructed sequence with a length matching the length of the current sequence by processing the current sequence with a length of L w Using the multi-coverage characteristics of the sliding window method, each current measurement point in the sequence is included in multiple windows. For any time j in the sequence, a set of reconstruction values The median of the set is taken as the reconstruction value of the current point at this time Finally, the reconstructed sequence is obtained
[0118] This method uses the dynamic time warping (DTW) algorithm to calculate the reconstruction error to avoid the drift characteristics of data features on the time axis and the misalignment problem between data points.
[0119] The DTW algorithm can be summarized as two main steps: first, calculate the distance matrix between two sequences, then find the optimal warping path in this matrix and calculate the warping distance As shown in the following formula, given two time series X=(x0,x1,…,x n ) and The distance between any two points in X and Y is calculated according to the formula.
[0120]
[0121] Where i∈{1,2,…,n}, j∈{1,2,…,b}.
[0122] As shown in the following formula, the distance matrix is obtained:
[0123]
[0124] Next, we use dynamic programming to find the optimal regular path for W, as shown in the following equation, where p k Indicates the position of the regular path, i.e., p k =(i,j) k x represents i and Alignment.
[0125] P best ={p1,p2,…,p k ,…,p K} (13)
[0126] Where n≤k≤2n-1.
[0127] p k By constructing the cost matrix, the matrix element γ(i,j) is defined as shown in the following equation.
[0128] γ(i,j)=d(i,j)+min[γ(i-1,j-1),γ(i-1,j),γ(i,j-1)] (14)
[0129] Among them, i∈{1,2,...,n}, j∈{1,2,...,n}, γ(0,0)=0, γ(i,0)=γ(0,j)=∞.
[0130] Optimal regularization path P best Dynamic time warping distance X and The cumulative distance value is minimized. The reconstruction error is calculated using the dynamic time-warped distance. As shown in the following formula:
[0131]
[0132] 3.2) Anomaly score based on discriminator output
[0133] During model training, the discriminator D x Its primary function is to distinguish between normal current sequences and sequences generated through reconstruction. Once the discriminator has completed training, its output can be directly used to determine whether a current sequence is abnormal. The discriminator output is shown in the following formula:
[0134]
[0135] Step 4) Abnormal score fusion
[0136] By fusing the reconstruction error with the discriminator output, the final anomaly score can be obtained.
[0137] 4.1) High reconstruction error and low discriminator output usually indicate sample abnormality. In order to standardize the evaluation, the error is normalized using z-score standardization method, which is shown as follows.
[0138]
[0139] where x represents the original data value, μ represents the mean of the original data set, and σ represents the original data.
[0140] The final anomaly score is defined as follows, the larger the score means the higher the possibility of abnormality, and the default value of λ is 0.5.
[0141] score = λZ rec (x) + (1-λ)Z dx (x) (18)
[0142] This method also attempts to calculate the anomaly score by multiplying the anomaly indicators, as shown in the following formula, and the default value of λ is 1.
[0143] score = λZ rec (x) × Z dx (x) (19)
[0144] 4.2) According to the anomaly score corresponding to each time series data point, the threshold can be used to determine the abnormal situation. Taking the anomaly score threshold as the optimization object, the best threshold is obtained by calculating the Gini index.
[0145] First, determine the initial threshold, calculate the absolute value vector E t of the error between the input current data and the reconstructed current data of each time of the training set μ , and then calculate the mean E σ and standard deviation E t of the data error at all times, the specific formula is as follows:
[0146]
[0147] Here, E t , E μ and E σ are n-dimensional vectors. Finally, take 3 times the standard deviation as the tolerance limit of anomaly detection, and get the initial anomaly score threshold thres, as shown in the following formula:
[0148] thres = E μ + 3E σ (23)
[0149] First, the obtained abnormal score set D is traversed, and each abnormal score score obtained by the traversal is taken as a value, and D is divided into two parts according to the rule that the abnormal score is less than or equal to the threshold value and the abnormal score is greater than the threshold value: D1={x|x<=score} and D2={x|x>score}. Then, the Gini index of set D is calculated. The Gini index is shown in the following formula.
[0150]
[0151] wherein C k is the kth sample subset in D, and K is the number of classes.
[0152] According to the case of performing a division operation on set D according to the initial threshold value thres, the Gini index of the set is defined as shown in the following formula.
[0153]
[0154] According to the case of performing a division operation on set D according to the threshold value thres, Gini(D, thres) can describe the uncertainty level of set D divided by the threshold value. The minimization of the Gini index indicates that the selected threshold value can effectively distinguish normal and abnormal samples.
[0155] 4.3) as Figure 6 As shown in the simulation results, the abnormal current sequence can be detected.
[0156] The present application also evaluates the model by F1 score (F1), precision (Precision) and recall (Recall).
[0157] In order to compare the performance of the algorithm, ARIMA, GAN and the algorithm in the present application are used to perform experiments on the scientific instrument data set and record the experimental results. Table 1 is the detection comparison result for the atomic absorption spectrometer instrument data set. It can be seen that the bidirectional GAN-BiLSTM algorithm proposed in the present application shows the best detection effect on the data set, with F1 of 90.14%, which is 0.77% higher than the second place and 3.92% higher than the unoptimized GAN.
[0158] Table 1
[0159]
[0160] The above only describes the preferred embodiments of the present application, and the protection scope of the present application is not limited to the above embodiments. Any equivalent modifications or changes made by those skilled in the art according to the disclosed content of the present application shall be included in the protection scope recited in the claims.
Claims
1. A non-intrusive abnormal current detection method characterized by The method comprises the following steps: (1) Instrument equipment current data acquisition and dataset establishment: The data in the dataset is the current data of the instrument equipment including two labels, and the two labels are label one and label two respectively; The label one includes normal and abnormal working states of the instrument equipment; The label two is the time of current acquisition; The current data of the instrument equipment is arranged according to time to obtain time sequence current data; The time sequence current data is processed by using a normalization method, and the time sequence current data is mapped to a unified interval [0, 1]; (2) An algorithm model is built based on a GAN network and a BiLSTM algorithm to obtain a GAN-BiLSTM model; The GAN-BiLSTM model takes a cycle consistency generative adversarial network as an algorithm framework, and the cycle consistency generative adversarial network is composed of a forward adversarial network and a reverse adversarial network, and the forward adversarial network is denoted as forward GAN; the reverse adversarial network is denoted as reverse GAN; Both the forward GAN and the reverse GAN include a generator and a discriminator; the generator of the algorithm framework is constructed based on a CNN feature extraction module and a BiLSTM algorithm; The discriminator is composed of a full connection layer; The generators of the forward GAN and the backward GAN are generator G and generator ; The discriminators of the forward GAN and the backward GAN are discriminators and discriminators respectively. (3) The GAN-BiLSTM model trained is used to process a current sequence, and the current sequence is specifically time sequence instrument equipment current data; The instrument equipment is an atomic absorption spectrometer; Reconstruction errors and discriminator outputs are obtained respectively, an abnormal threshold is constructed based on the reconstruction errors and the discriminator outputs, the abnormal threshold is optimized according to a Gini index, and abnormal current data points in the current sequence are obtained; The training process of the GAN-BiLSTM model comprises the following steps: extracting training data from the data set obtained from said step (1) ; Train the data and random sampling white noise Input the CNN feature extraction module, mine the local characteristics of the input vector, and obtain the data after feature extraction; The data after feature extraction by the BiLSTM algorithm is processed bidirectionally, dynamic change trends of the time sequence are captured and integrated, and finally realistic sequence data are obtained by combining input training data and randomly sampled white noise; The sequence data and the data in the training set are input into the discriminator, which outputs data from the training data. The difference between the input data and the sequence data output by the generator is used to evaluate the probability that the input data is from the training set. In the specific training, the generator and discriminator parameters in the model are initialized first, and the objective function is constructed , the generator is trained and the discriminator is trained in turn, and the iteration optimization is cycled until the objective function tends to be stable; The construction of the objective function comprising the steps of: Based on the training data and the sequence data output by the generator , the adversarial objective function is generated ; wherein ; X is the input data domain, is the distribution of is a set of 1-Lipschitz continuous functions; Generator based on latent vector space Generated sequence data With its discriminator Adversarial objective function ; ; Minimizing training data The L2 norm of the reconstructed sample The adversarial objective function is given by ; Combining the above three losses, the final objective function is obtained As shown in the following formula: ; In step (3), the reconstruction error acquisition method comprises the following steps: Given two time series and the distance between any 2 points in and is calculated as ; wherein , ; The distance matrix obtained: ; Next, the idea of dynamic programming is used to find the optimal rectification path as follows: ; wherein represents a regularized path position, i.e. represents with alignment, ; By constructing a cost matrix, the matrix elements are determined as follows: ; wherein , , , ; optimal warping path dynamic time warping distance such that and cumulative distance value is minimized; dynamic time warping distance computes reconstruction error as follows: ; In step (3), the abnormal threshold is constructed based on the reconstruction error and the discriminator output, the abnormal threshold is optimized according to the Gini index, and the abnormal current data points in the current sequence are obtained, comprising the following steps: (3.1) fusing reconstruction error and discriminator output to obtain a set of anomaly scores ; The reconstruction error is normalized by a z-score normalization method and the discriminator output respectively to obtain abnormality indexes and ; Anomaly score set Each element is an anomaly score score, which is calculated as follows, The value of the constant c is 0.5; ; (3.2) Construct an abnormal threshold and optimize the abnormal threshold according to the Gini index Statistical training data and sequence data output by the generator Mean of errors Standard deviation of errors Taking 3 times the standard deviation as the tolerance limit of anomaly detection, an initial anomaly threshold is obtained As shown in the following formula: ; traversing the set of anomaly scores ; and comparing each anomaly score score obtained by the traversing with a threshold value thres, and classifying the anomaly score according to the rule of anomaly score less than or equal to the threshold value and anomaly score greater than the threshold value into two parts: and ; The Gini index of the collection is calculated in the following manner: Gini Index = 1 - ∑(Pi2) ; The initial abnormal threshold is optimized by minimizing the Gini index to obtain an optimized threshold.
Citation Information
Patent Citations
Abnormal traceability method and system for electricity utilization information acquisition system
CN117648215A