A method for detecting abnormal electricity consumption in enterprises based on electricity consumption data
Through the method of multi-scale weighting and multi-layer feature extraction, combined with dynamic threshold judgment, the problems of production rhythm fluctuations and hidden anomalies in enterprise electricity consumption detection are solved, and efficient and accurate electricity consumption anomaly detection is achieved.
Patent Information
- Application Number
- CN202511020350.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-23
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2045-07-23
AI Technical Summary
Existing technologies cannot adapt to production rhythm fluctuations and seasonal load changes in enterprise electricity consumption detection, resulting in missed/false alarms, and it is difficult to capture hidden anomalies caused by harmonics or periodic disturbances.
A multi-scale weighted and multi-layer feature extraction method is adopted, combined with an adaptive dynamic threshold. By collecting enterprise electricity consumption data to construct a time series, the residual enhanced random forest, conditional variational autoencoder and long short-term memory network model are used to extract abnormal features, calculate the abnormal electricity consumption index and dynamically determine the abnormal state.
It achieves real-time and accurate detection of corporate electricity consumption, significantly shortens the anomaly discovery-response closed loop, improves monitoring efficiency and accuracy, reduces the risk of overfitting, and increases the detection sensitivity of fine-grained anomalies.
Smart Images

Figure CN120524276B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for detecting abnormal electricity consumption in an enterprise based on electricity consumption data, and belongs to the technical field of abnormal electricity consumption detection. Background Art
[0002] Abnormal power consumption detection at the enterprise side has become an important technical link in the lean operation and maintenance of distribution networks and energy consumption management. Existing mainstream solutions can be roughly divided into two categories:
[0003] Monitoring methods based on fixed thresholds or empirical rules: Compare key quantities of enterprise electricity consumption data with manually set thresholds. This method is simple to implement, but cannot adapt to fluctuations in the enterprise's production rhythm and seasonal load changes, and is prone to missed reports / false alarms.
[0004] Detection methods based on single-scale statistics or traditional machine learning:
[0005] The typical approach is to extract single-scale sliding window mean / variance features and use models such as SVM and isolation forest to identify anomalies. However, since multiple time scales are not considered, it is difficult to balance short-term shocks and long-term trends, and it is impossible to capture hidden anomalies caused by harmonic or periodic disturbances. Summary of the Invention
[0006] In order to solve the above problems existing in the prior art, the present invention proposes a method for detecting abnormal electricity consumption in an enterprise based on electricity consumption data.
[0007] The technical solutions of the present invention are as follows:
[0008] A method for detecting abnormal electricity consumption in an enterprise based on electricity consumption data comprises the following steps:
[0009] Collect the electricity consumption data of enterprises and pre-process the data to construct the enterprise electricity consumption data time series;
[0010] Adaptively weight the samples of each dimension in the enterprise electricity consumption data time series to obtain a weighted enterprise electricity consumption data time series;
[0011] Construct an enterprise electricity consumption anomaly feature extraction model, input the weighted enterprise electricity consumption data time series into the enterprise electricity consumption anomaly feature extraction model, and obtain the enterprise electricity consumption anomaly features;
[0012] The abnormal electricity consumption index of the enterprise is calculated based on the abnormal electricity consumption characteristics of the enterprise, and a dynamic threshold of the abnormal electricity consumption index is constructed. When the abnormal electricity consumption index is greater than the dynamic threshold of the abnormal electricity consumption index, it is determined that the current enterprise is in an abnormal electricity consumption state.
[0013] Preferably, the enterprise electricity consumption data time series includes basic electricity consumption data and cross-extended electricity consumption data.
[0014] Preferably, the specific steps of adaptively weighting each sample in the enterprise electricity consumption data time series are:
[0015] defining a multi-scale sliding time window set, wherein the multi-scale sliding time window set includes a plurality of sliding time windows of different lengths;
[0016] Based on different sliding time windows, the standardized fluctuation intensity of each dimension sample of the enterprise electricity consumption data time series at different scales is extracted;
[0017] The temporal importance of each dimension is calculated based on the normalized fluctuation intensity of each dimension sample at all scales;
[0018] Perform frequency domain transformation on the time series of enterprise electricity consumption data and calculate the frequency domain sensitivity of each dimension;
[0019] Calculate the comprehensive weight of each dimension based on its time domain importance and frequency domain sensitivity;
[0020] According to the comprehensive weight of each dimension, the samples of the corresponding dimension in the enterprise electricity consumption data time series are weighted to obtain the weighted enterprise electricity consumption data time series.
[0021] Preferably, the enterprise electricity consumption anomaly feature extraction model includes a preliminary feature extraction layer, a conditional variational autoencoder layer, a temporal dependency extraction layer and a fusion output layer.
[0022] Preferably, the preliminary feature extraction layer is constructed based on a residual enhanced random forest model;
[0023] Inputting the weighted enterprise electricity consumption data time series into the residual enhanced random forest model for training;
[0024] The residual enhanced random forest model includes multiple decision trees, and after each round of training, the residual of each decision tree is calculated based on the output results of each decision tree;
[0025] Repeat the following steps: construct an additional decision tree in this round of training, use the residual mean of all decision trees from the previous round of training as the leaf weight of the new decision tree, and then perform this round of training. When the preset stopping condition is reached, stop training to obtain the trained residual enhanced random forest model;
[0026] The output results of each decision tree in the residual enhanced random forest model after comprehensive training are used to obtain the preliminary abnormal electricity consumption characteristics of the enterprise.
[0027] Preferably, the conditional variational autoencoder layer includes an encoder and a decoder;
[0028] The preliminary abnormal electricity consumption characteristics of the enterprise are used as conditional variables, and the weighted enterprise electricity consumption data time series and the conditional variables are input into the encoder, which outputs the mean and standard deviation of the latent variable;
[0029] Calculate the latent variables based on their mean and standard deviation, input the latent variables and conditional variables into the decoder to output the reconstructed abnormal electricity consumption characteristics of the enterprise;
[0030] The reconstruction error characteristics are calculated based on the preliminary abnormal electricity consumption characteristics and the reconstructed abnormal electricity consumption characteristics of the enterprise.
[0031] Preferably, the timing dependency extraction layer is constructed based on the long short-term memory network model, and the preliminary power consumption anomaly characteristics, reconstructed power consumption anomaly characteristics and reconstructed error characteristics of the enterprise are spliced and input into the long short-term memory network model, and the long short-term memory network model outputs the timing dependency power consumption anomaly characteristics of the enterprise.
[0032] Preferably, the fusion output layer is constructed based on the fully connected layer;
[0033] The preliminary abnormal electricity consumption features, reconstructed abnormal electricity consumption features, and time-dependent abnormal electricity consumption features of the enterprise are input into the fully connected layer respectively, and the fully connected layer outputs the corresponding feature weights;
[0034] The enterprise's electricity consumption anomaly characteristics are obtained by weighted summing the preliminary electricity consumption anomaly characteristics, reconstructed electricity consumption anomaly characteristics and time-dependent electricity consumption anomaly characteristics with corresponding feature weights.
[0035] Preferably, the abnormal electricity consumption characteristics of the enterprise are mapped into the abnormal electricity consumption index of the enterprise through a multi-layer perceptron.
[0036] Preferably, the abnormal power consumption index dynamic threshold calculation formula is:
[0037] ;
[0038] in: express Dynamic threshold of abnormal power consumption index at each moment; express Abnormal electricity consumption index of the enterprise at the moment; express Samples of the time series of enterprise electricity consumption data at each moment; represents the sample mean of the time series of enterprise electricity consumption data; represents the sample covariance of the time series of enterprise electricity consumption data; 、 Indicates the weight of the abnormal power consumption index dynamic threshold calculation formula.
[0039] The present invention has the following beneficial effects:
[0040] 1. The present invention builds a fully automatic real-time detection link through an end-to-end process: acquisition, multi-scale weighting, multi-layer feature extraction, and dynamic threshold judgment, significantly shortening the abnormality discovery-response closed loop and improving overall monitoring efficiency and accuracy.
[0041] 2. The present invention calculates weights from dual perspectives of time domain and frequency domain, suppresses noise, highlights key fluctuation dimensions, and provides higher-precision input for subsequent models.
[0042] 3. The present invention integrates shallow statistical patterns with deep time series associations in a hierarchical and progressive manner, improves the discriminability of preliminary abnormal features through the preliminary feature extraction layer, reduces the risk of overfitting, amplifies subtle abnormal differences through the conditional variational autoencoder layer, improves the detection sensitivity of fine-grained anomalies, and effectively models long-term and short-term time series dependencies through the time series dependency extraction layer, accurately locating trend-type and persistent anomalies. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 Flow chart of the method of the present invention. DETAILED DESCRIPTION
[0044] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0045] It should be understood that the step numbers used herein are only for convenience of description and are not intended to limit the order in which the steps are to be executed.
[0046] It should be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, the singular forms "a", "an" and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0047] The terms “include” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0048] The term "and / or" refers to and includes any and all possible combinations of one or more of the associated listed items.
[0049] See also Figure 1A method for detecting abnormal electricity consumption in an enterprise based on electricity consumption data, characterized by comprising the following steps:
[0050] S100, collecting the electricity consumption data of the enterprise, and pre-processing the electricity consumption data to construct a time series of the enterprise electricity consumption data;
[0051] S200, adaptively weighting each sample in the enterprise electricity consumption data time series to obtain a weighted enterprise electricity consumption data time series;
[0052] S300: Build an enterprise electricity consumption anomaly feature extraction model, input the weighted enterprise electricity consumption data time series into the enterprise electricity consumption anomaly feature extraction model, and obtain the enterprise's electricity consumption anomaly features;
[0053] S400. Calculate the abnormal power consumption index of the enterprise based on the abnormal power consumption characteristics of the enterprise, and simultaneously establish a dynamic threshold value of the abnormal power consumption index. When the abnormal power consumption index is greater than the dynamic threshold value of the abnormal power consumption index, determine that the current enterprise is in an abnormal power consumption state.
[0054] In some embodiments, step S100 specifically includes:
[0055] S101. Collecting electricity consumption data of enterprises;
[0056] S102, pre-processing the collected enterprise electricity consumption data;
[0057] S103: Construct the pre-processed enterprise electricity consumption data into an enterprise electricity consumption data time series in chronological order, where the enterprise electricity consumption data time series includes basic electricity consumption data and cross-extended electricity consumption data.
[0058] In a specific embodiment, the enterprise electricity consumption data collected in step S101 includes active power, reactive power, current, voltage, power factor, and total harmonic distortion of current;
[0059] Step S103 defines a basic electricity consumption data set based on the collected enterprise electricity consumption data, as shown in the following formula:
[0060] ;
[0061] in: express Basic electricity consumption data collection at all times; express Active power at the moment; express Reactive power at the moment; express Voltage at the moment; express Current at the moment; express The power factor at the moment, ; express Total harmonic distortion of current at the moment;
[0062] Based on the collected enterprise electricity consumption data, a cross-extended electricity consumption data set is defined, as shown in the following formula:
[0063] ;
[0064] in: express Cross-extended electricity consumption data collection at each moment;
[0065] The basic electricity consumption data set and the cross-extended electricity consumption data set are integrated to construct the enterprise electricity consumption data time series, as shown in the following formula:
[0066] ;
[0067] in: Indicates that the time series of enterprise electricity consumption data is Sample of the moment.
[0068] In a specific embodiment, step S102 performs pre-processing operations such as outlier removal and data filling on the collected enterprise electricity consumption data.
[0069] In some embodiments, step S200 specifically includes:
[0070] S201. Define a multi-scale sliding time window set, where the multi-scale sliding time window set includes multiple sliding time windows of different lengths.
[0071] S202, extracting the standardized fluctuation intensity of each dimension sample of the enterprise electricity consumption data time series at different scales based on different sliding time windows;
[0072] S203. Calculate the temporal importance of each dimension based on the normalized fluctuation intensity of samples in each dimension at all scales;
[0073] S204: Perform frequency domain transformation on the time series of enterprise electricity consumption data and calculate the frequency domain sensitivity of each dimension;
[0074] S205, calculating the comprehensive weight of each dimension based on the time domain importance and frequency domain sensitivity of each dimension;
[0075] S206 , weighting the samples of the corresponding dimension in the enterprise electricity consumption data time series according to the comprehensive weight of each dimension to obtain a weighted enterprise electricity consumption data time series.
[0076] In a specific embodiment, S200 specifically includes the following steps:
[0077] Define a set of multi-scale sliding time windows , where represents the total number of scales, Indicates the Sliding time window at different scales;
[0078] pass Slide the enterprise electricity consumption data time series with a preset step length, extract the mean of the samples within the time window of each slide, and construct the enterprise electricity consumption data time series at the current scale;
[0079] Based on the time series of enterprise electricity consumption data at the current scale, the standardized fluctuation intensity of each dimension sample at the current scale is calculated, as shown in the following formula:
[0080] ;
[0081] in: Indicates the The time series of enterprise electricity consumption data at the scale The dimension samples are Normalized fluctuation intensity at the moment; Indicates the The time series of enterprise electricity consumption data at the scale The dimension samples are variance of the moment; Indicates the The time series of enterprise electricity consumption data at the scale The average variance of all samples in the dimension; represents a random constant term;
[0082] Based on the standardized fluctuation intensity of each dimension sample at all scales, the temporal importance of each dimension is calculated as shown in the following formula:
[0083] ;
[0084] in: express Time series of enterprise electricity consumption data at the moment The temporal importance of each dimension; Indicates the The time domain weight of each scale;
[0085] Perform short-time Fourier transform on the time series of enterprise electricity consumption data to obtain spectrum data, and calculate the frequency domain sensitivity of each dimension, as shown in the following formula:
[0086] ;
[0087] in: express Time series of enterprise electricity consumption data at the moment Frequency domain sensitivity of the dimensions; Indicates the preset frequency upper limit; Indicates the preset frequency lower limit; Represents the time series of enterprise electricity consumption data Dimensions in time Spectrum at frequency; Represents the time series of enterprise electricity consumption data dimensions at all times The average value of the spectrum at the frequency;
[0088] The comprehensive weight of each dimension is calculated based on the time domain importance and frequency domain sensitivity of each dimension. The specific steps are:
[0089] Construct the fusion weight of each dimension, as shown in the following formula:
[0090] ;
[0091] in: express Time series of enterprise electricity consumption data at the moment The fusion weight of each dimension; represents the scale factor;
[0092] Then perform nonlinear exponential mapping on the fusion weight of each dimension, as shown in the following formula:
[0093] ;
[0094] in: express Time series of enterprise electricity consumption data at the moment The nonlinear exponential mapping value of the fusion weight of the dimension; represents the adjustment parameter; Represents a nonlinear mapping function, controlling the weight range in Inside;
[0095] The last pair Perform Softmax normalization to obtain the time series of enterprise electricity consumption data. The comprehensive weight of the dimensions;
[0096] According to the comprehensive weight of each dimension, the samples of the corresponding dimension in the enterprise electricity consumption data time series are weighted to obtain the weighted enterprise electricity consumption data time series.
[0097] In some embodiments, the enterprise electricity consumption anomaly feature extraction model includes a preliminary feature extraction layer, a conditional variational autoencoder layer, a temporal dependency extraction layer, and a fusion output layer.
[0098] In some embodiments, the preliminary feature extraction layer is constructed based on a residual enhanced random forest model;
[0099] Inputting the weighted enterprise electricity consumption data time series into the residual enhanced random forest model for training;
[0100] The residual enhanced random forest model includes multiple decision trees, and after each round of training, the residual of each decision tree is calculated based on the output results of each decision tree;
[0101] Repeat the following steps: construct an additional decision tree in this round of training, use the residual mean of all decision trees from the previous round of training as the leaf weight of the new decision tree, and then perform this round of training. When the preset stopping condition is reached, stop training to obtain the trained residual enhanced random forest model;
[0102] The output results of each decision tree in the residual enhanced random forest model after comprehensive training are used to obtain the preliminary abnormal electricity consumption characteristics of the enterprise.
[0103] In a specific embodiment, the training steps of the residual enhanced random forest model are:
[0104] Preset the number of initial decision trees for the residual enhanced random forest model and the leaf weight of each initial decision tree;
[0105] For each decision tree, a fixed number of samples are randomly drawn with replacement from the time series of weighted enterprise electricity consumption data to construct a temporary sample set for the current decision tree, and the temporary sample set is input into the decision tree;
[0106] In each subsequent round of training, the residual of each decision tree is calculated based on the output of each decision tree in the previous round of training, and the leaf weight of the new decision tree is constructed based on the result of multiplying the mean residual of all decision trees by the preset learning rate. The new decision tree is then trained again in this round. When the preset number of training rounds is reached, the training is stopped.
[0107] The specific calculation steps of the residual are:
[0108] For each sample input into the decision tree, the probability of the sample falling into each leaf of the current decision tree is calculated, as shown in the following formula:
[0109] ;
[0110] in: Representation sample Falling into the current decision tree The probability of a leaf; Represents the internal node index of the current decision tree; Indicates the number of nodes from the current decision tree root to the The set of leaf nodes; Representation sample Fall into the node The probability of the left subtree of ; Indicates the branch indicator. When the value is 0, it means the The leaves are located at the node The left subtree of The leaves are located at the node The right subtree of
[0111] The sample Fall into the node The calculation formula for the probability of the left subtree is:
[0112] ;
[0113] in: Represents the Sigmoid activation function; Represents a node The splitting threshold; Represents the split control parameter, which is a hyperparameter. It is set to a large value in the early stage of training, such as 0.2 to 0.5, to ensure gradient stability and ease of optimization. It is gradually reduced in the later stage of training to ensure inference speed.
[0114] According to the probability of a sample falling into each leaf of the current decision tree, the leaves corresponding to all samples in the temporary sample set corresponding to the current decision tree are obtained. The distance between the leaf where each sample falls in the temporary sample set corresponding to the current decision tree in this round of training and the leaf where it fell in the previous round of training is used as the residual value of the current sample;
[0115] The output results of each decision tree in the residual enhanced random forest model after comprehensive training are used to obtain the preliminary abnormal electricity consumption characteristics of the enterprise.
[0116] In some embodiments, the conditional variational autoencoder layer includes an encoder and a decoder;
[0117] The preliminary abnormal electricity consumption characteristics of the enterprise are used as conditional variables, and the weighted enterprise electricity consumption data time series and the conditional variables are input into the encoder, which outputs the mean and standard deviation of the latent variable;
[0118] Calculate the latent variables based on their mean and standard deviation, input the latent variables and conditional variables into the decoder to output the reconstructed abnormal electricity consumption characteristics of the enterprise;
[0119] The reconstruction error characteristics are calculated based on the preliminary abnormal electricity consumption characteristics and the reconstructed abnormal electricity consumption characteristics of the enterprise.
[0120] In a specific embodiment, the latent variable is calculated based on the mean and standard deviation of the latent variable, as shown in the following formula:
[0121] ;
[0122] in: express Hidden variables at the moment; express The mean of the latent variable at each moment; express The standard deviation of the latent variable at each moment; represents the Gaussian noise vector; Indicates that the Gaussian noise vector obeys the multivariate standard normal distribution; represents the identity matrix; Represents element-wise multiplication.
[0123] In a specific embodiment, the reconstruction error feature is calculated based on the preliminary abnormal power consumption feature and the reconstructed abnormal power consumption feature of the enterprise, as shown in the following formula:
[0124] ;
[0125] in: express Reconstruction error characteristics at each moment; express Initial abnormal electricity consumption characteristics at the time; express Reconstruct abnormal electricity consumption characteristics at each moment.
[0126] In some embodiments, the timing dependency extraction layer is constructed based on a long short-term memory network model. The preliminary power consumption anomaly characteristics, reconstructed power consumption anomaly characteristics and reconstructed error characteristics of the enterprise are spliced and input into the long short-term memory network model. The long short-term memory network model outputs the timing dependency power consumption anomaly characteristics of the enterprise.
[0127] In a specific embodiment, the enterprise's preliminary power consumption anomaly features, reconstructed power consumption anomaly features, and reconstructed error features are concatenated to construct a long short-term memory network model input vector, as shown in the following formula:
[0128] ;
[0129] in: express The input vector of the long short-term memory network model at time t;
[0130] The long short-term memory network model outputs the time-dependent power consumption anomaly characteristics of the enterprise, as shown in the following formula:
[0131] ;
[0132] in: express The timing of the enterprise depends on the abnormal characteristics of electricity consumption; Indicates the length of the historical time window; Represents the long short-term memory network model; Represents the learning parameters of the long short-term memory network model.
[0133] In some embodiments, the fusion output layer is constructed based on a fully connected layer;
[0134] The preliminary abnormal electricity consumption features, reconstructed abnormal electricity consumption features, and time-dependent abnormal electricity consumption features of the enterprise are input into the fully connected layer respectively, and the fully connected layer outputs the corresponding feature weights;
[0135] The enterprise's electricity consumption anomaly characteristics are obtained by weighted summing the preliminary electricity consumption anomaly characteristics, reconstructed electricity consumption anomaly characteristics and time-dependent electricity consumption anomaly characteristics with corresponding feature weights.
[0136] In a specific embodiment, taking the preliminary abnormal electricity consumption characteristics of an enterprise as an example, the preliminary abnormal electricity consumption characteristics of the enterprise are input into the fully connected layer, and the fully connected layer outputs the corresponding feature weights, as shown in the following formula:
[0137] ;
[0138] in: Feature weights representing the preliminary abnormal electricity consumption characteristics of the enterprise; Represents the Softmax function; represents a fully connected layer; Represents the training parameters of the fully connected layer.
[0139] In some embodiments, the abnormal electricity usage characteristics of the enterprise are mapped to the abnormal electricity usage index of the enterprise through a multi-layer perceptron.
[0140] In some embodiments, the abnormal power consumption index dynamic threshold calculation formula is:
[0141] ;
[0142] in: express Dynamic threshold of abnormal power consumption index at each moment; express Abnormal electricity consumption index of the enterprise at the moment; express Samples of the time series of enterprise electricity consumption data at each moment; represents the sample mean of the time series of enterprise electricity consumption data; represents the sample covariance of the time series of enterprise electricity consumption data; 、 Indicates the weight of the abnormal power consumption index dynamic threshold calculation formula.
[0143] In some embodiments, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in any embodiment of the present invention is implemented.
[0144] In some embodiments, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method according to any embodiment of the present invention is implemented.
[0145] In the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can represent: a, b, c, a and b, a and c, b and c or a and b and c, where a, b, c can be single or multiple.
[0146] Those skilled in the art will appreciate that the various units and algorithm steps described in the embodiments disclosed herein can be implemented using a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0147] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0148] In the several embodiments provided in this application, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of this application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory; hereinafter referred to as: ROM), random access memory (Random Access Memory; hereinafter referred to as: RAM), magnetic disk or optical disk, and other media that can store program code.
[0149] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention's description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for detecting abnormal electricity consumption in an enterprise based on electricity consumption data, characterized in that: The following steps are involved: Collect the enterprise's electricity consumption data, pre-process the electricity consumption data, and construct it into a time series of enterprise electricity consumption data; Adaptively weight the samples of each dimension in the enterprise electricity consumption data time series to obtain the weighted enterprise electricity consumption data time series, specifically: defining a multi-scale sliding time window set, wherein the multi-scale sliding time window set includes a plurality of sliding time windows of different lengths; Based on different sliding time windows, the standardized fluctuation intensity of each dimension sample of the enterprise electricity consumption data time series at different scales is extracted; The temporal importance of each dimension is calculated based on the normalized fluctuation intensity of each dimension sample at all scales; Perform frequency domain transformation on the time series of enterprise electricity consumption data and calculate the frequency domain sensitivity of each dimension; Calculate the comprehensive weight of each dimension based on its time domain importance and frequency domain sensitivity; According to the comprehensive weight of each dimension, the samples of the corresponding dimension in the enterprise electricity consumption data time series are weighted to obtain the weighted enterprise electricity consumption data time series; Construct an enterprise electricity consumption anomaly feature extraction model, input the weighted enterprise electricity consumption data time series into the enterprise electricity consumption anomaly feature extraction model, and obtain the enterprise electricity consumption anomaly features; The enterprise power consumption anomaly feature extraction model includes a preliminary feature extraction layer, a conditional variational autoencoder layer, a temporal dependency extraction layer, and a fusion output layer; Based on the abnormal electricity consumption characteristics of the enterprise, the abnormal electricity consumption index of the enterprise is calculated, and at the same time, a dynamic threshold of the abnormal electricity consumption index is constructed. The calculation formula of the dynamic threshold of the abnormal electricity consumption index is: ; in: express Dynamic threshold of abnormal power consumption index at each moment; express Abnormal electricity consumption index of the enterprise at the moment; express Samples of the time series of enterprise electricity consumption data at each moment; represents the sample mean of the time series of enterprise electricity consumption data; represents the sample covariance of the time series of enterprise electricity consumption data; 、 Represents the weight of the abnormal power consumption index dynamic threshold calculation formula; When the abnormal power consumption index is greater than the abnormal power consumption index dynamic threshold, it is determined that the current enterprise is in an abnormal power consumption state.
2. The method for detecting abnormal electricity consumption in an enterprise based on electricity consumption data according to claim 1, characterized in that: The enterprise electricity consumption data time series includes basic electricity consumption data and cross-extended electricity consumption data.
3. The method for detecting abnormal electricity consumption in an enterprise based on electricity consumption data according to claim 1, characterized in that: The preliminary feature extraction layer is constructed based on the residual enhanced random forest model; Inputting the weighted enterprise electricity consumption data time series into the residual enhanced random forest model for training; The residual enhanced random forest model includes multiple decision trees, and after each round of training, the residual of each decision tree is calculated based on the output results of each decision tree; Repeat the following steps: construct an additional decision tree in this round of training, use the residual mean of all decision trees from the previous round of training as the leaf weight of the new decision tree, and then train it again. When the preset stopping condition is reached, stop training to obtain the trained residual enhanced random forest model. The output results of each decision tree in the residual enhanced random forest model after comprehensive training are used to obtain the preliminary abnormal electricity consumption characteristics of the enterprise.
4. The method for detecting abnormal electricity consumption in an enterprise based on electricity consumption data according to claim 3, characterized in that: The conditional variational autoencoder layer includes an encoder and a decoder; The preliminary abnormal electricity consumption characteristics of the enterprise are used as conditional variables, and the weighted enterprise electricity consumption data time series and the conditional variables are input into the encoder, which outputs the mean and standard deviation of the latent variable; Calculate the latent variables based on their mean and standard deviation, input the latent variables and conditional variables into the decoder to output the reconstructed abnormal electricity consumption characteristics of the enterprise; The reconstruction error characteristics are calculated based on the preliminary abnormal electricity consumption characteristics and the reconstructed abnormal electricity consumption characteristics of the enterprise.
5. The method for detecting abnormal electricity consumption in an enterprise based on electricity consumption data according to claim 4, characterized in that: The temporal dependency extraction layer is constructed based on the long short-term memory network model. The preliminary power consumption anomaly characteristics, reconstructed power consumption anomaly characteristics and reconstructed error characteristics of the enterprise are spliced and input into the long short-term memory network model. The long short-term memory network model outputs the temporal dependency power consumption anomaly characteristics of the enterprise.
6. The method for detecting abnormal electricity consumption in an enterprise based on electricity consumption data according to claim 5, characterized in that: The fusion output layer is built based on the fully connected layer; The preliminary abnormal electricity consumption features, reconstructed abnormal electricity consumption features, and time-dependent abnormal electricity consumption features of the enterprise are input into the fully connected layer respectively, and the fully connected layer outputs the corresponding feature weights; The enterprise's electricity consumption anomaly characteristics are obtained by weighted summing the preliminary electricity consumption anomaly characteristics, reconstructed electricity consumption anomaly characteristics and time-dependent electricity consumption anomaly characteristics with corresponding feature weights.
7. The method for detecting abnormal electricity consumption in an enterprise based on electricity consumption data according to claim 1, characterized in that: The abnormal electricity consumption features of the enterprise are mapped into the abnormal electricity consumption index of the enterprise through a multi-layer perceptron.
Citation Information
Patent Citations
Enterprise electricity utilization detection method and device, computer equipment and storage medium
CN117828507A
Power consumption behavior diagnosis system and method based on anomaly detection model
CN119918005A