A method for identifying electricity theft users based on label augmentation
By performing label augmentation on unlabeled data and combining it with labeled data for machine learning model training, the problem of insufficient data on abnormal power consumption cases of low-voltage residential users has been solved, the accuracy of identifying electricity theft has been improved, and more efficient theft has been achieved. Electric identification.
Patent Information
- Application Number
- CN202110763168.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-06
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-07-06
AI Technical Summary
The existing technology lacks data on abnormal power consumption cases of low-voltage residential users, resulting in low and unstable electricity theft identification accuracy, making it difficult to effectively identify electricity theft, affecting the security and economic stability of the power system.
A method of identifying electricity stealing users based on label augmentation is adopted. By performing label augmentation on unlabeled data, combined with labeled data for machine learning model training, the unlabeled data is used to assist labeled samples in electricity stealing detection, thereby improving the accuracy of electricity stealing behavior. Discrimination accuracy.
The label augmentation method greatly expands the amount of sample information, improves the accuracy of electricity theft sample identification, achieves higher electricity theft behavior identification accuracy and efficiency, and reduces losses caused by abnormal electricity usage behavior.
Smart Images

Figure CN113379322B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of power data analysis, and in particular to a method for identifying electricity stealing users based on label augmentation. Background Art
[0002] Power theft is an illegal crime that the State Grid Corporation of China and the public security organs of my country have severely cracked down on, which has had a bad impact on the development of the national economy. Timely identification of users' power theft is of great significance to regulating residents' electricity consumption and maintaining economic stability. Non-technical losses in traditional anti-theft power systems are usually caused by abnormal power consumption behaviors such as power theft, metering failures, illegal connections, and unauthorized changes in the nature of power consumption. On the one hand, as electricity consumption that is not included in the billing or not correctly billed, abnormal power consumption has brought huge economic losses to the power sector. On the other hand, unregulated abnormal power consumption behaviors, such as changing residential power consumption to commercial power consumption and privately connecting electric vehicle charging piles, seriously threaten the normal operation of the power system. The long-term existence of these abnormal power consumption behaviors is usually accompanied by overload of power supply equipment, overload of electrical equipment caused by overvoltage, insufficient power dispatch caused by system dynamic uncertainty and insufficient load information, etc., which is a major safety hazard of the power system.
[0003] Reducing the losses caused by abnormal electricity consumption has long been one of the important issues that power grids around the world need to solve, and many researchers have devoted themselves to it. The popularization of smart meters and the continuous improvement of the functions of the electricity information collection system have brought new changes to the anti-electricity theft work. At present, power supply companies have achieved full coverage of the collection system and full collection of power marketing data, and the collection of abnormal processing has become a daily routine. However, there is a serious lack of data on abnormal electricity consumption cases for low-voltage residential users, resulting in low and unstable accuracy in identifying abnormal electricity consumption by low-voltage residential users. Summary of the invention
[0004] In order to solve the deficiencies in the prior art, the purpose of the present invention is to provide a method for identifying electricity theft users based on label augmentation. Under the premise that the number of labeled electricity usage data samples of residential users is small and there is a large amount of unlabeled data, the method can make full use of the information of unlabeled data to assist labeled samples in electricity theft detection, thereby greatly improving the accuracy of identifying electricity theft behavior, which has important academic significance and engineering practical value.
[0005] The present invention adopts the following technical solution:
[0006] A method for identifying electricity stealing users based on label augmentation includes the following contents:
[0007] Step 1: Collect historical electricity consumption data of residential users;
[0008] Step 2: preprocess the historical power consumption current data collected in step 1;
[0009] Step 3: Calibrate the data preprocessed in step 2 to obtain labeled historical power consumption current data and unlabeled historical power consumption current data;
[0010] Step 4: augment the labels of the unlabeled historical electricity consumption current data based on the labeled historical electricity consumption current data;
[0011] Step 5: Match the labels augmented in step 4 with the original unlabeled historical electricity current data, and merge them with the labeled data in step 3 to obtain a sample set;
[0012] Step 6: Use machine learning methods to train the sample set obtained in step 5 to obtain a model for identifying electricity theft users;
[0013] Step 7: Collect the user's electricity current data in real time and input it into the model trained in step 6 for judgment.
[0014] In step 1, each piece of historical electricity consumption current data includes a plurality of historical electricity consumption current data points collected at a certain frequency within one day.
[0015] In step 2, the data preprocessing method includes removing outliers and filling missing values.
[0016] In step 3, the historical electricity usage current data is divided into tagged historical electricity usage current data and untagged historical electricity usage current data; the tagged historical electricity usage data includes electricity theft data and normal data.
[0017] In step 4, the method for augmenting the label includes the following steps:
[0018] Step 401: Generate matrix Y based on labeled historical power consumption current data L , and for Y L Initialize the elements in; Generate matrix Y based on unlabeled historical power current data U , and for Y U Initialize the elements in ; then concatenate the two matrices to get the matrix Y;
[0019] Step 402: construct a graph using all historical electricity current data, where the coordinates of each node in the graph correspond to the historical data points in each piece of historical electricity current data, that is, the number of dimensions of the data corresponds to the number of dimensions of the graph;
[0020] Step 403: Calculate the DistRank values of all nodes in the graph that represent unlabeled historical power consumption current data;
[0021] Step 404: sort the nodes representing the unlabeled historical power consumption current data according to the size of the DistRank value, and update the arrangement order of the labeled historical power consumption current data in the Y matrix according to the sorting order of these nodes;
[0022] Step 405: define the edge weights of any two nodes i and j in the graph;
[0023] Step 406: Calculate the probability value T between any two nodes ij ;
[0024] Step 407: after calculating the probability of each node representing the labeled historical power consumption current data in each graph being transferred to each node representing the unlabeled historical power consumption current data, the matrix T is obtained, and the matrix Y is updated;
[0025] Step 408: reset the value corresponding to the historical electricity current data with labels in Y after the update according to the method initialized in step 401, and normalize the label probability value of the historical electricity current data without labels in Y so that the sum of the label probability values of each historical electricity current data without labels is 1;
[0026] Step 409: Repeat steps 402 to 407 until the probability value of the label of the unlabeled historical power consumption current data converges or reaches the maximum number of iterations. At this time, the label corresponding to the unlabeled historical power consumption current data is the label category corresponding to the column with the maximum probability value in the column where it is located.
[0027] In step 401, the matrix Y L The dimension of Y is L×C, where L is the number of labeled historical electricity current data, and C is the number of label categories of labeled historical electricity current data; L The initialization method is: if the i-th historical power consumption current data is the m-th category, i = 1, 2, 3 ... L, m = 1, 2 ... C, then Y L The element in the i-th row and m-th column is 1, and the elements in other columns in the i-th row are 0;
[0028] Matrix Y U The dimension of Y is U×C, where U is the number of all unlabeled historical electricity current data; U The initialization method is: set the initial value of each element in the matrix to 1 / C.
[0029] In step 403, the calculation method of DistRank is:
[0030]
[0031] DR(M) is the DistRank value of node M, N is the total number of nodes representing labeled historical power consumption data, and D is the total number of dimensions of historical power consumption data. Refers to the coordinate of the nth node representing the labeled historical power consumption data in the dth dimension, M d Refers to the coordinates of node M in the dth dimension.
[0032] The edge weights in step 405 satisfy the following relationship:
[0033]
[0034] where d ij is the Euclidean distance between node i and node j, σ is a hyperparameter used to normalize data, and its value ranges from 0 to 1. represents the coordinates of node i in d dimension, Represents the coordinates of node j in d dimension.
[0035] Probability value T ij The following relationship is satisfied:
[0036]
[0037] Among them, w kj represents the edge weight between node k and node j.
[0038] The update method of matrix Y is:
[0039] Y=TY.
[0040] Machine learning methods include decision trees, Bayesian learning, and neural networks.
[0041] The beneficial effect of the present invention is that, compared with the prior art, the label augmentation method based on labeled data proposed by the present invention makes full use of the unlabeled sample data information and greatly expands the amount of information of the sample. The augmentation algorithm of the present invention can expand the label before using the machine learning method to establish the discrimination model, and the augmentation rate and efficiency are very high. Compared with only using the original labeled sample set, the sample set obtained by using the augmentation algorithm proposed by the present invention can achieve a higher accuracy rate in identifying electricity theft samples through the machine learning method. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 This is a graph of the current data preprocessing results of the present invention;
[0043] Figure 2 A distribution diagram of electricity theft data samples after using the label augmentation method proposed by the present invention;
[0044] Figure 3This is a distribution diagram of normal data samples after using the label augmentation method proposed by the present invention;
[0045] Figure 4 This is a ROC curve diagram of a model that does not use the label augmentation method proposed by the present invention;
[0046] Figure 5 The ROC curve diagram of the model based on the label augmentation method proposed by the present invention;
[0047] Figure 6 A comparison chart of the model detection results of random forest and SVM before and after using the label augmentation method proposed in the present invention;
[0048] Figure 7 The figure is a flow chart of a method for identifying electricity theft users based on tag augmentation according to the present invention. DETAILED DESCRIPTION
[0049] The present application is further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present application.
[0050] A method for identifying electricity theft users based on label augmentation, the flow chart of which is as follows: Figure 7 As shown, specifically including the following:
[0051] Step 1: Collect historical electricity consumption data of residential users;
[0052] The number of historical electricity current data can be adjusted according to actual conditions. The larger the number of historical electricity current data, the higher the probability that the final result of electricity theft identification is accurate. Each piece of historical electricity current data includes multiple historical electricity current data points collected at a certain frequency within a day. Preferably, the collection frequency is 1 hour;
[0053] In this embodiment, the historical electricity consumption current data of the smart meters of 88 users at each time of each day on intermittent dates between 2017 and 2020 are collected, that is, the historical electricity consumption current data of each user every day includes 24 historical data points;
[0054] Step 2: preprocess the historical power consumption current data collected in step 1;
[0055] Data preprocessing includes removing outliers and filling in missing values;
[0056] The principles for filling missing data values are as follows:
[0057]
[0058] Among them, g(x i) is a piece of historical electricity consumption data. i The missing data point at the moment, g(x i+1 ) represents x i The data point at the next moment, g(x i-1 ) represents x i The data point of the previous moment; NaN refers to non-data value, indicating that an item is empty or missing. i If the data points before and after the moment are not NaN, then the missing value is the average of the data points before and after. If at least one of the data points before and after is NaN, then the missing data point is filled with 0.
[0059] Abnormal values are deleted. If more than one quarter of the data points in a piece of historical power consumption current data have a value of 0, the piece of historical power consumption current data is defined as abnormal data and deleted. In this embodiment, when more than 6 data points out of 24 data points in each piece of data have a value of 0, the piece of data is deleted.
[0060] In this embodiment, after data preprocessing, a total of 18617 pieces of historical electricity current data are obtained.
[0061] Step 3: Calibrate the data preprocessed in step 2;
[0062] The historical electricity consumption current data is divided into labeled historical electricity consumption current data and unlabeled historical electricity consumption current data; the labeled historical electricity consumption data includes electricity theft data and normal data;
[0063] In this embodiment, the power supply company provides a list of electricity theft users, through which a total of 2192 tagged historical electricity current data and 16425 untagged historical electricity current data can be obtained. Among the tagged historical electricity current data, there are 136 electricity theft data and 2056 normal data; the rest are untagged historical electricity current data.
[0064] Step 4: augment the labels of the unlabeled historical electricity consumption current data based on the labeled historical electricity consumption current data;
[0065] The method to augment the label is as follows:
[0066] Step 401: Generate matrix Y based on labeled historical power consumption current data L , and for Y L Initialize the elements in; Generate matrix Y based on unlabeled historical power current data U , and for Y U Initialize the elements in ; then concatenate the two matrices to get the matrix Y;
[0067] Generate an L×C data label matrix Y for all labeled historical power consumption current data L , where L is the number of tagged historical electricity current data, and C is the number of tag categories of tagged historical electricity current data. In this embodiment, the categories are "electricity theft data" and "normal data", so the number of tag categories C is 2;
[0068] For all labeled historical electricity current data, if the i-th historical electricity current data is of the m-th category, i = 1, 2, 3 ... L, m = 1, 2 ... C, then the i-th row and m-th column element is 1, and the i-th row and other column elements are 0; initialize and generate a U × C data label matrix Y for all unlabeled historical electricity current data U , U is the number of all unlabeled historical electricity current data, where the initialization value of each element in the matrix is 1 / C, which is regarded as the probability value that the unlabeled historical electricity current data can be identified as any category of the labeled historical electricity current data. L and Y U Splice vertically to form a matrix Y with (L+U) rows and C columns;
[0069] Step 402: construct a graph using all historical power consumption current data, where the coordinates of each node in the graph correspond to the historical data points in each piece of historical power consumption current data, so the number of dimensions of the data corresponds to the number of dimensions of the graph;
[0070] In this embodiment, since each piece of historical electricity consumption current data contains 24 data points, that is, the dimension number of the data is 24, the latitude number of the constructed graph is also 24; each node in the graph represents a piece of historical electricity consumption current data, and the graph contains all labeled and unlabeled historical electricity consumption current data.
[0071] Step 403: Calculate the DistRank values of all nodes in the graph that represent unlabeled historical power consumption current data. The calculation method of DistRank is:
[0072]
[0073] DR(M) is the DistRank value of node M, N is the total number of nodes representing labeled historical power consumption data, and D is the total number of dimensions of historical power consumption data. Refers to the coordinate of the nth node representing the labeled historical power consumption current data in the dth dimension. d Refers to the coordinates of node M in the dth dimension.
[0074] Step 404: sort the nodes representing the unlabeled historical power consumption current data according to the DistRank values, and update the arrangement order of the labeled historical power consumption current data in the Y matrix according to the sorting order of these nodes.
[0075] Step 405: Define the edge weights of any two nodes i and j in the graph as:
[0076]
[0077] where d ij is the Euclidean distance between node i and node j, σ is a hyperparameter used to normalize data, and its value is 0-1, preferably 0.5. The value will have a certain impact on the final algorithm convergence result. represents the coordinates of node i in d dimension, Represents the coordinates of node j in d dimension;
[0078] Step 406: Calculate the probability value T between any two nodes ij , where the probability formula for transferring from node i to node j is:
[0079]
[0080] Among them, w kj represents the edge weight between nodes k and j;
[0081] Step 407: After calculating the probability of each node representing the labeled historical power consumption current data in each graph being transferred to each node representing the unlabeled historical power consumption current data, the matrix T is obtained and Y is updated. The updating method is:
[0082] Y=TY
[0083] The dimension of matrix T is (L+U)×(L+U).
[0084] Step 408: reset the value corresponding to the historical electricity current data with labels in Y after the update according to the method of step 401, and normalize the label probability value of the historical electricity current data without labels in Y so that the sum of the label probability values of each historical electricity current data without labels is 1;
[0085] Step 409: Repeat steps 402 to 407 until the probability value of the label of the unlabeled historical power consumption current data converges or reaches the maximum number of iterations. At this time, the label corresponding to the unlabeled historical power consumption current data is the label category corresponding to the column with the largest probability value in the column where it is located;
[0086] The probability value convergence of the label of the unlabeled historical power consumption current data means that the error between the probability value after normalization in this round of iteration and the probability value after normalization in the previous round of iteration is less than the convergence threshold;
[0087] Preferably, the convergence threshold is 0.00001 and the maximum number of iterations is 1000;
[0088] In this embodiment, 1357 pieces of data in the original unlabeled data are marked as electricity theft data, and 15068 pieces of data are marked as normal data.
[0089] Step 5: Match the labels augmented in step 4 with the original unlabeled historical electricity current data, and merge them with the original labeled data in step 3 to obtain a sample set;
[0090] In this embodiment, the sample set contains 2192 labeled data and 16425 calibrated unlabeled data, of which the total number of electricity theft data is 1493, and the distribution is as follows: Figure 2 As shown; the total number of normal data is 17124, and the distribution is as follows Figure 3 shown.
[0091] Step 6: Use machine learning methods to train the samples obtained in step 5 to obtain a model for identifying electricity theft users;
[0092] The machine learning methods here include decision trees, Bayesian learning, and neural networks. In this embodiment, random forests and SVM are used;
[0093] Step 7: Collect the user's electricity current data in real time and input it into the model trained in step 6 for identification;
[0094] The ROC curve, AUC value, accuracy, recall, precision, and F2 score are used for evaluation. The calculation method of each indicator is as follows:
[0095] The ROC curve uses the true positive rate as the X-axis and the false positive rate as the Y-axis to plot two variables. The calculation formulas for the true positive rate and false positive rate are as follows:
[0096]
[0097]
[0098] AUC is the area under the ROC curve.
[0099] The ROC curve and AUC value range are 0-1. The closer the ROC is to the upper left corner and the larger the AUC value is, the better the model classification effect is.
[0100] Accuracy is defined as the accuracy of the model in classifying samples. The formula is:
[0101]
[0102] Among them, TP is the number of samples correctly predicted as electricity theft, TN is the number of samples correctly predicted as normal electricity use, FP is the number of samples predicted as electricity theft but actually normal electricity use, and FN is the number of samples predicted as normal electricity use but actually electricity theft.
[0103] The F2 score calculation formula is:
[0104]
[0105] The accuracy and F2 score range from 0 to 1. The higher the accuracy, the higher the classification accuracy of the model. The F2 score indicates the model's ability to fully detect electricity theft samples. The larger the value, the higher the ability to fully detect electricity theft samples.
[0106] from Figure 4 and Figure 5 It can be seen that the ROC curve using the label augmentation proposed in the present invention makes the model classification more accurate; Figure 6 It is a comparison chart of the detection results using only random forest or SVM and combining the label augmentation of the present invention with random forest or SVM.
[0107] The applicant of the present invention has made a detailed explanation and description of the implementation examples of the present invention in conjunction with the drawings in the specification. However, those skilled in the art should understand that the above implementation examples are only preferred implementation schemes of the present invention, and the detailed description is only to help readers better understand the spirit of the present invention, but not to limit the scope of protection of the present invention. On the contrary, any improvements or modifications based on the inventive spirit of the present invention should fall within the scope of protection of the present invention.
Claims
1. A method for identifying electricity theft users based on label augmentation. It is characterized in that The method for identifying electricity stealing users comprises the following steps: Step 1: Collect historical electricity consumption data of residential users; Step 2: preprocess the historical power consumption current data collected in step 1; Step 3: Calibrate the data preprocessed in step 2 to obtain labeled historical power consumption current data and unlabeled historical power consumption current data; Step 4: augment the labels of the unlabeled historical electricity consumption current data based on the labeled historical electricity consumption current data; Step 401: Generate matrix Y based on labeled historical power consumption current data L , and for Y L Initialize the elements in; Generate matrix Y based on unlabeled historical power current data U , and for Y U Initialize the elements in ; then concatenate the two matrices to get the matrix Y; Step 402: construct a graph using all historical electricity current data, where the coordinates of each node in the graph correspond to the historical data points in each piece of historical electricity current data, that is, the number of dimensions of the data corresponds to the number of dimensions of the graph; Step 403: Calculate the DistRank values of all nodes in the graph that represent unlabeled historical power consumption current data; Step 404: sort the nodes representing the unlabeled historical power consumption current data according to the size of the DistRank value, and update the arrangement order of the labeled historical power consumption current data in the Y matrix according to the sorting order of these nodes; Step 405: define the edge weights of any two nodes i and j in the graph; Step 406: Calculate the probability value T between any two nodes ij ; Step 407: after calculating the probability of each node representing the labeled historical power consumption current data in each graph being transferred to each node representing the unlabeled historical power consumption current data, the matrix T is obtained, and the matrix Y is updated; Step 408: reset the value corresponding to the historical electricity current data with labels in Y after the update according to the method initialized in step 401, and normalize the label probability value of the historical electricity current data without labels in Y so that the sum of the label probability values of each historical electricity current data without labels is 1; Step 409: Repeat steps 402 to 407 until the probability value of the label of the unlabeled historical power consumption current data converges or reaches the maximum number of iterations; at this time, the label corresponding to the unlabeled historical power consumption current data is the label category corresponding to the column with the maximum probability value in the column where it is located; Step 5: Match the labels augmented in step 4 with the original unlabeled historical electricity current data, and merge them with the labeled data in step 3 to obtain a sample set; Step 6: Use machine learning methods to train the sample set obtained in step 5 to obtain a model for identifying electricity theft users; Step 7: Collect the user's electricity current data in real time and input it into the model trained in step 6 for judgment.
2. According to the method for identifying electricity stealing users based on label augmentation according to claim 1, Features: In step 1, each piece of historical electricity consumption current data includes a plurality of historical electricity consumption current data points collected at a certain frequency in one day.
3. A method for identifying electricity stealing users based on label augmentation according to claim 1 or 2, Features: In step 2, the data preprocessing method includes removing outliers and filling missing values.
4. According to the method for identifying electricity stealing users based on label augmentation according to claim 3, Features: In step 3, the historical electricity usage current data is divided into tagged historical electricity usage current data and untagged historical electricity usage current data; the tagged historical electricity usage data includes electricity theft data and normal data.
5. According to the method for identifying electricity stealing users based on label augmentation according to claim 4, Features: In step 401, the matrix Y L The dimension of Y is L×C, where L is the number of labeled historical electricity current data, and C is the number of label categories of labeled historical electricity current data; L The initialization method is: if the i-th historical power consumption current data is the m-th category, i = 1, 2, 3 ... L, m = 1, 2 ... C, then Y L The element in the i-th row and m-th column is 1, and the elements in other columns in the i-th row are 0; The matrix Y U The dimension of Y is U×C, where U is the number of all unlabeled historical electricity current data; U The initialization method is: set the initial value of each element in the matrix to 1 / C.
6. According to the method for identifying electricity stealing users based on label augmentation according to claim 5, Features: In step 403, the calculation method of DistRank is: DR(M) is the DistRank value of node M, N is the total number of nodes representing labeled historical power consumption data, and D is the total number of dimensions of historical power consumption data. Refers to the coordinate of the nth node representing the labeled historical power consumption data in the dth dimension, M d Refers to the coordinates of node M in the dth dimension.
7. The method for identifying electricity stealing users based on label augmentation according to claim 6, Features: The edge weights in step 405 satisfy the following relationship: where d ij is the Euclidean distance between node i and node j, σ is a hyperparameter used to normalize data, and its value ranges from 0 to 1. represents the coordinates of node i in d dimension, Represents the coordinates of node j in d dimension.
8. The method for identifying electricity stealing users based on label augmentation according to claim 7, Features: The probability value T ij The following relationship is satisfied: Among them, w kj represents the edge weight between node k and node j, w ij represents the edge weight between node i and node j.
9. The method for identifying electricity stealing users based on label augmentation according to claim 8, Features: The update method of matrix Y is: Y=TY.
10. The method for identifying electricity stealing users based on label augmentation according to claim 9, Features: The machine learning methods include decision trees, Bayesian learning, and neural networks.
Citation Information
Patent Citations
Differentiation electricity larceny prevention monitoring system based on electricity information collection system
CN106097137A
Power utilization behavior electricity theft prevention diagnosis method and device based on dynamic grid outliers
CN106645934A
Method for detecting electric theft by dimension reduction of electric power characteristic index and limit learning machine algorithm
CN109146705A
Transformer area line loss anomaly analysis method, computer readable storage medium and terminal equipment
CN110503136A
Dynamic time warping algorithm-based electricity larceny user identification and positioning method for high-loss transformer area
CN112257013A
