Abnormal data detection method in high voltage metering process
By establishing an abnormal data detection model in the high-voltage metering process, using graph attention meter network and reconstruction diffusion model to extract and reconstruct the multi-dimensional time series, the problem of low accuracy of data abnormal detection in high-voltage metering is solved, and efficient abnormal data detection and real-time response are achieved.
Patent Information
- Application Number
- CN202411700163.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-04-04
AI Technical Summary
During the high-pressure metering process, due to factors such as equipment aging and environmental impact, data abnormalities are frequent, and it is difficult for the existing technology to achieve accurate abnormal identification and real-time response.
An abnormal data detection method is adopted, by establishing an abnormal data detection model including the reconstruction part and the diffusion part, using the graph attention meter network to perform feature extraction and spatiotemporal feature mining on historical multi-dimensional time data, combining the reconstruction and diffusion model to reconstruct the multi-dimensional time series and remove noise, and then detect abnormal data.
It improves the detection accuracy of abnormal data during high-voltage measurement, can capture complex interactive relationships in multivariate time series data, reduces the risks of misjudgment and misjudgment, and realizes real-time abnormal data detection and alarm issuance.
Smart Images

Figure CN119759983A_ABST
Abstract
Description
Technical Field
[0001] The present invention specifically relates to a method for detecting abnormal data in a high-voltage metering process, and belongs to the technical field of abnormal data detection. Background Art
[0002] In the actual high-voltage metering process, various data anomalies are prone to occur due to factors such as equipment aging, environmental impact, and complex power load fluctuations. If these anomalies are not identified and handled in a timely and effective manner, a series of problems may occur. Existing technologies mainly rely on manual on-site detection or monitoring methods based on preset thresholds to deal with abnormal problems in high-voltage metering. However, these methods have some inherent defects: manual detection is inefficient, not only requires a lot of manpower and time, but also cannot respond in real time, especially in the face of scenes with wide distribution of equipment and harsh operating environment, manual detection is even more insufficient. At the same time, manual detection is easily affected by subjective judgment, and there is a certain risk of misjudgment or missed judgment. In addition, it is difficult to identify complex anomalies. Abnormal phenomena are not caused by a single factor, but may be caused by the interaction of multiple complex factors at the same time. Traditional single detection methods are difficult to achieve accurate anomaly identification in complex environments, and these methods lack in-depth use of historical data. They are usually only used for simple monitoring and display, and fail to fully tap the potential value in historical data. If it is possible to conduct in-depth analysis based on historical data and extract the occurrence patterns and trends of abnormal data, it will help to predict potential risks in advance and provide an important basis for subsequent abnormal processing and maintenance. Summary of the invention
[0003] The technical problem to be solved by the present invention is: how to improve the detection accuracy of abnormal data in a high-voltage metering process.
[0004] In order to solve the above technical problems, the technical solution proposed by the present invention is: a method for detecting abnormal data in a high-voltage metering process, comprising the following steps:
[0005] Step 1: Establish an abnormal data detection model, which includes a reconstruction part and a diffusion part. The reconstruction part is shown in the following formula (1):
[0006]
[0007] In formula (1), is the output of the reconstruction part; h out is the hidden state; J is the first weight matrix; b is the bias variable; g is the control variable; H decoder is the output of the last layer of the encoder; u is the randomly sampled μ(x) and σ 2 (x) is the mathematical expectation and variance of the random latent variable; ε is the adjustment parameter; F μ(s) and F σ (s) are the expected feedforward function and variance feedforward function of the random variable; diag(·) is a diagonal matrix generated with the input vector as diagonal elements; F1 and F2 are the first feedforward function and the second feedforward function; ReLU(·) is an activation function; MultiHead(Q,K,V) is the output of the multi-head self-attention in the encoder; Attention(Q,K,V) is the attention weight matrix; softmax(·) is a normalization function; Q, K and V are the query vector matrix, key vector matrix and value vector matrix respectively; d k refers to the dimension of the query and key vectors; W Q , W k and W v They are query weight matrix, key weight matrix and value weight matrix respectively; X1 is the input of the reconstruction part;
[0008] The diffusion part is shown in the following formula (2):
[0009]
[0010] In formula (2), represents the output after being processed by the internal level of the diffusion model; μ θ () Noise removal function; β i , (i=1,2,...,n) is the noise increase coefficient, is the noise removal coefficient;
[0011] Step 2: Collect historical multidimensional time data sequences in the historical high-voltage metering process to train the abnormal data detection model, and obtain the trained abnormal data detection model; the trained abnormal data detection model takes the multidimensional time series feature matrix as input and takes the reconstructed multidimensional time series matrix as output;
[0012] The training process of the abnormal data detection model is as follows:
[0013] Step 2.1: Collect the historical multidimensional time data sequence matrix X with a time series length of N in the historical high-voltage metering process ls To train the abnormal data detection model, the historical multidimensional time data series matrix X ls As shown in the following formula (3),
[0014]
[0015] In formula (3), x ls1 、x ls2 , ... to x lsNThe first historical multidimensional time series, the second historical multidimensional time series to the Nth historical multidimensional time series collected in chronological order in the process of the time series length N in the historical high-voltage metering respectively; arrive are the M variables in the first historical multidimensional time series; arrive are the M variables in the second historical multidimensional time series respectively; arrive are respectively the M variables in the Nth historical multidimensional time series;
[0016] The historical multidimensional time data series set X is analyzed by sliding window method. ls All the sequences in are divided into d historical division multidimensional time series matrices, as shown in the following formula (4):
[0017]
[0018] Step 2.2: The d historically divided multidimensional time series matrices are subjected to feature extraction through the graph attention network to obtain the historical multidimensional time series feature matrix H ls , as shown in the following formula (5),
[0019]
[0020] In formula (5), softmax(·) is the activation function; e(h i ,h j ) is the attention score of node i and node j;
[0021] Step 2.3: Input the multidimensional time series feature matrix H into the reconstruction part to obtain the first reconstruction matrix of the first multidimensional time data series output by the reconstruction part Reconstruct the first multidimensional time data series into a matrix With the historical multidimensional time data series matrix X ls Substitute it into the following formula (6) to calculate the loss of the reconstructed part:
[0022]
[0023] In formula (6), MSE(·) is the mean square error function;
[0024] If the loss of the reconstructed part is greater than the reconstruction loss threshold, updating the parameters in the reconstructed part according to the loss of the reconstructed part;
[0025] If the loss of the reconstructed part is less than the reconstruction loss threshold, it means that the training of the reconstructed part is completed;
[0026] Step 2.4: Reconstruct the matrix of the first multidimensional time data sequence output by the reconstruction part Substituted into the diffusion part to obtain the second reconstruction matrix of the first multidimensional time data sequence output by the diffusion part The loss of the diffusion part is calculated by the following formula (7):
[0027]
[0028] In formula (7), ε θ is the noise predicted by the model, which represents the noise predicted by the network based on the input and noise level n; ε is the real noise added in the forward process to generate noisy data; α n is the noise intensity factor, which is related to the noise level n and controls the degree of noise addition; n is the noise level or time step number, representing the current noise intensity;
[0029] If the loss of the diffusion part is greater than the diffusion loss threshold, updating the parameters in the reconstruction part according to the loss of the diffusion part;
[0030] If the loss of the diffusion part is less than the diffusion loss threshold, it means that the training of the diffusion part is completed;
[0031] Step 2.5: Repeat steps 2.1 to 2.4 until the reconstruction part and the diffusion supplement in the abnormal data detection model are trained, at which point the abnormal data detection model is trained;
[0032] Step 3: Real-time acquisition of a real-time multidimensional time data sequence with a time series length of N that needs to be detected for abnormal data during the high-voltage metering process to form a real-time multidimensional time data sequence matrix X ss As shown in the following formula (8),
[0033]
[0034] In formula (3), x ss1 、x ss2 , ... to x ssN The first real-time multidimensional time series, the second real-time multidimensional time series to the Nth real-time multidimensional time series collected in chronological order in the process of the time series length N in the real-time high-voltage metering; arrive are respectively M variables in the first real-time multidimensional time series; arrive are respectively M variables in the second real-time multidimensional time series; arrive are respectively the M variables in the Nth real-time multidimensional time series;
[0035] According to the principles in steps 2.1 and 2.2, the real-time multidimensional time series feature matrix H is obtained. ss , as shown in the following formula (9),
[0036]
[0037] The real-time multi-dimensional time series matrix feature matrix H ss Substitute into the trained abnormal data detection model to obtain the reconstructed real-time multidimensional time series matrix The reconstructed real-time multidimensional time series matrix With the real-time multidimensional time data series matrix X ss Subtracting the real-time difference matrix to obtain the real-time difference matrix, and calculating the modulus of the real-time difference matrix;
[0038] If the calculated modulus is less than the abnormal data detection threshold, it means that a real-time multi-dimensional time data sequence with a time series length of N in the high-voltage metering process that needs to be detected for abnormal data is not abnormal data;
[0039] If the calculated modulus is greater than the abnormal data detection threshold, it means that a real-time multidimensional time data sequence with a time series length of N in the high-voltage metering process that needs to be detected for abnormal data is abnormal data, and an alarm is issued.
[0040] The beneficial effects of the present invention are as follows: the present invention establishes an abnormal data detection model through a reconstruction part and a diffusion part, and performs preliminary mining of the spatiotemporal features of historical data through graph attention, extracts a multidimensional time feature matrix, further mines the spatiotemporal features by substituting the multidimensional time feature matrix into the reconstruction model and the diffusion module, reconstructs the original multidimensional time series matrix, and detects abnormal data by taking the modulus of the difference matrix between the reconstructed matrix and the original matrix. Compared with the existing abnormal detection method, the present invention mines the spatial dependency and temporal dependency between variables in multivariate time series data, effectively captures the complex interactive relationship between different timestamps and variables in the data, and improves the accuracy of abnormal detection. At the same time, the present invention introduces a denoising diffusion part in the detection process, and utilizes its ability to gradually remove noise to further improve the detection effect of abnormal data. In the process of reconstructing data multiple times, the diffusion model can effectively remove noise and anomalies, obtain smoother reconstruction results, and make the detection more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 The present invention is a flowchart of a method for detecting abnormal data in a high-voltage metering process.
[0042] Figure 2 It is the network structure of the reconstruction part in the abnormal data detection method of the present invention.
[0043] Figure 3 It is the network structure of the graph attention network of the abnormal data detection method in the present invention. DETAILED DESCRIPTION
[0044] The following is a further description of an abnormal data detection method in a high-voltage metering process of the present invention in conjunction with the accompanying drawings and specific embodiments.
[0045] Example
[0046] The abnormal data detection method in the high voltage metering process in this embodiment is as follows: Figure 1 As shown, the following steps are included:
[0047] Step 1: Establish an abnormal data detection model. The abnormal data detection model includes a reconstruction part and a diffusion part. The reconstruction part is shown in the following formula (1). The network structure of the reconstruction part is as follows: Figure 2 As shown,
[0048]
[0049] In formula (1), is the output of the reconstruction part; h out is the hidden state; J is the first weight matrix; b is the bias variable; g is the control variable; H decoder is the output of the last layer of the encoder; u is a random sample; δ[;] is (); μ(x) and σ 2 (x) is the mathematical expectation and variance of the random latent variable; ε is the adjustment parameter; F μ (s) and F σ (s) is the expected feedforward function and variance feedforward function of the random variable; diag(·) is the diagonal matrix generated with the input vector as the diagonal element; F1 and F2 are the first feedforward function and the second feedforward function; ReLU(·) is the activation function; MultiHead(Q,K,V) is the output of the multi-head self-attention in the encoder;
[0050] Attention(Q,K,V) is the attention weight matrix; softmax(·) is the normalization function, and the calculated attention weights are normalized; Q, K, and V are the query vector matrix, key vector matrix, and value vector matrix, respectively; d k Refers to the dimensions of the query and key vectors, mainly used for scaling operations in the self-attention mechanism;
[0051] W Q , W k and W v They are query weight matrix, key weight matrix and value weight matrix respectively; X1 is the input of the input reconstruction part;
[0052] The diffusion part is shown in the following formula (2):
[0053]
[0054] In formula (2), represents the output after the diffusion model; μ θ () is the noise predicted by the model, about The calculation is to train a network ε θ To predict a given The noise ε~N(0,1); β n ∈(0,1) and increases linearly with n, α n =1-β n and α n is a noise control parameter that gradually increases with n;
[0055] Step 2: Collect historical multidimensional time data series in the historical high-voltage metering process to train the abnormal data detection model, and obtain a trained abnormal data detection model; the trained abnormal data detection model takes the multidimensional time series feature matrix as input and takes the reconstructed multidimensional time series matrix as output;
[0056] The training process of the anomaly data detection model is as follows:
[0057] Step 2.1: Collect the historical multidimensional time data sequence matrix X with a time series length of N in the historical high-voltage metering process ls To train the abnormal data detection model, the historical multidimensional time data series matrix X ls As shown in the following formula (3),
[0058]
[0059] In formula (3), x ls1 、x ls2 , ... to x lsN The first historical multidimensional time series, the second historical multidimensional time series to the Nth historical multidimensional time series collected in chronological order in the process of the time series length N in the historical high-voltage metering respectively; arrive are the M variables in the first historical multidimensional time series; arrive are the M variables in the second historical multidimensional time series;
[0060] arrive are the M variables in the Nth historical multidimensional time series;
[0061] The historical multidimensional time data series set X is analyzed by sliding window method. lsAll the sequences in are divided into d historical division multidimensional time series matrices, as shown in the following formula (4):
[0062]
[0063] Step 2.2: The d historically divided multidimensional time series matrices are extracted through the graph attention network to obtain the historical multidimensional time series feature matrix H ls , as shown in the following formula (5), the graph attention network is Figure 3 As shown,
[0064]
[0065] In formula (5), softmax(·) is a common activation function, which is usually used in the output layer of classification tasks and is also often used for weight normalization in attention mechanisms. ; e(h i ,h j ) is the attention score of node i and node j, usually expressed as some similarity measure of their feature representations, e(h i ,h j )=LeakyReLU(μ T [Wh i ||Wh j ]), where LeakyReLU is a nonlinear activation function, μ∈R 2m is the learnable weight vector, m is the feature vector of each node;
[0066] Step 2.3: Input the multidimensional time series feature matrix H into the reconstruction part to obtain the first reconstruction matrix of the first multidimensional time data series output by the reconstruction part Reconstruct the first multidimensional time data series into a matrix With the historical multidimensional time data series matrix X ls Substitute it into the following formula (6) to calculate the loss of the reconstruction part,
[0067]
[0068] In formula (6), MSE(·) is the mean square error function;
[0069] If the loss of the reconstructed part is greater than the reconstruction loss threshold, the parameters in the reconstructed part are updated by the loss of the reconstructed part;
[0070] If the loss of the reconstructed part is less than the reconstruction loss threshold, the training of the reconstructed part is completed;
[0071] Step 2.4: Reconstruct the matrix of the first multidimensional time data series output by the reconstruction part Substitute into the diffusion part to obtain the second reconstruction matrix of the first multidimensional time data sequence output by the diffusion part The loss of the diffusion part is calculated by the following formula (7):
[0072]
[0073] In formula (7), ε θ is the noise predicted by the model, which represents the noise predicted by the network based on the input and noise level n; ε is the real noise added in the forward process to generate noisy data; α n is the noise intensity factor, which is related to the noise level n and controls the degree of noise addition; n is the noise level or time step number, representing the current noise intensity.
[0074] If the loss of the diffusion part is greater than the diffusion loss threshold, the parameters in the diffusion part are updated by the loss of the diffusion part;
[0075] If the loss of the diffusion part is less than the diffusion loss threshold, the diffusion part training is completed;
[0076] Step 2.5: Repeat steps 2.1 to 2.4 until the reconstruction part and diffusion supplement in the abnormal data detection model are trained. At this time, the abnormal data detection model is trained.
[0077] Step 3: Real-time acquisition of a real-time multidimensional time data sequence with a time series length of N that needs to be detected for abnormal data during the high-voltage metering process to form a real-time multidimensional time data sequence matrix X ss As shown in the following formula (8),
[0078]
[0079] In formula (3), x ss1 、x ss2 , ... to x ssN The first real-time multidimensional time series, the second real-time multidimensional time series to the Nth real-time multidimensional time series collected in chronological order in the process of the time series length N in the real-time high-voltage metering; arrive are the M variables in the first real-time multidimensional time series; arrive are the M variables in the second real-time multidimensional time series;
[0080] arrive are the M variables in the Nth real-time multidimensional time series;
[0081] According to the principles in steps 2.1 and 2.2, the real-time multidimensional time series feature matrix H is obtained.ss , as shown in the following formula (9),
[0082]
[0083] The real-time multidimensional time series matrix feature matrix H ss Substitute it into the trained abnormal data detection model to obtain the reconstructed real-time multi-dimensional time series matrix The reconstructed real-time multidimensional time series matrix
[0084] With real-time multidimensional time data series matrix X ss Subtracting the real-time difference matrix, and calculating the modulus of the real-time difference matrix;
[0085] If the calculated modulus is less than the abnormal data detection threshold, it means that a real-time multi-dimensional time data sequence with a time series length of N in the high-voltage metering process that needs to be detected for abnormal data is not abnormal data;
[0086] If the calculated modulus is greater than the abnormal data detection threshold, it means that a real-time multidimensional time data sequence with a time series length of N in the high-voltage metering process that needs to be detected for abnormal data is abnormal data, and an alarm is issued.
Claims
1. A method for detecting abnormal data in a high-voltage metering process, characterized in that: The following steps are involved: Step 1: Establish an abnormal data detection model, which includes a reconstruction part and a diffusion part. The reconstruction part is shown in the following formula (1): In formula (1), is the output of the reconstruction part; h out is the hidden state; J is the first weight matrix; b is the bias variable; g is the control variable; H decoder is the output of the last layer of the encoder; u is a random sample; μ(x) and σ 2 (x) is the mathematical expectation and variance of the random latent variable; ε is the adjustment parameter; F μ (s) and F σ (s) are the expected feedforward function and variance feedforward function of the random variable; diag(·) is a diagonal matrix generated with the input vector as diagonal elements; F1 and F2 are the first feedforward function and the second feedforward function; ReLU(·) is an activation function; MultiHead(Q,K,V) is the output of the multi-head self-attention in the encoder; Attention(Q,K,V) is the attention weight matrix; softmax(·) is a normalization function; Q, K and V are the query vector matrix, key vector matrix and value vector matrix respectively; d k refers to the dimension of the query and key vectors; W Q , W k and W v They are query weight matrix, key weight matrix and value weight matrix respectively; X1 is the input of the reconstruction part; The diffusion part is shown in the following formula (2): In formula (2), represents the output after being processed by the internal level of the diffusion model; μ θ () Noise removal function; β i , (i=1,2,...,n) is the noise increase coefficient, is the noise removal coefficient; Step 2: Collect historical multidimensional time data sequences in the historical high-voltage metering process to train the abnormal data detection model, and obtain the trained abnormal data detection model; the trained abnormal data detection model takes the multidimensional time series feature matrix as input and takes the reconstructed multidimensional time series matrix as output; The training process of the abnormal data detection model is as follows: Step 2.1: Collect the historical multidimensional time data series matrix X with a time series length of N in the historical high-voltage metering process ls To train the abnormal data detection model, the historical multidimensional time data series matrix X ls As shown in the following formula (3), In formula (3), x ls1 、x ls2 , ... to x lsN The first historical multidimensional time series, the second historical multidimensional time series to the Nth historical multidimensional time series collected in chronological order in the process of the time series length N in the historical high-voltage metering respectively; arrive are the M variables in the first historical multidimensional time series; arrive are the M variables in the second historical multidimensional time series respectively; arrive are respectively the M variables in the Nth historical multidimensional time series; The historical multidimensional time data series set X is analyzed by sliding window method. ls All the sequences in are divided into d historical division multidimensional time series matrices, as shown in the following formula (4): Step 2.2: The d historically divided multidimensional time series matrices are subjected to feature extraction through the graph attention network to obtain the historical multidimensional time series feature matrix H ls , as shown in the following formula (5), In formula (5), softmax(·) is the activation function; e(h i ,h j ) is the attention score of node i and node j; Step 2.3: Input the multidimensional time series feature matrix H into the reconstruction part to obtain the first reconstruction matrix of the first multidimensional time data series output by the reconstruction part Reconstruct the first multidimensional time data series into a matrix With the historical multidimensional time data series matrix X ls Substitute it into the following formula (6) to calculate the loss of the reconstructed part: In formula (6), MSE(·) is the mean square error function; If the loss of the reconstructed part is greater than the reconstruction loss threshold, updating the parameters in the reconstructed part according to the loss of the reconstructed part; If the loss of the reconstructed part is less than the reconstruction loss threshold, it means that the training of the reconstructed part is completed; Step 2.4: Reconstruct the matrix of the first multidimensional time data sequence output by the reconstruction part Substituted into the diffusion part to obtain the second reconstruction matrix of the first multidimensional time data sequence output by the diffusion part The loss of the diffusion part is calculated by the following formula (7): In formula (7), ε θ is the noise predicted by the model, which represents the noise predicted by the network based on the input and noise level n; ε is the real noise added in the forward process to generate noisy data; α n is the noise intensity factor, which is related to the noise level n and controls the degree of noise addition; n is the noise level or time step number, representing the current noise intensity; If the loss of the diffusion part is greater than the diffusion loss threshold, updating the parameters in the reconstruction part according to the loss of the diffusion part; If the loss of the diffusion part is less than the diffusion loss threshold, it means that the training of the diffusion part is completed; Step 2.5: Repeat steps 2.1 to 2.4 until the reconstruction part and the diffusion supplement in the abnormal data detection model are trained, at which point the abnormal data detection model is trained; Step 3: Real-time acquisition of a real-time multidimensional time data sequence with a time series length of N that needs to be detected for abnormal data during the high-voltage metering process to form a real-time multidimensional time data sequence matrix X ss As shown in the following formula (8), In formula (3), x ss1 、x ss2 , ... to x ssN The first real-time multidimensional time series, the second real-time multidimensional time series to the Nth real-time multidimensional time series collected in chronological order in the process of the time series length N in the real-time high-voltage metering; arrive are respectively M variables in the first real-time multidimensional time series; arrive are respectively M variables in the second real-time multidimensional time series; arrive are respectively the M variables in the Nth real-time multidimensional time series; According to the principles in steps 2.1 and 2.2, the real-time multidimensional time series feature matrix H is obtained. ss , as shown in the following formula (9), The real-time multi-dimensional time series matrix feature matrix H ss Substitute into the trained abnormal data detection model to obtain the reconstructed real-time multidimensional time series matrix The reconstructed real-time multidimensional time series matrix With the real-time multidimensional time data series matrix X ss Subtracting the real-time difference matrix to obtain the real-time difference matrix, and calculating the modulus of the real-time difference matrix; If the calculated modulus is less than the abnormal data detection threshold, it means that a real-time multi-dimensional time data sequence with a time series length of N in the high-voltage metering process that needs to be detected for abnormal data is not abnormal data; If the calculated modulus is greater than the abnormal data detection threshold, it means that a real-time multidimensional time data sequence with a time series length of N in the high-voltage metering process that needs to be detected for abnormal data is abnormal data, and an alarm is issued.