A ConvLSTM electricity theft detection method, system, device and medium fusing self and nearest neighbor power information
By reconstructing the time-series electricity consumption data of the user and its nearest neighbors into a two-dimensional matrix sequence, and combining it with the ETD-SENICON detection model, the problem of the failure to fully utilize the periodicity and similarity of electricity consumption patterns in existing technologies is solved, and high-precision electricity theft detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-07
- Publication Date
- 2026-03-31
AI Technical Summary
Existing electricity theft detection methods fail to fully utilize the periodic characteristics of users' own electricity consumption patterns and the similarity of electricity consumption patterns among nearest neighbor users, resulting in low detection accuracy and high rates of missed detections and false detections.
The one-dimensional electricity consumption time series data of the user and its nearest neighbors are reconstructed into a two-dimensional neighboring day matrix sequence and a two-dimensional nearest neighbor matrix sequence. An ETD-SENICON detection model is constructed, and features are extracted by fusing horizontal ConvLSTM network and vertical ConvLSTM network. The model is then optimized through an intelligent optimization algorithm.
It achieves low false detection rate, low false detection rate, and high detection accuracy in electricity theft detection, improving the model's generalization ability and overall performance.
Smart Images

Figure CN117313031B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of electricity theft detection technology, specifically relating to a ConvLSTM electricity theft detection method, system, device and medium that integrates its own and nearest neighbor's electricity usage information. Background Technology
[0002] With the rapid development of society and the economy, the demand for electricity is increasing daily. To ensure power supply and optimize the energy structure, countries around the world have expanded their investment in smart grids. However, driven by considerable economic interests, electricity theft by users persists despite repeated crackdowns. Globally, the economic losses caused by electricity theft amount to as much as US$96 billion annually, with my country's power companies alone suffering losses of up to RMB 20 billion annually. Furthermore, the illegal and irregular operations of electricity thieves can damage expensive power supply equipment, even causing large-scale power outages, fires, casualties, and endangering public safety. In the smart grid environment, electricity theft methods have become increasingly sophisticated, widespread, diverse, covert, and low-cost, making the situation increasingly serious. Therefore, to effectively curb or even eliminate electricity theft in smart grids, it is urgent to strengthen the scientific research and application of electricity theft detection technologies and build a highly reliable and secure smart grid.
[0003] In the era of smart grids, existing technologies present a vast amount of electricity consumption data from users, characterized by its massive volume, high speed, and diversity (3V). Utility companies store extensive historical electricity consumption data, and smart meters periodically report their consumption data, providing a foundation for data-driven electricity theft detection. These methods primarily utilize data mining and machine learning algorithms such as clustering, support vector machines, decision trees, ensemble learning, and artificial neural networks to analyze user electricity consumption data, along with related data like weather and date information, aiming to identify abnormal electricity consumption patterns associated with theft. Early electricity theft detection methods relied heavily on single models, resulting in relatively low accuracy. Later methods often combined multiple models and methods through ensemble learning, achieving higher accuracy. Currently, more advanced methods incorporate artificial neural networks such as convolutional neural networks and long short-term memory neural networks, leveraging the temporal characteristics of electricity consumption data and their implicit consumption patterns to further improve detection accuracy.
[0004] It is well known that users' electricity consumption patterns exhibit significant periodicity, and some users share striking similarities with their own electricity consumption patterns. Currently, most data-driven electricity theft detection methods rely on one-dimensional time-series data of user electricity consumption. These methods not only fail to fully utilize the periodicity of users' own electricity consumption patterns but also ignore the similarity in electricity consumption patterns among nearest-neighbor users. Consequently, these methods suffer from low detection accuracy and high rates of false negatives and false positives.
[0005] Patent application CN113377827B discloses a method and system for detecting electricity theft based on a Conv-LSTM network. This method constructs a two-dimensional matrix sequence containing electricity consumption data and the differences in electricity consumption between several adjacent days from a user's one-dimensional electricity consumption time-series data. Based on the ConvLSTM network, it makes full use of the periodic characteristics of the user's own electricity consumption pattern. However, this method completely ignores the similarity characteristics of the electricity consumption patterns between nearest neighbor users. In addition, the ConvLSTM network in this method has a large number of parameters, which is prone to getting trapped in local optima during training, resulting in a significant decrease in its detection accuracy and a significant increase in the false negative rate and false positive rate. Summary of the Invention
[0006] To overcome the shortcomings of the prior art, the present invention aims to provide a ConvLSTM electricity theft detection method, system, device, and medium that integrates the user's own and nearest neighbor's electricity consumption information. By reconstructing the one-dimensional electricity consumption time-series data of the user and its nearest neighbors into a two-dimensional neighboring day matrix sequence and a two-dimensional nearest neighbor matrix sequence, the present invention fully utilizes the periodic characteristics of the user's own electricity consumption pattern in the neighboring day matrix sequence and the similarity characteristics of the electricity consumption patterns between the nearest neighbor users in the nearest neighbor matrix sequence, thereby achieving electricity theft detection with low false detection rate, low false detection rate, and high detection accuracy.
[0007] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0008] A ConvLSTM electricity theft detection method that integrates its own and nearest neighbor's electricity usage information includes the following steps:
[0009] Step S1: Obtain the electricity consumption data of all users in a certain area of the smart grid within a certain time period, and preprocess the data to construct a time series data set containing the one-dimensional electricity consumption data of all users after preprocessing.
[0010] Step S2: Construct the nearest neighbor user set for each user using the one-dimensional electricity consumption time-series data set built in Step S1;
[0011] Step S3: Reconstruct the one-dimensional electricity consumption time series data of a user after preprocessing into a two-dimensional nearest-day matrix sequence; Based on the nearest neighbor user set constructed in step S2, reconstruct the one-dimensional electricity consumption time series data of the user itself and its nearest neighbors after preprocessing into a two-dimensional nearest-neighbor matrix sequence.
[0012] Step S4: Construct the detection sample dataset for the electricity theft detection method using the two-dimensional neighboring day matrix sequence and the two-dimensional nearest neighbor matrix sequence of the user constructed in step S3, and divide the detection sample dataset into a training set and a test set;
[0013] Step S5: Construct a ConvLSTM detection model that integrates its own and nearest neighbor's electricity consumption information, namely the ETD-SENICON detection model. Train and optimize the ETD-SENICON detection model using the training set constructed in step S4, and test the ETD-SENICON detection model using the test set constructed in step S4.
[0014] Further, step S1 includes:
[0015] Step S11: Obtain the time-series data of electricity consumption of n users in a certain area of the smart grid over a certain period of time, and label q. u Let Q represent the time-series electricity consumption data of user u, and let Q be a set constructed from the time-series electricity consumption data of n users, i.e., Q = {q1, q2, ..., q}. n};
[0016] Step S12: Fill in the time series data q from step S11 using interpolation methods. u Missing values for electricity consumption;
[0017] Step S13: Reduce the time series data q from step S11 using a piecewise aggregation approximation method. u Time offset noise;
[0018] Step S14: Preprocess the electricity consumption time-series data of the n users in the set Q constructed in step S11 using the interpolation method described in step S12 and the piecewise aggregation approximation method described in step S13, and label them. This represents the preprocessed time-series data of user u's electricity consumption, marked with... It is a set constructed from the preprocessed time-series electricity consumption data of n users, i.e.
[0019] Further, step S2 includes:
[0020] Step S21: Obtain the preprocessed electricity consumption time-series data for one week for n users, and label q′. u This represents the weekly electricity consumption time-series data for user u, marked with tags. It is a set constructed from the weekly electricity consumption time-series data of n users, i.e.
[0021] Step S22: Using locality-sensitive hashing (LSH), the set constructed in step S21 is... Mapping and bucketing of weekly electricity consumption time-series data from n users; mapping time-series data Find buckets with the same hash value set, and construct a candidate set of nearest neighbor users for user u by constructing the users corresponding to the time series data in the bucket. Calculate the weekly electricity consumption time series data and the time series data for any user in the candidate set. Similarity, select with time series data The user reconstruction candidate set corresponding to the n′ time series data with the highest similarity, and the label U′ represents the nearest neighbor user candidate set of user u;
[0022] Step S23: Calculate the weekly electricity consumption time-series data and time-series data of any user in the candidate set U′ constructed in step S22. Based on the similarity of the corresponding load curves, select data with time series data. For the users corresponding to the n″ load curves with the highest similarity to the load curves, construct a set of nearest neighbor users for user u. The set includes the user itself, but removes it. Let U denote the set of nearest neighbor users for user u, i.e., U = {u1, u2, ..., u2}. n″-1}
[0023] Further, step S3 includes:
[0024] Step S31: Based on the nearest neighbor user set U of user u, construct a set from the preprocessed one-dimensional electricity consumption time series data of the user itself and its nearest neighbors, and label it. This represents the constructed one-dimensional time-series data set of electricity consumption, i.e.
[0025] Step S32: Process the preprocessed one-dimensional electricity consumption time series data of user u Reconstructed into a two-dimensional nearest-day matrix, labeled Q d Represents the two-dimensional neighboring day matrix of user u; the one-dimensional electricity consumption time series data set constructed in step S31. Reconstruct it into a two-dimensional nearest neighbor matrix, labeled Q. s Represent the two-dimensional nearest neighbor matrix of user u; reconstruct the matrix Q. d Sum matrix Q s Remove redundant information, highlight the differences in electricity consumption in the supplementary information in the matrix, and label Q′. d Let Q′ represent the reconstructed two-dimensional neighboring day matrix. s Represents the reconstructed two-dimensional nearest neighbor matrix;
[0026] Step S33: For the two-dimensional nearest-day matrix Q′ in step S32 d and the two-dimensional nearest neighbor matrix Q′ s The data is divided to obtain the two-dimensional neighbor matrix sequence and the two-dimensional nearest neighbor matrix sequence of user u.
[0027] Further, step S4 is as follows: the two-dimensional neighboring day matrix sequence and the two-dimensional nearest neighbor matrix sequence of the user obtained in step S33 are divided into a detection sample dataset; the detection sample dataset is labeled, and the labeled detection sample dataset is divided into a training set and a test set.
[0028] Further, step S5 includes:
[0029] Step S51: Construct a ConvLSTM detection model that integrates its own and nearest neighbor's electricity consumption information, namely the ETD-SENICON detection model. The model consists of a "horizontal" ConvLSTM network, a "vertical" ConvLSTM network, and convolutional layers.
[0030] Step S52: Use the training set constructed in step S4 as the model input, use the binary cross-entropy as the loss function for model training, and train the ETD-SENICON detection model using the mini-batch gradient descent algorithm under the backpropagation mechanism.
[0031] Step S53: Use the training set constructed in step S4 as the model input, and the F1-measure value corresponding to the model output as the objective function value. Use an intelligent optimization algorithm to optimize the ETD-SENICON detection model trained in step S52.
[0032] Step S54: Test the ETD-SENICON detection model using the test set constructed in step S4. Input the test set into the optimized ETD-SENICON detection model in step S53, output the detection results, and determine whether user u has engaged in electricity theft.
[0033] This invention also provides a ConvLSTM electricity theft detection system that integrates its own and nearest neighbor's electricity usage information, comprising:
[0034] Data processing module: used to acquire electricity consumption data of all users in a certain area of the smart grid within a certain time period, preprocess the data, and construct a time series data set containing one-dimensional electricity consumption data of all users after preprocessing.
[0035] Set construction module: used to construct the nearest neighbor set of each user from the constructed one-dimensional electricity consumption time series data set;
[0036] Sequence Reconstruction Module: This module is used to reconstruct the one-dimensional electricity consumption time-series data of a user after preprocessing into a two-dimensional nearest-day matrix sequence; based on the constructed nearest-neighbor user set, it reconstructs the one-dimensional electricity consumption time-series data of the user itself and its nearest neighbors after preprocessing into a two-dimensional nearest-neighbor matrix sequence.
[0037] Dataset partitioning module: This module is used to construct a detection sample dataset for the electricity theft detection method using the user's two-dimensional neighboring day matrix sequence and two-dimensional nearest neighbor matrix sequence, and to partition the detection sample dataset into a training set and a test set.
[0038] Model processing module: Constructs a ConvLSTM detection model that integrates its own and nearest neighbor's electricity consumption information, namely the ETD-SENICON detection model. The ETD-SENICON detection model is trained and optimized using the training set and tested using the test set.
[0039] This invention also provides a ConvLSTM electricity theft detection device that integrates its own and nearest neighbor's electricity usage information, comprising:
[0040] Memory: A computer program that stores the ConvLSTM electricity theft detection method that integrates its own and nearest neighbor's electricity consumption information, and is a computer-readable device;
[0041] Processor: Used to implement the ConvLSTM electricity theft detection method that integrates its own and nearest neighbor's electricity usage information when executing the computer program.
[0042] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, enables the implementation of the ConvLSTM electricity theft detection method that integrates its own and nearest neighbor's electricity usage information.
[0043] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0044] 1. This invention reconstructs the one-dimensional electricity consumption time-series data of a user and its nearest neighbors into a two-dimensional neighboring day matrix sequence and a two-dimensional nearest neighbor matrix sequence, highlighting the periodic characteristics of the user's own electricity consumption pattern and the similarity characteristics of the electricity consumption patterns among the nearest neighbor users.
[0045] 2. This invention constructs an ETD-SENICON detection model, which integrates the periodic features of user-specific electricity consumption patterns extracted from the two-dimensional nearest-neighbor matrix sequence by the "horizontal" ConvLSTM network and the similarity features of electricity consumption patterns among nearest-neighbor users extracted from the two-dimensional nearest-neighbor matrix sequence by the "vertical" ConvLSTM network. The ConvLSTM network not only inherits the advantages of the LSTM network but also introduces a convolution mechanism into the LSTM network, enabling it to effectively extract the temporal features of electricity consumption data and its implicit electricity consumption pattern features from the matrix sequence.
[0046] 3. This invention optimizes the ETD-SENICON model through an intelligent optimization algorithm, which largely avoids the model getting trapped in local optima, improves the model's generalization ability, and effectively improves the model's overall performance.
[0047] In summary, this invention reconstructs the one-dimensional electricity consumption time-series data of the user and its nearest neighbors into a two-dimensional neighboring day matrix sequence and a two-dimensional nearest neighbor matrix sequence. It fully utilizes the periodic characteristics of the user's own electricity consumption pattern in the neighboring day matrix sequence and the similarity characteristics of the electricity consumption patterns among the nearest neighbor users in the nearest neighbor matrix sequence, thus achieving electricity theft detection with low false detection rate, low false detection rate and high detection accuracy. Attached Figure Description
[0048] Figure 1 This is a flowchart of the method of the present invention.
[0049] Figure 2 This is a schematic diagram illustrating the reconstruction of one-dimensional electricity consumption time-series data into a two-dimensional matrix sequence in an embodiment of the present invention.
[0050] Figure 3 This is a schematic diagram of the ETD-SENICON detection model in an embodiment of the present invention.
[0051] Figure 4 This is a schematic diagram of a ConvLSTM network in an embodiment of the present invention.
[0052] Figure 5 This is a flowchart of the PGHA algorithm in an embodiment of the present invention.
[0053] Figure 6 The figures shown are simulation results comparing the performance of embodiments of the present invention with existing technologies; wherein, Figure 6 (a) is a comparison chart of F1-measure indices. Figure 6 (b) is a comparison chart of the FNR index. Figure 6 (c) is a comparison chart of FPR indicators. Detailed Implementation
[0054] The present invention will now be described in further detail with reference to the accompanying drawings.
[0055] like Figure 1 As shown, this embodiment provides a ConvLSTM electricity theft detection method that integrates its own and nearest neighbor's electricity consumption information, including the following steps:
[0056] Step S1: Obtain the electricity consumption data of all users in a certain area of the smart grid within a certain time period, and preprocess the data to construct a time series data set containing the one-dimensional electricity consumption data of all users after preprocessing.
[0057] Step S11: In daily life, smart meters installed by power distribution companies report users' electricity consumption within a measurement cycle at a specific frequency (usually 15 minutes / time), reporting 96 electricity consumption data points daily. In this embodiment, electricity consumption data of n users in a certain community within a smart grid are obtained over a certain period of time, constructing a set Q, where L represents the number of electricity consumption data points reported by the smart meters during this time period. u ={q1,q2,…,q L};
[0058] Step S12: Due to reasons such as smart meter malfunction, data transmission abnormality, and data storage abnormality, users' electricity consumption time-series data often has missing values. The time-series data q from step S11 is filled in using an interpolation method. u Missing values for electricity consumption are identified. If the electricity consumption within a measurement period t is missing, it is filled with the average of the electricity consumption within the four adjacent measurement periods. Specifically, if the electricity consumption within the second or penultimate measurement period is missing, it is filled with the average of the electricity consumption within the two adjacent measurement periods. The interpolation formula is as follows:
[0059]
[0060] Step S13: Smart meters typically report users' electricity consumption data at a high frequency. However, users' main daily activities are often brought forward or delayed for various reasons (e.g., cooking may be brought forward or delayed due to work). This results in significant time-shift noise in the user's electricity consumption time-series data. The time-series data q from step S11 is reduced using a segmented aggregation approximation method. u The time offset noise is eliminated; the data is divided into segments of w electricity consumption, and the average electricity consumption of each segment is calculated to reconstruct the electricity consumption time series data. The denot T represents the number of data segments. mark Let represent the mean of the i-th data segment, then Right now In this embodiment, w=4 is selected, so the daily electricity consumption time series data includes 24 electricity consumption data points;
[0061] Step S14: Preprocess the electricity consumption time-series data of all users in set Q of step S11 using the interpolation method described in step S12 and the piecewise aggregation approximation method described in step S13 to construct a set.
[0062] Step S2: Construct a set of nearest neighbor users for each user using the one-dimensional electricity consumption time series data set built in step S1. The load curves of each user and its nearest neighbor users are highly similar.
[0063] Step S21: Obtain preprocessed one-week electricity consumption time-series data for n users and construct a set. Each user's weekly electricity consumption time-series data contains a total of 168 electricity consumption data points, namely
[0064] Step S22: Select the LSH technology based on the angular similarity distance metric. Any hash function from its corresponding hash function family is defined as:
[0065]
[0066] In the above formula, v represents a random projection vector that satisfies a Gaussian distribution.
[0067] Randomly select 25 projection vectors {v1, v2, ..., v 25 The vectors are orthogonalized to obtain pairwise orthogonal projection vectors, and a set of hash functions {h1, h2, ..., h} is constructed based on these vectors. 25}; will set Mapping and bucketing of weekly electricity consumption time-series data from n users; mapping time-series data Find buckets with the same hash value set, and construct the nearest neighbor candidate set for user u by constructing the users corresponding to the time series data in the bucket. If the number of users in the set is less than n′, then randomly search for buckets with the same hash values {24, 23, ...} in the hash value set, and merge the users corresponding to the time series data in the buckets until the number of users in the set is not less than n′; calculate the weekly electricity consumption time series data for any user l in the candidate set. With time series data Similarity, select with time series data The user reconstruction candidate set U′ corresponding to the n′ time series data with the highest similarity is selected as n′=19 in this embodiment. The similarity calculation formula is as follows:
[0068]
[0069] Step S23: Mark Indicates user u's Daily electricity consumption time-series data, for time-series data The corresponding daily load curve is approximated by a piecewise linear approach, with K=6 indicating the number of linear segments, and Δ... u ={δ u (1),δ u (2),…,δ u (K+1)} represents the set of breakpoints of its linear segment, denoted by R. u ={r u,1 ,r u,2 ,…,r u,KLet} represent its set of linear segments. Then, the k-th approximate linear segment of user u's daily load curve can be expressed as:
[0070] r u,k =a u,k t+b u,k ,δ u (k)≤t≤δ u (k+1)
[0071] In the above formula, a u,k and b u,k Let represent the slope and intercept of the k-th approximately linear segment, respectively;
[0072] Approximate linear segments are constructed for each segment using the least squares estimation method, and the intersection points of adjacent approximate linear segments are then determined. As segment breakpoints, among which, This ensures the continuity of the linear segments; using a dynamic programming algorithm, the continuity of each linear segment r is minimized. u,k Electricity consumption during measurement period t Construct a linear piecewise set R using the squared error u The formula for minimizing the squared error is:
[0073]
[0074] Time series data for user u and any user l in the candidate set U′ and The corresponding daily load curves are piecewise linearly approximated, and their set of discontinuities is represented by Δ. u ={δ u (1),δ u (2),…,δ u (K+1)} and Δ l ={δ l (1),δ l (2),…,δ l (K+1)}, whose linear piecewise sets are represented as R. u ={r u,1 ,r u,2 ,…,r u,K} and R l ={r l,1 ,r l,2 ,…,r l,K Merge the breakpoint sets of the two sets in ascending order and without repetition to obtain a new breakpoint set Δ. ul ={δ ul (1),δ ul (2),…,δ ul(M+1)}, further subdivide the approximately linear segments of user u and user l into segments, and the sets of the further subdivided linear segments are represented as R. u ={r′ u,1 ,r′ u,2 ,…,r′ u,M} and R l ={r′ l,1 ,r′ l,2 ,…,r′ l,M}, where the m-th approximately linear segment of user u after further segmentation can be expressed as:
[0075] r′ u,m =a′ u,m t+b′ u,m ,δ u (m)≤t≤δ u (m+1)
[0076] In the above formula, a′ u,m and b′ u,m Let represent the slope and intercept of the m-th approximately linear segment, respectively;
[0077] If and only if δ u (k)≤δ ul (m)<δ ul (m+1)≤δ u When (k+1), a′ u,m =a u,k ,b′ u,m =b u,k Similarly, we can obtain a′ l,m ,b′ l,m .mark This represents the average value of the endpoints of the m-th segment after further segmentation of user u. Similarly, we can obtain c′. l,m ;
[0078] With triple (a′ u,m ,c′ u,m ,δ ul (m+1)) Re-representing the m-th line segment after further segmentation of user u, the approximate linear segmentation set of user u can be represented as {(a′ u,1 ,c′ u,1 ,δ ul (2)),(a′ u,2 ,c′ u,2 ,δ ul (3)),…,(a′ u,M ,c′ u,M ,δ ul Similarly, the approximate linear piecewise set of user l can be represented as {(a′)}. l,1 ,c′l,1 ,δ ul (2)),(a′ l,2 ,c′ l,2 ,δ ul (3)),…,(a′ l,M ,c′ l,M ,δ ul (M+1))};
[0079] The morphological and numerical differences of the approximate linear piecewise set of daily load curves for users u and l are calculated using the following formulas:
[0080]
[0081]
[0082] Calculate the average value of the approximate linear segmented set shape difference of the daily load curves corresponding to the daily electricity consumption time-series data of users u and l for a continuous week. The average of the numerical differences As the morphological and numerical differences in the load curves of user u and user l;
[0083] Calculate the set of morphological differences in the load curves of user u and the candidate set U′. Set of numerical differences Perform maximum-min normalization on each of them. The normalization formula can be expressed as:
[0084]
[0085] In the above formula, and These represent the maximum and minimum values in the morphological / numerical difference set, respectively;
[0086] The similarity θ(u,l) between the load curves of user u and user l is calculated using the following formula:
[0087]
[0088] In the above formula, α represents the degree of morphological difference. sum of numerical differences In this embodiment, the weighting factor between them is selected as α = 0.1;
[0089] Calculate the weekly electricity consumption time series data of any user l in the candidate set U′. With time series data Based on the similarity of the corresponding load curves, select data with time series data. The users corresponding to the n″ load curves with the highest similarity to the load curves are constructed as the nearest neighbor user set of user u. The set includes the user itself and removes it. In this embodiment, n″ = 7 is selected, that is, U = {u1, u2, ... u6}. Obviously, the number of users n′ in the nearest neighbor candidate set and the number of users n″ in the nearest neighbor set satisfy (n′-1) = 3(n″-1).
[0090] Step S3: Reconstruct the one-dimensional electricity consumption time series data of a user after preprocessing into a two-dimensional nearest-day matrix sequence; Based on the nearest neighbor user set constructed in step S2, reconstruct the one-dimensional electricity consumption time series data of the user itself and its nearest neighbors after preprocessing into a two-dimensional nearest-neighbor matrix sequence.
[0091] Step S31: Based on the nearest neighbor user set U of user u, construct a set from the preprocessed one-dimensional electricity consumption time series data of the user itself and its nearest neighbors.
[0092] Step S32: Process the preprocessed one-dimensional electricity consumption time series data of user u Reconstructed into a two-dimensional neighboring day matrix Q d Matrix Q d The Behavioral time series data The electricity consumption data from the 24(i-1)+1th to the T-24(7-i)th data point ensures that the electricity consumption in each column of the matrix represents the user's own electricity consumption during the same measurement period in the nearest daytime; this sets up a one-dimensional electricity consumption time series data set. Reconstructed into a two-dimensional nearest neighbor matrix Q s Matrix Q s The Behavior set Q u Time series data of the j-th user The electricity consumption data from the 145th to the Tth data point, with the 7th row being time-series data. The electricity consumption data from the 145th to the Tth data point ensures that the column electricity consumption between rows of the matrix represents the electricity consumption of the nearest neighbor users within the same measurement period. Clearly, matrix Q... d Sum matrix Q s The data in row 7 is the same; in order to remove redundant information and highlight the differences in electricity consumption in the supplementary information in the matrix, the matrix Q is respectively... d Sum matrix Q s No. The difference between the row data of row 1 and the row data of row 7 is used to reconstruct the matrix, and a two-dimensional neighboring day matrix Q′ of user u is constructed. d and the two-dimensional nearest neighbor matrix Q′ s ;
[0093] Step S33: For the two-dimensional neighboring day matrix Q′ dand the two-dimensional nearest neighbor matrix Q′ s Dividing the data into 7 columns each yields a two-dimensional nearest-day matrix sequence. and the sequence of two-dimensional nearest neighbor matrices The submatrix has 7 rows and 7 columns. The data reconstruction process described above is as follows: Figure 2 As shown.
[0094] Step S4: Construct the detection sample dataset for the electricity theft detection method using the two-dimensional neighboring day matrix sequence and the two-dimensional nearest neighbor matrix sequence of the user constructed in step S3, and divide the detection sample dataset into a training set and a test set;
[0095] The two-dimensional neighbor matrix sequence and the two-dimensional nearest neighbor matrix sequence obtained in step S33 are divided into 7 sub-matrices, and each sub-matrix is used to construct a detection sample. For each detection sample, a random number in the range (0,1) is randomly generated. If the number is less than 0.5, the detection sample is marked as a normal sample; otherwise, the detection sample is marked as an electricity theft sample. Various electricity theft attacks are carried out on the 7th row of the electricity consumption sequence in the subsequence of the sample. The marked detection samples are divided into training set and test set in a 7:3 ratio.
[0096] Step S5: Construct a ConvLSTM detection model that integrates its own and nearest neighbor's electricity consumption information, namely the ETD-SENICON detection model. Train and optimize the ETD-SENICON detection model using the training set constructed in step S4, and test the ETD-SENICON detection model using the test set constructed in step S4.
[0097] like Figure 3 As shown, in step S51: the ETD-SENICON detection model consists of a "horizontal" ConvLSTM network, a "vertical" ConvLSTM network, and convolutional layers; the "horizontal" ConvLSTM network is used to extract the periodic features of the user's own electricity consumption pattern in the neighboring day matrix subsequence, and the "vertical" ConvLSTM network is used to extract the similarity features of the electricity consumption patterns between the nearest neighbor users in the nearest neighbor matrix subsequence; the features extracted by the "horizontal" ConvLSTM network and the "vertical" ConvLSTM network are fused, and the fused features are output as the electricity theft detection result through the convolutional layer;
[0098] Specifically, such as Figure 4As shown, the "horizontal" ConvLSTM network and the "vertical" ConvLSTM network have the same structure, both consisting of one or more ConvLSTM layers, each composed of multiple connected ConvLSTM nodes. A batch normalization layer is inserted between any two ConvLSTM layers to accelerate model convergence. The ConvLSTM network consists of an abstraction layer, a pooling layer, and a reduction layer connected in sequence. The abstraction layer is a single convLSTM layer with a 3×3 kernel and a stride of 1, using a "same padding" strategy to extract data features from the feature matrix sequence. The pooling layer consists of three convLSTM layers with a 3×3 kernel and a stride of 1, using an "effective padding" strategy to remove redundant information and compress the extracted data features. The reduction layer is a single convLSTM layer with a 3×3 kernel and a stride of 1, using a "same padding" strategy to further extract the time-dependent features from the compressed data features, which are then used as the data features extracted by the ConvLSTM network.
[0099] Label H respectively out_self and H out_other The data features extracted by the "horizontal" ConvLSTM network and the data features extracted by the "vertical" ConvLSTM network are represented by the following formula for fusing the data features:
[0100] H out =βH out_self +(1-β)H out_other
[0101] In the above formula, β represents the weighting factor for fusing the data features extracted between the "horizontal" ConvLSTM network and the "vertical" ConvLSTM network. In this embodiment, β = 0.5 is selected.
[0102] The fused features are input into the convolutional layer, and the probability of whether there is electricity theft data in the input detection sample is output through the Sigmoid function. If the output is greater than or equal to 0.5, the user is identified as an electricity theft user; otherwise, the user is identified as a normal user.
[0103] Step S52: Use the training set constructed in step S4 as the model input, use the binary cross-entropy as the loss function for model training, and train the ETD-SENICON detection model using the mini-batch gradient descent algorithm under the backpropagation mechanism.
[0104] Step S53: The optimizable weights obtained from the model training in Step S52 are expanded into a weight vector x, which is used as the solution vector to be optimized by the algorithm. The F1-measure value corresponding to the model output is used as the objective function value of the optimization algorithm. The training set constructed in Step S4 is used as the model input. A hybrid intelligent optimization algorithm based on GA and PSO, PGHA, is used to optimize the weights of the ETD-SENICON detection model trained in Step S52. Since the model has many optimizable weights, updating a large number of parameters would consume a lot of time. Therefore, the weights of the abstract layer and pooling layer of the ConvLSTM network in the model are frozen, and only the weights of the reduced layer and convolutional layer of the ConvLSTM network in the model are optimized and updated. Specifically, the PGHA algorithm process is as follows: Figure 5 As shown, the GA algorithm subsystem and the PSO algorithm subsystem are initialized respectively, and GA operations and PSO operations are executed respectively. The optimal solutions of the two subsystems are compared, and the optimal solution vector is selected as the optimal solution of the PGHA algorithm system. If the maximum number of iterations of the algorithm is not reached or the algorithm termination condition is met, then after the iteration process that meets the condition (the label t represents the current iteration number, the label T represents the specified iteration number, t%T=0) ends, p=0.1*min(N) is randomly selected from the two subsystems according to the objective function value of the solution vector. GA N PSO The solution vectors are swapped to update the population, and the GA and PSO operations are performed again.
[0105] Step S54: Test the ETD-SENICON detection model using the test set constructed in step S4. Input the test set into the optimized ETD-SENICON detection model in step S53, output the detection results, and determine whether user u has engaged in electricity theft.
[0106] The experimental analysis is as follows:
[0107] like Figure 6 As shown, a simulation of a real-world electricity theft attack is presented, and an electricity theft attack model is set up. Where α t <1, this attack model tampers with the electricity consumption data to a smaller value. Based on this attack model, a simulation experiment was conducted on the embodiment of the present invention, and compared with the prior art (i.e., patent CN113377827B). The simulation experiment compared three indicators: (1) F1-measure: measures the performance of the classification model, that is, reflects the detection accuracy; (2) FNR: represents the probability that a stolen electricity sample is predicted as a normal sample, that is, reflects the false negative rate; (3) FPR: represents the probability that a normal sample is predicted as a stolen electricity sample, that is, reflects the false positive rate; The simulation results are as follows Figure 6As shown, in all cases, the detection accuracy of this embodiment is higher than that of the prior art, and the false negative rate and false positive rate are lower than those of the prior art, which fully demonstrates the superior performance of the present invention.
[0108] This invention also provides a ConvLSTM electricity theft detection system that integrates its own and nearest neighbor's electricity usage information, comprising:
[0109] Data processing module: used to obtain the electricity consumption data of all users in a certain area of the smart grid within a certain period of time in step S1, and to preprocess the data to construct a time series data set containing the one-dimensional electricity consumption data of all users after preprocessing.
[0110] Set construction module: used to construct the nearest neighbor user set for each user in step S2 using the constructed one-dimensional electricity consumption time series data set;
[0111] Sequence Reconstruction Module: Used to reconstruct the one-dimensional electricity consumption time series data of a user after preprocessing into a two-dimensional nearest-day matrix sequence in step S3; and based on the constructed nearest-neighbor user set, reconstruct the one-dimensional electricity consumption time series data of the user itself and its nearest neighbors after preprocessing into a two-dimensional nearest-neighbor matrix sequence.
[0112] Dataset partitioning module: This module is used to implement the construction of the detection sample dataset for the electricity theft detection method in step S4 using the user's two-dimensional neighboring day matrix sequence and two-dimensional nearest neighbor matrix sequence, and to partition the detection sample dataset into a training set and a test set.
[0113] Model processing module: Used to implement the construction of the ConvLSTM detection model that integrates its own and nearest neighbor's electricity consumption information in step S5, namely the ETD-SENICON detection model, the ETD-SENICON detection model is trained and optimized through the training set, and the ETD-SENICON detection model is tested through the test set.
[0114] This invention also provides a ConvLSTM electricity theft detection device that integrates its own and nearest neighbor's electricity usage information, comprising:
[0115] Memory: A computer program that stores the ConvLSTM electricity theft detection method that integrates its own and nearest neighbor's electricity consumption information, and is a computer-readable device;
[0116] Processor: Used to implement the ConvLSTM electricity theft detection method that integrates its own and nearest neighbor's electricity usage information when executing the computer program.
[0117] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, enables the implementation of the ConvLSTM electricity theft detection method that integrates its own and nearest neighbor's electricity usage information.
Claims
1. A ConvLSTM power theft detection method fusing self and nearest neighbor power information, characterized in that: The method comprises the following steps: Step S1: obtaining power consumption data of all users in a certain region of a smart grid within a certain time period, and preprocessing the power consumption data to construct a time series data set containing one-dimensional power consumption data of all users after preprocessing; Step S2: constructing a nearest neighbor user set of each user through the one-dimensional power consumption time series data set constructed in step S1; Step S3: reconstructing the one-dimensional power consumption time series data of a certain user after preprocessing into a two-dimensional adjacent day matrix sequence; based on the nearest neighbor user set constructed in step S2, reconstructing the one-dimensional power consumption time series data of the user itself and its nearest neighbors after preprocessing into a two-dimensional nearest neighbor matrix sequence; Step S4: constructing a detection sample data set of the electricity stealing detection method through the two-dimensional adjacent day matrix sequence and the two-dimensional nearest neighbor matrix sequence of the user constructed in step S3, and dividing the detection sample data set into a training set and a test set; Step S5: constructing a ConvLSTM detection model that fuses self and nearest neighbor power consumption information, i.e., an ETD-SENICON detection model, training and optimizing the ETD-SENICON detection model through the training set constructed in step S4, and testing the ETD-SENICON detection model through the test set constructed in step S4; The step S2 comprises: Step S21: obtaining the time series data of the weekly power consumption of the user after preprocessing ; Step S22: mapping the set constructed in step S21 by local sensitive hashing technology In the week power consumption time series data of a user; mapping the time series data , finding the same bucket of the hash value set, and constructing the user corresponding to the time series data in the bucket as the nearest neighbor user candidate set of the user , calculating the similarity between the week power consumption time series data of any user in the candidate set and the time series data , selecting the user corresponding to the time series data with the largest similarity to the time series data , and reconstructing the candidate set, and marking to represent the nearest neighbor user candidate set of the user ; Step S23: Calculate the candidate set constructed in step S22 Weekly electricity consumption time-series data and time-series data for any user Based on the similarity of the corresponding load curves, select data with time series data. The load curve with the highest similarity The users corresponding to each load curve are constructed as users. Find the nearest neighbor set of users, which includes the user themselves, remove the user, and mark them. Indicates user The set of nearest neighbor users, i.e. ; The step S3 comprises: Step S31: Based on user nearest neighbor set The preprocessed one-dimensional electricity consumption time-series data of the user and its nearest neighbors are constructed into a set and labeled. This represents the constructed one-dimensional time-series data set of electricity consumption, i.e. ; Step S32: Preprocess the user One-dimensional electricity consumption time series data Reconstructed into a two-dimensional nearest-day matrix, labeled Indicates user A two-dimensional nearest-day matrix; the one-dimensional electricity consumption time-series data set constructed in step S31. Reconstructed into a two-dimensional nearest neighbor matrix, labeled Indicates user Two-dimensional nearest neighbor matrix; reconstructed matrix sum matrix Remove redundant information, highlight the differences in electricity consumption in the supplementary information in the matrix, and mark them. Represents the reconstructed two-dimensional nearest-day matrix, labeled Represents the reconstructed two-dimensional nearest neighbor matrix; Step S33: dividing the two-dimensional adjacent day matrix in step S32 and the two-dimensional nearest neighbor matrix to obtain a two-dimensional adjacent day matrix sequence and a two-dimensional nearest neighbor matrix sequence of the user ; The step S5 comprises: Step S51: constructing a ConvLSTM detection model that fuses self and nearest neighbor power consumption information, i.e., an ETD-SENICON detection model, the model being composed of a "horizontal" ConvLSTM network, a "vertical" ConvLSTM network, and a convolutional layer; Step S52: taking the training set constructed in step S4 as the model input, taking binary cross-entropy as the loss function of the model training, and training the ETD-SENICON detection model under the backward propagation mechanism using the mini-batch gradient descent algorithm; Step S53: taking the training set constructed in step S4 as the model input, taking the corresponding value of the model output as the objective function value, and using an intelligent optimization algorithm to optimize the ETD-SENICON detection model trained in step S52. Step S53: taking the training set constructed in step S4 as the model input, taking the corresponding value of the model output as the objective function value, and using an intelligent optimization algorithm to optimize the ETD-SENICON detection model trained in step S52. Step S54: test the ETD-SENICON detection model constructed by step S4 through the test set, input the test set into the ETD-SENICON detection model optimized by step S53, output the detection result, and determine whether the user exists electricity stealing behavior. 2.The ConvLSTM electricity theft detection method of claim 1, wherein: The step S1 comprises: Step S11: Obtain the data for a specific area within the smart grid. Electricity consumption time-series data of a user over a certain period of time, marked Indicates user Electricity consumption time-series data, marked For the reason A collection constructed from the time-series electricity consumption data of each user, namely ; Step S12: filling in the time series data in step S11 by an interpolation method Missing values of medium power consumption Step S13: reducing the time offset noise of the time series data of step S11 by piecewise aggregate approximation method Step S13: reducing the time offset noise of the time series data of step S11 by piecewise aggregate approximation method Step S14: Apply the interpolation method described in step S12 and the piecewise aggregation approximation method described in step S13 to the set constructed in step S11. middle The electricity consumption time-series data of each user is preprocessed and labeled. Indicates the user after preprocessing Electricity consumption time-series data, marked For preprocessing A collection constructed from the time-series electricity consumption data of each user, namely . 3.The ConvLSTM electricity theft detection method of claim 1, wherein: The step S4 is: dividing the two-dimensional adjacent day matrix sequence and the two-dimensional nearest neighbor matrix sequence of the user obtained in step S33, and constructing them into a detection sample data set; The detection sample data set is labeled, and the labeled detection sample data set is divided into a training set and a test set.
4. The ConvLSTM power theft detection system based on the method of claim 1, wherein: It comprises: A data processing module is configured to obtain power consumption data of all users in a certain region of a smart grid within a certain time period, and preprocess the power consumption data to construct a time series data set containing one-dimensional power consumption data of all users after preprocessing; A set construction module is configured to construct a nearest neighbor user set of each user through the constructed one-dimensional power consumption time series data set; A sequence reconstruction module is configured to reconstruct one-dimensional power consumption time series data of a certain user after preprocessing into a two-dimensional adjacent day matrix sequence; based on the constructed nearest neighbor user set, reconstructing one-dimensional power consumption time series data of the user itself and its nearest neighbors after preprocessing into a two-dimensional nearest neighbor matrix sequence; A data set division module is configured to construct a detection sample data set of the electricity stealing detection method through the two-dimensional adjacent day matrix sequence and the two-dimensional nearest neighbor matrix sequence of the user, and divide the detection sample data set into a training set and a test set; The model processing module: constructs a ConvLSTM detection model fused with self and nearest neighbor power consumption information, i.e. an ETD-SENICON detection model, trains and optimizes the ETD-SENICON detection model through a training set, and tests the ETD-SENICON detection model through a test set.
5. A ConvLSTM electricity theft detection device that fuses self and nearest neighbor electricity information, characterized by: The computer program product comprises: a memory: for storing a computer program of a ConvLSTM electricity stealing detection method fused with self and nearest neighbor power consumption information according to any one of claims 2-3, and for being readable by a computer; a processor: for executing the computer program to implement the ConvLSTM electricity stealing detection method fused with self and nearest neighbor power consumption information according to any one of claims 2-3.
6. A computer-readable storage medium, characterized in that: The computer program is stored in the computer readable storage medium, and when the computer program is executed by the processor, the ConvLSTM electricity stealing detection method fused with self and nearest neighbor power consumption information according to any one of claims 2-3 can be implemented.
Citation Information
Patent Citations
A method and system for detecting electricity theft based on Conv-LSTM networks
CN113377827B