A proxy power purchase abnormal power identification method and system based on a multi-scale hypergraph Transformer sequence reconstruction and a storage medium
By using a multi-scale hypergraph Transformer sequence reconstruction network, the problem of insufficient accuracy in anomaly identification in the power grid enterprise's agency power purchase business was solved, achieving high-precision identification and differentiation of power data, and improving the accuracy and reliability of abnormal power identification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUHAN UNIV
- Filing Date
- 2026-03-13
- Publication Date
- 2026-07-10
AI Technical Summary
Existing anomaly identification methods are susceptible to interference from anomalies in the power grid company's agency power purchase business. Their limited ability to detect local anomalies leads to insufficient identification accuracy and makes it difficult to effectively distinguish between normal and abnormal power data.
A multi-scale hypergraph Transformer sequence reconstruction method is adopted. A multi-scale historical electricity input window is constructed through sliding window processing and downsampling techniques. Combined with the multi-scale hypergraph Transformer sequence reconstruction network, feature extraction and reconstruction are performed using encoder and decoder. Hypergraph constraint loss is introduced for model optimization to achieve high-precision identification of electricity sequences.
It effectively distinguishes between normal and abnormal electricity data, improves the accuracy and reliability of identifying abnormal electricity consumption in agent-purchased electricity, solves the problem of difficulty in taking into account both local details and long-term trends under a single scale, and enhances the ability to represent complex fluctuation patterns.
Smart Images

Figure CN122365221A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of power system automation technology, specifically relating to a method, system, and storage medium for identifying abnormal electricity consumption in proxy power purchase based on multi-scale hypergraph Transformer sequence reconstruction. Background Technology
[0002] In the power grid company's agency power purchase business, the electricity purchase data collected from multiple sources often contains various types and large-scale outliers due to communication interference, transmission errors, and environmental factors. These anomalies are not only highly concealed and disrupt the time sequence structure, but also easily interfere with subsequent data analysis and business decisions, making anomaly identification a significant challenge and posing a challenge to obtaining high-quality electricity data.
[0003] Existing anomaly identification methods mainly include those based on mathematical statistics, prediction, clustering, and sequence reconstruction. Mathematical statistics and prediction methods are easily affected by outliers, leading to increased threshold settings and prediction errors, thus affecting identification accuracy. Clustering methods can only identify outliers that significantly deviate from normal patterns, and their ability to detect local anomalies such as sudden changes in power levels is limited. Summary of the Invention
[0004] To overcome the shortcomings of existing anomaly identification methods, such as susceptibility to anomaly interference and limited ability to detect local anomalies, resulting in limited identification and detection accuracy, this invention provides a method, system, and storage medium for identifying abnormal electricity consumption in proxy power purchases based on multi-scale hypergraph Transformer sequence reconstruction. This method can model the long-term and short-term dependencies of electricity consumption sequences through a multi-scale hypergraph structure and combine this with the feature extraction capabilities of Transformer to effectively distinguish between normal and abnormal electricity consumption data, thereby improving the accuracy and reliability of identifying abnormal electricity consumption in proxy power purchases.
[0005] According to one aspect of the present invention, a method for identifying abnormal electricity consumption in proxy electricity purchases based on multi-scale hypergraph Transformer sequence reconstruction is provided, comprising: The abnormal power sequence under study is subjected to sliding window processing to generate several original historical power data windows, and several original historical power data windows are processed based on downsampling technology to obtain several multi-scale historical power input windows. Several multi-scale trainable hypergraphs are constructed, and these multi-scale trainable hypergraphs and several multi-scale historical electricity input windows are input into the encoder of the multi-scale hypergraph Transformer sequence reconstruction network for processing, so as to obtain several multi-scale fusion features and several multi-scale fusion hypergraphs. The decoder of the multi-scale hypergraph Transformer sequence reconstruction network reconstructs the power sequence fragments based on several multi-scale fusion features, several multi-scale fusion hypergraphs, and several original historical power data windows output by the encoder, thereby obtaining several reconstructed power sequence fragments. The total loss, including multi-scale hypergraph constraint loss and reconstruction loss, is calculated based on the outputs of the encoder and decoder. The model parameters of the multi-scale hypergraph Transformer sequence reconstruction network are then adjusted based on the total loss until the multi-scale hypergraph Transformer sequence reconstruction network converges. Anomaly scores for several multi-scale historical electricity input windows are calculated using a convergent multi-scale hypergraph Transformer sequence reconstruction network. Based on these anomaly scores, anomalous electricity sequence fragments are selected from several original historical electricity data windows.
[0006] As a further technical solution, the steps for constructing a multi-scale historical electricity input window include: According to the preset size and preset step size of the sliding window, with the starting point of the sliding window as the time point, the sliding window method is used to process the power series containing anomalies to be studied, and a series of data windows at time points are obtained as the original historical power data windows. A multi-scale window generator based on downsampling technology is used to downsample the original historical electricity data window to obtain data windows of several preset scales, which serve as the input windows for multi-scale historical electricity data.
[0007] As a further technical solution, the encoder includes a multi-channel structure, a multi-scale feature and hypergraph fusion module, and a multi-scale feature and hypergraph fusion module. Each channel in the multi-channel structure includes a multi-head hypergraph convolution module and a first temporal decomposition module for processing. Each channel is used to process trainable hypergraphs and historical energy input windows of different scales. Each channel takes a trainable hypergraph of the same scale and a historical energy input window as input, and processes them sequentially through the multi-head hypergraph convolution module and the first temporal decomposition module to obtain temporal evolution features of the corresponding scale. The multi-scale feature and hypergraph fusion module integrates the temporal evolution features of different scales to obtain multi-scale fused features, and the multi-scale feature and hypergraph fusion module integrates the multi-scale trainable hypergraph to obtain a multi-scale fused hypergraph.
[0008] As a further technical solution, the multi-head hypergraph convolution module includes a hypergraph attention, a multi-head convolution unit, and a fusion unit. The multi-head convolution unit includes a feature unit and several attention heads. It takes a trainable hypergraph of the same scale and a historical battery input window as input, and the processing includes: Feature variables of nodes in the historical electricity input window are extracted using feature units in multi-head convolutional units; Hypergraph attention is used to calculate the attention weights between nodes and neighborhood hyperedges based on the sparsed hypergraph association matrix using the graph attention mechanism, thus obtaining the hypergraph association matrix after attention at the corresponding scale. A multi-head convolutional unit contains several attention heads. Each attention head independently performs hypergraph convolution operations based on the correlation matrix after hypergraph attention at the corresponding scale, and outputs hyperedge features at the corresponding scale. The hyperedge features of the corresponding scales output by all attention heads within the multi-head convolutional unit are concatenated to obtain the fused hyperedge feature sequence of the corresponding scale.
[0009] As a further technical solution, the first temporal decomposition module processes the fusion superedge feature sequence at the corresponding scale to extract the seasonal and trend components in the fusion superedge feature sequence; the historical power input window of the input encoder and the seasonal and trend components in the fusion superedge feature sequence are fused to obtain the temporal evolution features at the corresponding scale.
[0010] As a further technical solution, the multi-scale feature and hypergraph fusion module takes the top-level scale as the highest scale, performs continuous upsampling operations on the temporal evolution features at the previous scale, until the scale of the upsampling result is the same as the temporal evolution features at the next scale of the previous scale, fuses the upsampling result with the temporal evolution features at the next scale of the previous scale, and uses a feedforward layer to further nonlinearly transform the fusion result to obtain the fusion features at the next scale of the previous scale. In this way, the temporal evolution features of different scales are integrated scale by scale until the fusion features of the bottom scale are obtained, and the fusion features of the bottom scale are used as the multi-scale fusion features. Using the top-level scale as the highest scale, perform low-scale mapping on the trainable hypergraph at the previous scale until the scale of the mapping result is the same as the scale of the trainable hypergraph at the next scale of the previous scale. Then, stitch and fuse the mapping result with the trainable hypergraph at the next scale of the previous scale to obtain the fused hypergraph at the next scale of the previous scale. This process is repeated step by step to integrate trainable hypergraphs at different scales until the fused hypergraph at the bottom scale is obtained. The fused hypergraph at the bottom scale is then used as the multi-scale fused hypergraph.
[0011] As a further technical solution, the decoder includes a second temporal decomposition module, a multi-head hypergraph convolution module, and a seasonal-trend fusion module; The multi-head hypergraph convolution module first fuses the initial seasonal features and multi-scale fusion features. Then, based on the multi-scale fusion hypergraph correlation matrix, the corresponding hypergraph convolution kernel is constructed according to the attention head for feature propagation. In each attention head, the hypergraph convolution kernel guides the feature transformation, and the hypergraph structure prior is incorporated into the seasonal features and multi-scale fusion features to obtain the output features of each attention head. The output features of all attention heads are concatenated in the feature dimension to obtain the multi-head hypergraph convolution features. The second temporal decomposition module processes the multi-head hypergraph convolution features to separate the secondary seasonal features and secondary trend features. The initial trend features and secondary trend features are then superimposed and fused to obtain the final trend features. The seasonal-trend fusion module integrates the original historical electricity data window, secondary seasonal features, and final trend features to obtain a reconstructed electricity sequence fragment.
[0012] According to another aspect of this specification, a proxy electricity purchase abnormality identification system based on multi-scale hypergraph Transformer sequence reconstruction is provided, comprising: The input preprocessing module is used to perform sliding window processing on the power sequence containing anomalies to be studied to generate several original historical power data windows, and to process several original historical power data windows based on downsampling technology to obtain several multi-scale historical power input windows. The dynamic hypergraph construction and encoding module is used to construct several multi-scale trainable hypergraphs. The multi-scale trainable hypergraphs and several multi-scale historical electricity input windows are input into the encoder of the multi-scale hypergraph Transformer sequence reconstruction network for processing to obtain several multi-scale fusion features and several multi-scale fusion hypergraphs. The power sequence reconstruction module is used by the decoder of the multi-scale hypergraph Transformer sequence reconstruction network to reconstruct power sequence segments based on several multi-scale fusion features, several multi-scale fusion hypergraphs and several original historical power data windows output by the encoder, thereby obtaining several reconstructed power sequence segments. The training update module is used to calculate the total loss, which includes multi-scale hypergraph constraint loss and reconstruction loss, based on the output of the encoder and the output of the decoder. The model parameters of the multi-scale hypergraph Transformer sequence reconstruction network are adjusted according to the total loss until the multi-scale hypergraph Transformer sequence reconstruction network converges. The anomaly identification module is used to calculate the anomaly scores of several multi-scale historical electricity input windows based on the converged multi-scale hypergraph Transformer sequence reconstruction network, and to filter out abnormal electricity sequence segments in several original historical electricity data windows based on the anomaly scores of several multi-scale historical electricity input windows.
[0013] According to another aspect of this specification, an electronic device is provided, including a memory and a processor, the memory storing program instructions executed by the processor, the processor invoking the program instructions to perform a method for identifying abnormal electricity consumption in proxy electricity purchases based on multi-scale hypergraph Transformer sequence reconstruction.
[0014] According to another aspect of this specification, a non-transitory computer-readable storage medium is provided, the non-transitory computer-readable storage medium storing computer instructions that cause the computer to execute a method for identifying abnormal electricity consumption in proxy electricity purchases based on multi-scale hypergraph Transformer sequence reconstruction.
[0015] Compared with existing technologies, the beneficial effects of this invention are as follows: First, the embodiments of this invention perform sliding window processing on the electricity sequence containing anomalies to generate several original historical electricity data windows. Then, based on downsampling techniques, these original historical electricity data windows are processed to obtain several multi-scale historical electricity input windows. Next, several multi-scale trainable hypergraphs are constructed, and these multi-scale trainable hypergraphs and several multi-scale historical electricity input windows are input into the encoder of a multi-scale hypergraph Transformer sequence reconstruction network for processing, to obtain several multi-scale fusion features and several multi-scale fusion hypergraphs. Second, the decoder of the multi-scale hypergraph Transformer sequence reconstruction network reconstructs electricity sequence segments based on the multi-scale fusion features, multi-scale fusion hypergraphs, and several original historical electricity data windows output by the encoder, thereby obtaining several reconstructed electricity sequence segments. Then, based on the output results of the encoder and decoder, the total loss, including multi-scale hypergraph constraint loss and reconstruction loss, is calculated. The model parameters of the multi-scale hypergraph Transformer sequence reconstruction network are adjusted according to the total loss until the multi-scale hypergraph Transformer sequence reconstruction network converges. Finally, based on the converged multi-scale hypergraph Transformer sequence reconstruction network… The Ormer sequence reconstruction network calculates the anomaly scores of several multi-scale historical electricity input windows. Based on these anomaly scores, it filters out anomaly electricity sequence fragments from several original historical electricity data windows. The technical solution of this invention first constructs multi-scale historical electricity input windows using a multi-scale input mechanism built with sliding windows and downsampling techniques. This captures temporal features at different time resolutions, effectively solving the problem of simultaneously capturing local details and long-term trends at a single scale, and enhancing the representation ability of complex fluctuation patterns. Second, it utilizes a multi-scale hypergraph Transformer sequence... The encoder of the reconstruction network incorporates trainable hypergraphs, hypergraph attention, and multi-head hypergraph convolution modules. Combined with time-series decomposition and fusion techniques, this enables deep extraction and high-order correlation mining of multi-dimensional features such as time series, seasonality, and trends in electricity data. Furthermore, in the decoding stage, high-quality electricity reconstruction sequences are generated through the decomposition of the original data and the re-fusion of multi-scale features. Finally, by introducing hypergraph constraint losses such as Laplacian loss, hyperedge loss, and node loss in conjunction with the reconstruction loss for joint optimization, the model learns a robust hypergraph structure, thereby achieving accurate identification of abnormal electricity consumption by agents based on reconstruction errors. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A flowchart illustrating a method for identifying abnormal electricity consumption in proxy electricity purchases based on multi-scale hypergraph Transformer sequence reconstruction, provided in an embodiment of the present invention;
[0018] Figure 2 This is a flowchart of the method for identifying abnormal electricity consumption in proxy electricity purchase based on multi-scale hypergraph Transformer sequence reconstruction in an embodiment of the present invention;
[0019] Figure 3 This is a network structure diagram of the multi-scale hypergraph Transformer sequence reconstruction model in an embodiment of the present invention;
[0020] Figure 4 This is a schematic diagram of the structure of an abnormal electricity consumption identification system for proxy electricity purchase based on multi-scale hypergraph Transformer sequence reconstruction, provided in an embodiment of the present invention.
[0021] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0022] It should be noted that:
[0023] The terms “comprising” and “having”, and any variations thereof, in the specification, claims, and accompanying drawings of this invention are intended to cover a non-exclusive inclusion, such as a process, method, system, product, or apparatus that includes a series of steps or units, not necessarily limited to those explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0024] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices. The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be decomposed, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. In addition, the technical features of the various embodiments or individual embodiments provided by the present invention can be arbitrarily combined to form new technical solutions. Such combinations are not bound by the order of steps and / or structural composition patterns, but must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by the present invention.
[0026] This invention aims to propose a method for identifying abnormal electricity consumption in proxy electricity purchases based on multi-scale hypergraph Transformer sequence reconstruction. Its key feature is the use of a multi-scale hypergraph structure to model the short-term and long-term dependencies in the electricity consumption sequence, combined with the feature extraction capabilities of Transformer, to effectively distinguish between normal and abnormal electricity consumption data, thereby improving the accuracy of identifying abnormal electricity consumption in proxy electricity purchases. This method has significant value. Figure 1 As shown, a method for identifying abnormal electricity consumption in proxy electricity purchases based on multi-scale hypergraph Transformer sequence reconstruction includes:
[0027] Step 1: Perform sliding window processing on the abnormal power sequence to be studied to generate several original historical power data windows, and process several original historical power data windows based on downsampling technology to obtain several multi-scale historical power input windows. Step 2: Construct several multi-scale trainable hypergraphs, and input the several multi-scale trainable hypergraphs and several multi-scale historical electricity input windows into the encoder of the multi-scale hypergraph Transformer sequence reconstruction network for processing, so as to obtain several multi-scale fusion features and several multi-scale fusion hypergraphs. Step 3: The decoder of the multi-scale hypergraph Transformer sequence reconstruction network reconstructs the power sequence fragments based on several multi-scale fusion features, several multi-scale fusion hypergraphs and several original historical power data windows output by the encoder, thereby obtaining several reconstructed power sequence fragments. Step 4: Calculate the total loss, including multi-scale hypergraph constraint loss and reconstruction loss, based on the output of the encoder and decoder. Adjust the model parameters of the multi-scale hypergraph Transformer sequence reconstruction network according to the total loss until the multi-scale hypergraph Transformer sequence reconstruction network converges. Step 5: Calculate the anomaly scores of several multi-scale historical electricity input windows based on the converged multi-scale hypergraph Transformer sequence reconstruction network, and filter out the abnormal electricity sequence segments in several original historical electricity data windows based on the anomaly scores of several multi-scale historical electricity input windows.
[0028] Preferably, in step 1, after obtaining the power sequence containing the anomalies to be studied, the step also includes preprocessing the power sequence, such as normalizing the power sequence using the Min-Max normalization method.
[0029] Specifically, the data normalization process includes: normalizing the electricity consumption sequence containing anomalies using the Min-Max normalization method to transform the data range to the interval [0,1], thus obtaining a normalized electricity consumption sequence. The mathematical expression is:
[0030]
[0031] In the formula, This represents the normalized electricity sequence. Represents the original energy sequence. This represents the minimum energy value in the original energy sequence. This represents the maximum value of the energy in the original energy sequence.
[0032] In step 1, a sliding window is used to generate a historical power data window for each time point of power data. Finally, a multi-scale historical power input window is generated using downsampling technology, which is then input into a multi-scale encoder for trainable hypergraph encoding.
[0033] Specifically, the steps for constructing a multi-scale historical electricity input window include:
[0034] Step 1-1: According to the preset size and preset step size of the sliding window, with the starting point of the sliding window as the time point, the sliding window method is used to process the power series containing anomalies to be studied, and a series of data windows at time points are obtained as the original historical power data windows. Step 1-2: Use a multi-scale window generator based on downsampling technology to downsample the original historical electricity data window to obtain data windows of several preset scales, which serve as the input windows for multi-scale historical electricity data.
[0035] The mathematical representation of the data window at a given time point is as follows:
[0036]
[0037] in, A data window representing time points, where t represents the t-th time point; This indicates the size of the sliding window.
[0038] Define a multi-scale window generator based on downsampling techniques to construct data windows of L different scales. s represents the scale index. This represents the window dimension generated at scale s.
[0039] when At that time, that is, at the lowest level (scale s=0), the original historical electricity data window W (as mentioned above) Simultaneously serving as input to both the convolutional and downsampling branches of the multi-scale window generator, the multi-scale window generator is defined as follows:
[0040] Convolutional branches: ;
[0041] Downsampling branch: ;
[0042] ;
[0043] In the formula, This represents the output of the convolution branch at scale s; This represents the output of the downsampling branch at scale s; This represents the parameters corresponding to the (s-1)th layer convolution operation, such as the weights and biases of the convolution kernel; Indicates that through trainable Perform parameterized one-dimensional convolution operators. The kernel size; This indicates a downsampling operation. [·] indicates the downsampling interval; [·] indicates the concatenation operation, which concatenates the outputs of the convolution branch and the downsampling branch at the s-th scale to obtain the data window at the s-th scale. .
[0044] The downsampling operation directly selects energy sequence data from the scale (s-1) at intervals of K, reducing the length of the energy sequence while retaining key information. Therefore, Scale 0 window size That is, the size of the sliding window.
[0045] In step 2, the construction steps of the multi-scale trainable hypergraph include:
[0046] For each scale of the multi-scale historical electricity input window, a hypergraph within the scale is constructed. The hypergraph includes a set of nodes, a set of hyperedges, and a hypergraph association matrix. Given the number of nodes, the total number of hyperedges, and the number of nodes initially connected by each hyperedge at the current scale, the hypergraph association matrix is initialized. A trainable node embedding matrix and a hyperedge embedding matrix are introduced to obtain a trainable hypergraph at the current scale. The initialized hypergraph association matrix is calculated, updated, and sparsified based on the trainable node embedding matrix and the hyperedge embedding matrix, thereby obtaining a multi-scale trainable hypergraph.
[0047] Specifically, for the target scale s corresponding to the electricity sequence window, a hypergraph within scale s is constructed: (in, This represents a hypergraph at the target scale s; Let represent the set of superedges, e represent the superedge, and the subscript m be the superedge index. Let be the total number of hyperedges at the target scale s; Let v represent a set of nodes, where v represents a node and n is the node's index. (Total number of nodes at target scale s) and hypergraph association matrix: (Represents the hypergraph incidence matrix at target scale s):
[0048] Set the total number of nodes at the target scale s Total number of super-edges And the initial number of connected nodes of the hyperedge is For hypergraph incidence matrix Initialize to establish short-term adjacency associations between hyperedges and nodes:
[0049] when hour, (node Belongs to superedge ),otherwise .
[0050] Then, a trainable node embedding matrix is introduced. With hyperedge embedding matrix The similarity basis association matrix (the initialized hypergraph association matrix) is calculated, updated, and sparsified in the following way:
[0051] ;
[0052] ;
[0053] ;
[0054] In the formula, Represents the sigmoid activation function and Represents the ReLU activation function; This represents the update rate of the correlation matrix; during the iterative training of the model, the model parameters are updated in each training round. This indicates the use of the medium scale during the (n-1)th training round. The hypergraph correlation matrix update in the nth round of training at the mesoscale The hypergraph correlation matrix of the first Round training scale Hypergraph correlation matrix; This indicates that a Top-k selection operation is performed, which means retaining the top k salient connecting superedges for each node. .
[0055] In step 2, the encoder includes a multi-channel structure, a multi-scale feature and hypergraph fusion module, and a multi-scale feature and hypergraph fusion module. Each channel in the multi-channel structure includes a multi-head hypergraph convolution module and a first temporal decomposition module for processing. Each channel is used to process trainable hypergraphs and historical electricity input windows at different scales. Each channel takes a trainable hypergraph and historical electricity input window of the same scale as input, and processes them sequentially through the multi-head hypergraph convolution module and the first temporal decomposition module to obtain temporal evolution features within the target scale. The multi-scale feature and hypergraph fusion module integrates the temporal evolution features at different scales and the multi-scale trainable hypergraph to obtain multi-scale fused features and multi-scale fused hypergraphs.
[0056] Firstly, the multi-head hypergraph convolution module includes hypergraph attention, multi-head convolutional units, and fusion units. The multi-head convolutional unit includes a feature unit and several attention heads. It takes a trainable hypergraph of the same scale and a historical electricity input window as input. The processing includes: Feature variables of nodes in the historical electricity input window are extracted using feature units in multi-head convolutional units; Hypergraph attention is used to calculate the attention weights between nodes and neighborhood hyperedges based on the sparsed hypergraph association matrix using the graph attention mechanism, thus obtaining the hypergraph association matrix after attention at the corresponding scale. A multi-head convolutional unit contains several attention heads. Each attention head independently performs hypergraph convolution operations based on the correlation matrix after hypergraph attention at the corresponding scale, and outputs hyperedge features at the corresponding scale. The hyperedge features of the corresponding scales output by all attention heads within the multi-head convolutional unit are concatenated to obtain the fused hyperedge feature sequence of the corresponding scale.
[0057] Specifically, the steps for obtaining the fused hyperedge feature sequence within the target scale s include:
[0058] Based on the sparsed hypergraph incidence matrix Historical electrical input window within the target scale Extract first The Middle Feature variables corresponding to each node Then for the super edge The feature variables of all connected nodes are aggregated to obtain the initial hyperedge features. Finally, based on the graph attention mechanism, the attention weights between a node and its neighboring hyperedges are calculated. :
[0059] ;
[0060] ;
[0061] In the formula, Indicates the superedge The index of the join node, Represents a node The index of the neighborhood superedge, This represents the feature vector corresponding to that node. Indicates trainable weights. Indicates the connection node The set of neighborhood superedges, Indicates the superedge The set of connected nodes It is an aggregate function.
[0062] Based on the above operations, the correlation matrix after in-scale hypergraph attention is obtained. Then, perform a multi-head hypergraph convolution operation: input historical electricity data into the window. Sparse hypergraph correlation matrix after in-scale attention processing and preset number of attention heads The input is fed into the multi-head hypergraph convolutional module, and for each attention head... Perform hypergraph convolution operations independently, and complete feature aggregation and transformation as follows:
[0063]
[0064] In the formula, This represents the aggregated edge feature output by the h-th feature head at scale s; This represents a trainable hyperedge weight diagonal matrix. This represents a trainable weight matrix for feature capture. Represents the node degree matrix, Represents the hypermarginality matrix. This represents the hypergraph post-attention hypergraph correlation matrix corresponding to the h-th attention head at scale s. This represents the sigmoid activation function, used to enhance the non-linear expressive power of features.
[0065] Finally, the output features of all H attention heads , , ..., By concatenating along the dimensions, we obtain the final fused hyperedge feature sequence of the multi-head hypergraph convolution within the target scale s. : .
[0066] Secondly, the first temporal decomposition module processes the fusion superedge feature sequence at the corresponding scale to extract the seasonal and trend components in the fusion superedge feature sequence; it fuses the historical power input window of the input encoder with the seasonal and trend components in the fusion superedge feature sequence to obtain the temporal evolution features at the corresponding scale.
[0067] The time series decomposition module converts the module input into a spectral form based on the discrete Fourier transform, extracts several significant frequencies from the spectral form, and then transforms these significant frequencies back into the time domain using the inverse discrete Fourier transform to obtain the seasonal components of the module input; a moving average operation is then performed on the module input to obtain the trend components of the module input.
[0068] Specifically, the steps for obtaining the temporal evolution features within the target scale s include:
[0069] To capture the seasonality of the electricity consumption sequence, the discrete Fourier transform operator is employed. The input sequence (the final fused hyperedge feature sequence of multi-head hypergraph convolution within the target scale s) is used to... The frequency domain is transformed to the time domain, and the top k significant frequencies are selected. Then, the inverse discrete Fourier transform operator is used to transform the frequency domain. Calculations were performed to obtain the seasonal components within the target scale s. To capture the trend of the power curve, a kernel size of [missing value] was used. The average pooling kernel, for Perform a moving average operation to obtain the trend component within the target scale s. Finally, the original data windows within the target scale s are merged. (Historical power input window within the encoder input scale s), seasonal component With trend components This yields the evolutionary characteristics (temporal evolution characteristics) of the time series within the target scale s. Mathematically, this is expressed as:
[0070] ;
[0071] ;
[0072] ;
[0073] ;
[0074] In the formula, This represents the first k significant frequencies, and A represents the amplitude. Indicates phase, This represents the weight of the i-th average pooling kernel. Indicates trainable weights. Indicates feedforward layer, This indicates the average pooling operation.
[0075] Third, the multi-scale feature and hypergraph fusion module, which takes the top-level scale as the highest scale, performs continuous upsampling operations on the temporal evolution features at the previous scale until the scale of the upsampling result is the same as the temporal evolution features at the next scale of the previous scale. The upsampling result and the temporal evolution features at the next scale of the previous scale are fused, and a feedforward layer is used to further nonlinearly transform the fusion result to obtain the fused features at the next scale of the previous scale. In this way, the temporal evolution features of different scales are integrated scale by scale until the fused features of the bottom scale are obtained. The fused features of the bottom scale are used as the multi-scale fusion features. Using the top-level scale as the highest scale, perform low-scale mapping on the trainable hypergraph at the previous scale until the scale of the mapping result is the same as the scale of the trainable hypergraph at the next scale of the previous scale. Then, stitch and fuse the mapping result with the trainable hypergraph at the next scale of the previous scale to obtain the fused hypergraph at the next scale of the previous scale. This process is repeated step by step to integrate trainable hypergraphs at different scales until the fused hypergraph at the bottom scale is obtained. The fused hypergraph at the bottom scale is then used as the multi-scale fused hypergraph.
[0076] Specifically, the multi-scale feature and hypergraph fusion module includes the following steps:
[0077] To integrate the temporal evolution features learned from the multi-channel encoder at multiple scales, the learned... Perform upsampling operation, where The outputs at all scales are normalized to the s-scale, ensuring that the outputs at all scales share the same dimension, thus achieving the fusion of multi-scale window features. Specifically:
[0078] ;
[0079] ;
[0080] In the formula, This represents a one-dimensional transposed convolutional layer. Operation can make Dimensions and Consistent dimensions Indicates feedforward layer, This represents the multi-scale fusion feature.
[0081] Furthermore, it is necessary to integrate the learned multi-scale hypergraphs. By mapping the high-scale hypergraph to a low-scale level and merging the multi-scale hypergraphs, the fusion of multi-scale hypergraphs and their associated information can be achieved. Specifically:
[0082] ;
[0083] ;
[0084] In the formula, This represents the hypergraph incidence matrix of the nth node at scale s. This indicates a round-down operation. Represents the multi-scale fused hypergraph correlation matrix. This indicates concatenation by column. Indicates the number of scales.
[0085] In step 3, the decoder of the multi-scale hypergraph Transformer sequence reconstruction network includes a second temporal decomposition module, a multi-head hypergraph convolution module, and a seasonal-trend fusion module. The multi-head hypergraph convolution module first fuses the initial seasonal features and multi-scale fusion features. Then, based on the multi-scale fusion hypergraph correlation matrix, the corresponding hypergraph convolution kernel is constructed according to the attention head for feature propagation. In each attention head, the hypergraph convolution kernel guides the feature transformation, and the hypergraph structure prior is incorporated into the seasonal features and multi-scale fusion features to obtain the output features of each attention head. The output features of all attention heads are concatenated in the feature dimension to obtain the multi-head hypergraph convolution features. The second temporal decomposition module processes the multi-head hypergraph convolution features to separate the secondary seasonal features and secondary trend features. The initial trend features and secondary trend features are then superimposed and fused to obtain the final trend features. The seasonal-trend fusion module integrates the original historical electricity data window, secondary seasonal features, and final trend features to obtain a reconstructed electricity sequence fragment.
[0086] Specifically, firstly, the decoder performs initial time-series decomposition: the raw electricity data window is input into the second time-series decomposition module in the decoder to extract initial seasonal and trend features, mathematically represented as:
[0087] ;
[0088] ;
[0089] ;
[0090] In the formula, W represents the original historical electricity data window. Indicates the initial seasonal characteristics. Indicates initial trend characteristics. This indicates the average pooling operation.
[0091] Secondly, the decoder uses multi-head hypergraph convolution: combining initial seasonal features. The multi-scale fusion features obtained in step 2 and the integrated multi-scale fused hypergraph Perform multi-head hypergraph convolution operation, then concatenate the output features of each attention head according to their dimensions to achieve multi-head fusion. This maintains the feature dimensions while fusing hypergraph association information from multiple perspectives, mathematically represented as:
[0092] ;
[0093] ;
[0094] In the formula, This represents the output feature of the h-th attention head; Represents the node degree matrix, This represents the number of nodes at scale 0 (the lowest level). This represents the hypergraph association matrix corresponding to the h-th head; This represents the weight of the hyperedge corresponding to the h-th head; Represents the hypermarginality matrix. This represents the total number of hyperedges in the decoder-fused hypergraph; This represents the learnable parameter matrix for the h-th head; This represents the multi-head convolutional fusion feature of the decoder.
[0095] Third, secondary temporal decomposition: the multi-head hypergraph convolutional features obtained above are used in the decoder. Input to the third time series decomposition module to separate the secondary seasonal features. Features of the second trend The mathematical representation of this decomposition process is as follows:
[0096] ;
[0097] ;
[0098] ;
[0099] In the formula, This indicates a secondary seasonality characteristic. Indicates a quadratic trend characteristic. This indicates the average pooling operation.
[0100] The initial trend features output by the second time series decomposition module The quadratic trend features obtained from the third time series decomposition module By overlaying and fusing the two trend features, the final trend feature is obtained. .
[0101] Fourth, sequence reconstruction: In the seasonal-trend fusion module of the decoder, the original historical electricity data window, secondary seasonal features and final trend features are fused to obtain the reconstruction result of the electricity sequence segment, which is used to compare with the original electricity sequence and calculate the reconstruction loss.
[0102] The reconstructed electricity sequence fragment maintains the same scale as the original sequence while incorporating multi-scale feature representations.
[0103] In step 4, model training optimization: In this embodiment, the reconstruction error and hypergraph constraints obtained in step 3 are used to calculate the training loss, including Laplacian loss, hyperedge loss, node loss and reconstruction loss. Then, all trainable parameters of the model are updated through gradient descent and backpropagation to ensure that the model learns the correct hypergraph structure during the training process and continuously improves the sequence reconstruction effect.
[0104] Specifically, the model training and optimization process includes:
[0105] In this embodiment, during model training, to ensure the cross-scale feature consistency of the multi-scale hypergraph and to match the learned hyperedges and node embeddings with the original temporal features, three types of multi-scale hypergraph constraints—Laplacian consistency, hyperedge similarity, and node consistency—are set to improve the modeling accuracy of the hypergraph for the short-term and long-term dependencies of the electrical quantity sequence. This leads to the construction of multi-scale hypergraph constraint loss and reconstruction loss, which are then fused to obtain the total training loss. The Adam gradient descent optimizer is used to perform backpropagation updates on the model parameters to minimize the total loss. Until the model converges, which can be specifically expressed as:
[0106] ;
[0107] ;
[0108] ;
[0109] ;
[0110] ;
[0111] In the formula, This indicates the Laplace consistency loss. This represents the loss due to hyperedge consistency. This represents the node consistency loss, and the three factors constitute the multi-scale hypergraph constraint loss. Indicates the reconstruction loss; Indicates the total loss; Represents the matrix trace operation; , where represents the Laplace matrix, for The angle matrix; This indicates that the node with index k at scale s belongs to the hyperedge. ; Represents the node embedding matrix; Represents the original features of the hyperedge at scale s; This represents the similarity weight between hyperedges at scale s; These are preset hyperparameters; Indicates the Euclidean distance between hyperedge embeddings; This represents the projection function used to align the dimensions of the node embeddings with those of the original hyperedge features. SD is the Frobenius norm; SD is the normalization coefficient. This represents the reconstruction result of the electricity sequence.
[0112] Step 5 essentially involves anomaly score calculation and anomaly identification: anomaly scores are calculated based on reconstruction errors, and anomaly thresholds are defined to identify anomalies in electricity purchased by agents.
[0113] The steps for calculating anomaly scores for several multi-scale historical electricity input windows and filtering out anomaly electricity sequence fragments from several original historical electricity data windows based on a convergent multi-scale hypergraph Transformer sequence reconstruction network include: A convergent multi-scale hypergraph Transformer sequence reconstruction network is used to process several multi-scale historical electricity input windows corresponding to several original historical electricity data windows, and output several final reconstructed electricity sequence segments. The reconstruction loss is calculated as an anomaly score based on several original historical electricity data windows and their corresponding reconstructed electricity sequence segments. An anomaly threshold is preset, and the anomaly score corresponding to each of several original historical electricity data windows is compared with the anomaly threshold. Several original historical electricity data windows with anomaly scores exceeding the anomaly threshold are selected as anomaly electricity sequence segments.
[0114] Specifically, in this embodiment, after the model converges, the reconstruction error of the reconstructed electricity sequence is calculated, the anomaly score at each time point is calculated, and then anomaly thresholds are set to identify abnormal electricity data, which can be expressed as follows:
[0115] ;
[0116] ;
[0117] In the formula, This represents the anomaly score at time point t. This represents the mean of the outlier scores at all time points. The standard deviation of outlier scores across all time points is represented by D; D represents the normalization coefficient, calculated using a threshold. Detecting anomalies: , This is an indicator function that takes the value 1 if the condition is met, and 0 otherwise.
[0118] Based on the same technical concept as the foregoing embodiments, the present invention also provides an optional embodiment, which implements a method for identifying abnormal electricity consumption in proxy electricity purchases based on multi-scale hypergraph Transformer sequence reconstruction, such as... Figure 2 and Figure 3 As shown, the steps include:
[0119] Step 1. Initialization and Preprocessing: Based on the sampling time interval and number of samples of the electricity purchase data, firstly, set the structural parameters of the multi-scale hypergraph Transformer sequence reconstruction model and initialize all trainable parameters. Then, for the electricity sequence containing anomalies, use the Min-Max normalization method to normalize the electricity sequence. Next, use a sliding window to generate historical electricity data windows for the electricity data at each time point. Finally, use downsampling technology to generate multi-scale historical electricity input windows, which are used to input into the multi-scale encoder for trainable hypergraph encoding.
[0120] Step 2. Multi-scale encoding: The encoder includes a multi-channel structure, a multi-scale feature and hypergraph fusion module, and a multi-scale feature and hypergraph fusion module. Each channel in the multi-channel structure includes a multi-head hypergraph convolution module and a first temporal decomposition module. Each channel is used to process trainable hypergraphs and historical electricity input windows at different scales. In order to capture the short-term and long-term relationships in the electricity sequence, a multi-scale trainable hypergraph is first constructed. Then, the trainable hypergraph and the multi-scale historical electricity input window generated in Step 1 are input into the encoder channel of the corresponding scale. In each channel, the encoder sequentially performs same-scale hypergraph attention, multi-head hypergraph convolution, temporal decomposition, and feature fusion operations. Then, the multi-scale feature and hypergraph fusion module integrates the learnable electricity seasonality features and trend features at different scales as well as the learned multi-scale hypergraph to obtain multi-scale fused features and hypergraphs, which are used to input into the decoder for electricity sequence reconstruction.
[0121] Step 3. Decoding and Reconstruction: The decoder adopts a single-channel structure. First, it performs time-series decomposition on the original electricity sequence window to extract initial seasonal and trend features. Then, it combines the initial seasonal features, the multi-scale fusion features obtained in Step 2, and the integrated hypergraph to perform a multi-head hypergraph convolution operation. Next, another time-series decomposition module analyzes the sequence features learned after hypergraph information transmission. Finally, the seasonal and trend fusion module is applied to generate a reconstructed sequence that integrates the multi-scale features of the electricity sequence, which is used to calculate the reconstruction loss.
[0122] Step 4. Model Training Optimization and Anomaly Identification: Based on the reconstruction error and hypergraph constraints obtained in Step 3, calculate the training loss, including Laplacian loss, hyperedge loss, node loss, and reconstruction loss. Then, update all trainable parameters of the model through gradient descent and backpropagation to ensure that the model learns the correct hypergraph structure during training and continuously improves the sequence reconstruction effect. Finally, calculate the anomaly score and divide the anomaly threshold according to the reconstruction error to realize the identification of abnormal electricity consumption in agent electricity purchase.
[0123] Step one includes:
[0124] Step 1.1, Parameter Setting and Model Initialization. In this embodiment, the sampling time interval for the electricity purchased by the agent is 1 hour, and the number of samples is 10920. The structural hyperparameters of the multi-scale hypergraph Transformer sequence reconstruction model are set, such as the multi-scale generation window size of 60, the sliding window stride of 1, the number of scales of 3, the number of convolution heads of 3, the pooling layer size of 2, the number of hyperedges of [30,20,10], and the model vector dimension of 64, etc., and all trainable parameters in the model are initialized.
[0125] Step 1.2, Data Normalization Process. In this embodiment, the power consumption sequence containing anomalies is normalized using the Min-Max normalization method, transforming the data range to between [0,1] to obtain a normalized power consumption sequence. :
[0126] Step 1.3: Constructing a multi-scale historical electricity input window. In this embodiment, a sliding window method is first used to construct the historical electricity data window corresponding to each time point, obtaining the initial scale data window. Then, a multi-scale window generator based on downsampling operation is defined to construct windows of three different scales, selecting electricity sequence data at intervals between scales to reduce the length of the electricity sequence while retaining key information.
[0127] Step two includes:
[0128] Step 2.1: Construct a multi-scale trainable hypergraph structure. In this embodiment, a hypergraph is constructed for the target scale s corresponding to the electricity sequence window. Hypergraph Intent Matrix Define node set Define the hyperedge set , To determine the total number of hyperedges at this target scale, the initial number of connected nodes for each hyperedge is set to 8. This applies to the incidence matrix. Perform initialization: when hour, Otherwise, it is 0, to construct short-term adjacency associations. Then, a trainable node embedding matrix is introduced. With hyperedge embedding matrix The similarity basis association matrix is calculated, updated, and sparsified in the following way:
[0129] ;
[0130] ;
[0131] ;
[0132] In this embodiment, the first 8 significant connections corresponding to each node are retained.
[0133] Step 2.2, Intra-scale Hypergraph Attention and Multi-Head Convolution. In this embodiment, based on the sparsified correlation matrix... Resampled data window at the target scale Extract first The variable corresponding to the nth node Then, based on the graph attention mechanism, the attention weights between the node and its neighborhood hyperedges are calculated. and for the super-edge Aggregate all node variables connected to obtain the hyperedge feature. ;
[0134] Based on the above, the correlation matrix after obtaining the intra-scale hypergraph attention is obtained. Perform multi-head hypergraph convolution operation: resample the data window Sparse hypergraph correlation matrix after in-scale attention processing and preset number of attention heads =3 is input into the multi-head hypergraph convolutional module, and for each attention head... It independently performs hypergraph convolution operations to complete feature aggregation and transformation;
[0135] Finally, the output features of all three attention heads are combined. , , ..., By concatenating along the dimensions, the final features of the multi-head hypergraph convolution are obtained. express: .
[0136] Step 2.3, Time Series Decomposition and Seasonal-Trend Fusion. In this embodiment, to capture the seasonality of the electricity consumption sequence, a Discrete Fourier Transform operator is used. Input sequence The frequency domain is transformed to the time domain, and the top 8 significant frequencies are selected. Then, the inverse discrete Fourier transform operator is used. Calculations were performed to obtain the seasonal component. To capture the trend of the charge curve, an average pooling kernel with a kernel size of 2 was used. Perform a moving average operation to obtain the trend component. Finally, the original data windows are merged. Seasonal components With trend components The evolutionary characteristics of the time series were obtained. ;
[0137] Step 2.4, Multi-scale Feature and Hypergraph Fusion. In this embodiment, in order to integrate the multi-scale window features learned from the multi-channel encoder, the learned features are... Perform upsampling operation, where The outputs at all scales will be normalized to the s scale, so that the outputs at all scales share the same dimension, thus achieving the fusion of multi-scale window features.
[0138] In addition, it is necessary to integrate the learned multi-scale hypergraphs and achieve the fusion of associated information of multi-scale hypergraphs by mapping low-scale hypergraphs to high-scale hypergraphs and splicing and fusing multi-scale hypergraphs.
[0139] Step three specifically includes:
[0140] Step 3.1, Decomposition of the initial timing sequence of the decoder.
[0141] In this embodiment, the original power data window is input into the first time-series decomposition module in the decoder to extract the initial periodic features and trend features;
[0142] Step 3.2, Decoder multi-head hypergraph convolution. In this embodiment, the initial seasonal features and the multi-scale fusion features obtained in step 2 are combined. And the integrated Hypergraph Perform multi-head hypergraph convolution operation, and then concatenate the output features of each attention head according to the dimension to achieve multi-head fusion, which integrates hypergraph association information from multiple perspectives while keeping the feature dimension unchanged;
[0143] Step 3.3, Secondary Temporal Decomposition and Sequence Reconstruction. In this embodiment, the multi-head hypergraph convolution features obtained above are... Input into another time series decomposition module to separate out secondary seasonal features. Features of the second trend ;
[0144] Then the initial trend features output by the first temporal decomposition module of the decoder are... The quadratic trend characteristics obtained in this step By overlaying and fusing the two trend features, the final trend feature is obtained. Finally, in the seasonal-trend fusion module of the decoder, the original data window, the secondary seasonal features and the final trend features are fused to generate a reconstructed sequence that integrates the multi-scale features of the electricity sequence. This reconstructed sequence is then compared with the original electricity sequence to calculate the reconstruction loss.
[0145] Step four specifically includes:
[0146] Step 4.1, Model Training and Optimization.
[0147] In this embodiment, during model training, to ensure the cross-scale feature consistency of the multi-scale hypergraph and to match the learned hyperedges and node embeddings with the original temporal features, three types of multi-scale hypergraph constraints—Laplacian consistency, hyperedge similarity, and node consistency—are set to improve the modeling accuracy of the hypergraph for the short-term and long-term dependencies of the electrical quantity sequence. This leads to the construction of multi-scale hypergraph constraint loss and reconstruction loss, which are then fused to obtain the total training loss. The Adam gradient descent optimizer is used to perform backpropagation updates on the model parameters to minimize the total loss. until the model converges;
[0148] Step 4.2, Calculation of abnormal scores and identification of abnormalities.
[0149] In this embodiment, after the model training is completed, the reconstruction error of the reconstructed power sequence is calculated, the anomaly score of each timestamp is calculated, and then the abnormal power data is identified by setting an anomaly threshold.
[0150] The implementation of the various embodiments of this invention is based on programmed processing through a system with processor functionality. Therefore, in practical engineering, the technical solutions and functions of the various embodiments of this invention are encapsulated into various modules. Based on this reality, and building upon the above embodiments, this invention provides a proxy electricity purchase anomaly identification system based on multi-scale hypergraph Transformer sequence reconstruction. This system is used to execute a proxy electricity purchase anomaly identification method based on multi-scale hypergraph Transformer sequence reconstruction from the above method embodiments.
[0151] See Figure 4 The system includes:
[0152] The input preprocessing module is used to perform sliding window processing on the power sequence containing anomalies to be studied to generate several original historical power data windows, and to process several original historical power data windows based on downsampling technology to obtain several multi-scale historical power input windows. The dynamic hypergraph construction and encoding module is used to construct several multi-scale trainable hypergraphs. The multi-scale trainable hypergraphs and several multi-scale historical electricity input windows are input into the encoder of the multi-scale hypergraph Transformer sequence reconstruction network for processing to obtain several multi-scale fusion features and several multi-scale fusion hypergraphs. The power sequence reconstruction module is used by the decoder of the multi-scale hypergraph Transformer sequence reconstruction network to reconstruct power sequence segments based on several multi-scale fusion features, several multi-scale fusion hypergraphs and several original historical power data windows output by the encoder, thereby obtaining several reconstructed power sequence segments. The training update module is used to calculate the total loss, which includes multi-scale hypergraph constraint loss and reconstruction loss, based on the output of the encoder and the output of the decoder. The model parameters of the multi-scale hypergraph Transformer sequence reconstruction network are adjusted according to the total loss until the multi-scale hypergraph Transformer sequence reconstruction network converges. The anomaly identification module is used to calculate the anomaly scores of several multi-scale historical electricity input windows based on the converged multi-scale hypergraph Transformer sequence reconstruction network, and to filter out abnormal electricity sequence segments in several original historical electricity data windows based on the anomaly scores of several multi-scale historical electricity input windows.
[0153] It should be noted that the system embodiments provided by the present invention are used not only to implement the methods in the above method embodiments, but also to implement the methods in other method embodiments provided by the present invention. The only difference is that corresponding functional modules are set. The principle is basically the same as that of the above system embodiments provided by the present invention. As long as those skilled in the art can improve the modules in the above system embodiments by referring to the specific technical solutions in other method embodiments and combining technical features to obtain corresponding technical means and technical solutions composed of these technical means, on the basis of the above system embodiments, and on the premise of ensuring the practicality of the technical solutions, they can obtain corresponding system-like embodiments for implementing the methods in other method-like embodiments.
[0154] As an optional embodiment, the present invention provides an abnormal power identification system based on multi-scale hypergraph Transformer sequence reconstruction that can automatically implement the above optional embodiments, including an initialization and preprocessing module, a multi-scale encoding module, a decoding and reconstruction module, and an abnormal score calculation and abnormal identification module.
[0155] The initialization and preprocessing module is used to perform the content described in step one above, set the structural hyperparameters of the multi-scale hypergraph Transformer sequence reconstruction model and complete the initialization of trainable parameters, then perform Min-Max normalization on the original agent electricity purchase data to eliminate dimensional differences, and use the sliding window technique combined with a multi-scale window generator containing convolutional branches and downsampling branches to construct hierarchical historical electricity input windows with different time resolutions, providing standardized multi-scale feature inputs for subsequent models.
[0156] The multi-scale encoding module is used to perform the content described in step two above, construct a multi-scale dynamic trainable hypergraph structure based on node and hyperedge embedding, and use a sparse correlation matrix to perform multi-head hypergraph convolution and attention aggregation within the scale to capture high-order correlation features between electricity data nodes. At the same time, it combines discrete Fourier transform and average pooling operations to extract the seasonal and trend evolution components of the electricity sequence, and achieves deep fusion of feature representation and topology at different time scales through transposed convolution upsampling and hypergraph mapping concatenation techniques to generate multi-scale encoded features.
[0157] The decoding and reconstruction module performs the steps described in step three above. It performs an initial temporal decomposition on the original electricity data window to extract basic seasonal and trend components. It then combines the fusion features output by the multi-scale encoding module with the integrated hypergraph to perform multi-head hypergraph convolution to fuse multi-view correlation information. Subsequently, it performs a second temporal decomposition on the convolutional features. By superimposing and accumulating the trend features from the two decompositions, it deeply fuses them with the second seasonal components and the original data window to generate the final electricity sequence reconstruction result, so as to calculate the reconstruction loss based on the reconstruction result.
[0158] The anomaly score calculation and anomaly identification module is used to perform the content described in step four above. During the model training phase, it introduces three types of multi-scale constraints: Laplacian consistency, hyperedge similarity, and node consistency. It constructs and minimizes the total training loss, which includes hypergraph constraints and sequence reconstruction errors, and uses the Adaw optimizer to achieve iterative updates and convergence of model parameters. During the inference phase, it calculates timestamp-level anomaly scores based on the reconstruction errors of the trained model and uses a preset threshold discrimination mechanism to achieve accurate identification of abnormal data in agent electricity purchases.
[0159] The method in this embodiment of the invention is implemented using an electronic device; therefore, it is necessary to introduce the relevant electronic device. For this purpose, embodiments of the present invention provide an electronic device, such as... Figure 5As shown, the electronic device includes: at least one processor, a communication interface, at least one memory, and a communication bus, wherein the at least one processor, the communication interface, and the at least one memory communicate with each other via the communication bus. The at least one processor invokes logical instructions stored in the at least one memory to execute all or part of the steps of the methods provided in the foregoing method embodiments.
[0160] Furthermore, when the logical instructions in at least one of the aforementioned memories are implemented as software functional units and sold or used as independent products, they are stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, is embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (a personal computer, server, or network device) to execute all or part of the steps of the methods described in the various method embodiments of the present invention. The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks—various media for storing program code.
[0161] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, located in one place, or distributed across multiple network units. The purpose of this embodiment is achieved by selecting some or all of the modules according to actual needs. Those skilled in the art will understand and implement this without any inventive effort.
[0162] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0163] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0164] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0165] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0166] Based on the same technical concept as the foregoing embodiments, the present invention provides a non-transitory computer-readable storage medium storing computer instructions that cause the computer to execute a method for identifying abnormal electricity consumption in proxy electricity purchases based on multi-scale hypergraph Transformer sequence reconstruction.
[0167] In summary, this invention provides a method for identifying abnormal electricity consumption in proxy electricity purchases based on multi-scale hypergraph Transformer sequence reconstruction, comprising: Step 1, initialization and preprocessing; Step 2, multi-scale encoding; Step 2.1, constructing a multi-scale trainable hypergraph structure; Step 2.2, intra-scale hypergraph attention and multi-head convolution; Step 2.3, temporal decomposition and seasonal-trend fusion; Step 2.4, multi-scale feature and hypergraph fusion; Step 3, decoding and reconstruction; Step 3.1, initial temporal decomposition of the decoder; Step 3.2, multi-head hypergraph convolution of the decoder; Step 3.3, secondary temporal decomposition and sequence reconstruction; Step 4: model optimization and anomaly identification. This invention takes into account both long-term and short-term dependencies in electricity data through a multi-scale input mechanism, utilizes hypergraph Transformer and temporal decomposition techniques to mine multi-dimensional features, and combines multiple hypergraph constraints and reconstruction loss for joint optimization to ensure a robust model structure, thereby achieving accurate identification of abnormal electricity consumption in proxy electricity purchases based on high-quality sequence reconstruction.
[0168] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the technical solutions of the embodiments of the present invention.
Claims
1. A method for identifying abnormal electricity consumption in proxy electricity purchases based on multi-scale hypergraph Transformer sequence reconstruction, characterized in that, include: The abnormal power sequence under study is subjected to sliding window processing to generate several original historical power data windows, and several original historical power data windows are processed based on downsampling technology to obtain several multi-scale historical power input windows. Several multi-scale trainable hypergraphs are constructed, and these multi-scale trainable hypergraphs and several multi-scale historical electricity input windows are input into the encoder of the multi-scale hypergraph Transformer sequence reconstruction network for processing, so as to obtain several multi-scale fusion features and several multi-scale fusion hypergraphs. The decoder of the multi-scale hypergraph Transformer sequence reconstruction network reconstructs the power sequence fragments based on several multi-scale fusion features, several multi-scale fusion hypergraphs, and several original historical power data windows output by the encoder, thereby obtaining several reconstructed power sequence fragments. The total loss, including multi-scale hypergraph constraint loss and reconstruction loss, is calculated based on the outputs of the encoder and decoder. The model parameters of the multi-scale hypergraph Transformer sequence reconstruction network are then adjusted based on the total loss until the multi-scale hypergraph Transformer sequence reconstruction network converges. Anomaly scores for several multi-scale historical electricity input windows are calculated using a convergent multi-scale hypergraph Transformer sequence reconstruction network. Based on these anomaly scores, anomalous electricity sequence fragments are selected from several original historical electricity data windows.
2. The method for identifying abnormal electricity consumption in proxy electricity purchases based on multi-scale hypergraph Transformer sequence reconstruction as described in claim 1, characterized in that, The steps for constructing the multi-scale historical electricity input window include: According to the preset size and preset step size of the sliding window, with the starting point of the sliding window as the time point, the sliding window method is used to process the power series containing anomalies to be studied, and a series of data windows at time points are obtained as the original historical power data windows. A multi-scale window generator based on downsampling technology is used to downsample the original historical electricity data window to obtain data windows of several preset scales, which serve as the input windows for multi-scale historical electricity data.
3. The method for identifying abnormal electricity consumption in proxy electricity purchases based on multi-scale hypergraph Transformer sequence reconstruction as described in claim 1, characterized in that, The encoder includes a multi-channel structure, a multi-scale feature and hypergraph fusion module, and a multi-scale feature and hypergraph fusion module. Each channel in the multi-channel structure includes a multi-head hypergraph convolution module and a first temporal decomposition module for processing. Each channel is used to process trainable hypergraphs and historical electricity input windows of different scales. Each channel takes a trainable hypergraph of the same scale and a historical electricity input window as input, and processes them sequentially through the multi-head hypergraph convolution module and the first temporal decomposition module to obtain temporal evolution features of the corresponding scale. The multi-scale feature and hypergraph fusion module integrates the temporal evolution features of different scales to obtain multi-scale fused features, and the multi-scale feature and hypergraph fusion module integrates the multi-scale trainable hypergraph to obtain a multi-scale fused hypergraph.
4. The method for identifying abnormal electricity consumption in proxy electricity purchases based on multi-scale hypergraph Transformer sequence reconstruction as described in claim 3, characterized in that, The multi-head hypergraph convolutional module includes hypergraph attention, multi-head convolutional units, and fusion units. Each multi-head convolutional unit includes a feature unit and several attention heads. It takes a trainable hypergraph of the same scale and a historical battery input window as input. The processing includes: Feature variables of nodes in the historical electricity input window are extracted using feature units in multi-head convolutional units; Hypergraph attention is used to calculate the attention weights between nodes and neighborhood hyperedges based on the sparsed hypergraph association matrix using the graph attention mechanism, thus obtaining the hypergraph association matrix after attention at the corresponding scale. A multi-head convolutional unit contains several attention heads. Each attention head independently performs hypergraph convolution operations based on the correlation matrix after hypergraph attention at the corresponding scale, and outputs hyperedge features at the corresponding scale. The hyperedge features of the corresponding scales output by all attention heads within the multi-head convolutional unit are concatenated to obtain the fused hyperedge feature sequence of the corresponding scale.
5. The method for identifying abnormal electricity consumption in proxy electricity purchases based on multi-scale hypergraph Transformer sequence reconstruction as described in claim 4, characterized in that, The first temporal decomposition module processes the fused hyperedge feature sequence at the corresponding scale to extract the seasonal and trend components in the fused hyperedge feature sequence; it fuses the historical power input window of the input encoder with the seasonal and trend components in the fused hyperedge feature sequence to obtain the temporal evolution features at the corresponding scale.
6. The method for identifying abnormal electricity consumption in proxy electricity purchases based on multi-scale hypergraph Transformer sequence reconstruction as described in claim 5, characterized in that, The multi-scale feature and hypergraph fusion module takes the top-level scale as the highest scale, performs continuous upsampling operations on the temporal evolution features at the previous scale, until the scale of the upsampling result is the same as the temporal evolution features at the next scale of the previous scale. It then fuses the upsampling result with the temporal evolution features at the next scale of the previous scale, and uses a feedforward layer to further nonlinearly transform the fusion result to obtain the fusion features at the next scale of the previous scale. In this way, it integrates the temporal evolution features of different scales scale by scale until the fusion features at the bottom scale are obtained. The fusion features at the bottom scale are then used as the multi-scale fusion features. Using the top-level scale as the highest scale, perform low-scale mapping on the trainable hypergraph at the previous scale until the scale of the mapping result is the same as the scale of the trainable hypergraph at the next scale of the previous scale. Then, stitch and fuse the mapping result with the trainable hypergraph at the next scale of the previous scale to obtain the fused hypergraph at the next scale of the previous scale. This process is repeated step by step to integrate trainable hypergraphs at different scales until the fused hypergraph at the bottom scale is obtained. The fused hypergraph at the bottom scale is then used as the multi-scale fused hypergraph.
7. The method for identifying abnormal electricity consumption in proxy electricity purchases based on multi-scale hypergraph Transformer sequence reconstruction as described in claim 3, characterized in that, The decoder includes a second temporal decomposition module, a multi-head hypergraph convolution module, and a seasonal-trend fusion module; The multi-head hypergraph convolution module first fuses the initial seasonal features and multi-scale fusion features. Then, based on the multi-scale fusion hypergraph correlation matrix, the corresponding hypergraph convolution kernel is constructed according to the attention head for feature propagation. In each attention head, the hypergraph convolution kernel guides the feature transformation, and the hypergraph structure prior is incorporated into the seasonal features and multi-scale fusion features to obtain the output features of each attention head. The output features of all attention heads are concatenated in the feature dimension to obtain the multi-head hypergraph convolution features. The second temporal decomposition module processes the multi-head hypergraph convolution features to separate the secondary seasonal features and secondary trend features. The initial trend features and secondary trend features are then superimposed and fused to obtain the final trend features. The seasonal-trend fusion module integrates the original historical electricity data window, secondary seasonal features, and final trend features to obtain a reconstructed electricity sequence fragment.
8. A proxy electricity purchase anomaly identification system based on multi-scale hypergraph Transformer sequence reconstruction, characterized in that, include: The input preprocessing module is used to perform sliding window processing on the power sequence containing anomalies to be studied to generate several original historical power data windows, and to process several original historical power data windows based on downsampling technology to obtain several multi-scale historical power input windows. The dynamic hypergraph construction and encoding module is used to construct several multi-scale trainable hypergraphs. The multi-scale trainable hypergraphs and several multi-scale historical electricity input windows are input into the encoder of the multi-scale hypergraph Transformer sequence reconstruction network for processing to obtain several multi-scale fusion features and several multi-scale fusion hypergraphs. The power sequence reconstruction module is used by the decoder of the multi-scale hypergraph Transformer sequence reconstruction network to reconstruct power sequence segments based on several multi-scale fusion features, several multi-scale fusion hypergraphs and several original historical power data windows output by the encoder, thereby obtaining several reconstructed power sequence segments. The training update module is used to calculate the total loss, which includes multi-scale hypergraph constraint loss and reconstruction loss, based on the output of the encoder and the output of the decoder. The model parameters of the multi-scale hypergraph Transformer sequence reconstruction network are adjusted according to the total loss until the multi-scale hypergraph Transformer sequence reconstruction network converges. The anomaly identification module is used to calculate the anomaly scores of several multi-scale historical electricity input windows based on the converged multi-scale hypergraph Transformer sequence reconstruction network, and to filter out abnormal electricity sequence segments in several original historical electricity data windows based on the anomaly scores of several multi-scale historical electricity input windows.
9. An electronic device, characterized in that, The method includes a memory and a processor, the memory storing program instructions that are executed by the processor, the processor invoking the program instructions to perform the method according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium, characterized in that, The non-transitory computer-readable storage medium stores computer instructions that cause the computer to perform the method described in any one of claims 1 to 7.