A method and system for cleaning and classifying abnormal power consumption data of power users
By preprocessing and expanding data sets of smart grid electricity consumption data, the problem of data imbalance is solved, and an effective power theft discriminator is built, which improves the accuracy of power theft detection.
Patent Information
- Application Number
- CN202411224676.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-09-03
AI Technical Summary
There are a large number of missing values, outliers and unbalanced data distributions in the electricity consumption data generated in the smart grid, which makes it difficult to classify data cleaning and power stolen and non-power stolen data.
By preprocessing historical power consumption data, including restoring lost data, processing outliers and data standardization, and adding synthetic samples of a few classes through the data set expansion scheme, deleting redundant samples of most classes, and achieving balanced distribution of the data set , thereby building an effective power stolen discriminator for real-time classification.
It significantly improves the integrity and consistency of data, balances the distribution of data sets, improves the learning effect of the power stolen discriminator on a few types of samples, reduces classification deviations, and improves the accuracy of power stolen detection.
Smart Images

Figure CN118734236B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electricity consumption data cleaning, and in particular to a method and system for cleaning and classifying abnormal electricity consumption data of power users. Background Art
[0002] With the development of smart grids, the amount of data generated and collected in power systems has increased dramatically, making it possible to monitor and record users' electricity usage behavior in real time. However, these data usually contain a large number of missing values, outliers, and unbalanced data distribution, which brings great challenges to data cleaning and classification of electricity theft and non-electricity theft data. In view of this, it is necessary to study and improve related technologies to meet the needs of users. Summary of the invention
[0003] In order to meet the user's demand for cleaning and classifying electricity consumption data, the purpose of the present invention is to provide a method and system for cleaning and classifying abnormal electricity consumption data of power users.
[0004] To achieve the purpose of the present invention, the technical solution provided by the present invention is as follows:
[0005] First aspect
[0006] The present invention provides a method for cleaning and classifying abnormal power consumption data of power users, comprising the following steps:
[0007] Step S1: Collect historical electricity consumption data of power users to form a historical electricity consumption data set X , wherein the historical electricity consumption data has been marked as electricity consumption data of non-electricity stealing users or electricity consumption data of electricity stealing users;
[0008] Step S2: The historical electricity consumption data set X Perform preprocessing to obtain the preprocessed historical electricity consumption data set , the preprocessing includes recovering lost data, processing outliers, and data standardization;
[0009] Step S3: Preprocess the historical electricity consumption data set Expand and get the data set ;
[0010] The step S3 specifically includes the following:
[0011] Step S3.1: Calculate the power consumption data of the electricity-stealing users to be increased: , and Electricity consumption data of electricity theft users and Splice into a power consumption matrix of electricity stealing users ;
[0012] Step S3.2: Target , delete unnecessary non-electricity-stealing user electricity consumption data, and form a non-electricity-stealing user electricity consumption matrix ;
[0013] Step S3.3: and Splice into data set ;
[0014] Step S3.4: Calculation The degree of characteristic imbalance ratio , It is the ratio of the amount of electricity used by electricity-stealing users to the amount of electricity used by non-electricity-stealing users;
[0015] Step S3.5: Repeat steps S3.1 to S3.4 until Output The dataset at that time , dataset The elements are used express;
[0016] Step S4: Build a power theft detector and use the dataset In Training the electricity theft detector;
[0017] Step S5: using the trained electricity theft discriminator to classify the electricity consumption data of the monitored power users in the distribution network in real time, and judging whether they are non-electricity theft users or electricity theft users according to the classification results.
[0018] Second aspect
[0019] Corresponding to the above method, the present invention provides a power user power consumption abnormal data cleaning and classification system, comprising the following units: a historical power consumption data set X forming unit, a preprocessing unit, a data set expansion unit, a power theft discriminator building unit, and a classification unit;
[0020] The historical power consumption data set X forming unit is used to collect the historical power consumption data of power users to form a historical power consumption data set X , wherein the historical electricity consumption data has been marked as electricity consumption data of non-electricity stealing users or electricity consumption data of electricity stealing users;
[0021] The preprocessing unit is used to process the historical power consumption data set X Perform preprocessing to obtain the preprocessed historical electricity consumption data set , the preprocessing includes recovering lost data, processing outliers, and data standardization;
[0022] The data set expansion unit is used to expand the preprocessed historical power consumption data set. Expand and get the data set ;
[0023] The data set expansion unit is specifically used to perform the following steps:
[0024] Step S3.1: Calculate the power consumption data of the electricity-stealing users to be increased: , and Electricity consumption data of electricity theft users and Splice into a power consumption matrix of electricity stealing users ;
[0025] Step S3.2: Target , delete unnecessary non-electricity-stealing user electricity consumption data, and form a non-electricity-stealing user electricity consumption matrix ;
[0026] Step S3.3: and Splice into data set ;
[0027] Step S3.4: Calculation The degree of characteristic imbalance ratio , It is the ratio of the amount of electricity used by electricity-stealing users to the amount of electricity used by non-electricity-stealing users;
[0028] Step S3.5: Repeat steps S3.1 to S3.4 until Output The dataset at that time , dataset The elements are used express;
[0029] The electricity theft discriminator unit is used to construct an electricity theft discriminator and use a data set In Training the electricity theft detector;
[0030] The classification unit is used to classify the power consumption data of the monitored power users in the distribution network in real time using the trained power theft discriminator, and judge whether the users are non-power theft users or power theft users according to the classification results.
[0031] Compared with the prior art, the present invention preprocesses the historical electricity consumption data set, significantly improving the integrity and consistency of the data; the present invention adopts a scheme for expanding the historical electricity consumption data set, adds synthetic samples of the minority class and deletes redundant majority class samples, thereby achieving a balanced distribution of the data set, effectively solving the problem of imbalanced data sets, significantly improving the learning effect of the electricity theft discriminator on minority class samples, reducing classification bias, thereby improving the detection accuracy of the electricity theft discriminator on minority class samples, and enabling the electricity theft discriminator to more accurately detect electricity theft behavior. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A schematic diagram of a method flow chart provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0033] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the drawings 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. Example 1
[0034] like Figure 1 As shown, this embodiment provides a method for cleaning and classifying abnormal power consumption data of power users, including the following steps:
[0035] Step S1: Collect historical electricity consumption data of power users to form a historical electricity consumption data set X , wherein the historical electricity consumption data has been marked as electricity consumption data of non-electricity stealing users or electricity consumption data of electricity stealing users;
[0036] Among them, the historical electricity consumption data set X as follows:
[0037]
[0038] In the formula, Represents the historical electricity consumption data of power users, x mn Indicates m The first electricity user n The power consumption at each timestamp.
[0039] It should be noted that in the above historical electricity consumption data, it has been marked which data are the electricity consumption data of non-electricity theft users. Identify which are the electricity consumption data of electricity theft users and which are the electricity consumption data of electricity theft users. Logo.
[0040] Step S2: Preprocess the historical electricity consumption data set X to obtain a preprocessed historical electricity consumption data set , the preprocessing includes recovering lost data, processing outliers, and data standardization;
[0041] The details are as follows:
[0042] Step S2.1: restore missing values based on interpolation method;
[0043] Step S2.2: Use the “three sigma rule of thumb” to handle outliers;
[0044] Step S2.3: Data standardization, as follows:
[0045] Use the MIN-MAX scaling method to rescale the data set processed in the above steps to the range of 0 to 1 to obtain the preprocessed historical electricity consumption data set :
[0046] .
[0047] Step S3: Preprocess the historical electricity consumption data set Expand and get the data set ;
[0048] It should be noted that, because the electricity consumption data of electricity theft users accounts for a very small proportion of the entire data set, in order to highlight the characteristics of their electricity theft data, it is necessary to supplement the electricity consumption data of electricity theft users.
[0049] The details are as follows:
[0050] Step S3.1: Calculate the power consumption data of the electricity-stealing users to be increased: , and Electricity consumption data of electricity theft users and Splice into a power consumption matrix of electricity stealing users ;
[0051] The details include:
[0052] Step S3.1.1: Calculate the electricity consumption data of the electricity-stealing users to be increased: , including the following:
[0053] Step S3.1.1.1: Electricity consumption data of electricity theft users And non-electricity-stealing users' electricity consumption data , using the distance formula , find v Individual and The nearest ;
[0054] in, It refers to the pth , It refers to the zth ; and They are The amount of electricity consumed by non-electricity-stealing users and the amount of electricity consumed by electricity-stealing users, that is, and The number of is related as follows: and , m is the index of electricity users, n Represents a time index;
[0055] Step S3.1.1.2: Use the obtained v and To calculate the ratio radius , the specific formula is as follows: ;
[0056] Step S3.1.1.3: Use the formula , the ratio radius Normalized to get the normalized ratio radius ;
[0057] Step S3.1.1.4: Use the normalized ratio radius , calculate the power consumption data of the electricity-stealing users that need to be increased as , as follows:
[0058] ;
[0059] In the formula, the variable λ represents the random number ; express Difference vector in dimensional space; parameters ,Depend on To obtain, G is the number of electricity consumption data of users who need to synthesize electricity theft, ,in, Indicates the degree of characteristic imbalance ratio, that is, the balance level of electricity theft data and non-electricity theft data required after synthesizing the electricity consumption data of electricity theft users; Electricity usage data for electricity theft users Remove the other data of the i-th data.
[0060] Step S3.1.2: and Splice into a power consumption matrix of electricity stealing users .
[0061] Step S3.2: Target , delete unnecessary non-electricity-stealing user electricity consumption data, and form a non-electricity-stealing user electricity consumption matrix ;
[0062] These include:
[0063] Step S3.2.1: From Select ;
[0064] Step S3.2.2: Delete unnecessary non-electricity-stealing user electricity consumption data, including the following:
[0065] First, in Find the distance The electricity consumption of the three most recent non-electricity-stealing users; secondly, only keep With the smallest distance , delete the other two ; Finally, there will be no deleted Save and splice into the power consumption matrix of non-electricity-stealing users .
[0066] Step S3.3: and Splice into data set ;
[0067] Step S3.4: Calculation The degree of characteristic imbalance ratio , It is the ratio of the amount of electricity used by electricity-stealing users to the amount of electricity used by non-electricity-stealing users;
[0068] Step S3.5: Repeat steps S3.1 to S3.4 until Output The dataset at that time , dataset The elements are used It should be noted that this means that the electricity theft data and the non-electricity theft data are equal. In this case, the electricity theft data features and the non-electricity theft data features are equally important to the identifier.
[0069] Step S4: Build a power theft detector and use the dataset In Training the electricity theft detector;
[0070] It should be noted that a neural network is established in this step.
[0071] The electricity theft detector consists of an input layer, an output layer, and a hidden layer. Their structures are similar to Composition, receiving data The one that outputs whether electricity is stolen is the output layer, and the one between the two is the hidden layer.
[0072] Step S4.1: Establish a neural network, as follows:
[0073] ;
[0074] ;
[0075] In the formula, Indicates the hidden layer Neurons are input The corresponding output is: is 1, 2, 3; Represents matrix transpose; and represents the parameters (weights and biases) of the neural network, and the activation function is used express; For judgment The type value (whether it is the user data of electricity theft determined by the electricity theft detector) is obtained by weighted summation of three neurons; is the weight of each neuron.
[0076] Step S4.2: Initialize network parameters, and All are 0;
[0077] Step S4.3: Input and output and ;
[0078] Step S4.4: Calculate the current loss function L , as follows:
[0079] ;
[0080] in, express The corresponding real type value (whether it is electricity theft user data).
[0081] Step S4.5: Calculate the The error of a neuron ;
[0082] ;
[0083] Step S4.6: Update the weights of the neurons to get ;
[0084]
[0085] in, is the coefficient of variation;
[0086] Step S4.7: Calculate the partial derivatives of w and b, the formula is as follows;
[0087] ;
[0088] Step S4.8: Calculate the change in weight , the formula is as follows:
[0089] ;
[0090] Step S4.9: Combination , update the weights ,get , the formula is as follows:
[0091] ;
[0092] In the formula, and Respectively represent the learning rate and momentum terms in artificial neural networks; Indicates Neural network parameters of neurons The attenuation parameter of , the weight decay property can be easily disabled to obtain typical behavior.
[0093] Step S4.10: Calculate weights The offset before and after the update; the formula is as follows:
[0094]
[0095] If the offset is greater than 0.25, it is discarded. ,wrong Otherwise, keep the updated ;
[0096] Step S4.11: Update bias get ;
[0097] ;
[0098] Step S4.12: Repeat steps S4.1-S4.11 until all Use them all to complete the training.
[0099] Step S5: using the trained electricity theft discriminator to classify the electricity consumption data of the monitored power users in the distribution network in real time, and judging whether they are non-electricity theft users or electricity theft users according to the classification results.
[0100] Specifically, using the electricity theft detector The power consumption data of the power users in the distribution network are judged. If the power consumption data is judged to be a non-power stealing user, then the user is a non-power stealing user; if the power consumption data is judged to be a power stealing user, then the user is a power stealing user.
[0101] in, The power consumption data of the monitored power users in the distribution network; is the weight of each neuron; , , Respectively represent the 1st, 2nd, and 3rd neurons in the hidden layer at the input The corresponding output is: For judgment The type value is obtained by weighted summation of three neurons.
[0102] Example 2
[0103] This embodiment provides a power user power consumption abnormal data cleaning and classification system, including the following units: a historical power consumption data set X forming unit, a preprocessing unit, a data set expansion unit, a power theft discriminator building unit, and a classification unit;
[0104] The historical power consumption data set X forming unit is used to collect the historical power consumption data of power users to form a historical power consumption data set X , wherein the historical electricity consumption data has been marked as electricity consumption data of non-electricity stealing users or electricity consumption data of electricity stealing users;
[0105] The preprocessing unit is used to process the historical power consumption data set X Perform preprocessing to obtain the preprocessed historical electricity consumption data set , the preprocessing includes recovering lost data, processing outliers, and data standardization;
[0106] The data set expansion unit is used to expand the preprocessed historical power consumption data set. Expand and get the data set ;
[0107] The data set expansion unit is specifically used to perform the following steps:
[0108] Step S3.1: Calculate the power consumption data of the electricity-stealing users to be increased: , and Electricity consumption data of electricity theft users and Splice into a power consumption matrix of electricity stealing users ;
[0109] Step S3.2: Target , delete unnecessary non-electricity-stealing user electricity consumption data, and form a non-electricity-stealing user electricity consumption matrix ;
[0110] Step S3.3: and Splice into data set ;
[0111] Step S3.4: Calculation The degree of characteristic imbalance ratio , It is the ratio of the amount of electricity used by electricity-stealing users to the amount of electricity used by non-electricity-stealing users;
[0112] Step S3.5: Repeat steps S3.1 to S3.4 until Output The dataset at that time , dataset The elements are used express;
[0113] The electricity theft discriminator unit is used to construct an electricity theft discriminator and use a data set In Training the electricity theft detector;
[0114] The classification unit is used to classify the power consumption data of the monitored power users in the distribution network in real time using the trained power theft discriminator, and judge whether the users are non-power theft users or power theft users according to the classification results.
[0115] The preprocessing unit is specifically used to perform the following steps:
[0116] Step S2.1: for the historical electricity consumption dataset X, restore missing values based on an interpolation method;
[0117] Step S2.2: For the historical electricity consumption dataset with restored missing values, use the three sigma rule of thumb to handle outliers;
[0118] Step S2.3: Standardize the historical electricity consumption dataset after processing outliers, and use the MIN-MAX scaling method to rescale the historical electricity consumption dataset to the range of 0 to 1 to obtain the preprocessed historical electricity consumption dataset. .
[0119] Wherein, the step S3.1 includes the following:
[0120] Step S3.1.1: Calculate the electricity consumption data of the electricity-stealing users to be increased: , including the following:
[0121] Step S3.1.1.1: Electricity consumption data of electricity theft users And non-electricity-stealing users' electricity consumption data , using the distance formula , find v Individual and The nearest ;
[0122] in, It refers to the pth , It refers to the zth ; and They are The relationship between the amount of electricity consumed by non-electricity theft users and the amount of electricity consumed by electricity theft users is: and ; m is the index of electricity users, n Represents a time index;
[0123] Step S3.1.1.2: Use the obtained v and To calculate the ratio radius , the specific formula is as follows: ;
[0124] Step S3.1.1.3: Use the formula , the ratio radius Normalized to get the normalized ratio radius ;
[0125] Step S3.1.1.4: Use the normalized ratio radius , calculate the power consumption data of the electricity-stealing users that need to be increased as , as follows:
[0126] ;
[0127] In the formula, the variable λ represents the random number ; express Difference vector in dimensional space; parameters ,Depend on To obtain, G is the number of electricity consumption data of users who need to synthesize electricity theft, ,in, Indicates the degree of feature imbalance ratio; Electricity usage data for electricity theft users Remove the other data of the i-th data.
[0128] Step S3.1.2: and Splice into a power consumption matrix of electricity stealing users .
[0129] Wherein, the step S3.2 includes the following:
[0130] Step S3.2.1: From Select ;
[0131] Step S3.2.2: Delete unnecessary non-electricity-stealing user electricity consumption data, including the following:
[0132] First, in Find the distance The electricity consumption of the three most recent non-electricity-stealing users; secondly, only keep With the smallest distance , delete the other two ; Finally, there will be no deleted Save and splice into the power consumption matrix of non-electricity-stealing users .
[0133] Wherein, the electricity theft detector is:
[0134] ;
[0135] in, The power consumption data of the monitored power users in the distribution network; is the weight of each neuron; , , Respectively represent the 1st, 2nd, and 3rd neurons in the hidden layer at the input The corresponding output is: For judgment The type value is obtained by weighted summation of three neurons.
[0136] Finally, it should be noted that the above embodiments are only used to illustrate and explain the present invention, and are not intended to limit the present invention to the scope of the described embodiments. In addition, those skilled in the art can understand that the present invention is not limited to the above embodiments, and more variations and modifications can be made according to the teachings of the present invention, and these variations and modifications all fall within the scope of the protection claimed by the present invention.
Claims
1. A method for cleaning and classifying abnormal power consumption data of power users, characterized in that: The steps include: Step S1: Collect historical electricity consumption data of power users to form a historical electricity consumption data set X, wherein the historical electricity consumption data has been marked as electricity consumption data of non-electricity theft users or electricity consumption data of electricity theft users; Step S2: preprocessing the historical electricity consumption dataset X to obtain a preprocessed historical electricity consumption dataset X', wherein the preprocessing includes restoring lost data, processing outliers, and data standardization; Step S3: Expand the preprocessed historical electricity consumption data set X' to obtain a data set X". The step S3 specifically includes the following: Step S3.1: Calculate the electricity consumption data of the electricity stealing users to be increased as x i ", and the electricity consumption data x of the electricity stealing users in X' i ' and x i ” is spliced into the electricity consumption matrix X of the electricity stealing users i '; Step S3.2: For X', delete unnecessary non-electricity-stealing user electricity consumption data to form a non-electricity-stealing user electricity consumption matrix X j '; Step S3.3: Set X i ' and X j 'joined into data set X"; Step S3.4: Calculate the degree β of the characteristic imbalance ratio of X”, where β is the ratio of the amount of electricity used by electricity-stealing users to the amount of electricity used by non-electricity-stealing users; Step S3.5: Repeat steps S3.1 to S3.4 until β = 1; output the data set X” when β = 1. The elements of the data set X” are the elements of the data set x. c "'express; Step S4: Construct a power theft detector and use x in the dataset X' c ” 'Training the electricity theft detector; The details are as follows: The electricity theft detector consists of an input layer, an output layer, and a hidden layer. It receives data x c The layer with "' is the input layer, the layer that outputs whether electricity is stolen is the output layer, and the layer between the two is the hidden layer; Step S4.1: Establish a neural network, as follows: h θ (x c ”')=ε1h1(x c ”')+ε2h2(x c ”')+ε3h3(x c ”') In the formula, h l (x c ”') indicates that the lth neuron in the hidden layer receives input x c ”’ corresponds to the output; l is 1, 2, 3; T represents matrix transpose; w and b represent the parameters (weights and biases) of the neural network, and the activation function is represented by f(·); h θ (x c ”') is used to judge x c The type value (whether it is electricity theft user data identified by the electricity theft detector) is obtained by weighted summation of three neurons; ε1, ε2, ε3 are the weights of each neuron; Step S4.2: Initialize network parameters, w and b are both 0; Step S4.3: Set x c ”' Input and find h1(x c ”')、h2(x c ”')、h3(x c ”') and h θ (x c ”'); Step S4.4: Calculate the current loss function L as follows: Among them, y c ”' indicates x c "'The corresponding real type value; Step S4.5: Calculate the error δ of the lth neuron l ; Step S4.6: Update the weights of the neurons to get ε l ′; e l '=e l -ad l Among them, α is the coefficient of variation; Step S4.7: Calculate the partial derivatives of w and b, the formula is as follows; Step S4.8: Calculate the weight change Δw l , the formula is as follows: Step S4.9: Combine Δw l , update the weight w l , we get w l ′, the formula is as follows: Where η and μ represent the learning rate and momentum term in the artificial neural network respectively; Υw l Represents the attenuation parameter of the neural network parameter w of the lth neuron, which is used to control the relative importance of regularization; when Υw l = 0, the weight decay property can be disabled to obtain typical behavior; Step S4.10: Calculate weight w l The offset before and after the update; the formula is as follows: ||in l -In l '||2 If the offset is greater than 0.25, w is discarded. l ', not right l Update; otherwise, keep the updated w l '; Step S4.11: Update bias b l Get b l '; Step S4.12: Repeat steps S4.1-S4.10 until all x c ”'Use all and complete the training; Step S5: using the trained electricity theft discriminator to classify the electricity consumption data of the monitored power users in the distribution network in real time, and judging whether they are non-electricity theft users or electricity theft users according to the classification results.
2. A method for cleaning and classifying abnormal power consumption data of power users according to claim 1, characterized in that: The step S2 includes the following: Step S2.1: for the historical electricity consumption dataset X, restore missing values using an interpolation method based on ; Step S2.2: For the historical electricity consumption dataset with restored missing values, use the three sigma rule of thumb to handle outliers; Step S2.3: Standardize the historical electricity consumption dataset after processing outliers, and use the MIN-MAX scaling method to rescale the historical electricity consumption dataset to the range of 0 to 1 to obtain the preprocessed historical electricity consumption dataset X'.
3. A method for cleaning and classifying abnormal power consumption data of power users according to claim 2, characterized in that: The step S3.1 includes the following: Step S3.1.1: Calculate the electricity consumption data of the electricity stealing users to be increased as x i ”, including the following: Step S3.1.1.1: The electricity consumption data x of the electricity stealing users in X' i ' and non-electricity-stealing users' electricity consumption data x j ', using the distance formula Find v and x i 'The nearest x j '; Among them, x i,p ' refers to the pth x i ', x j,z ' refers to the zth x j 'S j and S i are the amount of electricity consumed by non-electricity-stealing users and the amount of electricity consumed by electricity-stealing users in X', and the relationship is: S i ≤S j and S i +S j =m×n; Step S3.1.1.2: Use the obtained v and S j To calculate the ratio radius r i , the specific formula is as follows: Step S3.1.1.3: Use the formula The ratio radius r i Normalized to get the normalized ratio radius Step S3.1.1.4: Using the ratio radius Calculate the additional electricity consumption data of electricity stealing users as x i ”; including the following: x i ”=g i +λ(x k -x i '); Where, variable λ represents a random number λ∈[0,1], (x k -x i ) represents the difference vector in n-dimensional space; parameter g i ,Depend on It is found that G is the number of electricity consumption data required to synthesize electricity theft users, G = (S j -S i )×β, where β represents the degree of characteristic imbalance ratio; Step S3.1.2: Set x i ' and x i ” is spliced into the electricity consumption matrix X of the electricity stealing users i '.
4. A method for cleaning and classifying abnormal power consumption data of power users according to claim 3, characterized in that: The step S3.2 includes the following: Step S3.2.1: Select x from X' j '; Step S3.2.2: Delete unnecessary non-electricity-stealing user electricity consumption data, including the following: First, in x j 'Find the distance x i 'The electricity consumption of the three most recent non-electricity-stealing users; secondly, only keep the data related to x i 'The x with the smallest distance j ', delete the other two x j ';Finally, there will be no deleted x j 'Save and splice into the non-electricity-stealing user electricity consumption matrix X j '.
5. A method for cleaning and classifying abnormal power consumption data of power users according to claim 4, characterized in that: In step S5, the electricity theft detector is: hθ(x o )=ε1h1(x o )+ε2h2(x o )+ε3h3(x o ); Among them, x o is the power consumption data of the monitored power users in the distribution network; ε1, ε2, ε3 are the weights of each neuron; h1(x o )、h2(x o )、h3(x o ) represent the 1st, 2nd, and 3rd neurons in the hidden layer when input x o The corresponding output is h θ (x o ) is used to judge x o The type value is obtained by weighted summation of three neurons.
6. A power user power consumption abnormal data cleaning and classification system, characterized in that: It includes the following units: a historical electricity consumption data set X forming unit, a preprocessing unit, a data set expansion unit, a power theft discriminator building unit, and a classification unit; The historical electricity consumption data set X forming unit is used to collect historical electricity consumption data of power users to form a historical electricity consumption data set X, wherein the historical electricity consumption data has been marked as electricity consumption data of non-electricity theft users or electricity consumption data of electricity theft users; The preprocessing unit is used to preprocess the historical power consumption data set X to obtain a preprocessed historical power consumption data set X', wherein the preprocessing includes restoring lost data, processing outliers, and data standardization; The data set expansion unit is used to expand the preprocessed historical power consumption data set X' to obtain a data set X". The data set expansion unit is specifically used to perform the following steps: Step S3.1: Calculate the electricity consumption data of the electricity stealing users to be increased as x i ", and the electricity consumption data x of the electricity stealing users in X' i ' and x i ” is spliced into the electricity consumption matrix X of the electricity stealing users i '; Step S3.2: For X', delete unnecessary non-electricity-stealing user electricity consumption data to form a non-electricity-stealing user electricity consumption matrix X j '; Step S3.3: Set X i ' and X j 'joined into data set X"; Step S3.4: Calculate the degree β of the characteristic imbalance ratio of X”, where β is the ratio of the amount of electricity used by electricity-stealing users to the amount of electricity used by non-electricity-stealing users; Step S3.5: Repeat steps S3.1 to S3.4 until β = 1; output the data set X” when β = 1. The elements of the data set X” are the elements of the data set x. c "'express; The electricity theft discriminator unit is used to construct an electricity theft discriminator and use x in the data set X” c "'Training the electricity theft detector; specifically used as follows: The electricity theft detector consists of an input layer, an output layer, and a hidden layer. It receives data x c The layer with "' is the input layer, the layer that outputs whether electricity is stolen is the output layer, and the layer between the two is the hidden layer; Step S4.1: Establish a neural network, as follows: h θ (x c ”')=ε1h1(x c ”')+ε2h2(x c ”')+ε3h3(x c ”') In the formula, h l (x c ”') indicates that the lth neuron in the hidden layer receives input x c ”’ corresponds to the output; l is 1, 2, 3; T represents matrix transpose; w and b represent the parameters (weights and biases) of the neural network, and the activation function is represented by f(·); h θ (x c ”') is used to judge x c The type value (whether it is electricity theft user data identified by the electricity theft detector) is obtained by weighted summation of three neurons; ε1, ε2, ε3 are the weights of each neuron; Step S4.2: Initialize network parameters, w and b are both 0; Step S4.3: Set x c ”' Input and find h1(x c ”')、h2(x c ”')、h3(x c ”') and h θ (x c ”'); Step S4.4: Calculate the current loss function L as follows: Among them, y c ”' indicates x c "'The corresponding real type value; Step S4.5: Calculate the error δ of the lth neuron l ; Step S4.6: Update the weights of the neurons to get ε l ′; e l '=e l -ad l Among them, α is the coefficient of variation; Step S4.7: Calculate the partial derivatives of w and b, the formula is as follows; Step S4.8: Calculate the weight change Δw l , the formula is as follows: Step S4.9: Combine Δw l , update the weight w l , we get w l ′, the formula is as follows: Where η and μ represent the learning rate and momentum term in the artificial neural network respectively; Υw l Represents the attenuation parameter of the neural network parameter w of the lth neuron, which is used to control the relative importance of regularization; when Υw l = 0, the weight decay property can be disabled to obtain typical behavior; Step S4.10: Calculate weight w l The offset before and after the update; the formula is as follows: ||in l -In l '||2 If the offset is greater than 0.25, w is discarded. l ', not right l Update; otherwise, keep the updated w l '; Step S4.11: Update bias b l Get b l '; Step S4.12: Repeat steps S4.1-S4.10 until all x c ”'Use all and complete the training; The classification unit is used to classify the power consumption data of the monitored power users in the distribution network in real time using the trained power theft discriminator, and judge whether the users are non-power theft users or power theft users according to the classification results.
7. A power user power consumption abnormal data cleaning and classification system according to claim 6, characterized in that: The preprocessing unit is specifically used to perform the following steps: Step S2.1: for the historical electricity consumption dataset X, restore missing values using an interpolation method based on ; Step S2.2: For the historical electricity consumption dataset with restored missing values, use the three sigma rule of thumb to handle outliers; Step S2.3: Standardize the historical electricity consumption dataset after processing outliers, and use the MIN-MAX scaling method to rescale the historical electricity consumption dataset to the range of 0 to 1 to obtain the preprocessed historical electricity consumption dataset X'.
8. A power user power consumption abnormal data cleaning and classification system according to claim 7, characterized in that: The step S3.1 includes the following: Step S3.1.1: Calculate the electricity consumption data of the electricity stealing users to be increased as x i ”, including the following: Step S3.1.1.1: The electricity consumption data x of the electricity stealing users in X' i ' and non-electricity-stealing users' electricity consumption data x j ', using the distance formula Find v and x i 'The nearest x j '; Among them, x i,p ' refers to the pth x i ', x j,z ' refers to the zth x j 'S j and S i are the amount of electricity consumed by non-electricity-stealing users and the amount of electricity consumed by electricity-stealing users in X', and the relationship is: S i ≤S j and S i +S j =m×n; Step S3.1.1.2: Use the obtained v and S j To calculate the ratio radius r i , the specific formula is as follows: Step S3.1.1.3: Use the formula The ratio radius r i Normalized to get the normalized ratio radius Step S3.1.1.4: Using the ratio radius Calculate the additional electricity consumption data of electricity stealing users as x i ”; including the following: x i ”=g i +λ(x k -x i '); Where, variable λ represents a random number λ∈[0,1], (x k -x i ) represents the difference vector in n-dimensional space; parameter g i ,Depend on It is found that G is the number of electricity consumption data required to synthesize electricity theft users, G = (S j -S i )×β, where β represents the degree of characteristic imbalance ratio; Step S3.1.2: Set x i ' and x i ” is spliced into the electricity consumption matrix X of the electricity stealing users i '.
9. A power user power consumption abnormal data cleaning and classification system according to claim 8, characterized in that: The step S3.2 includes the following: Step S3.2.1: Select x from X' j '; Step S3.2.2: Delete unnecessary non-electricity-stealing user electricity consumption data, including the following: First, in x j 'Find the distance x i 'The electricity consumption of the three most recent non-electricity-stealing users; secondly, only keep the data related to x i 'The x with the smallest distance j ', delete the other two x j ';Finally, there will be no deleted x j 'Save and splice into the non-electricity-stealing user electricity consumption matrix X j '.
10. A power user power consumption abnormal data cleaning and classification system according to claim 9, characterized in that: The electricity theft detector is: hθ(x o )=ε1h1(x o )+ε2h2(x o )+ε3h3(x o ); Among them, x o is the power consumption data of the monitored power users in the distribution network; ε1, ε2, ε3 are the weights of each neuron; h1(x o )、h2(x o )、h3(x o ) represent the 1st, 2nd, and 3rd neurons in the hidden layer when input x o The corresponding output is h θ (x o ) is used to judge x o The type value is obtained by weighted summation of three neurons.
Citation Information
Patent Citations
Power consumer electricity stealing identification method and system based on deep learning
CN113901977A
Residential electricity consumption abnormity discovery method based on big data mining
CN117974218A