Method for detecting abnormal value of power utilization data of low-voltage transformer area
By applying mean drift clustering and outlier detection methods of hybrid deep neural networks in the power consumption data in low-voltage table areas, the problem of insufficient detection accuracy in the prior art is solved, and high-precision identification of complex power consumption behavior is achieved, ensuring the stable operation of the power system.
Patent Information
- Application Number
- CN202411459191.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-03-18
AI Technical Summary
The prior art lacks accuracy in the detection of outlier value of electricity consumption data in low-voltage table areas, making it difficult to effectively identify complex and changeable electricity consumption behaviors, affecting the safety and stability of the power system.
The outlier detection method based on mean drift clustering and hybrid deep neural network is adopted to collect electricity data through smart electricity meters, and the vacant values are filled with low-rank matrix completion method with a minimization of core norm. The users are classified based on the mean drift clustering algorithm, and the normal power consumption mode is learned through the FPA-CNN-BiLSTM network to detect outliers.
It significantly improves the accuracy of outlier detection of smart meter data in low-voltage table areas, improves the ability to identify abnormal electricity use behaviors, ensures the stable operation of the power system and optimizes the power resource scheduling.
Smart Images

Figure CN119646694A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of outlier detection, and relates to a method for detecting outlier values of low-voltage power consumption data, and in particular to a method for detecting outlier values of low-voltage power consumption data based on mean shift clustering and hybrid deep neural network. Background Art
[0002] With the continuous development of smart grids, smart meters have become important data collection devices in power systems, which can record the power consumption data of low-voltage users in real time. However, due to factors such as equipment failure, channel congestion, and power outages, abnormal values that deviate significantly from the normal range often appear in the data collected by smart meters. These abnormal values not only affect the accurate assessment of user power consumption behavior, but may also lead to wrong decisions in the operation of the power system, thereby threatening the safety and stability of the power grid. Accurate outlier detection can enhance the power system's ability to identify abnormal power consumption behavior, provide more reliable data support for the safe and stable operation of the power grid, and promote the smart power system to a higher level of intelligence and automation.
[0003] Traditional outlier detection methods such as box plots and 3σ criteria may be effective when processing simple data, but their detection effect is often insufficient when facing complex and changeable electricity consumption behaviors. With the development of artificial intelligence technology, outlier detection methods based on machine learning, such as cluster analysis and artificial neural networks, have gradually attracted attention. It is worth noting that clustering methods such as k-means clustering and fuzzy C-means clustering are unsupervised learning methods, while artificial neural networks are supervised learning methods.
[0004] The supervised learning method in the existing technology can be used to screen outliers in the electricity consumption data of low-voltage users. Machine learning methods can better identify outliers by learning patterns in historical electricity consumption data. However, due to the diversity and complexity of user electricity consumption behaviors, how to further improve the accuracy of outlier detection is still a challenge that needs to be solved.
[0005] After searching, no public documents of the prior art identical or similar to the present invention were found. Summary of the invention
[0006] The purpose of the present invention is to overcome the deficiencies of the prior art and to propose a method for detecting abnormal values of electricity consumption data in low-voltage areas, which can improve the accuracy of abnormal value detection of smart meter data in low-voltage areas.
[0007] The present invention solves the practical problem by adopting the following technical solutions:
[0008] A method for detecting abnormal values of low-voltage power consumption data includes the following steps:
[0009] Step 1: Collect electricity consumption data of all users through smart meters installed in low-voltage areas;
[0010] Step 2: Repair the electricity consumption data collected in step 1 and fill in the missing values;
[0011] Step 3: Based on the power consumption data after repair in step 2, users in the low-voltage area are classified according to their power consumption characteristics;
[0012] Step 4: Based on normal data that does not contain outliers, establish an FPA-CNN-BiLSTM outlier detection model trained with normal data;
[0013] Step 5: Use the FPA-CNN-BiLSTM outlier detection model trained in step 4 to predict the test set data containing outliers and calculate the prediction error. If the prediction error of a data point exceeds the threshold, it is marked as an outlier.
[0014] Moreover, the specific steps of step 2 include:
[0015] The missing values caused by meter failure, channel congestion, and power outages are completed using a low-rank matrix completion method based on nuclear norm minimization.
[0016] (1) Assume that the original electricity consumption matrix with missing values is M, then the low-rank matrix completion model can be described as the following optimization problem:
[0017]
[0018] Where: X is the filled power matrix; rank(·) is the rank function of the matrix; P Ω is the position operator, and Ω is the position set of observable data.
[0019] (2) The rank function in the above low-rank matrix completion model is replaced by the nuclear norm of the matrix, thereby transforming it into a low-rank matrix completion model based on minimizing the nuclear norm:
[0020]
[0021] Secondly, increase L 1,1 The penalty term is used to prevent the model from overfitting, so the low-rank matrix completion model is transformed into:
[0022]
[0023] Where: P Ω (E) = 0; ||E|| 1,1 That is L 1,1 Norm, also called L 1,1 Penalty term. The constraint of formula (4) is removed by the Lagrange multiplier L, and the formula is:
[0024]
[0025] When Y=Y k , u=u k , solve equation (5) by the alternating direction multiplication method. First, let Then we have:
[0026]
[0027] By finding X k+1 , update the matrix E k+1 :
[0028]
[0029] By finding X k+1 and E k+1 , update the matrix Y k+1 :
[0030] Y k+1 =Y k +μ k (P Ω -X k+1 -E k+1 ) (8)
[0031] After the alternating direction multiplication method is iterated, the filled complete power consumption matrix X is output. Based on the complete power consumption matrix X, the missing values in the original power consumption matrix M are filled.
[0032] Moreover, the specific method of step 3 is:
[0033] According to the user's electricity consumption characteristics, users in the substation area are classified based on the mean shift clustering algorithm:
[0034] Based on the mean shift clustering algorithm, the completed electricity consumption data is X∈R m×n , x i The kernel density estimation function is:
[0035]
[0036] Where: C k is the scaling constant; k(x) is the kernel function; h is the kernel width; x is the initial center point.
[0037] The derivative calculation of the gradient function is:
[0038]
[0039] Introducing the Gaussian kernel function into equation (10), we get the mean shift vector M h (x):
[0040]
[0041] Finally, based on the mean shift vector, the classification of users in the low-voltage area is achieved.
[0042] Moreover, the specific steps of establishing the FPA-CNN-BiLSTM outlier detection model in step 4 include:
[0043] (1) Based on normal data that does not contain outliers, a convolutional neural network (CNN) is trained for different categories of low-voltage users, and deep local correlation features of electricity consumption data are extracted through CNN.
[0044] (2) Based on normal data that does not contain outliers, for different categories of low-voltage users, the deep local correlation features extracted by the CNN layer are used as input to train a bidirectional long short-term memory (BiLSTM) neural network, and the global time series features of the electricity consumption data are extracted through BiLSTM.
[0045] (3) The FPA algorithm is used to find the optimal hyperparameters of the CNN-BiLSTM network, including the number of CNN layers, the number of BiLSTM layers, the number of neurons in the BiLSTM layer, and the learning rate, and then the FPA-CNN-BiLSTM outlier detection model trained with normal data is obtained;
[0046] Moreover, the specific method of step 3 (1) is:
[0047] The convolution layer of CNN converts the local information of the input power consumption data into a feature map through the convolution operation of the local receptive field, thereby effectively extracting the local features of the power consumption data;
[0048] The calculation formula of the convolutional layer is as follows:
[0049]
[0050] in, and are the nth new feature map of layer l and the mth feature map of layer l-1 respectively. The first feature map is the original electricity consumption data. f() is the activation function. This study uses the rectified linear unit as the activation function. m map is the feature atlas of layer l-1; is the convolution operation; is a convolution filter that connects the m-th feature map of layer l-1 with the n-th feature map of layer l; is the bias of the nth new feature map of layer l.
[0051] The pooling layer of CNN uses downsampling technology to extract important feature information from the low-voltage user electricity consumption feature map and further compress the feature map information;
[0052] Select the maximum pooling method as the downsampling technique, and select the maximum value of the pooling window as the pooling feature value of the area. The calculation formula is as follows:
[0053]
[0054] in, represents the oth pooled feature map of layer l+1, n pool Represents the feature atlas of layer l before pooling.
[0055] Moreover, the specific method of step 3 (2) is:
[0056] Assume that the input of the BiLSTM neural network is p t , output h t Then:
[0057]
[0058]
[0059] Where: → and ← are the forward propagation and backward propagation of LSTM respectively; f for and f back are the forward LSTM layer function and the backward LSTM layer function respectively; f, i and o are the input gate, input gate and output gate respectively; c and c' are the cell state and intermediate cell state respectively; W and b are the weight and bias in the network parameters respectively; δ and are sigmoid and tanh activation functions respectively; ⊙ represents point-by-point multiplication; t represents time. Based on the deep local correlation features extracted by the CNN layer, the BiLSTM layer is used to extract the global time series features of the power consumption data. The CNN-BiLSTM network can effectively extract the local correlation features and global time series features of the power consumption data, and use these features to complete the missing values.
[0060] Moreover, the specific method of step 3 (3) is:
[0061] 1) Set the parameters of FPA, including the number of individuals in the pollen population, the search range of pollen individuals, the maximum number of iterations, the step size scaling factor, and the global pollination probability.
[0062] 2) Find the hyperparameter dimension of the CNN-BiLSTM network to be 4, namely the number of CNN layers, the number of BiLSTM layers, the number of neurons in the BiLSTM layer, and the learning rate.
[0063] 3) Initialize the population, calculate its fitness value, and select the best performing individual as the optimal individual in the current population. The fitness is the root mean square error of the CNN-BiLSTM network training, and the calculation formula is as follows:
[0064]
[0065] Where: is the predicted value of CNN-BiLSTM network; y i is the true value; n is the number of predicted sample points.
[0066] 4) Generate a random number. If it is less than the global pollination probability, then global pollination is performed to update the population; otherwise, local pollination is performed to update the population. The formula for global pollination and local pollination is:
[0067]
[0068] Where: and is the pollen value of the t+1th and tth time, storing the hyperparameters of the CNN-BiLSTM network; γ is the step scaling factor; L is the Levy factor; ε is the variation factor, which is a random number with uniform distribution between 0 and 1. It is worth noting that the number of CNN layers, BiLSTM layers, and the number of neurons in the BiLSTM layer are integer values, and the updated pollen values need to be rounded off.
[0069] 5) Update the fitness value of the population and the optimal individual of the current population;
[0070] 6) Determine whether the current number of iterations has reached the maximum number of iterations. If not, continue iterating and updating; if reached, output the global population optimal individual and the global optimal fitness, and then obtain the FPA-CNN-BiLSTM outlier detection model trained with normal data;
[0071] Moreover, the specific steps of step 5 include:
[0072] The FPA-CNN-BiLSTM outlier detection model trained in step 4 is used to predict the test set data containing outliers and calculate the prediction error. If the prediction error of a data point exceeds the threshold ε, it is marked as an outlier.
[0073] (1) y of the sample point m Prediction error m The calculation formula is:
[0074]
[0075] Where: is the electricity consumption data point y m The predicted value of .
[0076] The mean and variance of the prediction errors of n sample points in the sliding window are as follows:
[0077]
[0078] Where n is the number of sample points contained in the sliding window, which is generally set to 96, that is, the mean and standard deviation of the most recent 96 data points in the past are considered.
[0079] (2) The calculation process of the threshold ε is as follows:
[0080]
[0081] Where: ε up (t) and ε down (t) are the upper and lower thresholds at time point t, respectively; α is the coefficient of standard deviation, which is set according to the scale of outlier detection and is selected as 3 according to the 3σ rule; β is the time gradient coefficient; is the gradient at time point t, which is calculated by fitting the past n data points in the sliding window to a multivariate equation fit(t) and taking the derivative with respect to time t. This is to take into account fluctuations at different time points.
[0082] Advantages and beneficial effects of the present invention:
[0083] 1. The present invention proposes a method for detecting outliers in low-voltage power consumption data based on mean shift clustering and hybrid deep neural network to improve the accuracy of outlier detection of smart meter data in low-voltage areas. First, the power consumption data of all users are collected through smart meters; secondly, the data gap problem caused by meter failure, channel congestion and power outage events is solved by the low-rank matrix completion method with nuclear norm minimization. Then, the users are classified using the mean shift clustering algorithm to ensure that the data input into the FPA-CNN-BiLSTM network has a strong correlation, thereby improving the training effect of the model. Subsequently, the FPA-CNN-BiLSTM network is trained with normal data to learn the normal power consumption patterns of users of the same category. Subsequently, outlier detection is carried out. When there are outliers in the training data, the model will show a large prediction error. When the prediction error exceeds the threshold, the point is marked as an outlier. Finally, the accuracy of outlier detection of this method is evaluated. The experimental results show that this method is superior to the existing methods in terms of accuracy, precision and recall, verifying its effectiveness in practical applications.
[0084] 2. The present invention proposes a method for detecting outliers in low-voltage power consumption data based on mean shift clustering and hybrid deep neural network. This method realizes high-precision detection of outliers for power consumption data collected by smart meters in low-voltage areas through a series of innovative steps. The specific steps are as follows: First, the missing values caused by factors such as meter failure, channel congestion and power outage events are completed by a low-rank matrix completion method based on nuclear norm minimization; secondly, the users in the area are classified based on the mean shift clustering algorithm, and users with similar power consumption characteristics are classified into one category, so as to ensure that the input of the FPA-CNN-BiLSTM network has strong correlation, which helps to improve the training effect of the model; then, for different categories of users, the FPA-CNN-BiLSTM network is trained separately to learn the normal patterns in the power consumption data of users of the same category; then, the test set data containing outliers is predicted and the prediction error is calculated. If the prediction error of a data point exceeds the threshold, it is marked as an outlier. Finally, the outlier detection accuracy of the method is evaluated by accuracy, precision and recall. Experiments show that the method of the present invention is superior to existing methods and verifies its effectiveness. The method of the present invention improves the power system's ability to identify abnormal power consumption behavior through accurate outlier detection, thereby helping to ensure the stable operation of the power system and optimize the dispatch and management of power resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0085] Figure 1 is a process flow chart of the present invention;
[0086] Figure 2 This is a graph of outlier detection results of the method (MSC-FPA-CNN-BiLSTM) proposed in the present invention. DETAILED DESCRIPTION
[0087] The embodiments of the present invention are further described in detail below with reference to the accompanying drawings:
[0088] A method for detecting abnormal values of low-voltage power consumption data based on mean shift clustering and hybrid deep neural network includes the following steps:
[0089] Step 1: Collect electricity consumption data of all users through smart meters installed in low-voltage areas;
[0090] Step 2: Repair the electricity consumption data collected in step 1 and fill in the missing values;
[0091] The specific steps of step 2 include:
[0092] The missing values caused by meter failure, channel congestion, and power outages are completed using a low-rank matrix completion method based on nuclear norm minimization.
[0093] (1) Assume that the original electricity consumption matrix with missing values is M, then the low-rank matrix completion model can be described as the following optimization problem:
[0094]
[0095]
[0096] Where: X is the filled power matrix; rank(·) is the rank function of the matrix; P Ω is the position operator, and Ω is the position set of observable data.
[0097] (2) Due to the non-convexity of the rank function, the rank function in the above low-rank matrix completion model is replaced by the nuclear norm of the matrix, thereby transforming it into a low-rank matrix completion model based on minimizing the nuclear norm:
[0098]
[0099] Secondly, increase L 1,1 The penalty term is used to prevent the model from overfitting, so the low-rank matrix completion model is transformed into:
[0100]
[0101] Where: P Ω (E) = 0; ||E|| 1,1 That is L 1,1 Norm, also called L 1,1 Penalty term. The constraint of formula (4) is removed by the Lagrange multiplier L, and the formula is:
[0102]
[0103] When Y=Y k , u=u k , solve equation (5) by the alternating direction multiplication method. First, let Then we have:
[0104]
[0105] By finding X k+1 , update the matrix E k+1 :
[0106]
[0107] By finding X k+1 and E k+1 , update the matrix Y k+1 :
[0108] Y k+1 =Y k +μ k (PΩ -X k+1 -E k+1 ) (8)
[0109] After the alternating direction multiplication method is iterated, the filled complete power consumption matrix X is output. Based on the complete power consumption matrix X, the missing values in the original power consumption matrix M are filled.
[0110] Step 3: Based on the power consumption data repaired in step 2, users in the low-voltage area are classified according to their power consumption characteristics, laying the foundation for establishing outlier detection models in step 4.
[0111] The specific method of step 3 is:
[0112] In order to improve the training effect of the deep neural network, users in the substation area are classified based on the mean shift clustering algorithm according to their electricity consumption characteristics:
[0113] Based on the mean shift clustering algorithm, the completed electricity consumption data is X∈R m×n , x i The kernel density estimation function is:
[0114]
[0115] Where: C k is the scaling constant; k(x) is the kernel function; h is the kernel width; x is the initial center point.
[0116] The derivative calculation of the gradient function is:
[0117]
[0118] Introducing the Gaussian kernel function into equation (10), we get the mean shift vector M h (x):
[0119]
[0120] Finally, based on the mean shift vector, the classification of users in the low-voltage area is realized, laying the foundation for establishing outlier detection models in step 4.
[0121] Step 4: Based on normal data that does not contain outliers, establish an FPA-CNN-BiLSTM outlier detection model trained with normal data;
[0122] The specific method of step 4 is:
[0123] Based on normal data that does not contain outliers, a hybrid neural network (CNN-BiLSTM) combining a convolutional neural network (CNN) and a bidirectional long short-term memory (BiLSTM) neural network is trained for different categories of low-voltage users, and the flower pollination algorithm (FPA) is used to find the optimal hyperparameters of the CNN-BiLSTM network. That is, the FPA-CNN-BiLSTM model is used to learn the normal patterns in the electricity consumption data of users of the same category, and the FPA-CNN-BiLSTM outlier detection model trained with normal data is obtained.
[0124] Specifically, the hybrid neural network is composed of a convolutional neural network (CNN) and a bidirectional long short-term memory (BiLSTM) neural network, where CNN is used to extract deep local correlation features of electricity consumption data, BiLSTM is used to extract global temporal features, and the flower pollination algorithm (FPA) is used to find the optimal hyperparameters of the CNN-BiLSTM network. Using normal data that does not contain outliers, the hybrid neural network (FPA-CNN-BiLSTM) is trained to learn the normal patterns in the electricity consumption data of users of the same category. When outliers appear, FPA-CNN-BiLSTM will show a large prediction error, thereby achieving outlier detection.
[0125] The specific steps of establishing the FPA-CNN-BiLSTM outlier detection model in step 4 include:
[0126] (1) Based on normal data that does not contain outliers, a convolutional neural network (CNN) is trained for different categories of low-voltage users, and deep local correlation features of electricity consumption data are extracted through CNN.
[0127] The specific method of step (1) of step 3 is:
[0128] The convolution layer of CNN converts the local information of the input power consumption data into a feature map through the convolution operation of the local receptive field, thereby effectively extracting the local features of the power consumption data; in addition, the local perception and weight sharing technology of CNN can effectively reduce the training parameters of the network, thereby improving learning efficiency.
[0129] The calculation formula of the convolutional layer is as follows:
[0130]
[0131] in, and are the nth new feature map of layer l and the mth feature map of layer l-1 respectively. The first feature map is the original electricity consumption data. f() is the activation function. This study uses the rectified linear unit as the activation function. m map is the feature atlas of layer l-1; is the convolution operation; is a convolution filter that connects the m-th feature map of layer l-1 with the n-th feature map of layer l; is the bias of the nth new feature map of layer l.
[0132] The pooling layer of CNN uses downsampling technology to extract important feature information from the low-voltage user electricity consumption feature map and further compress the feature map information, thereby reducing the network training cost.
[0133] Select the maximum pooling method as the downsampling technique, and select the maximum value of the pooling window as the pooling feature value of the area. The calculation formula is as follows:
[0134]
[0135] in, represents the oth pooled feature map of layer l+1, n pool Represents the feature atlas of the lth layer before pooling. The convolutional layer and pooling layer of CNN can effectively extract local relevant features of electricity consumption data and improve the network's completion capability.
[0136] (2) Based on normal data that does not contain outliers, for different categories of low-voltage users, the deep local correlation features extracted by the CNN layer are used as input to train a bidirectional long short-term memory (BiLSTM) neural network, and the global time series features of the electricity consumption data are extracted through BiLSTM.
[0137] The principle of extracting the global time series features of electricity consumption data through BiLSTM is as follows:
[0138] Taking the deep local correlation features extracted by the CNN layer as input, the BiLSTM neural network is used to extract the global time series features of the electricity consumption data of low-voltage users, focusing on the trend and periodicity of the electricity consumption data. Similar to the LSTM neural network, the hidden layer of the BiLSTM neural network is also composed of long short-term memory units, which are composed of forget gates, input gates, and output gates, allowing longer information to be transmitted between hidden layers. Unlike the LSTM neural network, the BiLSTM neural network has two independent but different directional LSTM layers, namely the forward propagation layer and the back propagation layer, so it can learn the relationship between the two time directions of the original data, thereby extracting more comprehensive time-related features. Specifically, the BiLSTM neural network has the advantages of short training time, good robustness, strong linear expression ability, and strong ability to handle uncertainty.
[0139] The specific method of step (2) of step 3 is:
[0140] Assume that the input of the BiLSTM neural network is p t , output h t Then:
[0141]
[0142]
[0143] Where: → and ← are the forward propagation and backward propagation of LSTM respectively; f for and f back are the forward LSTM layer function and the backward LSTM layer function respectively; f, i and o are the input gate, input gate and output gate respectively; c and c' are the cell state and intermediate cell state respectively; W and b are the weight and bias in the network parameters respectively; δ and are sigmoid and tanh activation functions respectively; ⊙ represents point-by-point multiplication; t represents time. Based on the deep local correlation features extracted by the CNN layer, the BiLSTM layer is used to extract the global time series features of the power consumption data. The CNN-BiLSTM network can effectively extract the local correlation features and global time series features of the power consumption data, and use these features to complete the missing values.
[0144] (3) The FPA algorithm is used to find the optimal hyperparameters of the CNN-BiLSTM network, including the number of CNN layers, the number of BiLSTM layers, the number of neurons in the BiLSTM layer, and the learning rate, and then the FPA-CNN-BiLSTM outlier detection model trained with normal data is obtained;
[0145] The specific method of step (3) of step 3 is:
[0146] 1) Set the parameters of FPA, including the number of individuals in the pollen population, the search range of pollen individuals (network hyperparameters of the CNN-BiLSTM network), the maximum number of iterations, the step size scaling factor, and the global pollination probability.
[0147] 2) Find the hyperparameter dimension of the CNN-BiLSTM network to be 4, namely the number of CNN layers, the number of BiLSTM layers, the number of neurons in the BiLSTM layer, and the learning rate.
[0148] 3) Initialize the population and calculate its fitness value, and select the individual with the best performance (smallest fitness value and smallest prediction error) as the optimal individual in the current population. Fitness is the root mean square error of CNN-BiLSTM network training, and the calculation formula is as follows:
[0149]
[0150] Where: is the predicted value of CNN-BiLSTM network; y i is the true value; n is the number of predicted sample points.
[0151] 4) Generate a random number. If it is less than the global pollination probability, then global pollination is performed to update the population; otherwise, local pollination is performed to update the population. The formula for global pollination and local pollination is:
[0152]
[0153] Where: and is the pollen value of the t+1th and tth time, storing the hyperparameters of the CNN-BiLSTM network; γ is the step scaling factor; L is the Levy factor; ε is the variation factor, which is a random number with uniform distribution between 0 and 1. It is worth noting that the number of CNN layers, BiLSTM layers, and the number of neurons in the BiLSTM layer are integer values, and the updated pollen values need to be rounded off.
[0154] 5) Update the fitness value of the population and the optimal individual of the current population;
[0155] 6) Determine whether the current number of iterations has reached the maximum number of iterations. If not, continue iterating and updating; if reached, output the optimal individual in the global population (optimal hyperparameters of the CNN-BiLSTM network, including the number of CNN layers, the number of BiLSTM layers, the number of neurons in the BiLSTM layer, and the learning rate) and the global optimal fitness (the root mean square error of the optimal individual), and then obtain the FPA-CNN-BiLSTM outlier detection model trained with normal data;
[0156] The FPA-CNN-BiLSTM outlier detection model trained with normal data can effectively learn the normal patterns in the electricity consumption data of users of the same category. When there are outliers in the training data, the model will show a large prediction error.
[0157] Step 5: Use the FPA-CNN-BiLSTM outlier detection model trained in step 4 to predict the test set data containing outliers and calculate the prediction error. If the prediction error of a data point exceeds the threshold, it is marked as an outlier.
[0158] The specific steps of step 5 include:
[0159] The FPA-CNN-BiLSTM outlier detection model trained in step 4 predicts the test set data containing outliers and calculates the prediction error; if the prediction error of a data point exceeds the threshold ε, it is marked as an outlier.
[0160] (1) y of the sample point m Prediction error m The calculation formula is:
[0161]
[0162] Where: is the electricity consumption data point y m The predicted value of .
[0163] The mean and variance of the prediction errors of n sample points in the sliding window are as follows:
[0164]
[0165] Where n is the number of sample points contained in the sliding window, which is generally set to 96, that is, the mean and standard deviation of the most recent 96 data points in the past are considered.
[0166] (2) The calculation process of the threshold ε is as follows:
[0167]
[0168] Where: ε up (t) and ε down (t) are the upper and lower thresholds at time point t, respectively; α is the coefficient of the standard deviation, which can be set according to the scale of outlier detection. According to the 3σ rule, it can be selected as 3; β is the time gradient coefficient; is the gradient at time point t, which is calculated by fitting the past n data points in the sliding window to a multivariate equation fit(t) and taking the derivative with respect to time t. This is to take into account the fluctuation of time points, because in general, the greater the fluctuation, the greater the prediction error of the model and the greater the prediction difficulty. At this time, the range of the threshold can be appropriately increased to avoid normal points being mistakenly detected as outliers.
[0169] Step 6: Evaluate the outlier detection accuracy of the method through accuracy, precision, and recall.
[0170] The specific method of step 6 is:
[0171] The detection accuracy of the method is evaluated by accuracy, precision and recall. The calculation formulas for accuracy, precision, recall and F1 score are as follows:
[0172]
[0173] Where TP is the number of samples correctly predicted by the model as positive; TN is the number of samples incorrectly predicted by the model as positive but actually negative; FP is the number of samples correctly predicted by the model as negative; FN is the number of samples incorrectly predicted by the model as negative but actually positive.
[0174] The outlier detection results of the method (MSC-FPA-CNN-BiLSTM) proposed in this invention are as follows: Figure 2 shown.
[0175] like Figure 2 As shown in the figure, the proposed method MSC-FPA-CNN-BiLSTM detects all outliers in the electricity consumption data.
[0176] The comparison of the detection results of the 3σ criterion, box plot, K-Means, CNN-BiLSTM and MSC-FPA-CNN-BiLSTM methods is shown in Table 1.
[0177] Table 1 Comparison of detection results of 3σ criterion, box plot, K-Means, FPA-CNN-BiLSTM and MSC-FPA-CNN-BiLSTM methods
[0178]
[0179] As shown in Table 1, the detection accuracy of the proposed method MSC-FPA-CNN-BiLSTM is better than the compared 3σ criterion, box plot, K-Means, and CNN-BiLSTM.
[0180] It should be emphasized that the embodiments of the present invention are illustrative rather than restrictive. Therefore, the present invention includes but is not limited to the embodiments described in the specific implementation modes. Any other implementation modes derived by those skilled in the art based on the technical solutions of the present invention also fall within the scope of protection of the present invention.
Claims
1. A method for detecting abnormal values of low-voltage power consumption data, characterized in that: The following steps are involved: Step 1: Collect electricity consumption data of all users through smart meters installed in low-voltage areas; Step 2: Repair the electricity consumption data collected in step 1 and fill in the missing values; Step 3: Based on the power consumption data after repair in step 2, users in the low-voltage area are classified according to their power consumption characteristics; Step 4: Based on normal data that does not contain outliers, establish an FPA-CNN-BiLSTM outlier detection model trained with normal data; Step 5: Use the FPA-CNN-BiLSTM outlier detection model trained in step 4 to predict the test set data containing outliers and calculate the prediction error. If the prediction error of a data point exceeds the threshold, it is marked as an outlier.
2. A method for detecting abnormal values of low-voltage power consumption data according to claim 1, characterized in that: The specific steps of step 2 include: The missing values caused by meter failure, channel congestion, and power outages are completed using a low-rank matrix completion method based on nuclear norm minimization. (1) Assume that the original electricity consumption matrix with missing values is M, then the low-rank matrix completion model can be described as the following optimization problem: Where: X is the filled power matrix; rank(·) is the rank function of the matrix; P Ω is the position operator, Ω is the position set of observable data; (2) The rank function in the above low-rank matrix completion model is replaced by the nuclear norm of the matrix, thereby transforming it into a low-rank matrix completion model based on minimizing the nuclear norm: Secondly, increase L 1,1 The penalty term is used to prevent the model from overfitting, so the low-rank matrix completion model is transformed into: Where: P Ω (E) = 0; ||E|| 1,1 That is L 1,1 Norm, also called L 1,1 Penalty term; remove the constraint of formula (4) through the Lagrange multiplier L, the formula is: When Y=Y k , u=u k , solve equation (5) by the alternating direction multiplier method; first let Then we have: By finding X k+1 , update the matrix E k+1 : By finding X k+1 and E k+1 , update the matrix Y k+1 : AND k+1 =And k +μ k (P Ω -X k+1 -AND k+1 ) (8) After the alternating direction multiplication method is iterated, the filled complete power consumption matrix X is output; based on the complete power consumption matrix X, the missing values in the original power consumption matrix M are filled.
3. A method for detecting abnormal values of low-voltage power consumption data according to claim 1, characterized in that: The specific method of step 3 is: According to the user's electricity consumption characteristics, users in the substation area are classified based on the mean shift clustering algorithm: Based on the mean shift clustering algorithm, the completed electricity consumption data is X∈R m×n , x i The kernel density estimation function is: Where: C k is the scaling constant; k(x) is the kernel function; h is the kernel width; x is the initial center point; The derivative calculation of the gradient function is: Introducing the Gaussian kernel function into equation (10), we get the mean shift vector M h (x): Finally, based on the mean shift vector, the classification of users in the low-voltage area is achieved.
4. A method for detecting abnormal values of low-voltage power consumption data according to claim 1, characterized in that: The specific steps of establishing the FPA-CNN-BiLSTM outlier detection model in step 4 include: (1) Based on normal data that does not contain outliers, a convolutional neural network (CNN) is trained for different categories of low-voltage users, and deep local correlation features of electricity consumption data are extracted through CNN. (2) Based on normal data that does not contain outliers, for different categories of low-voltage users, the deep local correlation features extracted by the CNN layer are used as input to train a bidirectional long short-term memory (BiLSTM) neural network, and the global time series features of the electricity consumption data are extracted through BiLSTM. (3) The FPA algorithm is used to find the optimal hyperparameters of the CNN-BiLSTM network, including the number of CNN layers, the number of BiLSTM layers, the number of neurons in the BiLSTM layer, and the learning rate, and then the FPA-CNN-BiLSTM outlier detection model trained with normal data is obtained.
5. A method for detecting abnormal values of low-voltage power consumption data according to claim 4, characterized in that: The specific method of step (1) of step 3 is: The convolution layer of CNN converts the local information of the input power consumption data into a feature map through the convolution operation of the local receptive field, thereby effectively extracting the local features of the power consumption data; The calculation formula of the convolutional layer is as follows: in, and are the nth new feature map of layer l and the mth feature map of layer l-1 respectively. The first feature map is the original electricity consumption data. f() is the activation function. This study uses the rectified linear unit as the activation function. m map is the feature atlas of layer l-1; is the convolution operation; is a convolution filter that connects the m-th feature map of layer l-1 with the n-th feature map of layer l; is the bias of the nth new feature map of layer l; The pooling layer of CNN uses downsampling technology to extract important feature information from the low-voltage user electricity consumption feature map and further compress the feature map information; Select the maximum pooling method as the downsampling technique, and select the maximum value of the pooling window as the pooling feature value of the area. The calculation formula is as follows: in, represents the oth pooled feature map of layer l+1, n pool Represents the feature atlas of layer l before pooling.
6. A method for detecting abnormal values of low-voltage power consumption data according to claim 4, characterized in that: The specific method of step (2) of step 3 is: Assume that the input of the BiLSTM neural network is p t , output h t Then: Where: → and ← are the forward propagation and backward propagation of LSTM respectively; f for and f back are the forward LSTM layer function and the backward LSTM layer function respectively; f, i and o are the input gate, input gate and output gate respectively; c and c' are the cell state and the intermediate cell state respectively; W and b are the weights and biases in the network parameters respectively; δ and are sigmoid and tanh activation functions respectively; ⊙ represents point-by-point multiplication; t represents the time.
7. A method for detecting abnormal values of low-voltage power consumption data according to claim 4, characterized in that: The specific method of step (3) of step 3 is: 1) Set the parameters of FPA, including the number of pollen individuals, the search range of pollen individuals, the maximum number of iterations, the step size scaling factor, and the global pollination probability; 2) Find the hyperparameter dimension of the CNN-BiLSTM network to be 4, namely the number of CNN layers, the number of BiLSTM layers, the number of neurons in the BiLSTM layer, and the learning rate; 3) Initialize the population and calculate its fitness value, and select the best performing individual as the optimal individual in the current population; the fitness is the root mean square error of the CNN-BiLSTM network training, and the calculation formula is as follows: Where: is the predicted value of CNN-BiLSTM network; y i is the true value; n is the number of predicted sample points; 4) Generate a random number. If it is less than the global pollination probability, then carry out global pollination to update the population; otherwise, carry out local pollination to update the population. The formula for global pollination and local pollination is: Where: and is the pollen value of the t+1th and tth time, storing the hyperparameters of the CNN-BiLSTM network; γ is the step scaling factor; L is the Levy factor; ε is the variation factor, which is a random number with uniform distribution between 0 and 1; it is worth noting that the number of CNN layers, BiLSTM layers, and neurons in the BiLSTM layer are integer values, and the updated pollen values need to be rounded off; 5) Update the fitness value of the population and the optimal individual of the current population; 6) Determine whether the current number of iterations reaches the maximum number of iterations; If it is not reached, continue to iterate and update; if it is reached, output the global optimal individual of the population and the global optimal fitness, and then obtain the FPA-CNN-BiLSTM outlier detection model trained with normal data.
8. A method for detecting abnormal values of low-voltage power consumption data according to claim 1, characterized in that: The specific steps of step 5 include: The FPA-CNN-BiLSTM outlier detection model trained in step 4 is used to predict the test set data containing outliers and calculate the prediction error; if the prediction error of a data point exceeds the threshold ε, it is marked as an outlier; (1) y of the sample point m Prediction error m The calculation formula is: Where: is the electricity consumption data point y m The predicted value of The mean and variance of the prediction errors of n sample points in the sliding window are as follows: Where: n is the number of sample points contained in the sliding window, which is generally set to 96, that is, considering the mean and standard deviation of the most recent 96 data points in the past; (2) The calculation process of the threshold ε is as follows: Where: ε up (t) and ε down (t) are the upper and lower thresholds at time point t, respectively; α is the coefficient of standard deviation, which is set according to the scale of outlier detection and is selected as 3 according to the 3σ rule; β is the time gradient coefficient; is the gradient at time point t, which is calculated by fitting the past n data points in the sliding window to a multivariate equation fit(t) and taking the derivative with respect to time t; add This is to take into account fluctuations at different time points.