A smart meter fault classification method based on global sample rebalancing
Important feature encoding is generated through sample global rebalancing technology and VAE-GAN model, combining feature repulsion and hybrid coding technology, the problem of complexity of smart meter fault types is solved, the accuracy and recall of fault classification are improved, and the model is enhanced. robustness.
Patent Information
- Application Number
- CN202210348671.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-01
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2042-04-01
AI Technical Summary
The types of smart meter failures are complex and diverse. The prior art is difficult to accurately predict under unknown fault types, resulting in maintenance problems. The method based on unbalanced data learning has problems with prediction result offset and sample generation authenticity guarantee.
Using a method based on global sample rebalancing, the smart meter fault data is converted into a Class II data set, and important feature encoding and secondary feature encoding are generated through the fusion model of VAE and GAN, and feature repulsion technology and hybrid encoding technology are designed to generate reliable Balance the data set and improve the accuracy of fault classification.
It improves the accuracy and recall rate of smart meter fault classification, solves the data authenticity and pattern crash problems, and enhances the robustness of the model.
Smart Images

Figure CN114781495B_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to a smart meter fault classification method, and in particular to a smart meter fault classification method based on sample global rebalancing. [Background technology]
[0002] Since the 21st century, smart meters have been widely used in the field of electricity consumption information collection, and the power industry has entered the era of big data. As the terminal equipment under the current smart grid construction in my country, smart meters integrate multiple functions such as measurement, display, and communication, and play an important supporting role in the stable operation of the power grid. With the development of smart grids, the functions of smart meters are becoming increasingly rich, and at the same time, their fault types are also increasing. The timely maintenance of faulty meters is of great significance to the stable operation of the power grid and the stable electricity consumption of users. However, since operation and maintenance personnel often only have maintenance experience for certain specific faulty meters, when a smart meter fails, it is difficult to dispatch maintenance personnel with relevant maintenance experience to perform meter maintenance when the meter fault type is unknown. Therefore, accurate prediction of smart meter fault types is crucial.
[0003] With the development of smart grids, the demand for smart meters is increasing, and the number of smart meter manufacturers has increased accordingly. Different manufacturers have different design schemes, component selection and process flows. In addition, the complex production environment and application environment lead to complex and diverse fault types of smart meters. The occurrence of faults is affected by the above-mentioned multiple factors at the same time. Finding the mapping relationship between these factors and fault types is extremely complex, which is a typical machine learning problem. In addition, the frequency of occurrence of meters with different fault types is also different, and the fault data presents multi-modal distribution characteristics, which further increases the prediction difficulty of smart meters. Direct learning based on unbalanced data will cause the prediction results of the classifier to shift to the majority class. The balance between categories can be achieved through data sampling, but this type of method lacks a mechanism to ensure the authenticity of synthetic samples; the generative adversarial network can improve the authenticity of the generated samples through the adversarial game between the generator and the discriminator, but there is a mode collapse problem, and the consistency of the distribution of the minority class samples before and after the balance cannot be guaranteed. Based on the above analysis, the present invention proposes a smart meter fault classification method based on global sample rebalancing to improve the performance of smart meter fault classification. [Summary of the invention]
[0004] In view of this, the present invention proposes a smart meter fault classification method based on global sample rebalancing to improve the performance of smart meter fault classification.
[0005] The present invention proposes a smart meter fault classification method based on sample global rebalancing, comprising the following steps:
[0006] (1) Taking the fault history data of different categories of smart meters as the input data set, multiple second-category data sets are obtained, specifically:
[0007] The actual fault data set of smart meters is input. The samples in this data set contain 9 characteristic variables: working time, arrival batch number, power supply unit number, electric energy meter category, fault identification month, installation month, province, equipment specification, communication method, and equipment identification. Its fault category labels include 11 categories: appearance fault, metering fault, storage unit fault, processing unit fault, display unit fault, control unit fault, power supply unit fault, communication unit fault, clock unit fault, other faults, and software fault. Each category of samples in the fault data set is traversed, and all samples under this category are regarded as minority class sample sets, and all samples of other categories are majority class sample sets, and the original data set is converted into 11 second-category data sets. For each of the second-category data sets, the data set can be described as follows:
[0008] X=[X min ,X maj ]
[0009] Among them, X is a two-category dataset, and x is defined as any sample in the dataset, that is, x∈X; X min For the minority class sample set, define x min is any sample in the data set, that is, x min ∈X min ;X maj is the majority class sample set, define x maj is any sample in the data set, that is, x maj ∈X maj ;
[0010] (2) For each of the two datasets, a fusion model of VAE and GAN is constructed. Each sample is used as the input of the model and its latent code is divided into important feature code and secondary feature code. Specifically:
[0011] Based on the unbalanced binary classification dataset X = [X min ,X maj ], build VAE / GAN model and train:
[0012] VAE learns the hidden variable posterior distribution q(z|x) of sample x through the encoder, and learns the distribution p(x|z) of sample x through the decoder. The process is as follows:
[0013] z:Enc(x)=q(z|x)
[0014]
[0015] Among them, Enc is the encoder, Dec is the decoder, z is the hidden code obtained by the sample x through the VAE encoder, Reconstructed samples generated by VAE;
[0016] The VAE decoder is fused with the GAN generator to obtain the VAE and GAN fusion model, whose optimization goal is:
[0017]
[0018]
[0019]
[0020] Among them, α1, α2 are hyperparameters, L prior is the prior loss caused by the distribution difference between q(z|x) and N(0,I), N(0,I) is a normal distribution with mean 0 and variance 1, D KL () is KL divergence; L likelihood is the likelihood loss of sampling q(z|x) to obtain p(x|z), L GAN is the adversarial loss of GAN; z min For x min The hidden code, z maj For x maj The hidden code; E[] is the expected calculation function, Dis is the discriminator;
[0021] Based on the above optimization goal, for a given sample x, an m-dimensional latent code z containing its features can be obtained; the characteristic is that during the training process, the VAE model divides the latent code of sample x into important feature codes z KF and the secondary feature code z SF Two parts; the important feature encoding corresponds to some important attributes of the sample, which is their high-level feature representation and the key feature that determines the sample category; the secondary feature encoding is the personalized attribute of the sample, which is usually not general and its change will not lead to the change of the sample category; that is, the first m1 dimension of the partition z is z KF , then m2 dimension is z SF , and m=m1+m2, sample x min The hidden code z min The division is shown as follows:
[0022] z min =[z min,KF ,z min,SF ]
[0023] =Enc(x min )
[0024] Among them, z min,KF For xmin The important feature encoding, z min,SF For x min Secondary feature coding of
[0025] (3) The variant latent code is obtained through the latent code reconstruction technology, and after the decoder restores it, the mutual information constraint and the discriminator confront it, multiple reliable similar variant samples are generated that take into account the important features of the input sample. Specifically:
[0026] Based on the sample latent code and its important feature code and secondary feature code obtained in step (2), keep the important feature code unchanged and randomly replace the secondary feature code to generate a similar sample with the same features as the given sample;
[0027] 1) The decoder restoration process of the variant latent code and variant sample is calculated as follows:
[0028]
[0029]
[0030] in, is the obtained variant latent code, Reason The obtained variant samples; Sampling from its prior normal distribution N(0,I);
[0031] In order to make the important feature coding correspond to some important attributes of the sample, it is necessary to introduce the mutual information maximization constraint between the minority class samples and their important feature coding on the basis of the optimization target in step (2). The important feature coding of the sample can be reversely inferred through the mutual information inference model Q. The optimization target L of the mutual information is Inforence as follows:
[0032]
[0033] Among them, β1 is a hyperparameter, z″ min,KF For variant samples The important features of hidden coding, model Q is replaced by encoder Enc; z′ min,KF To reconstruct the sample The important feature encoding obtained by reverse reasoning is z″ min,KF For variant samples The important feature encoding obtained by reverse reasoning is
[0034] 2) In order to generate reliable variant samples, modify the optimization target L of GAN in step (2) GAN It is divided into two parts:
[0035]
[0036]
[0037] Among them, L Gen is the optimization target of the generator, L Dis is the optimization target of the discriminator; γ1, γ2, γ3, γ4 are hyperparameters;
[0038] 3) For each minority class sample x in the dataset min , apply the above process to obtain its variant latent code; after the traversal is completed, merge the obtained variant samples with the original minority class samples to obtain a new minority class sample set X min , sample until the number is consistent with the majority class samples, and obtain a balanced data set X = [X min ,X maj ];
[0039] (4) Design a feature repulsion technique that acts on the hidden codes of two types of samples to perform supervised feature representation learning, specifically:
[0040] Based on the balanced data set X = [X min ,X maj ], take any batch of samples Z in the training cycle maj,KF and Z min,KF , where Z maj,KF is a feature set consisting of the important hidden codes of all the majority class samples in the training batch, Z min,KF is a feature set consisting of the important feature hidden codes of all minority class samples in the training batch; the feature repulsion L feature_force The calculation of is as follows:
[0041] d loss =Nearest_Neighbor_distance(Z min,KF ,Z maj,KF ,n)
[0042] L feature_class =E Zmaj,KF (Z maj,KF [0]+ρ) 2 +E Zmin,KF (Z min,KF [0]-ρ) 2
[0043] L feature_force =μ1E dloss (-log(d loss +1e-6))+μ2L feature_class
[0044] Among them, Nearest_Neighbor_distance() is the distance loss calculation function, which has the following functions: Find z min,KF In Z maj,KF The n nearest neighbors in z, the value of n is 20, min,KF ∈Z min,KF , and returns all Z min,KF The average distance set d loss ; L feature_class is the category feature repulsion loss, defining the important feature encoding. The first dimension represents the category information of the sample, ρ is a hyperparameter, is the feature repulsion label of the minority class sample, -ρ is the feature repulsion label of the majority class sample; μ1 and μ2 are hyperparameters;
[0045] (5) The hybrid coding technology is used to superimpose the reconstruction errors of each dimension of the sample as a supplement to the important feature coding. Based on this, the classification results of the sample to be tested in each two-class data set are determined, and its fault category is obtained through hard voting, which is specifically:
[0046] Based on the cyclic training model from steps (1) to (4), a reliable balanced dataset can be obtained. The important feature encoding of the combined sample and the reconstruction error e of each dimension are used as new sample features for distinguishing the sample category; for the input sample x, its constructed feature is expressed as F = [z KF ,e], e is calculated as follows:
[0047]
[0048] Input F and its corresponding category label into the random forest classifier training to obtain a single unbalanced binary classifier; repeat the above process to obtain 11 random forest classifiers RF j , j is the subscript of the random forest classifier, j∈[1,11]; for the test sample x test , its predicted label The calculation of is as follows:
[0049]
[0050] When the value is j, it means x test The predicted fault category is the jth fault.
[0051] In the above method, in step (2), the structures of the encoder Enc, the decoder Dec and the discriminator Dis are as follows:
[0052]
[0053] Among them, Reshape() is a tensor deformation function; Conv1D() is a one-dimensional convolutional layer construction function; Flatten() is a tensor flattening function; Dense() is a fully connected layer construction function; LeakyRelu and tanh represent the corresponding activation functions; Dropout() is a random dropout function.
[0054] In the above method, in step (2), the values of α1 and α2 are 0.1 and 1 respectively; the value of m1 is 5, and the value of m2 is 1.
[0055] In the above method, in step (3), the value of β1 is 1; the values of γ1 and γ2 are both 0.5; the values of γ3 and γ4 are both 1.
[0056] In the above method, in step (4), the value of ρ is 0.4; the values of μ1 and μ2 are 1 and 2 respectively.
[0057] The smart meter fault classification method based on global sample rebalancing improves the accuracy and recall rate of smart meter fault classification.
[0058] It can be seen from the above technical solutions that the present invention has the following beneficial effects:
[0059] In the technical solution implemented by the present invention, the sample generation for the specified features is realized by redefining the VAE hidden code, which solves the data authenticity and overfitting problems caused by the data oversampling algorithm, and improves the mode collapse problem existing in the existing sample generation algorithm; the design of feature repulsion technology and hybrid coding technology alleviates the problem of feature extraction and classification difficulties of overlapping area samples. This method can improve the robustness of the model, thereby improving the accuracy and recall rate of smart meter fault classification.
Brief Description of the Drawings
[0060] In order to more clearly illustrate the technical solution of the present invention, the drawings required for use in the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0061] Figure 1 It is a schematic diagram of the framework flow of the smart meter fault classification method based on global sample rebalancing proposed in the present invention;
[0062] Figure 2 It is a flowchart for solving smart meter fault classification;
[0063] Figure 3 It is a detailed schematic diagram of the algorithm of the present invention;
[0064] Figure 4 It is a schematic diagram of the structure and input and output of the model proposed in the present invention. [Specific implementation method]
[0065] In order to better understand the technical solution of the present invention, the present invention is described in detail below with reference to the accompanying drawings.
[0066] It should be clear that the described embodiments of the invention are only part of the embodiments of the invention, not all of the embodiments. Based on the embodiments of the invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the invention.
[0067] The present invention provides a smart meter fault classification method based on global sample rebalancing. In order to meet the fault classification of smart meters, the present invention decomposes the complex unbalanced multi-classification problem into multiple unbalanced binary classification problems, designs implicit coding reconstruction technology to realize the generation of reliable variant samples considering the key features of given samples, and obtains multiple balanced two-class data sets; designs feature repulsion technology and hybrid coding technology to alleviate the difficulty of feature extraction and classification of overlapping area samples; finally, the classification results of the sample to be tested in each two-class data set are integrated, and its fault category is obtained by hard voting.
[0068] Figure 1 The figure is a schematic diagram of the framework flow of the smart meter fault classification method based on global sample rebalancing proposed by the present invention, and the method comprises the following steps:
[0069] Step 101: taking fault history data of different categories of smart meters as input data sets, and dividing them into multiple second-category data sets, specifically:
[0070] The actual fault data set of smart meters is input. The samples in this data set contain 9 characteristic variables: working time, arrival batch number, power supply unit number, electric energy meter category, fault identification month, installation month, province, equipment specification, communication method, and equipment identification. Its fault category labels include 11 categories: appearance fault, metering fault, storage unit fault, processing unit fault, display unit fault, control unit fault, power supply unit fault, communication unit fault, clock unit fault, other faults, and software fault. Each category of samples in the fault data set is traversed, and all samples under this category are regarded as minority class sample sets, and all samples of other categories are majority class sample sets, and the original data set is converted into 11 second-category data sets. For each of the second-category data sets, the data set can be described as follows:
[0071] X=[X min ,X maj ]
[0072] Among them, X is a two-category dataset, and x is defined as any sample in the dataset, that is, x∈X; X min For the minority class sample set, define x min is any sample in the data set, that is, x min ∈X min ;X maj is the majority class sample set, define x maj is any sample in the data set, that is, x maj ∈X maj .
[0073] Step 102, for each of the two types of data sets, a fusion model of VAE and GAN is constructed, each sample is used as the input of the model, and its latent code is divided into important feature code and secondary feature code, specifically:
[0074] Based on the unbalanced binary classification data set X=[X min ,X maj ], build VAE / GAN model and train:
[0075] VAE learns the hidden variable posterior distribution q(z|x) of sample x through the encoder, and learns the distribution p(x|z) of sample x through the decoder. The process is as follows:
[0076] z:Enc(x)=q(z|x)
[0077]
[0078] Among them, Enc is the encoder, Dec is the decoder, z is the hidden code obtained by the sample x through the VAE encoder, Reconstructed samples generated by VAE;
[0079] The VAE decoder is fused with the GAN generator to obtain the VAE and GAN fusion model, whose optimization goal is:
[0080]
[0081]
[0082]
[0083] Among them, α1, α2 are hyperparameters, L prior is the prior loss caused by the distribution difference between q(z|x) and N(0,I), N(0,I) is a normal distribution with mean 0 and variance 1, D KL () is KL divergence; L likelihood is the likelihood loss of sampling q(z|x) to obtain p(x|z), L GANis the adversarial loss of GAN; z min For x min The hidden code, z maj For x maj The hidden code; E[] is the expected calculation function, Dis is the discriminator;
[0084] Based on the above optimization goal, for a given sample x, an m-dimensional latent code z containing its features can be obtained; the characteristic is that during the training process, the VAE model divides the latent code of sample x into important feature codes z KF and the secondary feature code z SF Two parts; the important feature encoding corresponds to some important attributes of the sample, which is their high-level feature representation and the key feature that determines the sample category; the secondary feature encoding is the personalized attribute of the sample, which is usually not general and its change will not lead to the change of the sample category; that is, the first m1 dimension of the partition z is z KF , then m2 dimension is z SF , and m=m1+m2, sample x min The hidden code z min The division is shown as follows:
[0085] z min =[z min,KF ,z min,SF ]
[0086] =Enc(x min )
[0087] Among them, z min,KF For x min The important feature encoding, z min,SF For x min Secondary feature encoding.
[0088] Step 103, obtain its variant latent code through latent code reconstruction technology, restore it through decoder, constrain mutual information and confront it with discriminator, and generate multiple reliable similar variant samples considering important features of input samples, specifically:
[0089] Based on the sample latent code and its important feature code and secondary feature code obtained in step 102, keep the important feature code unchanged and randomly replace the secondary feature code to generate a similar sample with the same features as the given sample;
[0090] 1) The decoder restoration process of the variant latent code and variant sample is calculated as follows:
[0091]
[0092]
[0093] in, is the obtained variant latent code, Reason The obtained variant samples; Sampling from its prior normal distribution N(0,I);
[0094] In order to make the important feature coding correspond to some important attributes of the sample, it is necessary to introduce the mutual information maximization constraint between the minority class samples and their important feature coding on the basis of the optimization target in step (2). The important feature coding of the sample can be reversely inferred through the mutual information inference model Q. The optimization target L of the mutual information is Inforence as follows:
[0095]
[0096] Among them, β1 is a hyperparameter, z″ min,KF For variant samples The important features of hidden coding, model Q is replaced by encoder Enc; z′ min,KF To reconstruct the sample The important feature encoding obtained by reverse reasoning is z″ min,KF For variant samples The important feature encoding obtained by reverse reasoning is
[0097] 2) In order to generate reliable variant samples, modify the optimization target L of GAN in step (2) GAN It is divided into two parts:
[0098]
[0099]
[0100] Among them, L Gen is the optimization target of the generator, L Dis is the optimization target of the discriminator; γ1, γ2, γ3, γ4 are hyperparameters;
[0101] 3) For each minority class sample x in the dataset min , apply the above process to obtain its variant latent code; after the traversal is completed, merge the obtained variant samples with the original minority class samples to obtain a new minority class sample set Sampling until the number is consistent with the majority class samples to obtain a balanced data set
[0102] Step 104, design a feature repulsion technique acting on the latent codes of two types of samples to perform supervised feature representation learning, specifically:
[0103] Based on the balanced data set obtained in step 103 , take any batch of samples Z in the training cycle maj,KF and Z min,KF , where Z maj,KF is a feature set consisting of the important hidden codes of all the majority class samples in the training batch, Z min,KF is a feature set consisting of the important feature hidden codes of all minority class samples in the training batch; the feature repulsion L feature_force The calculation of is as follows:
[0104] d loss =Nearest_Neighbor_distance(Z min,KF ,Z maj,KF ,n)
[0105]
[0106]
[0107] Among them, Nearest_Neighbor_distance() is the distance loss calculation function, which has the following functions: Find z min,KF In Z maj,KF The n nearest neighbors in z, the value of n is 20, min,KF ∈Z min,KF , and returns all Z min,KF The average distance set d loss ; L feature_class It is the category feature repulsion loss, which defines the important feature encoding. The first dimension represents the category information of the sample, ρ is a hyperparameter, is the feature repulsion label of the minority class sample, -ρ is the feature repulsion label of the majority class sample; μ1 and μ2 are hyperparameters.
[0108] Step 105, the reconstruction errors of each dimension of the sample are superimposed by hybrid coding technology as a supplement to the important feature coding, and the classification results of the sample to be tested in each two-class data set are determined accordingly, and its fault category is obtained by hard voting, which is specifically:
[0109] Based on the loop training model from step 101 to step 104, a reliable balanced data set can be obtained. The important feature encoding of the combined sample and the reconstruction error e of each dimension are used as new sample features for distinguishing the sample category; for the input sample x, its constructed feature is expressed as F = [z KF ,e], e is calculated as follows:
[0110]
[0111] Input F and its corresponding category label into the random forest classifier training to obtain a single unbalanced binary classifier; repeat the above process to obtain 11 random forest classifiers RFj , j is the subscript of the random forest classifier, j∈[1,11]; for the test sample x test , its predicted label The calculation of is as follows:
[0112]
[0113] When the value is j, it means x test The predicted fault category is the jth fault.
[0114] Figure 2 It is a flow chart of the present invention for solving the problem of smart meter fault classification. First, the fault history data set under different categories of smart meters is divided into multiple two-category data sets, and the proposed VAE-SLGAN is used to balance the sample sets to obtain multiple balanced two-category data sets, and random forest two-category classifiers are trained respectively. For the samples to be tested, the classifiers obtained under each two-category data set can be used for discrimination, and the final prediction category can be obtained through the soft voting method.
[0115] Figure 3 It is a detailed schematic diagram of the algorithm of the present invention. The algorithm of the present invention is based on the fusion model of VAE and GAN, and proposes a latent coding reconstruction technology to solve the problem of mode collapse occurring in the sample generation process; it designs feature repulsion technology and hybrid coding technology to solve the problems of difficulty in feature mining and classification in overlapping areas.
[0116] Figure 4 This is a schematic diagram of the model structure and input and output proposed in the present invention. The original sample is reconstructed through implicit coding technology to realize the generation of reliable variant samples that take into account the important features of the given sample. The discriminator is combined to constrain the authenticity of the generated samples to obtain multiple balanced two-class data sets. The classification results of the sample to be tested in each two-class data set are integrated to obtain its fault category through hard voting.
[0117] Algorithm 1 is the pseudo code for calculating the number of generated samples of each minority class:
[0118]
[0119]
[0120] Algorithm 2 is the pseudo code of the algorithm for the global sample generation method:
[0121]
[0122]
[0123] Algorithm 3 is the pseudo code of the algorithm for calculating characteristic repulsion:
[0124]
[0125] In the specific embodiment, the fault history data set of different categories of smart meters was used for testing. The data set collected a total of 11 types of smart meter data in 25 provinces. Due to the influence of various factors such as manual statistics and external conditions, the data labels were mislabeled or missing. After data cleaning by various technologies such as cluster analysis, missing value completion, and outlier processing, a total of 15,885 fault sample data were obtained. In order to reduce the randomness of the results, the data set was randomly divided into a training set and a test set with a fixed random number seed in a ratio of 8:2.
[0126] Table 1 Datasets used in specific examples
[0127]
[0128] To verify the effectiveness of the proposed algorithm, 8 mainstream oversampling methods and 5 mainstream deep learning sample generation methods are used in the embodiment of the present invention for comparison, as shown in Table 2. Considering the large amount of sample data and complex categories of the smart meter fault dataset, RF is used as a classifier to verify the sample balance effect. The embodiment of the present invention is represented by VAE-SLGAN in the table.
[0129] Table 2 Algorithms compared in specific embodiments
[0130]
[0131]
[0132] The embodiment of the present invention uses macro-F1 and G-mean indicators to evaluate the classification effect of the algorithm. The macro-F1 indicator is the arithmetic mean of the F1-measure of each category, which is used to comprehensively evaluate the accuracy and recall of the model in each category. The G-mean indicator is the geometric mean of the recall rate in each category, which is used to evaluate the recall of the model in each category. Both Macro-F1 and G-mean have values from 0 to 1. The larger the value, the better the classification performance of the model.
[0133] The experimental results of the embodiment of the present invention and the mainstream oversampling method on the F1-measure and macro-F1 indicators under various fault categories of smart meters are shown in Table 3, and the experimental results on the recall rate and G-mean indicators of each category are shown in Table 4. It can be seen that the smart meter fault classification method based on global sample rebalancing of the present invention has obtained F1-measure and recall rates that exceed those of other methods in most categories, and has obtained the highest macro-F1 and G-mean. The results of Tables 3 and 4 show that the smart meter fault sample balancing effect of the method of the embodiment of the present invention is better than that of the oversampling method, and can obtain higher classification accuracy and recall rate.
[0134] Table 3 Experimental results of VAE-SLGAN and oversampling method on F1-measure and macro-F1 indicators under various fault categories of smart meters
[0135]
[0136] Table 4 Experimental results of VAE-SLGAN and oversampling method on recall rate and G-mean index for each fault category of smart meter
[0137]
[0138] The experimental results of the embodiment of the present invention and the mainstream deep learning generation method on the F1-measure and macro-F1 indicators under various fault categories of smart meters are shown in Table 5, and the experimental results on the recall rate and G-mean indicators of each category are shown in Table 6. It can be seen that the smart meter fault classification method based on global sample rebalancing of the present invention has obtained F1-measure and recall rates that exceed those of other methods in most categories, and has obtained the highest macro-F1 and G-mean. Combining the results of Tables 5 and 6, it is shown that the smart meter fault sample balancing effect of the method of the embodiment of the present invention is better than that of the deep learning generation method, and can obtain higher classification accuracy and recall rate.
[0139] Table 5 Experimental results of VAE-SLGAN and deep learning generation methods on F1-measure and macro-F1 indicators under various fault categories of smart meters
[0140]
[0141]
[0142] Table 6 Experimental results of VAE-SLGAN and deep learning generation methods on recall rate and G-mean index for each fault category of smart meters
[0143]
[0144] A large number of comparison results with mainstream oversampling methods and deep learning sample generation methods show that the present invention can perform reliable sample balance when dealing with the multi-classification problem of smart meters where there are multiple distribution patterns in categories and feature overlap between category data, provide features that are conducive to mining category differences for classifier learning, and effectively improve the accuracy and recall rate of faulty meter classification.
[0145] In summary, the embodiments of the present invention have the following beneficial effects:
[0146] In the technical solution implemented in the present invention, the fault history data of smart meters under different categories are taken as input data sets, and divided into multiple two-category data sets; for each two-category data set, a fusion model of VAE and GAN is constructed, and each sample is taken as the input of the model, and its latent code is divided into important feature code and secondary feature code; its variant latent code is obtained by latent code reconstruction technology, and after decoder restoration, mutual information constraint and discriminator confrontation, multiple reliable similar variant samples considering the important features of the input sample are generated; a feature repulsion technology acting on the latent codes of the two types of samples is designed to perform supervised feature representation learning; the reconstruction errors of each dimension of the sample are superimposed by the hybrid coding technology as a supplement to the important feature code, and the classification result of the sample to be tested in each two-category data set is determined accordingly, and its fault category is obtained by hard voting.
[0147] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A smart meter fault classification method based on global sample rebalancing, It is characterized in that The steps include: (1) Taking the fault history data of different categories of smart meters as the input data set, multiple second-category data sets are obtained, specifically: The actual fault data set of smart meters is input. The samples in this data set contain 9 characteristic variables: working time, arrival batch number, power supply unit number, electric energy meter category, fault identification month, installation month, province, equipment specification, communication method, and equipment identification. Its fault category labels include 11 categories: appearance fault, metering fault, storage unit fault, processing unit fault, display unit fault, control unit fault, power supply unit fault, communication unit fault, clock unit fault, other faults, and software faults. Each category of samples in the fault data set is traversed, and all samples under this category are regarded as minority class sample sets, and all samples of other categories are majority class sample sets, and the original data set is converted into 11 second-category data sets. For each of the second-category data sets, the data set can be described as: X=[X min ,X maj ] Among them, X is a two-category dataset, and x is defined as any sample in the dataset, that is, x∈X; X min For the minority class sample set, define x min is any sample in the data set, that is, x min ∈X min ;X maj is the majority class sample set, define x maj is any sample in the data set, that is, x maj ∈X maj ; (2) For each of the two datasets, a fusion model of VAE and GAN is constructed. Each sample is used as the input of the model and its latent code is divided into important feature code and secondary feature code. Specifically: Based on the unbalanced binary classification dataset X = [X min ,X maj ], build VAE / GAN model and train: VAE learns the hidden variable posterior distribution q(z|x) of sample x through the encoder, and learns the distribution p(x|z) of sample x through the decoder. The process is as follows: z~Enc(x)=q(z|x) Among them, Enc is the encoder, Dec is the decoder, z is the hidden code obtained by the sample x through the VAE encoder, Reconstructed samples generated by VAE; The VAE decoder is fused with the GAN generator to obtain the VAE and GAN fusion model, whose optimization goal is: Among them, α 1 , α 2 is a hyperparameter, L prior is the prior loss caused by the distribution difference between q(z|x) and N(0,I), N(0,I) is a normal distribution with mean 0 and variance 1, D KL () is KL divergence; L likelihood is the likelihood loss of sampling q(z|x) to obtain p(x|z), L GAN is the adversarial loss of GAN; z min For x min The hidden code, z maj For x maj The hidden code; E[] is the expected calculation function, Dis is the discriminator; Based on the above optimization goal, for a given sample x, an m-dimensional latent code z containing its features can be obtained; the characteristic is that during the training process, the VAE model divides the latent code of sample x into important feature codes z KF and the secondary feature code z SF Two parts; the important feature encoding corresponds to some important attributes of the sample, which is their high-level feature representation and the key feature that determines the sample category; the secondary feature encoding is the personalized attribute of the sample, which is usually not general and its change will not lead to the change of the sample category; that is: the first m of the division z 1 Dimension z KF , after m 2 Dimension z SF , and m=m 1 +m 2 , sample x min The hidden code z min The division is shown as follows: With min =[of min,KF ,With min,SF ] =Enc(x min ) Among them, z min,KF For x min The important feature encoding, z min,SF For x min Secondary feature coding of (3) The variant latent code is obtained through the latent code reconstruction technology, and after the decoder restores it, the mutual information constraint and the discriminator confront it, multiple reliable similar variant samples are generated that take into account the important features of the input sample. Specifically: Based on the sample latent code and its important feature code and secondary feature code obtained in step (2), keep the important feature code unchanged and randomly replace the secondary feature code to generate a similar sample with the same features as the given sample; 1) The decoder restoration process of the variant latent code and variant sample is calculated as follows: in, is the obtained variant latent code, Reason The obtained variant samples; Sampling from its prior normal distribution N(0,I); In order to make the important feature coding correspond to some important attributes of the sample, it is necessary to introduce the mutual information maximization constraint between the minority class samples and their important feature coding on the basis of the optimization target in step (2). The important feature coding of the sample can be reversely inferred through the mutual information inference model Q. The optimization target L of the mutual information is Inforence as follows: Among them, β 1 is a hyperparameter, z″ min,KF For variant samples The important features of hidden coding, model Q is replaced by encoder Enc; z′ min,KF To reconstruct the sample The important feature encoding obtained by reverse reasoning is z″ min,KF For variant samples The important feature encoding obtained by reverse reasoning is 2) In order to generate reliable variant samples, modify the optimization target L of GAN in step (2) GAN It is divided into two parts: Among them, L Gen is the optimization target of the generator, L Dis is the optimization target of the discriminator; 1 , γ 2 , γ 3 , γ 4 is a hyperparameter; 3) For each minority class sample x in the dataset min , apply the above process to obtain its variant latent code; after the traversal is completed, merge the obtained variant samples with the original minority class samples to obtain a new minority class sample set Sampling until the number is consistent with the majority class samples to obtain a balanced data set (4) Design a feature repulsion technique that acts on the hidden codes of two types of samples to perform supervised feature representation learning, specifically: Based on the balanced data set obtained in step (3) Take any batch of samples Z in the training cycle maj,KF and Z min,KF , where Z maj,KF is a feature set consisting of the important hidden codes of all the majority class samples in the training batch, Z min,KF is a feature set consisting of the important feature hidden codes of all minority class samples in the training batch; the feature repulsion L feature_force The calculation of is as follows: d loss =Nearest_Neighbor_distance(Z min,KF ,Z maj,KF ,n) Among them, Nearest_Neighbor_distance() is the distance loss calculation function, which has the following functions: Find z min,KF In Z maj,KF The n nearest neighbors in z, the value of n is 20, min,KF ∈Z min,KF , and returns all Z min,KF The average distance set d loss ; L feature_class is the category feature repulsion loss, defining the first dimension of the important feature encoding to represent the category information of the sample, ρ is a hyperparameter, is the feature repulsion label of the minority class sample, -ρ is the feature repulsion label of the majority class sample; μ 1 and μ 2 is a hyperparameter; (5) The hybrid coding technology is used to superimpose the reconstruction errors of each dimension of the sample as a supplement to the important feature coding. Based on this, the classification results of the sample to be tested in each two-class data set are determined, and its fault category is obtained through hard voting, which is specifically: Based on the cyclic training model from steps (1) to (4), a reliable balanced dataset can be obtained. The important feature encoding of the combined sample and the reconstruction error e of each dimension are used as new sample features for distinguishing the sample category; for the input sample x, its constructed feature is expressed as F = [z KF ,e], e is calculated as follows: Input F and its corresponding category label into the random forest classifier training to obtain a single unbalanced binary classifier; repeat the above process to obtain 11 random forest classifiers RF j , j is the subscript of the random forest classifier, j∈[1,11]; for the test sample x test , its predicted label The calculation of is as follows: When the value is j, it means x test The predicted fault category is the jth fault.
2. According to claim 1, the smart meter fault classification method based on sample global rebalancing, It is characterized in that In step (2), the structures of the encoder Enc, the decoder Dec and the discriminator Dis are as follows: Among them, Reshape() is a tensor deformation function; Conv1D() is a one-dimensional convolutional layer construction function; Flatten() is a tensor flattening function; Dense() is a fully connected layer construction function; LeakyRelu and tanh represent the corresponding activation functions; Dropout() is a random dropout function.
3. According to claim 1, the smart meter fault classification method based on global sample rebalancing, It is characterized in that In the step (2), α 1 With α 2 The values of are 0.1 and 1 respectively; m 1 The value of m is 5, 2 The value of is 1.
4. According to claim 1, the smart meter fault classification method based on sample global rebalancing, It is characterized in that In the step (3), β 1 The value of is 1; 1 , γ 2 The value of is 0.5, γ 3 , γ 4 The value of is 1.
5. The smart meter fault classification method based on global sample rebalancing according to claim 1, It is characterized in that In step (4), the value of ρ is 0.4; μ 1 and μ 2 The values are 1 and 2 respectively.
