Method and system for resisting abnormal power consumption behaviors based on data driving
By using technologies such as adaptive synthetic sampling and hyperparameter optimization in artificial intelligence models, the problems of data set imbalance and overfitting are solved, which significantly improves the detection accuracy of abnormal electricity use behavior and achieves more efficient identification capabilities.
Patent Information
- Application Number
- CN202411293837.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2024-12-20
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing technology has problems such as data set imbalance, long calculation time and overfitting in artificial intelligence model training, resulting in poor generalization ability and low detection accuracy of the model, making it difficult to effectively identify abnormal electricity use behavior.
Using a data-driven method, the abnormal electrical data samples are expanded through adaptive synthetic sampling (ADASYN), and hyperparameter optimization, regularization methods and jump connection methods are used in neural network models, including simulated annealing algorithm and batch collection. Integrate, weight decay and jump connection to improve the detection accuracy of the model.
The detection accuracy of a few types of samples (power stolen samples) is improved, the negative impact of data imbalance problem is avoided, the detection accuracy of the overall sample is improved, and the generalization ability and classification accuracy of the model are significantly improved.
Smart Images

Figure CN119167267A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of artificial intelligence anti-electricity theft, and specifically relates to a method and system for combating abnormal electricity usage behavior based on data drive. Background Art
[0002] Abnormal electricity usage includes electricity theft, meter failure, billing errors, etc. The main source is electricity theft. With the rapid increase in electricity demand in my country, abnormal electricity usage also occurs from time to time, which not only causes huge economic losses to power companies, but also threatens the personal safety and normal electricity use of residents.
[0003] Traditional methods for identifying abnormal electricity consumption behaviors focus on prevention. It is difficult to effectively identify them based on experience and user reports alone. With the development of science and technology, the methods and means of abnormal electricity consumption behaviors have become more scientific and information-based, which greatly increases their concealment. With the in-depth application of procurement and marketing systems, abnormal electricity consumption can be identified by using power big data and artificial intelligence methods. However, in the process of training artificial intelligence models, there will be problems such as unbalanced data sets, long calculation time, and overfitting, which will lead to poor generalization ability of the model and low detection accuracy. Summary of the invention
[0004] In view of the deficiencies in the prior art, the purpose of the present invention is to provide a method and system for combating abnormal electricity usage behavior based on data drive, which solves the problems in the prior art.
[0005] The purpose of the present invention can be achieved through the following technical solutions:
[0006] A method for combating abnormal power consumption behavior based on data drive, comprising the following steps:
[0007] Acquire electricity consumption data and pre-process the electricity consumption data;
[0008] Classify the preprocessed electricity consumption data and use adaptive synthetic sampling to expand the abnormal electricity consumption data samples;
[0009] The expanded electricity consumption data samples are input into the improved neural network model for classification, and the classification results are output; the improvements to the neural network model include hyperparameter optimization, regularization method and skip connection method.
[0010] Furthermore, the electricity consumption data preprocessing process includes: using linear interpolation to fill missing values of electricity consumption data, using the 3σ criterion to process abnormal values of electricity consumption data, and normalizing the electricity consumption data.
[0011] Furthermore, the step of expanding the abnormal power consumption data sample includes:
[0012] S21, the preprocessed electricity consumption data is divided into a training set, a validation set and a test set. Assume that Dtr is the training set, which contains m samples {x i ,y i}, i = 1, ..., m, where x i is an instance in the n-dimensional feature space X, y i ∈y={0,1} is the same as x i Related category labels, m s and m l are defined as the number of minority class samples and the number of majority class samples respectively; therefore, m s ≤m l , and m s +m l =m;
[0013] S22, calculate class imbalance
[0014] S23, calculate the number of samples that need to be synthesized for the minority class G = (m l -m s )×β, where β∈[0,1] is a parameter used to formulate the desired level of balancing after generating synthetic samples;
[0015] S24, for each sample x in the minority class i ∈m l , find K neighbors based on the Euclidean distance in n-dimensional space and calculate r i And to r i Standardize the process;
[0016]
[0017] Where Δi is x i The number of samples of the majority class in the K neighbor, r i ∈[0,1], K is the number of neighboring samples, is the normalized value;
[0018] S25, calculate each sample x in the minority class i The number of synthetic samples that need to be generated, and the minority class samples that need to be synthesized;
[0019]
[0020] s i =x i +λ(x k -x i )
[0021] Among them, λ is a random number, λ∈[0,1], (x k -xi ) is the difference vector in n-dimensional space; s i is the minority class sample, g i For each sample x i The number of synthetic samples required.
[0022] Further, the hyperparameter optimization is performed using a simulated annealing algorithm, which starts with random initialization of the population, and in each iteration, a fitness function is considered to evaluate more suitable solutions, and a new solution is selected based on a probability-based decision of whether to discard or keep the current solution.
[0023] Furthermore, the regularization method includes batch normalization and weight decay; batch normalization normalizes a batch of data in the input layer and the intermediate layer;
[0024] The formula for updating the weight by weight decay is:
[0025]
[0026] Where η and μ represent the learning rate and momentum term in ANN respectively; w i t is the weight updated in the tth step, and L is the loss function.
[0027] And add a regularization term to prevent overfitting and limit the size of the weights:
[0028]
[0029] Among them, γ is the weight decay coefficient; when γ = 0, there is no weight decay behavior.
[0030] Furthermore, the skip connection method skips some layers in the neural network and uses the output of one layer as the input of the next layer. The formula is:
[0031] X l+1 =σ(F(x l )+x l )
[0032] In the formula, F l represents the residual function, and σ is the ReLU activation max(0,x).
[0033] A data-driven system for combating abnormal power consumption behavior, comprising:
[0034] Data preprocessing module: obtains electricity consumption data and preprocesses the electricity consumption data;
[0035] Data sample expansion module: classifies the pre-processed electricity consumption data and uses adaptive synthetic sampling to expand abnormal electricity consumption data samples;
[0036] And, classification module: input the expanded and processed electricity consumption data samples into the improved neural network model for classification, and output the classification results; the improvements to the neural network model include hyperparameter optimization, regularization method and jump connection method.
[0037] A computer storage medium stores a readable program, which can execute the above-mentioned method of combating abnormal power consumption behavior based on data drive when the program is running.
[0038] An electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus;
[0039] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the above-mentioned method for combating abnormal power consumption behavior based on data driving.
[0040] A computer program product includes computer instructions, wherein the computer instructions instruct a computing device to execute operations corresponding to the above-mentioned method for combating abnormal electricity usage behavior based on data-driven.
[0041] Beneficial effects of the present invention:
[0042] The beneficial effects of the present invention are as follows: the present invention performs sample expansion based on ADASYN and uses a variety of parameter adjustment methods, which can not only improve the detection accuracy of minority samples, namely electricity theft samples, and avoid the negative impact of data imbalance problems, but also improve the detection accuracy of overall samples. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0044] Figure 1 It is a flow chart of a method for combating abnormal electricity consumption behavior based on data-driven according to the present invention;
[0045] Figure 2 This is a comparison chart of the detection effect of the model proposed in the present invention and the AUC scores of other models;
[0046] Figure 3 It is a comparison diagram of the positive and negative sample distribution before and after the sample expansion of the present invention. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] Example 1
[0049] like Figure 1 As shown, a method for combating abnormal power consumption behavior based on data drive includes the following steps:
[0050] S1, obtain 96 points of electricity consumption data of users with abnormal electricity consumption labels, with a time granularity of 15 minutes, and pre-process the electricity consumption data;
[0051] The steps of electricity consumption data preprocessing include:
[0052] S11, linear interpolation is used to fill in the missing values of electricity consumption data; the expression is:
[0053]
[0054] Among them, f(x i ) is the power consumption at the i-th time point after filling, x i To fill the electricity consumption at the previous i-th time point, NaN is the missing value.
[0055] S12, using the 3σ criterion to process outliers in electricity consumption data;
[0056]
[0057] Among them, g(x i ) is the power consumption at the i-th time point after processing, x is the actual power consumption vector, is the average value of electricity consumption, and σ is the standard deviation. When the electricity consumption data measured at time i does not satisfy the Gaussian distribution, the measured value at that time is Fill it.
[0058] S13, after processing the outlier and missing value data, the power consumption data is normalized to speed up the convergence of the neural network and avoid the problem of gradient explosion; the expression for normalizing the power consumption data is:
[0059]
[0060] Among them, min(x) and max(x) represent the minimum and maximum power consumption of the user respectively.
[0061] S2, classifies the preprocessed electricity consumption data and uses adaptive synthetic sampling (ADASYN) to expand the abnormal electricity consumption data samples to solve the problem of sample imbalance
[0062] Considering that there are few samples of abnormal electricity consumption, the problem of data imbalance will have an adverse effect on the performance of the algorithm, so the ADASYN model is selected to simulate and expand the abnormal electricity consumption data. The main idea of the ADASYN algorithm is to make full use of the density distribution information of the samples to determine the frequency of each minority class sample as the main sample, and synthesize more training data for a few difficult-to-learn class samples, so as to correct the negative impact of the imbalanced distribution of the class as much as possible.
[0063] The specific steps are:
[0064] S21, the preprocessed electricity consumption data is divided into a training set, a validation set and a test set. Assume that Dtr is the training set, which contains m samples {x i ,y i}, i = 1, ..., m, where x i is an instance in the n-dimensional feature space X, y i ∈y={0,1} is the same as x i Related category labels, m s and m l are defined as the number of minority class samples and the number of majority class samples respectively; therefore, m s ≤m l , and m s +m l =m;
[0065] S22, calculate class imbalance
[0066] S23, when d<d threshold , calculate the number of samples G that need to be synthesized for the minority class:
[0067] G=(m l -m s )×β (4)
[0068] where d threshold is the maximum threshold of class imbalance. β∈[0,1] is a parameter used to determine the desired level of balance after generating synthetic samples; β=1 means that a completely balanced dataset is formed after the operation;
[0069] S24, for each sample x in the minority class i ∈m i , find k neighbors based on the Euclidean distance in n-dimensional space and calculate r i , and for r i Standardize the process;
[0070]
[0071] Where Δi is x i The number of samples of the majority class in the k-neighbors, r i ∈[0,1], K is the number of neighboring samples, is the normalized value.
[0072] S25, calculate each sample x in the minority class i The number of synthetic samples that need to be generated, and use equations (7) and (8) to generate the minority class samples that need to be synthesized;
[0073]
[0074] s i =x i +λ(x k -x i ) (8)
[0075] Among them, λ is a random number, λ∈[0,1], (x k -x i ) is the difference vector in n-dimensional space; s i is the minority class sample, g i For each sample x i The number of synthetic samples required.
[0076] S3, inputting the electricity consumption data samples after sample expansion by the ADASYN algorithm into the improved neural network model for classification, and outputting the classification results;
[0077] Improvements to the neural network model include hyperparameter optimization, regularization methods, and skip connection methods; specifically, the following steps:
[0078] S31, hyperparameter optimization is performed using the simulated annealing algorithm (SA). The SA algorithm starts with random initialization of the population. In each iteration, a fitness (objective) function is considered to evaluate more suitable solutions, and a new solution is selected based on a probability-based decision of whether to discard or keep the current solution;
[0079] S32, regularization methods include batch normalization and weight decay; internal covariate shift (ICS) refers to the phenomenon that the input data of each neuron is no longer "independent and identically distributed"; batch normalization can effectively prevent the problem of internal covariate shift (ICS) during training by normalizing the data of a batch in the input layer and the intermediate layer; weight decay is a mature regularization technique that can keep the weight of the neural network small and avoid gradient explosion. The general formula for updating weights is as follows:
[0080]
[0081] Where η and μ represent the learning rate and momentum term in ANN respectively; w i t is the weight updated in the tth step, and L is the loss function.
[0082] By adding a regularization term to prevent overfitting and limit the size of the weights, as follows:
[0083]
[0084] Among them, γ is the weight decay coefficient; when γ = 0, there is no weight decay behavior.
[0085] S33, the skip connection method skips some layers in the neural network and uses the output of one layer as the input of the next layer. The formula is:
[0086] X l+1 =σ(F(x l )+x l ) (11)
[0087] where F l represents the residual function, and σ is the ReLU activation max(0,x).
[0088] Example 2
[0089] This embodiment uses the time series data on user electricity consumption provided by the State Grid, and records the electricity consumption records of 42,372 users from January 1, 2014 to October 31, 2016. Among them, 3,615 users were identified as abnormal electricity users through offline staff investigation, and the remaining users were not marked as abnormal electricity users.
[0090] Figure 2 It shows the existence of minority and majority classes before and after sample expansion. Figure 2 The number of positive samples in (a) is significantly larger than that of negative samples, which makes it difficult for the network to learn the rules of negative samples. The sample distribution after expansion is as follows Figure 2 As shown in (b) in the figure, it can be seen that the sample distribution is more uniform, so the distribution law of abnormal power consumption data can be learned.
[0091] Figure 3 The classification AUC scores of different models are shown. It can be seen that the classification accuracy has been improved to a certain extent after sample expansion. Compared with the baseline model, the improved ANN model has higher classification accuracy, indicating that this improvement is effective.
[0092] The method of the present invention may be implemented in hardware, firmware, or as software or computer code that may be stored in a recording medium (such as a CDROM, RAM, floppy disk, hard disk, or magneto-optical disk), or as computer code that is originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded over a network and will be stored in a local recording medium, so that the method described herein may be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an ASIC or FPGA). It is understood that a computer, processor, microprocessor controller, or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, processor, or hardware, the method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown herein, the execution of the code converts the general-purpose computer into a dedicated computer for executing the method shown herein.
[0093] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments, and the above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, and these changes and improvements all fall within the scope of the present invention to be protected.
Claims
1. A data-driven method for combating abnormal electricity consumption behavior. It is characterized in that The following steps are involved: Acquire electricity consumption data and pre-process the electricity consumption data; Classify the preprocessed electricity consumption data and use adaptive synthetic sampling to expand the abnormal electricity consumption data samples; Input the expanded electricity consumption data samples into the improved neural network model for classification, and output the classification results; Improvements to neural network models include hyperparameter optimization, regularization methods, and skip connection methods.
2. According to claim 1, a method for combating abnormal electricity consumption behavior based on data drive, It is characterized in that The electricity consumption data preprocessing process includes: using linear interpolation method to fill the missing values of electricity consumption data, using the 3σ criterion to deal with outliers in electricity consumption data, and normalizing the electricity consumption data.
3. According to claim 1, a method for combating abnormal electricity consumption behavior based on data drive, It is characterized in that The steps for expanding the abnormal electricity consumption data sample include: S21, the preprocessed electricity consumption data is divided into a training set, a validation set and a test set. Assume that Dtr is the training set, which contains m samples {x i ,y i }, i = 1, ..., m, where x i is an instance in the n-dimensional feature space X, y i ∈y={0,1} is the same as x i Related category labels, m s and m l are defined as the number of minority class samples and the number of majority class samples respectively; therefore, m s ≤m l , and m s +m l =m; S22, calculate class imbalance d∈(0,1]; S23, calculate the number of samples that need to be synthesized for the minority class G = (m l -m s )×β, where β∈[0,1] is a parameter used to formulate the desired level of balancing after generating synthetic samples; S24, for each sample x in the minority class i ∈m l , find K neighbors based on the Euclidean distance in n-dimensional space and calculate r i And to r i Standardize the process; Where Δi is x i The number of samples of the majority class in the K neighbors, r i ∈[0,1], K is the number of neighboring samples, is the normalized value; S25, calculate each sample x in the minority class i The number of synthetic samples that need to be generated, and the minority class samples that need to be synthesized; s i =x i +λ(x k -x i ) Among them, λ is a random number, λ∈[0,1], (x k -x i ) is the difference vector in n-dimensional space; s i is the minority class sample, g i For each sample x i The number of synthetic samples required.
4. According to claim 1, a method for combating abnormal electricity consumption behavior based on data drive, It is characterized in that The hyperparameter optimization is performed using a simulated annealing algorithm that starts with a random initialization of the population and, in each iteration, a fitness function is considered to evaluate more suitable solutions, selecting a new solution based on a probability-based decision of whether to discard or keep the current solution.
5. According to claim 1, a method for combating abnormal electricity consumption behavior based on data drive, It is characterized in that The regularization method includes batch normalization and weight decay; batch normalization normalizes the data of a batch of the input layer and the intermediate layer; The formula for updating the weight by weight decay is: Among them, η and μ represent the learning rate and momentum term in ANN respectively; is the weight updated in the tth step, and L is the loss function. And add a regularization term to prevent overfitting and limit the size of the weights: Among them, γ is the weight decay coefficient; when γ = 0, there is no weight decay behavior.
6. A method for combating abnormal electricity consumption behavior based on data drive according to claim 1, It is characterized in that The skip connection method skips some layers in the neural network and uses the output of one layer as the input of the next layer. The formula is: X l+1 =σ(F(x l )+x l ) In the formula, F l represents the residual function, and σ is the ReLU activation max(0,x).
7. A data-driven system to combat abnormal electricity consumption behavior. It is characterized in that include: Data preprocessing module: obtains electricity consumption data and preprocesses the electricity consumption data; Data sample expansion module: classifies the pre-processed electricity consumption data and uses adaptive synthetic sampling to expand abnormal electricity consumption data samples; And, classification module: input the expanded and processed electricity consumption data samples into the improved neural network model for classification, and output the classification results; Improvements to neural network models include hyperparameter optimization, regularization methods, and skip connection methods.
8. A computer storage medium storing a readable program, It is characterized in that When the program is running, it can execute the method for combating abnormal electricity usage behavior based on data driving as described in any one of claims 1 to 6.
9. An electronic device, include: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the method for combating abnormal power consumption behavior based on data driving as described in any one of claims 1-6.
10. A computer program product, comprising computer instructions, wherein the computer instructions instruct a computing device to execute operations corresponding to the method for combating abnormal electricity usage behavior based on data drive as described in any one of claims 1 to 6.
