Electricity use abnormality analysis method, device, equipment, medium and product
By using a noise-reducing autoencoder to analyze electricity consumption data, the problem of manpower consumption caused by reliance on manual methods in traditional methods is solved, and more efficient and accurate detection of electricity consumption anomalies is achieved.
Patent Information
- Application Number
- CN202111609057.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2041-12-27
AI Technical Summary
Traditional methods for detecting abnormal electricity usage rely too heavily on manual labor, resulting in high manpower costs, misjudgments, missed detections, and low analysis efficiency.
A power consumption anomaly analysis method based on a noise-reducing autoencoder is adopted. By acquiring user power consumption data, the reconstructed data is analyzed using a trained noise-reducing autoencoder to determine whether the power consumption data is abnormal, thus reducing the reliance on human experience.
It saves manpower, improves the accuracy and efficiency of power anomaly analysis, reduces misjudgments and omissions, and increases analysis speed.
Smart Images

Figure CN114462771B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of power grid technology, and in particular to a method, apparatus, computer equipment, storage medium and computer program product for analyzing power consumption anomalies. Background Technology
[0002] With economic and technological development and the improvement of people's living standards, electricity has become an indispensable energy source for people's production and daily life. However, the problem of electricity theft has also increased significantly. The construction of smart meters and smart grids is constantly being promoted and improved. Power companies acquire a large amount of user electricity consumption data from their grid big data platforms. By analyzing and studying this data, potential safety hazards caused by abnormal electricity consumption can be avoided. Therefore, anomaly analysis of electricity consumption data is a necessary task and an important means of ensuring the profitability of power companies.
[0003] Traditional methods for detecting abnormal electricity usage rely on manual judgment based on experience. For example, when acquiring user electricity usage data for a week, technicians repeatedly filter the data using indicators and then manually assess it. These indicators might include filtering data with line loss rates >10% or <-10%. If the filtered data shows significant fluctuations, it's considered abnormal; if the data remains relatively stable, it's considered normal.
[0004] However, traditional methods for detecting abnormal electricity usage rely too heavily on manual labor, which is labor-intensive. Summary of the Invention
[0005] Therefore, it is necessary to provide a method, apparatus, computer equipment, computer-readable storage medium, and computer program product for analyzing power consumption anomalies that can save manpower, in response to the above-mentioned technical problems.
[0006] Firstly, this application provides a method for analyzing abnormal electricity consumption. The method includes:
[0007] Obtain users' electricity consumption data;
[0008] Based on the electricity consumption data and the preset noise reduction autoencoder, the reconstructed data corresponding to the electricity consumption data is determined; wherein, the noise reduction autoencoder is trained based on the user's historical electricity consumption data and the historical reconstructed data corresponding to the historical electricity consumption data;
[0009] Perform data analysis on the reconstructed data to determine whether the electricity consumption data is abnormal.
[0010] In one embodiment, the reconstructed data corresponding to the power consumption data is determined based on the power consumption data and a preset noise reduction autoencoder, including:
[0011] The electricity consumption data is preprocessed to obtain the preprocessed data corresponding to the electricity consumption data.
[0012] The preprocessed data is input into the noise reduction autoencoder to determine the reconstructed data corresponding to the power consumption data.
[0013] In one embodiment, performing data analysis on the reconstructed data to determine whether the electricity consumption data is abnormal includes:
[0014] Calculate the similarity between the reconstructed data and the preprocessed data;
[0015] The similarity score is used to determine whether the electricity consumption data is abnormal.
[0016] In one embodiment, determining whether the electricity consumption data is abnormal based on the similarity includes:
[0017] Determine whether the similarity is greater than a preset similarity threshold, and determine whether the electricity consumption data is abnormal based on the determination result.
[0018] In one embodiment, determining whether the similarity is greater than a preset similarity threshold, and determining whether the electricity consumption data is abnormal based on the determination result, includes:
[0019] If the similarity score is greater than the similarity threshold, then the electricity consumption data is determined to be abnormal.
[0020] Alternatively, if the similarity is not greater than the similarity threshold, then the electricity consumption data is determined to be normal.
[0021] In one embodiment, the method further includes:
[0022] Obtain historical electricity consumption data from multiple users and corresponding historical reconstructed data for each historical electricity consumption data;
[0023] Preprocess each historical electricity consumption data to determine the corresponding historical preprocessed data;
[0024] The initial denoising autoencoder is trained based on the historical preprocessed data and the historical reconstructed data to determine the denoising autoencoder.
[0025] Secondly, this application also provides a power consumption anomaly analysis device. The device includes:
[0026] The first acquisition module is used to acquire the user's electricity consumption data;
[0027] The first determining module is used to determine the reconstructed data corresponding to the electricity consumption data based on the electricity consumption data and a preset noise reduction autoencoder; wherein the noise reduction autoencoder is trained based on the user's historical electricity consumption data and the historical reconstructed data corresponding to the historical electricity consumption data.
[0028] The second determination module is used to perform data analysis on the reconstructed data to determine whether the electricity consumption data is abnormal.
[0029] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of any of the methods described above.
[0030] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of any of the methods described above.
[0031] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of any of the methods described above.
[0032] The aforementioned electricity consumption anomaly analysis method, apparatus, computer equipment, storage medium, and computer program product acquire users' electricity consumption data and determine the corresponding reconstructed data based on this data and a preset noise reduction autoencoder. The noise reduction autoencoder is trained based on the user's historical electricity consumption data and corresponding historical reconstructed data. This reconstructed data is then analyzed to determine whether the electricity consumption data is abnormal. Since the method provided in this application does not rely on human experience for electricity consumption anomaly analysis, but instead analyzes the reconstructed data using a trained noise reduction autoencoder to determine whether the electricity consumption data is abnormal, it solves the problem of excessive reliance on manual labor in traditional technologies, thus saving manpower. Attached Figure Description
[0033] Figure 1 This is an internal structural diagram of the computer device in the embodiments of this application;
[0034] Figure 2 This is a flowchart illustrating a method for analyzing abnormal electricity consumption provided in an embodiment of this application.
[0035] Figure 3 This is a schematic diagram of a process for determining reconstructed data provided in an embodiment of this application;
[0036] Figure 4 This is a schematic diagram of a process for analyzing and reconstructing data provided in an embodiment of this application;
[0037] Figure 5 This is a schematic diagram of the process for determining the noise reduction autoencoder provided in the embodiments of this application;
[0038] Figure 6 This is a schematic diagram of the overall process of the power consumption anomaly analysis method provided in the embodiments of this application;
[0039] Figure 7 This is a schematic diagram of the structure of an abnormal power consumption analysis device provided in an embodiment of this application. Detailed Implementation
[0040] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0041] In this embodiment, a method for analyzing abnormal electricity consumption is provided. This method can be applied to computer equipment, which can be a server or a terminal. Taking a terminal as an example, its internal structure diagram can be as follows: Figure 1 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a method for analyzing power consumption anomalies. The display screen can be an LCD screen or an e-ink display. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.
[0042] Those skilled in the art will understand that Figure 1 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0043] Figure 2 This is a flowchart illustrating a method for analyzing abnormal electricity consumption provided in an embodiment of this application. This method can be applied to computer equipment. In one embodiment, such as... Figure 2 As shown, it includes the following steps:
[0044] S201, Obtain the user's electricity consumption data.
[0045] In this embodiment, the computer device acquires the user's electricity consumption data. The electricity consumption data may include electricity consumption data, voltage data, and current data collected by the electricity meter over a period of time, such as 1 hour. This embodiment does not impose specific restrictions on the content and form of the electricity consumption data.
[0046] S202, based on the electricity consumption data and the preset noise reduction autoencoder, determine the reconstructed data corresponding to the electricity consumption data; wherein, the noise reduction autoencoder is trained based on the user's historical electricity consumption data and the historical reconstructed data corresponding to the historical electricity consumption data.
[0047] In this embodiment, the computer device determines the reconstructed data corresponding to the acquired electricity consumption data and a preset noise-reducing autoencoder. The reconstructed data is the predicted value of the electricity consumption data. The noise-reducing autoencoder is a deep unsupervised model, mainly composed of an encoder and a decoder. Based on the noise-reducing autoencoder, the user's historical electricity consumption data is input. The autoencoder then adds Gaussian white noise to the input historical electricity consumption data, performs data dimensionality reduction, and reconstructs the dimensionality-reduced historical electricity consumption data to obtain the historical reconstructed data corresponding to the historical electricity consumption data. It should be noted that adding Gaussian white noise is equivalent to the encoding process of the noise-reducing autoencoder, while data dimensionality reduction and reconstruction are equivalent to the decoding process. In this embodiment, based on the electricity consumption data and the preset noise-reducing autoencoder, the reconstructed data corresponding to the electricity consumption data can be determined through either method one or method two, and this embodiment does not limit this method.
[0048] Method 1: Input the acquired power consumption data into the noise reduction autoencoder to determine the reconstructed data corresponding to the power consumption data.
[0049] Method 2: Preprocess the acquired electricity consumption data to obtain preprocessed data corresponding to the electricity consumption data, and then input the preprocessed data into the noise reduction autoencoder to determine the reconstructed data corresponding to the electricity consumption data.
[0050] S203, perform data analysis on the reconstructed data to determine whether the electricity consumption data is abnormal.
[0051] In this embodiment, the computer device performs data analysis on the obtained reconstructed data to determine whether the electricity consumption data is abnormal. Data analysis may include comparing the reconstructed data with the acquired electricity consumption data, or comparing the differences between the reconstructed data and the acquired electricity consumption data. For example, if the difference between the reconstructed data and the acquired electricity consumption data is large, the acquired electricity consumption data is considered abnormal.
[0052] This embodiment acquires user electricity consumption data and determines the corresponding reconstructed data based on the electricity consumption data and a preset noise reduction autoencoder. The noise reduction autoencoder is trained on the user's historical electricity consumption data and corresponding historical reconstructed data. This reconstructed data is then analyzed to determine if the electricity consumption data is abnormal. Since the method provided in this application does not rely on human experience for electricity consumption anomaly analysis, but instead analyzes the reconstructed data based on the trained noise reduction autoencoder to determine if the electricity consumption data is abnormal, it solves the problem of excessive reliance on manual labor in traditional technologies, thus saving manpower.
[0053] Furthermore, traditional techniques rely on human experience for electricity consumption anomaly analysis, which may lead to misjudgments, missed detections, and low analysis efficiency. In this embodiment, the noise-reducing autoencoder is trained based on a large amount of historical electricity consumption data from users and corresponding historical reconstructed data. Therefore, the trained noise-reducing autoencoder has high accuracy. Moreover, using this noise-reducing autoencoder to determine and analyze the reconstructed data of electricity consumption data is faster and takes less time compared to manually determining and analyzing reconstructed data based on experience. Therefore, the method in this embodiment can also solve the problems of misjudgments, missed detections, and low analysis efficiency in traditional techniques, improving the accuracy and efficiency of electricity consumption anomaly analysis.
[0054] Figure 3 This is a schematic diagram of a process for determining reconstructed data provided in an embodiment of this application, referring to... Figure 3 This embodiment relates to an optional implementation of how to determine the reconstructed data corresponding to electricity consumption data. Based on the above embodiment, S202 further includes the following steps:
[0055] S301, preprocess the electricity consumption data to obtain the preprocessed data corresponding to the electricity consumption data.
[0056] In this embodiment, the preprocessing includes regression interpolation and standardization.
[0057] During the collection of electricity consumption data, data may be incomplete due to machine malfunctions such as damaged electricity meters. However, this missing data still contains important information. Incomplete electricity consumption data can cause difficulties in subsequent electricity anomaly analysis, and may even lead to deviations in the final analysis results, thus affecting the accuracy of subsequent decisions made by technical personnel based on the anomaly analysis. Therefore, this embodiment first uses regression interpolation to fill in the missing values in the electricity consumption data.
[0058] More specifically, regression interpolation constructs a regression equation based on the missing variables and the obtained variables in the sample. The relationship between the independent variables and the target variable M is constructed. The independent variables are the existing data in the electricity consumption data, with a total of m existing data, where m is an integer greater than or equal to 2. The target variable is the missing data in the electricity consumption data. Therefore, the imputed value of the kth missing value can be calculated according to the following formula (1), where k is an integer greater than or equal to 1 and less than or equal to m.
[0059]
[0060] Where, λ i This represents the weight values of existing data, where λ0 is the initial weight, which is a pre-set value, and N... ik Let ξ represent the value of the k-th independent variable. k It indicates randomness.
[0061] Furthermore, due to differences in magnitude, the varying magnitudes of electricity consumption data across different attributes can lead to smaller but more important data being less dominant in electricity consumption anomaly analysis, thus affecting the efficiency of the analysis. Therefore, this embodiment employs a maximum-minimum method for standardization to eliminate the impact of different magnitudes across different attributes in the electricity consumption data. For example, the electricity consumption data includes attribute 1, attribute 2, ..., attribute X, where attribute X has n values, where n is an integer greater than or equal to 1, and the n values of attribute X are x1, x2, ..., x... n Let x max Let x represent the largest value among n values. min This represents the minimum value among n values. According to the following formula (2), each value in attribute X is mapped to the interval 0-1 by the maximum-minimum normalization operation.
[0062]
[0063] Where i is an integer greater than or equal to 1 and less than or equal to n, and the i-th value in attribute X is mapped to x′. i .
[0064] Therefore, in this embodiment, the computer device uses formulas (1) and (2) to perform regression interpolation on the acquired electricity consumption data and then performs standardization processing to obtain the preprocessed data corresponding to the electricity consumption data.
[0065] S302 inputs the preprocessed data into the noise reduction autoencoder to determine the reconstructed data corresponding to the power consumption data.
[0066] In this embodiment, the computer device uses the preprocessed data as input to a preset noise reduction autoencoder, and then outputs the reconstructed data corresponding to the power consumption data.
[0067] In this embodiment, electricity consumption data is preprocessed to obtain preprocessed data corresponding to the electricity consumption data. The preprocessed data is then input into a noise reduction autoencoder to determine the reconstructed data corresponding to the electricity consumption data. Preprocessing the electricity consumption data further improves its accuracy, thereby increasing the accuracy and speed of determining the reconstructed data based on the preprocessed data.
[0068] Figure 4 This is a schematic diagram of a process for analyzing and reconstructing data provided in an embodiment of this application, with reference to... Figure 4 This embodiment relates to an optional implementation method for performing data analysis on reconstructed data. Based on the above embodiment, S203 further includes the following steps:
[0069] S401, calculate the similarity between the reconstructed data and the preprocessed data.
[0070] In this embodiment, the computer device calculates the similarity between the reconstructed data and the preprocessed data. More specifically, the residual between the reconstructed data and the preprocessed data can be calculated as the similarity.
[0071] S402, determine whether the electricity consumption data is abnormal based on similarity.
[0072] In this embodiment, the computer device determines whether the electricity consumption data is abnormal based on similarity. Specifically, the computer device determines whether the similarity is greater than a preset similarity threshold, and determines whether the electricity consumption data is abnormal based on the determination result.
[0073] In this embodiment, the similarity between the reconstructed data and the preprocessed data is calculated, and the power consumption data is judged as abnormal based on the similarity. Since there is no need for manual reliance on experience to judge whether the power consumption data is abnormal, manpower is saved.
[0074] Optionally, the above-mentioned S402 can also be implemented in the following way:
[0075] Determine whether the similarity is greater than a preset similarity threshold, and determine whether the electricity consumption data is abnormal based on the determination result.
[0076] In this embodiment, the similarity can be compared with a similarity threshold to determine if the similarity is greater than a preset similarity threshold. If the similarity is greater than the similarity threshold, the electricity consumption data is determined to be abnormal. Alternatively, the difference between the similarity and the similarity threshold can be calculated. If the difference is greater than zero, the similarity is greater than the preset similarity threshold, thus determining that the electricity consumption data is abnormal. Another method is to calculate the quotient between the similarity and the similarity threshold. If the quotient is greater than 1, the similarity is greater than the preset similarity threshold, thus determining that the electricity consumption data is abnormal. The similarity threshold can be a detection threshold ε, where ε is a value known from the noise reduction autoencoder.
[0077] In this embodiment, the similarity is determined to be greater than a preset similarity threshold, and the power consumption data is determined to be abnormal based on the determination result. Since there is no need for manual reliance on experience to determine whether the power consumption data is abnormal, manpower is saved.
[0078] Optionally, determining whether the similarity exceeds a preset similarity threshold and identifying whether the electricity consumption data is abnormal based on the determination result can be achieved in the following way:
[0079] If the similarity is greater than the similarity threshold, the electricity consumption data is determined to be abnormal; or, if the similarity is not greater than the similarity threshold, the electricity consumption data is determined to be normal.
[0080] In this embodiment, the abnormality of electricity consumption data is determined by comparing the similarity to a similarity threshold. If the similarity is greater than the similarity threshold, that is, the residual between the reconstructed data and the preprocessed data is greater than the detection threshold ε, then the electricity consumption data is determined to be abnormal; if the similarity is not greater than the similarity threshold, that is, the residual between the reconstructed data and the preprocessed data is not greater than the detection threshold ε, then the electricity consumption data is determined to be normal.
[0081] In this embodiment, if the similarity is greater than the similarity threshold, the electricity consumption data is determined to be abnormal; conversely, if the similarity is not greater than the similarity threshold, the electricity consumption data is determined to be normal. Since comparing the similarity and the similarity threshold is sufficient to determine whether the electricity consumption data is abnormal, it further saves manpower and improves the efficiency of electricity consumption anomaly analysis.
[0082] Figure 5 This is a schematic diagram of the process for determining the noise reduction autoencoder provided in the embodiments of this application, referring to... Figure 5 This embodiment relates to determining an optional implementation of a noise reduction autoencoder. Based on the above embodiment, the above-described power consumption anomaly analysis method further includes the following steps:
[0083] S501, acquires historical electricity consumption data of multiple users and historical reconstructed data corresponding to each historical electricity consumption data.
[0084] To more clearly explain the training method of the denoising autoencoder in this application, we will first further explain the denoising autoencoder (DAE) and the biased random key genetic algorithm (BRKGA) in this application. The denoising autoencoder consists of two modules: an encoder and a decoder, i.e., it has an encoding process and a decoding process. The functional expressions of the encoding process and the decoding process are shown in equations (3) and (4).
[0085] f θ (x)=s f(W*x+b) (3)
[0086] g η (x)=s g (W T *x+d) (4)
[0087] Among them, f θ (x) is a functional expression for the encoding process of the input data, g n (x) is a functional expression for the input data decoding process, s f and s g These are the nonlinear activation functions of the encoder and decoder, s, respectively. f For encoding function, s g Here is the decoding function; θ = {W, b}, η = {W} T ,d};W and W T represents the weight matrix; b and d represent the bias vectors.
[0088] More specifically, a denoising autoencoder is also a type of neural network. The network parameters of a denoising autoencoder include the distribution of the added noise, the number of hidden layer neurons, the biases of the hidden layer neurons, the weights of connections between nodes, and a similarity threshold. Using a genetic algorithm, a set of data including the network parameters of the denoising autoencoder is called a "chromosome." That is, a "chromosome" contains the network parameters of the denoising autoencoder, such as the noise distribution, the maximum number of hidden layer neurons, the bias value of each hidden layer neuron, the weights of connections between nodes, and the similarity threshold.
[0089] In this embodiment, N is defined as: input N represents the dimension of the input data for the noise reduction autoencoder. hidden N represents the maximum number of neurons in the hidden layer. output N represents the dimension of the data output by the noise reduction autoencoder. con q represents the number of connections between network nodes in a noise reduction autoencoder. i y is a binary variable used to indicate whether the i-th dimension of the input data is noise-added; i b is a binary variable used to indicate whether the i-th hidden layer neuron is used; i w is the bias value of the i-th hidden layer neuron; j Let i be the weight of the j-th connection; i is greater than or equal to 1 and less than or equal to N. hidden The integer j is greater than or equal to 1 and less than or equal to N. con The length of a chromosome can be calculated using the following formula (5).
[0090]
[0091] in, It is the number of noise distributions added to the input data. This indicates the number of hidden layer neurons used. This represents the number of bias values for the corresponding hidden layer neurons. It is the number of weights directly connected to each neuron. Since there is also a detection threshold in the network parameters, l needs to be increased by 1. Combining equation (5), it can be seen that the number of all parameters in the network parameters determines the length of the "chromosome".
[0092] In this embodiment, the network parameters of the denoising autoencoder are optimized based on a biased random key genetic algorithm, where the random key is a real number randomly generated in the interval [0,1]. The computer device acquires historical electricity consumption data from multiple users and generates n random keys in the interval [0,1] using the biased random key genetic algorithm, thereby initializing the corresponding n "chromosomes," i.e., initializing the network parameters of the denoising autoencoder. For example, random key 1 corresponds to chromosome 1, and chromosome 1 includes a set of network parameters, thus corresponding to the initial denoising autoencoder 1. Here, n is a manually set integer value greater than zero, given based on data and experiments, such as 10 or 15.
[0093] Based on the above initial noise reduction autoencoder, the computer device extracts the network parameters in the "chromosome" according to the preset rules, calculates them based on the preset rules, and then combines Equation (3) and Equation (4) to complete the encoding and decoding process of the noise reduction autoencoder, thereby obtaining the historical reconstructed data corresponding to each historical electricity consumption data.
[0094] Specifically, the preset rules include a first preset rule, a second preset rule, a third preset rule, a fourth preset rule, and a fifth preset rule. The first preset rule is used to calculate the noise added to the input historical electricity consumption data x. The noise distribution, wherein adding noise can be white noise, as shown in equation (6).
[0095]
[0096] The second preset rule is used to calculate whether the i-th hidden layer neuron is used, as shown in equation (7).
[0097]
[0098] Among them, a i It is the i-th random key.
[0099] The third preset rule is used to calculate y. i The bias value of the hidden neuron with a value of 1 is given by equation (8).
[0100]
[0101] The fourth preset rule is used to convert random keys located in the [0,1] interval into weight values located in the [-1,1] interval, as shown in equation (9).
[0102]
[0103] The fifth preset rule is used to calculate the similarity threshold, as shown in equation (10).
[0104]
[0105] It is understandable that, combining the third and fourth preset rules, if y i If the weights are equal to 0, then the bias value of the neuron in the i-th hidden layer and the weights connected to it are both 0, therefore all neurons in the hidden layer are uniform. The weight matrix in the denoising autoencoder includes all w... j The bias vector includes all b i Therefore, the parameters W and W in equations (3) and (4) T b and d are also reflected in "chromosomes".
[0106] S502, preprocess each historical electricity consumption data to determine the corresponding historical preprocessed data for each historical electricity consumption data.
[0107] In this embodiment, the computer device also preprocesses the acquired historical electricity consumption data to determine the historical preprocessed data corresponding to each historical electricity consumption data. The preprocessing includes regression interpolation and standardization processing, and the method is the same as the method provided in S201 of this application, so it will not be described again here.
[0108] S503 trains the initial denoising autoencoder based on each historical preprocessed data and each historical reconstructed data to determine the denoising autoencoder.
[0109] In this embodiment, n random keys correspond to n "chromosomes," which in turn correspond to n initial denoising autoencoders. Therefore, the fitness can be calculated based on each historical preprocessed data and each historical reconstructed data, thereby calculating the fitness function corresponding to the n random keys. For example, random key 1 corresponds to fitness 1. The unsupervised training process of the denoising autoencoder is actually a continuous adjustment of the network parameters to determine the network parameters corresponding to the optimal fitness. In this embodiment, the mean square error (MSE) function is used as the fitness, and the calculation formula is shown in equation (11).
[0110] Among them, P k A represents the predicted value of electricity consumption data, i.e., the historical reconstructed data. k This represents the actual value of electricity consumption data, i.e., each historical preprocessed data, where N is the number of each historical preprocessed data.
[0111]
[0112] In this embodiment, the n random key vectors are sorted and grouped, for example, by fitness into two groups. The random keys with the lowest fitness among the n keys are marked as elite individuals, and the rest are marked as non-elite individuals. This embodiment does not limit the specific number of elite and non-elite individuals. Further, this embodiment uses a genetic algorithm to iterate K times based on the above n "chromosomes" to obtain n last-generation "chromosomes". The iteration number K of the "chromosome" is a preset specified value, for example, K=100. The first generation chromosome is obtained after the first iteration, and the last generation chromosome is obtained after 100 iterations. Specifically, the iteration process includes the k-th generation "chromosome" consisting of three parts: the "chromosome" of the (k-1)-th generation elite individuals, the mutated "chromosome", and the genetic offspring generated by the exchange of "chromosomes", to ensure the variation of the iteration. Understandably, all elite individuals are replicated into the next generation; a small number of mutants generated in the initial population are also added to the next generation, where mutations randomly alter some values of chromosomes, replacing them with random values between [0,1]; the remaining members of the next generation are obtained by randomly selecting one gene each from the elite and non-elite groups to serve as the parents of the next generation, exchanging parts of their chromosomes to produce offspring. The results obtained through these three methods constitute the next generation.
[0113] In this embodiment, after obtaining n last-generation "chromosomes," the fitness corresponding to the n last-generation "chromosomes" is calculated according to preset rules. The fitness values of the n last-generation chromosomes are then sorted to obtain the "chromosome" corresponding to the optimal fitness. The network parameters corresponding to this "chromosome" are then determined, and the denoising autoencoder is determined from this. It should be noted that the denoising autoencoder can be trained and updated periodically. For example, historical electricity consumption data can be updated every 30 days to retrain and obtain an updated denoising autoencoder, ensuring the timeliness of the denoising autoencoder used.
[0114] In this embodiment, historical electricity consumption data of multiple users and historical reconstructed data corresponding to each historical electricity consumption data are obtained. Each historical electricity consumption data is preprocessed to determine the historical preprocessed data corresponding to each historical electricity consumption data. Then, the initial noise reduction autoencoder is trained based on each historical preprocessed data and each historical reconstructed data to determine the noise reduction autoencoder, thereby improving the accuracy of the noise reduction autoencoder and thus improving the accuracy of electricity consumption anomaly analysis.
[0115] To more clearly illustrate the power supply method provided in this embodiment, the following is combined with... Figure 6 Provide an explanation. Figure 6The schematic diagram of the overall process for the power consumption anomaly analysis method provided in this application embodiment can be executed on a computer device. Figure 6 As shown, the user's electricity consumption data is first filled with missing values through regression interpolation, then standardized to eliminate the influence of different attributes having different magnitudes in the electricity consumption data. The preprocessed data is then input into a denoising autoencoder to obtain the reconstructed data corresponding to the electricity consumption data. The denoising autoencoder is a model optimized and trained using a biased random key genetic algorithm, and its network parameters include a detection threshold. The residual between the reconstructed data and the preprocessed data is then calculated and compared with the detection threshold. A residual greater than the detection threshold indicates that the input electricity consumption data is abnormal, while a residual less than or equal to the detection threshold indicates that the input electricity consumption data is normal.
[0116] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0117] Based on the same inventive concept, this application also provides an electricity anomaly analysis device for implementing the electricity anomaly analysis method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more embodiments of the electricity anomaly analysis device provided below can be found in the limitations of the electricity anomaly analysis method described above, and will not be repeated here.
[0118] Reference Figure 7 , Figure 7 This is a schematic diagram of the structure of an electricity anomaly analysis device provided in an embodiment of this application. The device 700 includes a first acquisition module 701, a first determination module 702, and a second determination module 703, wherein:
[0119] The first acquisition module 701 is used to acquire the user's electricity consumption data.
[0120] The first determining module 702 is used to determine the reconstructed data corresponding to the electricity consumption data based on the electricity consumption data and the preset noise reduction autoencoder; wherein, the noise reduction autoencoder is trained based on the user's historical electricity consumption data and the historical reconstructed data corresponding to the historical electricity consumption data.
[0121] The second determination module 703 is used to perform data analysis on the reconstructed data to determine whether the electricity consumption data is abnormal.
[0122] The power consumption anomaly analysis device provided in this embodiment acquires the user's power consumption data and determines the reconstructed data corresponding to the power consumption data based on the power consumption data and a preset noise reduction autoencoder. The noise reduction autoencoder is trained based on the user's historical power consumption data and corresponding historical reconstructed data, and then analyzes the reconstructed data to determine whether the power consumption data is abnormal. Since the method provided in this application does not rely on human experience for power consumption anomaly analysis, but instead analyzes the reconstructed data based on the trained noise reduction autoencoder to determine whether the power consumption data is abnormal, it solves the problem of excessive reliance on manual labor in traditional technologies, thus saving manpower.
[0123] Optionally, the first determining module 701 includes:
[0124] The preprocessing unit is used to preprocess the electricity consumption data to obtain the preprocessed data corresponding to the electricity consumption data.
[0125] The determination unit is used to input the preprocessed data into the noise reduction autoencoder to determine the reconstructed data corresponding to the power consumption data.
[0126] Optionally, the second determining module 703 includes:
[0127] The computational unit is used to calculate the similarity between the reconstructed data and the preprocessed data.
[0128] The judgment unit is used to determine whether the electricity consumption data is abnormal based on similarity.
[0129] Optionally, the judgment unit is used to determine whether the similarity is greater than a preset similarity threshold, and to determine whether the electricity consumption data is abnormal based on the judgment result.
[0130] Optionally, the judgment unit includes a function to determine that the electricity consumption data is abnormal if the similarity is greater than a similarity threshold, or to determine that the electricity consumption data is normal if the similarity is not greater than a similarity threshold.
[0131] Optionally, the device 700 also includes:
[0132] The second acquisition module is used to acquire historical electricity consumption data of multiple users and historical reconstructed data corresponding to each historical electricity consumption data.
[0133] The third determination module is used to preprocess each historical electricity consumption data and determine the historical preprocessed data corresponding to each historical electricity consumption data.
[0134] The fourth determination module is used to train the initial denoising autoencoder based on each historical preprocessed data and each historical reconstructed data, and to determine the denoising autoencoder.
[0135] Each module in the aforementioned power consumption anomaly analysis device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0136] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0137] Obtain users' electricity consumption data;
[0138] Based on the electricity consumption data and a preset noise reduction autoencoder, the reconstructed data corresponding to the electricity consumption data is determined; wherein, the noise reduction autoencoder is trained based on the user's historical electricity consumption data and the historical reconstructed data corresponding to the historical electricity consumption data;
[0139] The reconstructed data is analyzed to determine whether the electricity consumption data is abnormal.
[0140] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0141] The electricity consumption data is preprocessed to obtain preprocessed data corresponding to the electricity consumption data;
[0142] The preprocessed data is input into the noise reduction autoencoder to determine the reconstructed data corresponding to the power consumption data.
[0143] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0144] Calculate the similarity between the reconstructed data and the preprocessed data;
[0145] The similarity score is used to determine whether the electricity consumption data is abnormal.
[0146] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0147] Determine whether the similarity is greater than a preset similarity threshold, and determine whether the electricity consumption data is abnormal based on the determination result.
[0148] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0149] If the similarity is greater than the similarity threshold, then the electricity consumption data is determined to be abnormal.
[0150] Alternatively, if the similarity is not greater than the similarity threshold, then the electricity consumption data is determined to be normal.
[0151] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0152] Obtain historical electricity consumption data from multiple users and historical reconstructed data corresponding to each historical electricity consumption data;
[0153] The historical electricity consumption data are preprocessed to determine the historical preprocessed data corresponding to each historical electricity consumption data.
[0154] The initial denoising autoencoder is trained based on the historical preprocessed data and the historical reconstructed data to determine the denoising autoencoder.
[0155] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0156] Obtain users' electricity consumption data;
[0157] Based on the electricity consumption data and a preset noise reduction autoencoder, the reconstructed data corresponding to the electricity consumption data is determined; wherein, the noise reduction autoencoder is trained based on the user's historical electricity consumption data and the historical reconstructed data corresponding to the historical electricity consumption data;
[0158] The reconstructed data is analyzed to determine whether the electricity consumption data is abnormal.
[0159] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0160] The electricity consumption data is preprocessed to obtain preprocessed data corresponding to the electricity consumption data;
[0161] The preprocessed data is input into the noise reduction autoencoder to determine the reconstructed data corresponding to the power consumption data.
[0162] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0163] Calculate the similarity between the reconstructed data and the preprocessed data;
[0164] The similarity score is used to determine whether the electricity consumption data is abnormal.
[0165] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0166] Determine whether the similarity is greater than a preset similarity threshold, and determine whether the electricity consumption data is abnormal based on the determination result.
[0167] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0168] If the similarity is greater than the similarity threshold, then the electricity consumption data is determined to be abnormal.
[0169] Alternatively, if the similarity is not greater than the similarity threshold, then the electricity consumption data is determined to be normal.
[0170] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0171] Obtain historical electricity consumption data from multiple users and historical reconstructed data corresponding to each historical electricity consumption data;
[0172] The historical electricity consumption data are preprocessed to determine the historical preprocessed data corresponding to each historical electricity consumption data.
[0173] The initial denoising autoencoder is trained based on the historical preprocessed data and the historical reconstructed data to determine the denoising autoencoder.
[0174] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0175] Obtain users' electricity consumption data;
[0176] Based on the electricity consumption data and a preset noise reduction autoencoder, the reconstructed data corresponding to the electricity consumption data is determined; wherein, the noise reduction autoencoder is trained based on the user's historical electricity consumption data and the historical reconstructed data corresponding to the historical electricity consumption data;
[0177] The reconstructed data is analyzed to determine whether the electricity consumption data is abnormal.
[0178] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0179] The electricity consumption data is preprocessed to obtain preprocessed data corresponding to the electricity consumption data;
[0180] The preprocessed data is input into the noise reduction autoencoder to determine the reconstructed data corresponding to the power consumption data.
[0181] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0182] Calculate the similarity between the reconstructed data and the preprocessed data;
[0183] The similarity score is used to determine whether the electricity consumption data is abnormal.
[0184] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0185] Determine whether the similarity is greater than a preset similarity threshold, and determine whether the electricity consumption data is abnormal based on the determination result.
[0186] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0187] If the similarity is greater than the similarity threshold, then the electricity consumption data is determined to be abnormal.
[0188] Alternatively, if the similarity is not greater than the similarity threshold, then the electricity consumption data is determined to be normal.
[0189] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0190] Obtain historical electricity consumption data from multiple users and historical reconstructed data corresponding to each historical electricity consumption data;
[0191] The historical electricity consumption data are preprocessed to determine the historical preprocessed data corresponding to each historical electricity consumption data.
[0192] The initial denoising autoencoder is trained based on the historical preprocessed data and the historical reconstructed data to determine the denoising autoencoder.
[0193] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0194] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0195] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0196] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for analyzing abnormal electricity consumption, characterized in that, The method includes: Obtain users' electricity consumption data; Based on the electricity consumption data and a preset noise reduction autoencoder, reconstructed data corresponding to the electricity consumption data is determined; wherein, the noise reduction autoencoder is trained based on the user's historical electricity consumption data and the historical reconstructed data corresponding to the historical electricity consumption data; the reconstructed data is the predicted value of the electricity consumption data; The reconstructed data is analyzed to determine whether the electricity consumption data is abnormal; The method further includes: Based on the biased random key genetic algorithm, n random keys are randomly generated in the interval [0, 1], and n initial chromosomes corresponding to the n random keys are obtained; n is an integer greater than 0; Based on the genetic algorithm, n initial chromosomes are iterated a predetermined number of times to obtain n final generation chromosomes; The fitness of the n last-generation chromosomes is calculated according to preset rules, and the fitness of the n last-generation chromosomes is sorted to determine the target chromosome. The noise reduction autoencoder is determined based on the network parameters corresponding to the target chromosome; The preset rules include the first preset rule, the second preset rule, the third preset rule, the fourth preset rule, and the fifth preset rule; The first preset rule is used to determine whether the i-th input data dimension is noise-added; the second preset rule is used to determine whether the i-th hidden layer neuron is used; i is greater than or equal to 1 and less than or equal to 1. integers, This represents the maximum number of neurons in the hidden layer. The third preset rule includes , This represents the bias value of the i-th hidden layer neuron. Indicates whether the i-th dimension of the input data is noise-added. The dimension of the data input to the noise reduction autoencoder. Represents the i-th random key; The fourth preset rule includes , This represents the weight of the j-th connection, where j is greater than or equal to 1 and less than or equal to 1. integers, The number of connections between network nodes in the noise reduction autoencoder; The fifth preset rule includes , The similarity threshold is used to determine whether the electricity consumption data is abnormal.
2. The method according to claim 1, characterized in that, The step of determining the reconstructed data corresponding to the power consumption data based on the power consumption data and a preset noise reduction autoencoder includes: The electricity consumption data is preprocessed to obtain preprocessed data corresponding to the electricity consumption data; The preprocessed data is input into the noise reduction autoencoder to determine the reconstructed data corresponding to the power consumption data.
3. The method according to claim 2, characterized in that, The step of performing data analysis on the reconstructed data to determine whether the electricity consumption data is abnormal includes: Calculate the similarity between the reconstructed data and the preprocessed data; The similarity score is used to determine whether the electricity consumption data is abnormal.
4. The method according to claim 3, characterized in that, The step of determining whether the electricity consumption data is abnormal based on the similarity includes: Determine whether the similarity is greater than a preset similarity threshold, and determine whether the electricity consumption data is abnormal based on the determination result.
5. The method according to claim 4, characterized in that, The step of determining whether the similarity is greater than a preset similarity threshold, and determining whether the electricity consumption data is abnormal based on the determination result, includes: If the similarity is greater than the similarity threshold, then the electricity consumption data is determined to be abnormal. Alternatively, if the similarity is not greater than the similarity threshold, then the electricity consumption data is determined to be normal.
6. The method according to any one of claims 2-5, characterized in that, The training methods for the noise reduction autoencoder include: Obtain historical electricity consumption data from multiple users and historical reconstructed data corresponding to each historical electricity consumption data; The historical electricity consumption data are preprocessed to determine the historical preprocessed data corresponding to each historical electricity consumption data. The initial denoising autoencoder is trained based on the historical preprocessed data and the historical reconstructed data to determine the denoising autoencoder.
7. A power consumption anomaly analysis device, characterized in that, The device includes: The first acquisition module is used to acquire the user's electricity consumption data; The first determining module is used to determine the reconstructed data corresponding to the electricity consumption data based on the electricity consumption data and a preset noise reduction autoencoder; wherein, the noise reduction autoencoder is trained based on the user's historical electricity consumption data and the historical reconstructed data corresponding to the historical electricity consumption data; the reconstructed data is the predicted value of the electricity consumption data; The second determining module is used to perform data analysis on the reconstructed data to determine whether the electricity consumption data is abnormal. The device is also used for: Based on the biased random key genetic algorithm, n random keys are randomly generated in the interval [0, 1], and n initial chromosomes corresponding to the n random keys are obtained; n is an integer greater than 0; Based on the genetic algorithm, n initial chromosomes are iterated a predetermined number of times to obtain n final generation chromosomes; The fitness of the n last-generation chromosomes is calculated according to preset rules, and the fitness of the n last-generation chromosomes is sorted to determine the target chromosome. The noise reduction autoencoder is determined based on the network parameters corresponding to the target chromosome; The preset rules include the first preset rule, the second preset rule, the third preset rule, the fourth preset rule, and the fifth preset rule; The first preset rule is used to determine whether the i-th input data dimension is noise-added; the second preset rule is used to determine whether the i-th hidden layer neuron is used; i is greater than or equal to 1 and less than or equal to 1. integers, This represents the maximum number of neurons in the hidden layer. The third preset rule includes , This represents the bias value of the i-th hidden layer neuron. Indicates whether the i-th dimension of the input data is noise-added. The dimension of the data input to the noise reduction autoencoder. Represents the i-th random key; The fourth preset rule includes , This represents the weight of the j-th connection, where j is greater than or equal to 1 and less than or equal to 1. integers, The number of connections between network nodes in the noise reduction autoencoder; The fifth preset rule includes , The similarity threshold is used to determine whether the electricity consumption data is abnormal.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Abnormal power consumption behavior identification method based on improved deep self-encoding network
CN110929843A