Distributed dynamic electric energy metering-oriented unbalanced data processing method and system

By employing a multi-level isolated forest model and an adaptive feature subset selection strategy, the problems of data imbalance and noise interference in electricity metering are solved, improving the accuracy and robustness of anomaly identification and enabling fine classification of multiple types of anomalies.

CN121542903APending Publication Date: 2026-02-17STATE GRID JIANGSU ELECTRIC POWER CO ZHENJIANG POWER SUPPLY CO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511659681.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-13
Publication Date
2026-02-17

AI Technical Summary

Technical Problem

Existing technologies for electricity metering suffer from problems such as data imbalance, noise interference, and difficulty in identifying various types of anomalies, resulting in low accuracy and high false positive rates in anomaly identification.

Method used

A multi-level isolated forest model is constructed, combined with an adaptive feature subset selection strategy. Data balancing is performed through an anomaly generation model, and small sample data is augmented using an adaptive synthesis model. Feature importance ranking and cluster analysis are performed through a multi-level forest model, and a gradient boosting decision tree is used for the final judgment.

Benefits of technology

It significantly improves the detection capability of minority anomaly patterns, enhances the robustness of the model and the accuracy of sparse anomaly identification, and achieves refined anomaly classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121542903A_ABST
    Figure CN121542903A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of electric energy metering anomaly detection and diagnostic analysis, in particular to a distributed dynamic electric energy metering-oriented unbalanced data processing method and system, and the method comprises the steps: carrying out the generation of unbalanced data through employing an anomaly generation model for the abnormal data in multi-dimensional electric energy data; the anomaly generation model is used for adopting a voltage or current phase as an input item, carrying out data balance aiming at the acquired unbalanced type data, and realizing simulation amplification of small sample anomaly data by utilizing a self-adaptive synthesis model aiming at small type sample data; according to the method, the adaptive synthesis data sample and the data conversion strategy under the drive of data exception model analysis are introduced, so that the detection capability of minority class exception modes is remarkably improved, the limitation of a traditional model on an unbalanced data set is overcome, and the problem of data imbalance is effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power metering anomaly detection and diagnostic analysis technology, and in particular to an imbalance data processing method and system for distributed dynamic power metering. Background Technology

[0002] As smart grids evolve towards distributed and dynamic architectures, electricity metering data exhibits characteristics of massive volume, real-time processing, and multi-source heterogeneity. However, three core problems exist in the current electricity metering data processing: First, the data distribution is severely unbalanced. The amount of data on normal electricity consumption behavior usually far exceeds that of various abnormal events. For example, data on technical losses from normal metering, and non-technical loss data including metering failures, electricity theft, billing errors, and malfunctions of the metering equipment itself, are distributed very unevenly. Normal metering data accounts for over 95%, while abnormal data such as technical losses and electricity theft account for less than 5%. This causes traditional classification models to tend to predict the majority class, resulting in extremely low accuracy in anomaly identification. Secondly, the data is severely affected by noise interference from power grid fluctuations, sensor errors, etc. Existing preprocessing methods can only remove simple noise and cannot eliminate complex noise in dynamic scenarios, thus affecting the accuracy of subsequent pattern mining. Third, anomaly patterns are diverse and covert, such as the gradual characteristics of technical losses and the sudden characteristics of electricity theft. Traditional single detection models are difficult to adapt to multiple types of anomalies at the same time, resulting in low anomaly identification coverage and high false positive rate. To address the problem of imbalanced data, existing technologies often employ oversampling or undersampling methods. However, oversampling can easily lead to overfitting, while undersampling can easily result in the loss of key information. For anomaly identification, single-level models are often used, which cannot dynamically adjust the analysis dimensions according to the characteristics of different anomaly types and do not consider the correlation between features and anomaly types, resulting in insufficient attention to sparse anomaly data by the model. Summary of the Invention

[0003] Purpose of the invention: This invention addresses the problems of data imbalance, noise interference, and difficulty in identifying multiple types of anomalies in the prior art by constructing an imbalance data processing method for distributed dynamic energy metering. This invention also discloses an imbalance data processing system for distributed dynamic energy metering.

[0004] Technical solution: First, this invention provides an imbalance data processing method for distributed dynamic energy metering, the method comprising: Collect relevant real-time data from distributed power metering terminals to construct a multi-dimensional representation of power data; An anomaly generation model is used to generate unbalanced data for abnormal data in multi-dimensional power data. The anomaly generation model is used to balance the collected unbalanced data by taking voltage or current phase as input. For small-category sample data, an adaptive synthesis model is used to simulate and amplify small-sample abnormal data. The resulting balanced sample data is input into a first-level coarse-grained forest model to quickly determine the probability that the data is an anomaly; a second-level bi-branch forest model is constructed based on the probability of anomalies to rank the importance of each feature in various anomaly types; based on the anomaly type, a third-level precise forest model is used to determine the attention weights corresponding to the unique features under the current anomaly type. The results of the first-level coarse-classification forest model, the second-level bi-branch forest model, and the third-level precise forest model are integrated and used as input features for the gradient boosting decision tree model to learn the optimal combination strategy or decision boundary. Based on the final discrimination results of the above models, cluster analysis is performed on suspected abnormal data points, and finally the analysis results are classified into specific anomaly types.

[0005] Furthermore, the method also includes: The personalized TreeSHAP attribution method is iteratively quantized and embedded into the training process of each level of forest for the first-level coarse classification forest model, the second-level bi-branch forest model, and the third-level precise forest model, so as to dynamically evaluate the contribution of each feature under the current anomaly category in the current iteration round. The model is trained iteratively, removing the features with the lowest contribution each time, until a preset number is reached or the model performance no longer deteriorates. Finally, optimized data features are output, and an optimal feature subset is dynamically selected based on the iterative evaluation results.

[0006] Furthermore, including: The aforementioned anomaly generation model uses voltage or current phase as input to perform data balancing on the collected unbalanced data, including: voltage phase and current phase Both are used in a unified manner express; The formula for generating data under the condition of complete phase imbalance is defined as follows: ; Among them, the coefficient of the constant term , Generates data for anomalous data. It can be a, b, or c; The data generation definition for any phase exceeding the overload standard for that phase is as follows: ; Among them, the coefficient of the constant term ; The data generation definition for all phases under the uniform attenuation condition is as follows: ; where the coefficient of the constant term , This represents the average value of the input items. for a , b or c ; The data generation definition for the case where all phases decay to 0 within the same time interval is as follows: ; The data generation definition for the case where all phases decrease is as follows: ; Among them, the coefficient of the constant term constant term system These represent the start and end times of the time, respectively; electricity theft data. The generation rules are as follows: ; Among them, the coefficient of the constant term ; By changing the time parameter and baseline normal data To generate diverse data in batches.

[0007] Furthermore, including: The method for simulating and amplifying anomalous data using an adaptive synthesis model for small-category sample data includes: Calculate the proportion of category samples in the total sample data. , is represented as: ; If the proportion of a certain type of sample Below the threshold Then calculate the amount of data that needs to be synthesized. ,in, These represent the data volume for the minority category and the data volume for the majority category, respectively. It is the desired balance parameter; Calculate the ratio ,in, The number of samples is calculated using the K-nearest neighbor algorithm. K is the number of nearest neighbor samples; Normalized ratio The sample density distribution is expressed as follows: ; Finally, calculate the number of generated data samples: ; in, This refers to the amount of sample data to be synthesized; a specific data point from a small sample is input from the generated data sample size. The following generation rules are used to generate synthetic data samples: ;in, For measuring voltage data and current data The matrix formed , for A random constant over an interval.

[0008] Furthermore, including: The process of inputting the resulting balanced sample data into a first-level coarse-grained classification forest model to quickly determine the probability that the sample data is anomaly includes: Set the number of isolated trees and the maximum depth of each tree, set the number of features randomly selected each time the tree splits into branches, and then combine the total number of features to obtain the feature combination coverage; The mutual information value between each feature and the label classification is calculated based on the balanced sample data.

[0009] Furthermore, including: The construction of a two-level bi-branch forest model based on the probability of anomaly types completes the ranking of the importance of various features among multiple anomaly types, including: A bi-branch forest is constructed based on the isolated tree, where one branch is obtained by splitting based on densely distributed loss data, and the other branch is obtained based on sparse fault or theft data. The branch obtained by splitting based on densely distributed loss data includes: collecting relevant features of the loss data, and the features are densely distributed; determining the spatial local density based on the features; determining the number of tree splits and the splitting precision based on the spatial local density value; and setting the priority weight for splitting under the loss data to distinguish between normal loss and abnormal loss. The branch obtained based on sparse fault or theft data includes: collecting relevant features of fault or theft data, which are sparsely distributed due to insufficient fault data, and calculating sample sparsity based on the above features. When the sparsity of the sample is greater than a set threshold, it is identified as a sparse sample characteristic, and oversampling is used to increase the sampling factor to ensure that the sparse sample is fully isolated.

[0010] Furthermore, including: The step of determining the attention weights corresponding to the unique features under the current anomaly type using a three-level precise forest model based on anomaly type includes: ranking the feature importance based on a two-level bi-branch forest model, selecting multiple unique features for each anomaly type, and calculating the attention weights of the current features to the anomaly category using mutual information entropy.

[0011] Furthermore, including: The first-level coarse-classification forest model will be personalized. Tree SHAP The attribution method iteratively quantizes the embeddings in the training process of each level of the forest, including: For a first-level coarse-grained classification forest model: based on an adaptively synthesized balanced dataset, through... Tree SHAP Calculate the top N optimal candidate features The value, i.e., the mutual information value of the features of Top N. value; Based on the number of isolated trees in the current operation and the number of trees in each training session, multiple iterations are performed, and the calculation is recalculated. Value and adjust feature priority; If a certain feature If the value decreases beyond a set range during the iteration process, it will be replaced with... The value rises to the threshold range This ensures that the input features always focus on high-discrimination dimensions; Then the current The value is bound to the feature selection probability of tree splitting, and the splitting rule is optimized to obtain the probability of selecting features when splitting.

[0012] Furthermore, including: The The value is represented as: ; in, For the sample size, For the sample Chinese characteristics of value.

[0013] Furthermore, including: The second-level bi-branch forest model will be personalized. Tree SHAP The attribution method iteratively quantizes the embeddings in the training process of each level of the forest, including: For loss-related branching processes, training is conducted through... Tree SHAP Analyze the distribution of loss-related characteristic SHAP values, if The local density of the feature space is greater than a set threshold and the corresponding The value is higher than another feature The splitting number enhancement factor is then dynamically adjusted, as follows: ; in, Features within branches The average value, through more refined splitting, enhances the discriminative power of high-contribution features, thereby improving the classification accuracy of loss-type anomalies. If the current sample sparsity is greater than a set threshold, the oversampling factor will be dynamically adjusted, as follows: ; in, To preset a high contribution threshold, the sampling amount of high contribution feature samples is increased to avoid missing sparse anomalies.

[0014] Furthermore, including: The three-level precision forest model will be personalized. Tree SHAP The attribution method iteratively quantizes the embeddings in the training process of each level of the forest, including: The design dynamically optimizes attention weights and confidence, updating fixed attention weights using mutual information entropy. ,Right now: ; in, Features before update In the anomaly category Attention weights under, Will Tree SHAP The attribution results are incorporated into the confidence score calculation, and the final confidence score of the three-level precise forest model is... The formula is: ; in, As the initial confidence level, For this anomaly category The highest characteristic, For this anomaly category Average characteristics This is a correction factor.

[0015] Furthermore, including: The dynamic evaluation of the contribution of each feature under the current anomaly category in the current iteration round includes: The Shapley value quantifies the marginal contribution of each input feature to the model's prediction. It fairly allocates the contribution of each input feature using the following formula: ; in, It is a feature set. It is a feature subset. It is the prediction function of the current model.

[0016] On the other hand, the present invention also provides an imbalance data processing system for distributed dynamic energy metering, the system comprising: The data acquisition module is used to collect relevant real-time data from distributed power metering terminals and construct a multi-dimensional representation of power data. The data preprocessing module is used to generate unbalanced data by using an anomaly generation model for abnormal data in multi-dimensional power data; the anomaly generation model is used to balance the collected unbalanced data by using voltage or current phase as input, and to simulate and amplify small sample abnormal data by using an adaptive synthesis model for small category sample data. The model training module is used to input the formed balanced sample data into the first-level coarse classification forest model to quickly determine the probability that the data is an anomaly type; a second-level bi-branch forest model is constructed based on the probability of anomaly type to complete the importance ranking of each feature in multiple anomaly types; based on the anomaly type, the attention weights corresponding to the unique features under the current anomaly type are determined through a third-level precise forest model. The type determination module integrates the results of the first-level coarse-classification forest model, the second-level bi-branch forest model, and the third-level precise forest model, and uses them as input features for the gradient boosting decision tree model to learn the optimal combination strategy or decision boundary. Based on the final model discrimination results, it performs cluster analysis on suspected abnormal data points and finally classifies the analysis results into specific anomaly types.

[0017] Beneficial effects: Compared with the prior art, the present invention has the following advantages: This invention significantly improves the detection capability of minority class anomaly patterns by introducing adaptive synthetic data samples and data transformation strategies driven by data anomaly model analysis, overcomes the limitations of traditional models on imbalanced datasets, and effectively solves the problem of data imbalance.

[0018] This invention employs a multi-level isolated forest model combined with an adaptive feature subset selection strategy, which can dynamically focus on discriminative features, effectively eliminate noise interference, improve the robustness of the model, and enhance its noise resistance.

[0019] This invention employs a multi-level model for progressive in-depth analysis and focuses on sparsity, enabling more effective discovery and identification of low-probability, covert anomaly patterns that are difficult to detect by traditional methods, such as certain types of electricity theft, thereby improving the accuracy of sparse anomaly identification.

[0020] This invention uses multi-level features for clustering and identification, which can more accurately distinguish different types of electricity metering anomalies, including technical losses, non-technical losses, metering faults, and electricity theft, providing support for the refined management of the power grid and enabling refined anomaly classification.

[0021] Finally, the technology of this invention integrates multiple advanced data processing and machine learning methods to form a complete and efficient solution for identifying abnormal electricity metering, which has high technical value and application prospects. Attached Figure Description

[0022] Figure 1 This is a flowchart of the imbalance data processing method for distributed dynamic energy metering as described in an embodiment of the present invention. Figure 2 This is a schematic diagram of the unbalanced data processing system for distributed dynamic energy metering as described in an embodiment of the present invention. Detailed Implementation

[0023] To better understand the present invention, the technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0024] Example 1: As Figure 1 As shown, this embodiment provides a technology for imbalance data processing and pattern mining for distributed dynamic energy metering. Through an integrated design of "data preprocessing – balance optimization – multi-level modeling – anomaly fusion and identification," it solves the problems of data imbalance, noise interference, and difficulty in identifying multiple types of anomalies. Specifically, it includes the following steps:

[0025] S1 collects relevant real-time data from distributed power metering terminals to construct a multi-dimensional representation of power data. S2 uses an anomaly generation model to generate unbalanced data for abnormal data in multi-dimensional power data; the anomaly generation model is used to balance the collected unbalanced data by taking voltage or current phase as input, and to simulate and amplify small sample abnormal data by using an adaptive synthesis model for small category sample data. S3 inputs the balanced sample data into a first-level coarse-grained classification forest model to quickly determine the probability that the data is an anomaly; a second-level bi-branch forest model is constructed based on the probability of anomalies to complete the importance ranking of each feature in multiple anomaly types; based on the anomaly type, a third-level precise forest model is used to determine the attention weights corresponding to the unique features under the current anomaly type. S4 integrates the results of the first-level coarse-classification forest model, the second-level bi-branch forest model, and the third-level precise forest model, and uses them as input features for the gradient boosting decision tree model to learn the optimal combination strategy or decision boundary. Based on the final discrimination results of the above models, it performs cluster analysis on suspected abnormal data points and finally classifies the analysis results into specific anomaly types.

[0026] Based on the steps described above, this embodiment provides a more detailed description, including the following: 1. Preprocessing of distributed dynamic energy metering data Collect real-time data (including voltage, current, power, and electricity consumption) from distributed energy metering terminals (such as smart meters and transformers) to construct a multi-dimensional representation of energy data.

[0027] The electricity metering of commercial and industrial three-phase systems (using the three-meter method) is calculated by summing the active power of the three phases. Its mathematical model can be expressed by the following equation: (1) in: It is the three-phase voltage measured at the input terminal. It is the three-phase current measured on the secondary side by a current transformer. It is the three-phase power factor, which is the phase angle between current and voltage.

[0028]

[0029] in: This refers to the three-phase active power. Measuring instruments Electrical energy measured within a time period; This represents the total energy consumption over one cycle. When the three phases are in balance, the active power of each phase is approximately equal. The three phases are affected by voltage, current, and power factor. When the meter malfunctions or electricity theft occurs, abnormal amplitude and angle can lead to three-phase imbalance.

[0030] After acquiring the aforementioned electricity data, data cleaning is a crucial step in big data preprocessing. First, a preliminary check for errors in the data is necessary, including analyzing erroneous, duplicate, and missing data items. Additionally, incomplete data items can be corrected by replacing or removing invalid data.

[0031] In this embodiment, the following method is used to clean and process massive amounts of data.

[0032] (5) in, Indicates time interval Inside, the category is The voltage or current data corresponding to the customer.

[0033] In this embodiment, "customer" refers to clients from different data collection sources, and the categories mainly include different types of clients such as some enterprises that need to be monitored.

[0034] In some special circumstances, electricity meters may become out of service due to malfunction or other reasons, requiring the installation of new meters for new customers. The recorded data in such cases may contain erroneous and outlier values. These outliers can be addressed using... An empirical method (based on the principle of normal distribution) is used to handle this, as shown in equation (6) below: (6) in, Based on time interval Utilizing a time window The dataset is calculated by using a vector composed of the values ​​of . This represents taking the average value from the dataset. This represents the variance in the dataset.

[0035] The data acquisition of electricity metering instruments operates based on the three-element measurement principle. It measures the low-side current and line-to-zero voltage. Because different customers install transformers of varying sizes, the rated current transformers installed will also differ. To normalize the data range, a Min-max scaling method is used. (7) in, and They are The corresponding maximum and minimum values ​​in the dataset.

[0036] 2. Imbalanced Econometric Data Equalization Sample Generation Data imbalance is a key challenge in big data analytics, and imbalanced data must be balanced before input detection models can learn from them. Taking historical electricity metering datasets as an example, there is ample normal electricity consumption data, but data on common faulty meters and cases of electricity theft are very rare. In practical applications, anomalies in meter readings are often caused by various factors affecting customer electricity consumption behavior. For example, seasonal variations in electricity consumption, customer behavior, and economic conditions can all lead to permanent or temporary changes in electricity usage patterns.

[0037] For the collected imbalanced data, an anomaly generation model for imbalanced small sample data is constructed, taking into account the situation of periodic decrease or sudden change in energy consumption, and an algorithm rule for generating imbalanced sample data is designed.

[0038] For ease of explanation, the parameters of the data generation model are defined as follows: Input item: Voltage phase Current phase The two can be used interchangeably. express.

[0039] coefficient of constant term: They all change over time. This represents the average value of the input items.

[0040] Output: Generate baseline normal data from abnormal data. .

[0041] For different phases The formula for generating abnormal data in the presence of pressure drop is defined as follows: (8) The formula for generating data under the condition of complete phase imbalance is defined as follows: (9) Among them, the coefficient of the constant term .

[0042] If any phase exceeds the overload standard for the same phase: (10) Among them, the coefficient of the constant term .

[0043] All phases under uniform decay: (11) Among them, the coefficient of the constant term .

[0044] When all phases decay to 0 within the same time interval: (12) All phases show a decreasing trend: (13) Among them, the coefficient of the constant term constant term system These represent the start and end times of the time, respectively.

[0045] Electricity theft data The generation rules are as follows: (14) Among them, the coefficient of the constant term .

[0046] In this embodiment, by changing the time parameter ( ) and baseline normal data This allows for the batch generation of diverse simulated electricity theft data or the expansion of imbalance data. For example, suppose we have historical normal data from a certain metering terminal. By changing the time parameter in the formula ( This allows for the creation of various different electricity theft methods. For example: Scenario A (Nighttime Electricity Theft): Settings ( (00:00, 04:00)

[0047] Scenario B (Electricity theft during a weekday afternoon): Settings ( The time range is (13:00, 17:00) and applies only from Monday to Friday.

[0048] Scenario C (Random Short-Term Electricity Theft): Multiple discontinuous short-term windows are randomly generated as ( ).

[0049] Substitute the time parameters for each of the above scenarios into formula (14), and use the same set (or multiple sets) of constants as the benchmark. This will generate: An abnormal data point related to electricity theft, corresponding to "Scenario A".

[0050] An abnormal data point related to electricity theft, corresponding to "Scenario B".

[0051] An abnormal data point related to electricity theft, corresponding to "Scenario C".

[0052] In other words, in this embodiment, by combining different time parameters and different baseline normal data, a large number of diverse abnormal electricity theft samples can be systematically and on a large scale generated from limited raw data. These newly generated samples, together with normal samples, constitute a more class-balanced dataset, which can be used to subsequently train a model that can accurately identify electricity theft.

[0053] For small-class sample data, an adaptive synthetic sample algorithm can be used to achieve class balance and simulate amplify small-sample outlier data. Specifically, the design process of the adaptive synthetic sample generation algorithm is as follows: For distributed energy metering scenarios, a sample ratio threshold is bound to the data type. To address the poor adaptability of traditional fixed thresholds to different sample categories, a new threshold is set for small, infrequent "real anomalies" such as electricity theft and metering faults. Due to the relatively large amount of data, "pseudo-anomaly" samples such as new energy fluctuations are set... .

[0054] This embodiment calculates the proportion of category samples in the total sample data. , is represented as: ,in, These represent the data volume for the minority class and the data volume for the majority class, respectively. If the percentage of a certain class of samples... Below the threshold Calculate the amount of data that needs to be synthesized. ,in, It is the expected balance parameter.

[0055] In a preferred embodiment, the aforementioned expectation balance parameter can be dynamically adjusted. First, the balance parameter is set, and then the balance parameter... This is correlated with the "significance of anomalies" in small sample data. If the anomalies in a small sample are highly identifiable, No need for excessive synthesis, Take 0.8; if the characteristics are ambiguous, such as error fluctuations caused by minor wiring errors, We set it to 1.2 to increase the amount of synthesis to enhance features and avoid data redundancy caused by blind synthesis.

[0056] Calculate the amount of data to be synthesized At that time, "anomaly feature confidence level" is introduced. The corrected formula is: (15) in, The data volumes for the majority and minority classes are respectively determined by... Ensure that the synthetic data focuses on small samples with high confidence, and reduce the interference of low-value synthetic data on model training.

[0057] Calculate the ratio , The number of samples is calculated using the K-nearest neighbor algorithm. .

[0058] Normalized ratio And sample density distribution: (16) Calculate the number of generated data samples: (17) in, This refers to the amount of sample data that needs to be synthesized.

[0059] For the above sample data, input a small sample of data from the dataset. The following generation rules are used to generate synthetic data samples: (18) in, For measuring voltage data and current data The matrix formed , for A random constant over an interval.

[0060] 3. Multi-level Isolation Forest Algorithm Design: In distributed dynamic energy metering scenarios, the traditional isolated forest algorithm has three major limitations.

[0061] First, the single-level structure cannot adapt to the multi-level identification requirements of "normal data - major anomaly category - sub-anomaly category", resulting in insufficient differentiation of subdivided anomalies such as technical loss and electricity theft. Second, randomly selecting features to construct isolated trees is susceptible to interference from redundant features in the power data (such as voltage fluctuation data during non-critical periods), reducing the sensitivity of identifying sparsity anomalies, such as occasional electricity theft. Third, the isolated tree generation process does not consider the temporal sequence of data and cannot capture the dynamic change patterns of power data (such as abnormal patterns during peak electricity consumption periods).

[0062] This invention proposes an improved algorithm with "multi-level accurate identification, dynamic feature adaptation, and time-series pattern capture" as its core objectives. Through architectural reconstruction and module innovation, it achieves efficient mining of multiple types of anomalies in distributed power metering imbalance data.

[0063] Traditional isolated forests directly use static features, failing to capture the temporal correlations in power data. This invention innovatively introduces a "sliding window temporal feature extraction + adaptive wavelet filtering" module: Using a time window, the window size can be dynamically adjusted according to the electricity consumption cycle. For example, residential electricity consumption is set to 24 hours and industrial electricity consumption is set to 1 hour. The original data is traversed by sliding to extract the time-series statistical features within the window, such as the maximum / minimum power value, the rate of change of electricity consumption, and the power difference between adjacent windows. This transforms static data into multi-dimensional features containing time-series patterns, solving the problem of dynamic adaptation of power data. The wavelet basis is dynamically adjusted based on the data noise intensity. For example, when the noise intensity is >10%, the db6 wavelet basis is selected, and when the noise intensity is ≤10%, the db4 wavelet basis is selected. High-frequency noise, such as instantaneous fluctuations in the power grid, is removed through three-level wavelet decomposition, while retaining abnormal features, such as sudden power drops, to avoid the false rejection of abnormal signals by traditional filtering.

[0064] Breaking away from the traditional single-level structure, a progressive architecture of "Level 1 coarse-grained forest - Level 2 fine-grained forest - Level 3 precise forest" is designed. Each level optimizes model parameters for different recognition targets, and a "dynamic feature selection" mechanism is introduced to improve the model's targeting. First-level coarse-grained forest: quickly filtering out abnormal data. The forest is constructed using "lightweight isolated trees," abandoning the traditional configuration of 100 trees and instead using 50 lightweight isolated trees, denoted as... Maximum depth of each tree , while traditional The formula for reducing computational complexity is: (19) in, The computational complexity is that of a first-order forest. For traditional forest complexity, These represent the number of trees, These represent the tree depth.

[0065] In each split, two features are randomly selected, while the traditional method selects only one. The formula for improving feature combination coverage is: ; (20) Where M is the total number of features, The combination number is given when M=28. This means that the feature coverage is increased by 13.5 times, avoiding blind spots in recognition caused by the reduction in the number of trees.

[0066] Based on the balanced sample set generated by the adaptive sample synthesis algorithm, each feature is calculated. "Normal / Abnormal" label mutual information value The formula is: ;(twenty one) in, Features With tags The joint probability, These are the marginal probabilities.

[0067] In other words, the first-level coarse-grained forest in this embodiment is an efficient filter that quickly identifies "suspected anomalies" from all the data. It does not perform fine-grained classification of anomalies; its output is a batch of data marked as "anomalies," but the specific anomaly type of these data is still unknown.

[0068] Second-level sub-forest: classifying anomalies into major categories.

[0069] To address the characteristic differences between the two types of anomalies, a "two-branch forest" is constructed: Input features related to loss, such as line loss rate and power factor deviation, and use a "density-sensitive isolation tree" to increase the number of tree splits for densely distributed loss data to improve the discriminativeness of loss-related anomalies; Input features related to faults / theft, such as current distortion rate and duration of high-power electricity use at night, and use a "sparse-enhanced isolation tree" to increase the sampling weight for sparse theft data to avoid missing sparse anomalies.

[0070] Specifically, for the data output from the first level, a "two-branch forest" is constructed to handle two types of anomalies respectively: 1) Loss-related anomalies (density-sensitive isolated trees) Focusing on 6 characteristics related to loss (line loss rate) Power factor deviation Voltage drop amplitude Three-phase current imbalance Transformer loss deviation Cable loss deviation These characteristics are densely distributed, such as line loss rate. The sample size was 85%. Calculate the local density of the above feature space The formula is: ;(twenty two) in, The characteristic mean, The standard deviation is denoted as .

[0071] When the line loss rate of At that time, and when In (dense areas), the number of tree splits increases from the traditional The next increase to a new Next, the fineness of splitting Upgraded to: ;(twenty three) At the same time, samples in dense regions are assigned a split priority weight of 1.2 times. Ensure the distinction between "normal wear and tear" "and abnormal losses" ".

[0072] 2) Fault / Theft-related anomalies (sparse augmented isolated tree) Focusing on 7 characteristics related to fault / theft (current distortion rate) High-power electricity usage time at night Voltage swell / dip Current transformer ratio jump value creeping current of electricity meter Current leakage value bypassing metering device Frequency of abnormal switch status This type of feature is sparsely distributed due to insufficient fault data during actual operation. To address the above issues, sample sparsity is calculated. : ;(twenty four) in, For feature data of Number of similar samples in the nearest neighbors For the nearest neighbor number, when When the dataset exhibits sparse sample characteristics, oversampling is used, and the sampling factor is set to... Sample size after sampling ( (This refers to the original sparse sample number); at the same time, the tree sampling rate is increased from the traditional 0.8 to 0.9, and the sampling weight... This ensures that sparse samples are adequately isolated and avoids omissions.

[0073] In this embodiment, the input to the second-level subdivided forest is all the "suspected anomaly" data output from the first layer. The results of the first layer are finely classified. Based on the feature differences of different types of anomalies (such as loss-related and fault / electricity theft-related anomalies), different branching strategies are used for in-depth analysis, and feature importance is ranked.

[0074] Level 3 Precision Forest: Locating specific anomaly types. By introducing an "attention mechanism isolated tree," unique features of each anomaly type are assigned higher attention weights, such as the feature that electricity theft occurs during a "sudden power surge between 2-4 AM." The weight values ​​are calculated using mutual information entropy, ranging from 0.6 to 0.9. High-weight features are prioritized during tree splitting, improving the accuracy of identifying subdivided anomalies.

[0075] Specifically, for the data output from the previous level, an "attention mechanism isolated tree forest" is constructed, focusing on eight types of anomalies, including electricity theft, transformer failure, cable aging, and transformer overload.

[0076] In this embodiment, the core task of the secondary forest is not to directly rank the global feature importance, but to optimize the model structure by adopting a differentiated splitting strategy based on the inherent distribution characteristics (dense and sparse) of the two types of outlier data, thereby more effectively separating outliers.

[0077] Based on the feature importance ranking in a secondary forest, 3-4 unique features are selected for each type of anomaly, such as for electricity theft. The power surge occurred between 2 and 4 AM. To bypass the metering current leakage value, This refers to the frequency of high-power electricity consumption at night.

[0078] Features are calculated using mutual information entropy. For anomaly categories attention weights : (25) in, Features In the anomaly category Conditional entropy under the following conditions .

[0079] Based on the weights assigned to the recognition difficulty and accuracy of each level, the weight of the first-level coarse forest is set to 0.2, which means low recognition difficulty; the weight of the second-level fine forest is set to 0.3, which means medium recognition difficulty; and the weight of the third-level precise forest is set to 0.5, which means high recognition difficulty and high accuracy. In addition, the raw outputs at each level are normalized and transformed into evidence. The purpose of this transformation process is to unify various indicators into a measure of "the degree of confidence in the data point belonging to a certain anomalous hypothesis".

[0080] In a preferred embodiment, the original output of the first-level forest needs to be processed using methods such as the Softmax function to combine multiple features. With tags The mutual information contribution values ​​are converted into a probability distribution, represented as follows: .

[0081] The raw output of the secondary forest, with metrics for different branches such as "split precision" for the loss branch and "sample sparsity" for the fault / electricity theft branch, actually reflects the model's "input level" or "certainty" when processing that sample. For example, higher split precision might mean the model is more confident in judging "loss anomalies"; a higher oversampling factor might mean the model is more focused on the possibility of "electricity theft." Mapping "split precision" to the degree of confidence in "loss anomalies" is a good way to understand this. (Abnormal Loss); Mapping "sample sparsity" and oversampling factor to confidence level for "fault / electricity theft anomaly". (Faulty electricity theft anomaly). Similarly, a portion of the probability needs to be reserved for the uncertainty domain. .

[0082] The transformation of the output of the third-level forest, with its "attention weights" for specific anomaly types (such as "electricity theft" and "transformer failure"), after normalization, can naturally be represented as the distribution of confidence in the sample belonging to each specific anomaly type, as follows: .

[0083] Therefore, in this embodiment, the transformation output results of each level are... As evidence, according to the rules of evidence composition: (26) in, The conflict coefficient, This is for the intersection operation.

[0084] By fusing multi-feature data using the above method, the anomaly type with the highest confidence is finally output, thus avoiding the influence of single-level errors on the results.

[0085] Based on the iterative evaluation results, the model dynamically selects an optimal feature subset. This subset is not fixed but dynamically adjusted according to the current data distribution and the patterns the model is attempting to distinguish. The subset aims to include the core indicative features that best distinguish the patterns to be identified in the current isolated forest hierarchy, while actively suppressing features that are heavily influenced by noise, have low discriminative power, or are redundant. This allows the model to learn to select the most suitable feature combination for different data subsets or different recognition tasks.

[0086] Furthermore, by combining sliding window temporal features with multi-layer isolated forests, the problem of traditional algorithms being unable to handle the dynamic nature of electricity data is addressed, enabling the model to capture time-specific anomalies in electricity consumption. A progressive forest structure of "coarse screening-sub-precision" is designed, combining "dynamic feature selection" and "attention mechanism" to achieve hierarchical adaptation to multiple types of anomalies. Compared with traditional single-layer models, the accuracy of subdivided anomaly identification is significantly improved.

[0087] By using "lightweight isolated trees" and "feature pre-screening", the model complexity is reduced while ensuring accuracy. The model parameter size is significantly reduced and the inference time is significantly shortened, which can fully meet the deployment requirements of edge devices in distributed metering scenarios.

[0088] Finally, after completing model building and prediction at all levels, the discrimination results at each level are integrated to obtain more robust and accurate final analysis conclusions. The above method design, by employing a multi-granularity attribution adaptation approach, adapts different levels of identification targets by focusing on feature attribution for "normal / abnormal" binary classification in the first-level forest, intra-branch attribution for "major category division" in the second-level forest, and intra-category attribution for "sub-categorical anomalies" in the third-level forest, thus avoiding the problem of single-granularity in traditional attribution.

[0089] A separate meta-learner—gradient boosting decision tree—is used to optimize the feature data at each level's final output. As input features to the gradient boosting decision tree model, the optimal combination strategy or decision boundary is learned to achieve higher-level decision fusion. For the aforementioned multi-level feature inputs, the gradient boosting tree algorithm is designed as follows: The initial prediction value is the minimum of all target values: (27) in, Selection features for corresponding inputs Corresponding to the category The probability of.

[0090] For each round : Calculate the residual from the previous round: (28) Fit the residuals to generate a new regression tree. .

[0091] Update model predictions: (29) Based on the final model discrimination results, cluster analysis is performed on suspected abnormal data points, and further, based on their predicted abnormality scores and characteristics, they are classified into specific types such as technical power loss, non-technical power loss, metering equipment failure, or power theft.

[0092] Example 2: This example provides a method for processing imbalance data for distributed dynamic energy metering, which further includes: The personalized TreeSHAP attribution method is iteratively quantized and embedded into the training process of each level of forest for the first-level coarse classification forest model, the second-level bi-branch forest model, and the third-level precise forest model, so as to dynamically evaluate the contribution of each feature under the current anomaly category in the current iteration round. The model is trained iteratively, removing the features with the lowest contribution each time, until a preset number is reached or the model performance no longer deteriorates. Finally, optimized data features are output, and an optimal feature subset is dynamically selected based on the iterative evaluation results.

[0093] Specifically, in this embodiment, the importance of global features is not determined all at once during the training process of each level of the isolated forest, but rather iteratively quantized. This embodiment employs a personalized approach. Tree SHAP The global attribution method for the average magnitude of attributions is estimated using Tree Explainer. Tree SHAP value. Tree SHAP It is an improvement on the Shapley value, which enhances the interpretability of tree-based machine learning prediction models by using a simpler model as an interpretable approximation of the complex model.

[0094] Specifically Tree SHAP The values ​​are attributed to each predictor by combining conditional expectation with the original Shapley value, following the characteristics of local accuracy, missing values, and consistency, and combining primary and interaction effects, i.e., one predictor and all predictor combinations. It utilizes the attribute size of the predictors rather than the model performance degradation characteristics related to permutation importance, and designs unique importance rules for additive features.

[0095] In this embodiment, Tree SHAP Tree SHAP is an interpretable tool based on SHAP value theory and specifically designed for tree models. It achieves quantitative interpretation of model predictions by efficiently calculating feature contribution. Tree SHAP optimization leverages the structural characteristics of tree models, such as splitting paths and node coverage sample size, to exponentially reduce computational complexity. O (2 MReduced to polynomial level O ( TLD 2), T For the number of trees, L For the number of nodes, D The depth is the tree depth. By recursively traversing the decision path, the expected value of the predicted feature subset is dynamically calculated, avoiding explicit enumeration of all subsets.

[0096] To address the limitation of traditional one-time global feature importance calculations in adapting to dynamic data distributions, this method differs from traditional one-time global attribution by performing 5-10 rounds of iterative calculation for each forest level. MA-SHAP The value can dynamically adapt to changes in data distribution during training. Specifically, it will personalize... Tree SHAP Attribution's "iterative quantization" is embedded in the training process of each level of the forest, through... Tree Explainer Estimate the performance of each feature at different training stages SHAP Value, in SHAP The average range of the values ​​( MA- SHAP As a dynamic quantitative indicator of feature importance, it is deeply bound to the core parameters of forests at all levels.

[0097] During the initial training of the first-level forest, a balanced dataset based on adaptively synthesized samples is used. Tree SHAP Calculate the top 10 optimal candidate features (i.e., the features with the top 10 mutual information values ​​in the original scheme). MA-SHAP value: (30) in, For the sample size, For the sample Chinese characteristics of value.

[0098] Based on the above definition, suppose in a certain operation there are 50 trees, and every time 10 trees are trained, it is done in 5 rounds of iteration, and the calculation is repeated. MA-SHAP Value and adjust feature priority.

[0099] If a certain characteristic, such as the frequency of voltage sags... If the value drops from 0.73 to 0.58, a decrease of more than 20%, then replace it with... The three-phase voltage imbalance value is increased to 0.65, ensuring that the input features always focus on high-discrimination dimensions, thereby solving the problem of poor adaptability of the fixed feature set to dynamic data in the original scheme.

[0100] Then The value is bound to the feature selection probability of tree splitting, and the splitting rule is optimized to select features during splitting. probability ,Right now: (31) in, This is the current input feature set.

[0101] During the initial training of the secondary forest, scenario-based parameter binding is performed. The values ​​are directly related to the core parameters of the Isolation Forest (number of splits, sampling factor, attention weight), rather than just serving as a post-hoc explanation tool, forming a closed-loop process of "attribution-parameter optimization-model training".

[0102] Specifically, for the lossy branching process (density-sensitive isolated tree), during training... Tree SHAP Analyze loss-related characteristics, such as based on line loss rate. Power factor deviation of Value distribution, if In dense areas The value is 0.81, which is higher than 0.65, dense area The splitting number enhancement factor will then be dynamically adjusted from the original fixed value of 1.5 to: (32) in, Features within branches The average value, through more refined splitting, enhances the discriminative power of high-contribution features, thereby improving the classification accuracy of loss-type anomalies.

[0103] For sparse samples In other words, the oversampling factor The original fixed value of 1.5 has been revised to: (33) Among them, 0.8 is the preset high contribution threshold, which avoids the omission of sparse anomalies by increasing the sampling amount of high contribution feature samples.

[0104] In the three-tiered forest design, combined with Tree SHAP of The dynamic adjustment process involves designing dynamic optimization of attention weights and confidence levels, and updating fixed attention weights using mutual information entropy. ,Right now: (34) By further increasing the splitting priority of high-contribution features, and then... Tree SHAP The attribution results are incorporated into the confidence score calculation, and the final confidence score of the three-level forest is calculated. The formula is: (35) in, As the initial confidence level, For this anomaly category The highest characteristic, For this anomaly category Average characteristic, with a correction factor of 0.2.

[0105] Finally, the marginal contribution of the input features corresponding to each level to the model prediction is quantified to provide interpretability of the model and dynamically evaluate the contribution of each feature in the current sub-model or the current iteration round.

[0106] In cooperative game theory, the model predictions generated by multiple input features at each isolated forest level are used. The Shapley value fairly distributes the contribution of each input feature using the following formula: (36) in, It is a feature set. It is a feature subset. It is the model prediction function.

[0107] In this embodiment, in a preferred manner, the sum of the Shapley values ​​of all features is equal to the difference between the model's predicted value and the average value of the dataset. The value can provide a fairer assessment of the feature contribution.

[0108] This embodiment Tree SHAP The Shapley value is an interpretability method that combines cooperative game theory with tree model structure. Its core is to achieve fair attribution of model predictions by accurately calculating the marginal contribution of each feature to the prediction result. The Shapley value is defined as the average contribution of a feature to the difference between the predicted value and the average predicted value.

[0109] Personalized attribution involves analyzing the specific impact of each feature in a single electricity metering sample on the model's prediction results, such as the voltage, current, and power data of a residential user during a certain period, or the three-phase electricity consumption data of an industrial user. This corresponds to the "personalized analysis of single terminal / single user data" requirement of "distributed dynamic electricity metering".

[0110] The average amplitude calculation involves taking the "average absolute value" of the personalized attribution values ​​of a certain type of sample, such as all abnormal samples of industrial users or samples of electricity theft by residents in a certain area, to quantify the "average contribution intensity" of each feature in that type of sample. This corresponds to the requirements of "imbalanced data processing" and "identification of major / sub-categories of anomalies" in this embodiment, such as distinguishing the core feature differences between "loss-related anomalies" and "electricity theft anomalies".

[0111] The global attribution design ranks features by their global importance based on the average magnitude of all samples. This clarifies which features have the greatest impact on the overall anomaly identification performance of the model in the entire electricity metering dataset, such as distinguishing between normal and abnormal and subdividing anomaly types. This provides a basis for dynamic feature selection and model architecture optimization.

[0112] For a certain type of sample set Calculate each sample Chinese characteristics Tree SHAP attribution value Then calculate the average amplitude: (37) The model is trained iteratively, removing the least important features each time, until a preset number is reached or the model performance no longer degrades, and finally the optimized data features are output.

[0113] Example 3: The present invention also provides an unbalanced data processing system for distributed dynamic electricity metering. This system achieves efficient and accurate identification of different types of abnormal situations involved in electricity metering, such as technical losses, non-technical losses, metering faults, and electricity theft, through the organic combination of data preprocessing, data balancing algorithm design, and multi-level isolated forest model construction.

[0114] In this embodiment, dynamic energy metering data is first comprehensively preprocessed, including data analysis, cleaning, normalization, and feature extraction. To address the problem of imbalanced data categories, a solution is proposed, including data anomaly model construction and analysis, adaptive data sample synthesis, and data transformation. For situations involving multiple categories of anomalies and faults, a multi-level isolated forest model is proposed. Each level of the model, while progressively analyzing, incorporates an adaptive feature subset selection strategy to dynamically focus on the features most capable of distinguishing energy anomaly patterns, thereby effectively reducing noise impact and increasing attention to sparse anomaly data. Finally, by fusing effective data features from multiple levels, energy metering anomaly patterns are clustered and identified to address the complex and ever-changing energy metering anomaly situations in actual power grids. Specifically, in this embodiment, as follows... Figure 2 As shown, the system includes: The data acquisition module is used to collect relevant real-time data from distributed power metering terminals and construct a multi-dimensional representation of power data. The data preprocessing module is used to generate unbalanced data by using an anomaly generation model for abnormal data in multi-dimensional power data; the anomaly generation model is used to balance the collected unbalanced data by using voltage or current phase as input, and to simulate and amplify small sample abnormal data by using an adaptive synthesis model for small category sample data. The model training module is used to input the formed balanced sample data into the first-level coarse classification forest model to quickly determine the probability that the data is an anomaly type; a second-level bi-branch forest model is constructed based on the probability of anomaly type to complete the importance ranking of each feature in multiple anomaly types; based on the anomaly type, the attention weights corresponding to the unique features under the current anomaly type are determined through a third-level precise forest model. The type determination module integrates the results of the first-level coarse-classification forest model, the second-level bi-branch forest model, and the third-level precise forest model, and uses them as input features for the gradient boosting decision tree model to learn the optimal combination strategy or decision boundary. Based on the final model discrimination results, it performs cluster analysis on suspected abnormal data points and finally classifies the analysis results into specific anomaly types.

[0115] Other technical features of the imbalance data processing system for distributed dynamic energy metering described in this embodiment of the invention are similar to the corresponding imbalance data processing method for distributed dynamic energy metering, as described in Embodiment 1 and Embodiment 2, and will not be repeated here.

[0116] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the invention.

[0117] Obviously, those skilled in the art can make various modifications and variations to the embodiments of the present invention without departing from the spirit and scope of the embodiments of the present invention. Thus, if these modifications and variations to the embodiments of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention also intends to include these modifications and variations.

Claims

1. A method for processing imbalance data in distributed dynamic energy metering, characterized in that, The method includes: Collect relevant real-time data from distributed power metering terminals to construct a multi-dimensional representation of power data; An anomaly generation model is used to generate unbalanced data for abnormal data in multi-dimensional power data. The anomaly generation model is used to balance the collected unbalanced data by taking voltage or current phase as input. For small-category sample data, an adaptive synthesis model is used to simulate and amplify small-sample abnormal data. The resulting balanced sample data is input into a first-level coarse-grained forest model to quickly determine the probability that the data is an anomaly; a second-level bi-branch forest model is constructed based on the probability of anomalies to rank the importance of each feature in various anomaly types; based on the anomaly type, a third-level precise forest model is used to determine the attention weights corresponding to the unique features under the current anomaly type. The results of the first-level coarse-classification forest model, the second-level bi-branch forest model, and the third-level precise forest model are integrated and used as input features for the gradient boosting decision tree model to learn the optimal combination strategy or decision boundary. Based on the final discrimination results of the above models, cluster analysis is performed on suspected abnormal data points. Finally, the analysis results are classified into specific anomaly types.

2. The imbalance data processing method for distributed dynamic energy metering according to claim 1, characterized in that, The method also includes: The personalized TreeSHAP attribution method is iteratively quantized and embedded into the training process of each level of forest for the first-level coarse classification forest model, the second-level bi-branch forest model, and the third-level precise forest model, so as to dynamically evaluate the contribution of each feature under the current anomaly category in the current iteration round. The model is trained iteratively, removing the features with the lowest contribution each time, until a preset number is reached or the model performance no longer deteriorates. Finally, optimized data features are output, and an optimal feature subset is dynamically selected based on the iterative evaluation results.

3. The imbalance data processing method for distributed dynamic energy metering according to claim 1 or 2, characterized in that, The anomaly generation model uses voltage or current phase as input to perform data balancing on the collected imbalance type data, including: voltage phase and current phase Both are used in a unified manner express; The formula for generating data under the condition of complete phase imbalance is defined as follows: ; Among them, the coefficient of the constant term , Generates data for anomalous data. It can be a, b, or c; The data generation definition for any phase exceeding the overload standard for that phase is as follows: ; Among them, the coefficient of the constant term ; The data generation definition for all phases under the uniform attenuation condition is as follows: ; where the coefficient of the constant term , This represents the average value of the input items. for a , b or c ; The data generation definition for the case where all phases decay to 0 within the same time interval is as follows: ; The data generation definition for the case where all phases decrease is as follows: ; Among them, the coefficient of the constant term constant term system These represent the start and end times of the time, respectively; electricity theft data. The generation rules are as follows: ; Among them, the coefficient of the constant term ; By changing the time parameter and baseline normal data To generate diverse data in batches.

4. The imbalance data processing method for distributed dynamic energy metering according to claim 1 or 2, characterized in that, The method for simulating and amplifying anomalous data using an adaptive synthesis model for small-category sample data includes: Calculate the proportion of category samples in the total sample data. , is represented as: ; If the proportion of a certain type of sample Below the threshold Then calculate the amount of data that needs to be synthesized. ,in, These represent the data volume for the minority category and the data volume for the majority category, respectively. It is the desired balance parameter; Calculate the ratio ,in, The number of samples is calculated using the K-nearest neighbor algorithm. K is the number of nearest neighbor samples; Normalized ratio The sample density distribution is expressed as follows: ; Finally, calculate the number of generated data samples: ; in, This refers to the amount of sample data to be synthesized; a specific data point from a small sample is input from the generated data sample size. The following generation rules are used to generate synthetic data samples: ;in, For measuring voltage data and current data The matrix formed , for A random constant over an interval.

5. The imbalance data processing method for distributed dynamic energy metering according to claim 1, characterized in that, The process of inputting the resulting balanced sample data into a first-level coarse-grained classification forest model to quickly determine the probability that the data is an anomaly includes: Set the number of isolated trees and the maximum depth of each tree, set the number of features randomly selected each time the tree splits into branches, and then combine the total number of features to obtain the feature combination coverage; Based on the balanced sample data, the mutual information value between each feature and the label classification is calculated, thereby obtaining the probability that the sample data is abnormal.

6. The imbalance data processing method for distributed dynamic energy metering according to claim 5, characterized in that, The construction of a two-level bi-branch forest model to assess the probability of anomalies allows for the ranking of the importance of various features across multiple anomaly types, including: A bi-branch forest is constructed based on the isolated tree, where one branch is obtained by splitting based on densely distributed loss data, and the other branch is obtained based on sparse fault or theft data. The branch obtained by splitting based on densely distributed loss data includes: collecting relevant features of the loss data, and the features are densely distributed; determining the spatial local density based on the features; determining the number of tree splits and the splitting precision based on the spatial local density value; and setting the priority weight for splitting under the loss data to distinguish between normal loss and abnormal loss. The branch obtained based on sparse fault or theft data includes: collecting relevant features of fault or theft data, which are sparsely distributed due to insufficient fault data, and calculating sample sparsity based on the above features. When the sparsity of the sample is greater than a set threshold, it is identified as a sparse sample characteristic, and oversampling is used to increase the sampling factor to ensure that the sparse sample is fully isolated.

7. The imbalance data processing method for distributed dynamic energy metering according to claim 6, characterized in that, The step of determining the attention weights corresponding to the unique features under the current anomaly type using a three-level precise forest model based on anomaly type includes: ranking the feature importance based on a two-level bi-branch forest model, selecting multiple unique features for each anomaly type, and calculating the attention weights of the current features to the anomaly category using mutual information entropy.

8. The imbalance data processing method for distributed dynamic energy metering according to claim 2, characterized in that, The first-level coarse-classification forest model will be personalized. Tree SHAP The attribution method iteratively quantizes the embeddings in the training process of each level of the forest, including: For a first-level coarse-grained classification forest model: based on an adaptively synthesized balanced dataset, through... Tree SHAP Calculate the top N optimal candidate features The value, i.e., the mutual information value of the features of Top N. value; Based on the number of isolated trees in the current operation and the number of trees in each training session, multiple iterations are performed, and the calculation is recalculated. Value and adjust feature priority; If a certain feature If the value decreases beyond a set range during the iteration process, it will be replaced with... The value rises to the threshold range This ensures that the input features always focus on high-discrimination dimensions; Then the current The value is bound to the feature selection probability of tree splitting, and the splitting rule is optimized to obtain the probability of selecting features when splitting.

9. The imbalance data processing method for distributed dynamic energy metering according to claim 8, characterized in that, The The value is represented as: ; in, For the sample size, For the sample Chinese characteristics of value.

10. The imbalance data processing method for distributed dynamic energy metering according to claim 2, characterized in that, The second-level bi-branch forest model will be personalized. Tree SHAP The attribution method iteratively quantizes the embeddings in the training process of each level of the forest, including: For loss-related branching processes, training is conducted through... Tree SHAP Analysis of loss-related characteristics The distribution of values, if The local density of the feature space is greater than a set threshold and the corresponding The value is higher than another feature The splitting number enhancement factor is then dynamically adjusted, as follows: ; in, Features within branches The average value, through more refined splitting, enhances the discriminative power of high-contribution features, thereby improving the classification accuracy of loss-type anomalies. If the current sample sparsity is greater than a set threshold, the oversampling factor will be dynamically adjusted, as follows: ; in, To preset a high contribution threshold, the sampling amount of high contribution feature samples is increased to avoid missing sparse anomalies.

11. The imbalance data processing method for distributed dynamic energy metering according to claim 2, characterized in that, The three-level precision forest model will be personalized. Tree SHAP The attribution method iteratively quantizes the embeddings in the training process of each level of the forest, including: The design dynamically optimizes attention weights and confidence, updating fixed attention weights using mutual information entropy. ,Right now: ; in, Features before update In the anomaly category Attention weights under, Will Tree SHAP The attribution results are incorporated into the confidence score calculation, and the final confidence score of the three-level precise forest model is... The formula is: ; in, As the initial confidence level, For this anomaly category The highest characteristic, For this anomaly category Average characteristics This is a correction factor.

12. The imbalance data processing method for distributed dynamic energy metering according to claim 2, characterized in that, The dynamic evaluation of the contribution of each feature under the current anomaly category in the current iteration round includes: The Shapley value quantifies the marginal contribution of each input feature to the model's prediction. It fairly allocates the contribution of each input feature using the following formula: ; in, It is a feature set. It is a feature subset. It is the prediction function of the current model.

13. An imbalance data processing system for distributed dynamic energy metering, characterized in that, The system includes: The data acquisition module is used to collect relevant real-time data from distributed power metering terminals and construct a multi-dimensional representation of power data. The data preprocessing module is used to generate unbalanced data by using an anomaly generation model for abnormal data in multi-dimensional power data; the anomaly generation model is used to balance the collected unbalanced data by using voltage or current phase as input, and to simulate and amplify small sample abnormal data by using an adaptive synthesis model for small category sample data. The model training module is used to input the formed balanced sample data into the first-level coarse classification forest model to quickly determine the probability that the data is an anomaly; a second-level bi-branch forest model is constructed based on the probability of anomalies, thereby completing the importance ranking of each feature in various anomaly types; based on the anomaly type, the attention weights corresponding to the specific features under the current anomaly type are determined through a third-level precise forest model. The type determination module integrates the results of the first-level coarse-classification forest model, the second-level bi-branch forest model, and the third-level precise forest model, and uses them as input features for the gradient boosting decision tree model to learn the optimal combination strategy or decision boundary. Based on the final model discrimination results, it performs cluster analysis on suspected abnormal data points and finally classifies the analysis results into specific anomaly types.