A method and system for completing electric energy metering data based on generative adversarial network
By using a method based on generative adversarial networks, complete historical data and missing data sets are used to construct a network, generate and update network parameters, which solves the problem of poor completion effect in the existing technology when there is a lot of missing data, and realizes the integration of electric energy measurement data into Accurate data supplement.
Patent Information
- Application Number
- CN202111425843.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-26
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-11-26
AI Technical Summary
The existing technology cannot accurately complete the electric energy measurement data when a large amount of data is missing, resulting in poor completion results.
Using a method based on generative adversarial networks, a generative adversarial network is constructed by obtaining the complete historical data set and missing data set of electric energy measurement data, and the mask matrix and the preprocessed missing data set are used for training to generate an initial completed data set. The network parameters are updated through the back propagation algorithm until the generated adversarial network converges, and the final completed data set is obtained.
When there is a lot of data missing, the data can be accurately supplemented and a complete electric energy measurement data set can be obtained, which improves the accuracy of data completion.
Smart Images

Figure CN114091615B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data completion, and more specifically, to an electric energy metering data completion method and system based on a generative adversarial network. Background Art
[0002] Data missing often occurs during the process of power load collection, which greatly hinders the subsequent use of power metering data for big data analysis. The current algorithm for missing time series data is only applicable to the case of a small amount of missing data, and often performs poorly for the case of a large amount of missing data. The main reasons for data missing are as follows: (1) Equipment damage during use; (2) External factors such as climate factors affect the data collection equipment and cause data missing; (3) During the metering process, due to the accuracy of the detection instrument or external influences, there are abnormal values in the collected data, and the data missing caused by the missing abnormal values during the data processing process. In summary, in order to better utilize power metering data, such as using the collected power metering data for power load prediction or big data analysis of power consumption habits of power users, it is necessary to complete the missing data. At present, there are existing methods for completing missing data based on the simplest interpolation method, such as linear interpolation, cubic spline interpolation and Hermite interpolation. The above methods have the advantages of easy implementation and simple calculation, but with the increase of missing data, the completion effect is not satisfactory. Machine learning-based methods, such as using support vector machines to construct a missing data completion framework, are also not suitable for situations with a large amount of missing data.
[0003] The prior art discloses a load data completion method based on Kmeans and T-LSTM, including the following steps: constructing a data model; training the data of K load intervals to obtain corresponding K data models; regularly obtaining the load data of the day to be completed; calculating the average value of the load data of the day; obtaining the corresponding data model according to the average value; inputting the load data to be completed into the corresponding data model, and calculating the completed complete load data. The technical solution needs to use the load data of the day to classify the load data with similar characteristics into one category. When there is indeed a lot of load data on a certain day, it is impossible to accurately complete the data. Summary of the invention
[0004] In order to overcome the defect of the above-mentioned prior art that the data cannot be accurately supplemented when a large amount of data is missing, the present invention provides an electric energy metering data supplement method and system based on a generative adversarial network, which can accurately supplement the data when a large amount of data is missing to obtain complete data.
[0005] In order to solve the above technical problems, the technical solution of the present invention is as follows:
[0006] The present invention provides an electric energy metering data completion method based on a generative adversarial network, comprising:
[0007] S1: Obtain the complete historical data set and missing data set of electric energy metering data in matrix form;
[0008] S2: Build a generative adversarial network and use the complete historical data set to train the generative adversarial network to obtain a trained generative adversarial network;
[0009] S3: Generate a mask matrix based on the location of missing data in the missing data set;
[0010] S4: preprocess the missing data set to obtain a preprocessed missing data set;
[0011] S5: Input the preprocessed missing data set and mask matrix into the trained generative adversarial network to obtain the initial completed data set;
[0012] S6: Process the initial completed data set, and use the processed initial completed data set to supplement the missing data set to obtain a final completed data set.
[0013] Preferably, in step S3, the specific method of generating a mask matrix according to the position of missing data in the missing data set is:
[0014] The dimension of the mask matrix M is the same as that of the missing data set X, and the elements it contains are composed of 0 and 1. If the element x in the i-th row and j-th column of the missing data set X is ij When missing, the element m corresponding to the i-th row and j-th column in the mask matrix M is ij The value is set to 0; if the element x in the i-th row and j-th column of the data set X is missing ij When there is no missing, the element m corresponding to the i-th row and j-th column in the mask matrix M is ij Set the value to 1.
[0015] Preferably, the specific method of step S4 is:
[0016] S4.1: Normalize the missing data set X to obtain the normalized missing data set X * ;
[0017] S4.2: Generate random numbers between 0 and 1 to fill in the missing data set X after normalization * The missing data in the data is obtained to obtain the preprocessed missing data set
[0018] Preferably, in step S4.1, the specific method for normalizing the data in the missing data set is:
[0019] The data in the missing data set X is normalized in the time dimension. The normalization formula is:
[0020]
[0021] In the formula, x ij Indicates the missing element in the i-th row and j-th column of the data set X. min(X[:,j]) indicates the minimum value of the j-th column of the missing data set X. max(X[:,j]) indicates the maximum value of the j-th element of the missing data set X.
[0022] Preferably, the specific method of step S4.2 is:
[0023] Use the random matrix generator to generate a random matrix Z, the dimension of which is the same as the mask matrix M, and the element z ij are all random numbers between 0 and 1; the dimension of the all-1 matrix is the same as the dimension of the mask matrix M. After subtracting the dimension of the all-1 matrix from the mask matrix M, the Hadamard product operation is performed with the random matrix Z to make the element position in the random matrix Z coincide with the missing data set X after normalization. * The missing data in the data correspond one by one, and the preprocessed missing data set is formed after addition. It is expressed as:
[0024]
[0025] Where Z represents a random matrix, ⊙ represents the Hadamard product, and 1 represents an all-1 matrix.
[0026] Preferably, the specific process of step S5 is:
[0027] S5.1: Generative adversarial networks include generators and discriminators; the preprocessed missing data sets After concatenating with the mask matrix M, it is input into the generator to generate the supplementary matrix X g , using the supplementary matrix X g Elements in Replace missing data sets after preprocessing The element z in ij , the generator outputs the initial completed data set
[0028] S5.2: Generate a hint matrix H using a random number generator and complete the initial dataset After being concatenated with the prompt matrix H, it is input into the discriminator. At the same time, the mask matrix M is also input into the discriminator, and the discriminator outputs the probability matrix P;
[0029] S5.3: Based on the preprocessed missing data set Supplementary Matrix X g, mask matrix M, probability matrix P construct the loss function of the generator and discriminator, calculate the loss value of the loss function, and use the back propagation algorithm to update the network parameters of the generator and discriminator;
[0030] S5.4: Repeat steps S5.1-S5.3 until the generative adversarial network converges, and output the initial completed data set corresponding to the generative adversarial network convergence
[0031] The generator and discriminator in the generative adversarial network have the same network structure, both are three-layer fully connected neural networks, and the input dimension is 2L t , the output dimension is L t , where L t Represents the length of the missing data set in matrix form along the time dimension.
[0032] Preferably, in step S5.3, the loss function of the generator is:
[0033]
[0034] The loss function of the discriminator is:
[0035] L D =∑[M i log(P i )+(1-M i )log(1-P i )]
[0036] In the formula, G represents the generator, Represents the supplementary matrix X g The i-th row element in Represents the missing data set after preprocessing The i-th row element in M i represents the i-th row element in the mask matrix M, P i Represents the i-th row element in the probability matrix P.
[0037] Preferably, in step S6, the initial completed data set is processed as a denormalization operation, and the specific method is:
[0038] Complete the elements in the initial dataset Perform denormalization processing, the denormalization formula is:
[0039]
[0040] In the formula, min(X[:,j]) represents the minimum value of the j-th column element in the missing data set X, and max(X[:,j]) represents the maximum value of the j-th column element in the missing data set X. The elements in the initial completed data set are all normalized. After the denormalization operation is performed using the minimum and maximum values of the j-th column elements in the missing data set X used in the normalization process, the numerical range of the data can adapt to the missing data set.
[0041] Preferably, in step S2, the specific method of obtaining the trained generative adversarial network is:
[0042] S2.1: Randomly remove data from the complete historical data set to convert it into a missing data set;
[0043] S2.2: Generate a mask matrix based on the location of missing data in the missing data set;
[0044] S2.3: preprocess the missing data set to obtain a preprocessed missing data set;
[0045] S2.4: Use the preprocessed missing data set and mask matrix to train the constructed generative adversarial network until the generative adversarial network converges, save the corresponding network parameters, and obtain the trained generative adversarial network.
[0046] The present invention also provides an electric energy metering data completion system based on a generative adversarial network, comprising:
[0047] A data acquisition module, used to acquire complete historical data sets and missing data sets of electric energy metering data in matrix form;
[0048] The network training module is used to build a generative adversarial network and train the generative adversarial network using a complete historical data set to obtain a trained generative adversarial network.
[0049] A matrix generation module generates a mask matrix according to the location of missing data in the missing data set;
[0050] A preprocessing module, used to preprocess the missing data set to obtain a preprocessed missing data set;
[0051] The initial completion module is used to input the preprocessed missing data set and mask matrix into the trained generative adversarial network to obtain the initial completed data set;
[0052] The final completion module is used to process the initial completion data set, and use the processed initial completion data set to supplement the missing data set to obtain the final completion data set.
[0053] Compared with the prior art, the technical solution of the present invention has the following beneficial effects:
[0054] The present invention collects the complete historical data set and the missing data set of the electric energy metering data at the same time, uses the complete historical data set to train the constructed generative adversarial network, fully exploits and utilizes the hidden statistical information features of the complete historical data, and the obtained trained generative adversarial network has the hidden statistical information features of the complete historical data, which can adapt to the situation where a large amount of data is missing; then a mask matrix is generated according to the position of the missing data, combined with the pre-processed missing data set, and the trained generative adversarial network is input together to obtain an initial completed data set, and the missing data set is supplemented after processing to obtain an accurate final completed data set. The present invention can accurately supplement the data when there is a lot of missing data to obtain complete data. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 This is a flow chart of a method for completing electric energy metering data based on a generative adversarial network as described in Example 1;
[0056] Figure 2 This is a data schematic diagram of a method for completing electric energy metering data based on a generative adversarial network as described in Example 2;
[0057] Figure 3 This is a structural diagram of an electric energy metering data completion system based on a generative adversarial network described in Example 3. DETAILED DESCRIPTION
[0058] The drawings are for illustrative purposes only and should not be construed as limiting the present patent;
[0059] In order to better illustrate the present embodiment, some parts in the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product;
[0060] It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0061] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0062] Example 1
[0063] This embodiment provides a method for completing electric energy metering data based on a generative adversarial network. Figure 1 As shown, including:
[0064] S1: Obtain the complete historical data set and missing data set of electric energy metering data in matrix form;
[0065] S2: Build a generative adversarial network and use the complete historical data set to train the generative adversarial network to obtain a trained generative adversarial network;
[0066] S3: Generate a mask matrix based on the location of missing data in the missing data set;
[0067] S4: preprocess the missing data set to obtain a preprocessed missing data set;
[0068] S5: Input the preprocessed missing data set and mask matrix into the trained generative adversarial network to obtain the initial completed data set;
[0069] S6: Process the initial completed data set, and use the processed initial completed data set to supplement the missing data set to obtain a final completed data set.
[0070] In the specific implementation process, the complete historical data set and the missing data set are collected at the same time, and the constructed generative adversarial network is trained using the complete historical data set, and the hidden statistical information features of the complete historical data are fully mined and utilized. The trained generative adversarial network has the hidden statistical information features of the complete historical data and can adapt to the situation where a large amount of data is missing; then a mask matrix is generated according to the position of the missing data in the missing data set, and the missing data set is preprocessed at the same time, and the preprocessed missing data set and the mask matrix are input into the trained generative adversarial network together to obtain an initial completed data set; the initial completed data set is processed, and then the missing data set is supplemented to obtain an accurate final completed data set. This embodiment can accurately supplement the data when there is a lot of missing data to obtain complete data.
[0071] Example 2
[0072] This embodiment provides a method for completing electric energy metering data based on a generative adversarial network, which is particularly applicable to electric energy metering data, including:
[0073] S1: Obtain the complete historical data set and missing data set of electric energy metering data in matrix form;
[0074] S2: Build a generative adversarial network and use the complete historical data set to train the generative adversarial network to obtain a trained generative adversarial network;
[0075] The generative adversarial network consists of a generator and a discriminator. The generator and the discriminator have the same network structure, both of which are three-layer fully connected neural networks, and the input dimension is 2L. t , the output dimension is L t , where L t Represents the length of the missing data set in matrix form in the time dimension; the training process is as follows:
[0076] S2.1: Randomly remove data from the complete historical data set to convert it into a missing data set;
[0077] S2.2: Generate a mask matrix based on the location of missing data in the missing data set;
[0078] The dimension of the mask matrix M is the same as that of the missing data set X, and the elements it contains are composed of 0 and 1. If the element x in the i-th row and j-th column of the missing data set X is ij When missing, the element m corresponding to the i-th row and j-th column in the mask matrix M is ij The value is set to 0; if the element x in the i-th row and j-th column of the data set X is missing ij When there is no missing, the element m corresponding to the i-th row and j-th column in the mask matrix M is ij The value is set to 1;
[0079] S2.3: Preprocess the missing data set to obtain the preprocessed missing data set, specifically:
[0080] S2.3.1: Normalize the missing data set X to obtain the normalized missing data set X * ; Normalize the data in the missing data set X in the time dimension. The normalization formula is:
[0081]
[0082] In the formula, x ij represents the element in the i-th row and j-th column of the missing dataset X, min(X[:,j]) represents the minimum value of the element in the j-th column of the missing dataset X, and max(X[:,j]) represents the maximum value of the element in the j-th column of the missing dataset X;
[0083] S2.3.2: Generate random numbers between 0 and 1 to fill in the missing data set X after normalization * The missing data in the data is obtained to obtain the preprocessed missing data set Specifically:
[0084] Use the random matrix generator to generate a random matrix Z, the dimension of which is the same as the mask matrix M, and the element z ij are all random numbers between 0 and 1; the dimension of the all-1 matrix is the same as the dimension of the mask matrix M. After subtracting the dimension of the all-1 matrix from the mask matrix M, the Hadamard product operation is performed with the random matrix Z to make the element position in the random matrix Z coincide with the missing data set X after normalization. * The missing data in the data correspond one by one, and the preprocessed missing data set is formed after addition. It is expressed as:
[0085]
[0086] Where Z represents a random matrix, ⊙ represents the Hadamard product, and 1 represents an all-1 matrix.
[0087] S2.4: Use the preprocessed missing data set and mask matrix to train the constructed generative adversarial network until the generative adversarial network converges, save the corresponding network parameters, and obtain the trained generative adversarial network. Specifically:
[0088] S2.4.1: Preprocess the missing data set After concatenating with the mask matrix M, it is input into the generator to generate the supplementary matrix X g , using the supplementary matrix X g Elements in Replace missing data sets after preprocessing The element z in ij , the generator outputs the initial completed data set
[0089] S2.4.2: Generate a hint matrix H using a random number generator and complete the initial dataset After being concatenated with the prompt matrix H, it is input into the discriminator. At the same time, the mask matrix M is also input into the discriminator, and the discriminator outputs the probability matrix P;
[0090] S2.4.3: Based on the preprocessed missing data set Supplementary Matrix X g , mask matrix M, probability matrix P construct the loss function of the generator and discriminator, calculate the loss value of the loss function, and use the back propagation algorithm to update the network parameters of the generator and discriminator;
[0091] The loss function of the generator is:
[0092]
[0093] The loss function of the discriminator is:
[0094]
[0095] In the formula, G represents the generator, Represents the supplementary matrix X g The i-th row element in Represents the missing data set after preprocessing The i-th row element in M i represents the i-th row element in the mask matrix M, P i Represents the i-th row element in the probability matrix P;
[0096] During the training of the generative adversarial network, the calculation , all elements in the i-th row are selected for calculation.
[0097] S2.4.4: Repeat steps S2.4.1-S2.4.3 until the generative adversarial network converges, save the corresponding network parameters, and obtain the trained generative adversarial network.
[0098] S3: Figure 2 As shown, a mask matrix is generated according to the position of missing data in the missing data set;
[0099] The dimension of the mask matrix M is the same as that of the missing data set X, and the elements it contains are composed of 0 and 1. If the element x in the i-th row and j-th column of the missing data set X is ij When missing, the element m corresponding to the i-th row and j-th column in the mask matrix M is ij The value is set to 0; if the element x in the i-th row and j-th column of the data set X is missing ij When there is no missing, the element m corresponding to the i-th row and j-th column in the mask matrix M is ij The value is set to 1;
[0100] S4: Preprocess the missing data set to obtain the preprocessed missing data set, specifically:
[0101] S4.1: Normalize the missing data set X to obtain the normalized missing data set X * ;
[0102] The data in the missing data set X is normalized in the time dimension. The normalization formula is:
[0103]
[0104] In the formula, x ij represents the element in the i-th row and j-th column of the missing dataset X, min(X[:,j]) represents the minimum value of the j-th column of the missing dataset X, and max(X[:,j]) represents the maximum value of the j-th element in the missing dataset X;
[0105] S4.2: Generate random numbers between 0 and 1 to fill in the missing data set X after normalization * The missing data in the data is obtained to obtain the preprocessed missing data set
[0106] Use the random matrix generator to generate a random matrix Z, the dimension of which is the same as the mask matrix M, and the element z ij are all random numbers between 0 and 1; the dimension of the all-1 matrix is the same as the dimension of the mask matrix M. After subtracting the dimension of the all-1 matrix from the mask matrix M, the Hadamard product operation is performed with the random matrix Z to make the element position in the random matrix Z coincide with the missing data set X after normalization. * The missing data in the data correspond one by one, and the preprocessed missing data set is formed after addition. It is expressed as:
[0107]
[0108] Where Z represents a random matrix, ⊙ represents a Hadamard product, and 1 represents an all-1 matrix;
[0109] S5: Input the preprocessed missing data set and mask matrix into the trained generative adversarial network to obtain the initial completed data set, specifically:
[0110] S5.1: Preprocess the missing data set After concatenating with the mask matrix M, it is input into the generator to generate the supplementary matrix X g , using the supplementary matrix X g Elements in Replace missing data sets after preprocessing The element z in ij , the generator outputs the initial completed data set
[0111] S5.2: Generate a hint matrix H using a random number generator and complete the initial dataset After being concatenated with the prompt matrix H, it is input into the discriminator. At the same time, the mask matrix M is also input into the discriminator, and the discriminator outputs the probability matrix P;
[0112] S5.3: Based on the preprocessed missing data set Supplementary Matrix X g , mask matrix M, probability matrix P construct the loss function of the generator and discriminator, calculate the loss value of the loss function, and use the back propagation algorithm to update the network parameters of the generator and discriminator;
[0113] The loss function of the generator is:
[0114]
[0115] The loss function of the discriminator is:
[0116] L D =∑[M i log(P i )+(1-M i )log(1-P i )]
[0117] In the formula, G represents the generator, Represents the supplementary matrix X g The i-th row element in Represents the missing data set after preprocessing The i-th row element in M i represents the i-th row element in the mask matrix M, Pi Represents the i-th row element in the probability matrix P;
[0118] During the data completion process, calculation When , only the elements in the i-th row that are not missing are taken for calculation;
[0119] S5.4: Repeat steps S5.1-S5.3 until the generative adversarial network converges, and output the initial completed data set corresponding to the generative adversarial network convergence
[0120] S6: Process the initial completed data set, and use the processed initial completed data set to supplement the missing data set to obtain a final completed data set.
[0121] The initial completion data set is processed as a denormalization operation, the specific method is:
[0122] Complete the elements in the initial dataset Perform denormalization processing, the denormalization formula is:
[0123]
[0124] In the formula, min(X[:,j]) represents the minimum value of the j-th column element in the missing data set X, and max(x[:,j]) represents the maximum value of the j-th column element in the missing data set X. The elements in the initial completed data set are all normalized. After the denormalization operation is performed using the minimum and maximum values of the j-th column elements in the missing data set X used in the normalization process, the numerical range of the data can adapt to the missing data set.
[0125] In the specific implementation process, the method provided in this embodiment includes two processes: pre-training and completion; randomly remove part of the acquired complete historical data, artificially construct a missing data set, use the same steps as the completion process to process the artificially constructed missing data set, train the constructed generative adversarial network, and update the network parameters by calculating the loss value of the loss function until the network converges, obtain the corresponding initial completed data set, and then obtain the final completed data set; calculate the root mean square error of the final completed data set, repeat the above steps until the root mean square error is less than the preset error threshold, save the network parameters of the generated adversarial network at this time, and obtain the trained generative adversarial network. At this time, the generated adversarial network has the hidden statistical information characteristics of the complete historical data and can adapt to the situation where a large amount of data is missing; then the natural missing data set is processed in the same way and input into the trained generative adversarial network. Finally, the final completed data set obtained is accurate and complete, and conforms to the hidden statistical information characteristics of the historical data. S2.5: Process the initial completed data set, use the processed initial completed data set to supplement the missing data set, and obtain the final completed data set X out ; Calculate the root mean square error of the final completed data set to evaluate the completion effect. The calculation formula of the root mean square error is:
[0126]
[0127] The following is a verification of the electric energy metering data completion method based on the generative adversarial network proposed in this embodiment based on the public data set ElectricityLoadDiagrams20112014 Data Set:
[0128] ElectricityLoadDiagrams20112014 Data Set is a data set in which 321 customers recorded their kilowatt-hour electricity consumption every 15 minutes from 2011 to 2014. In this embodiment, the data is converted to reflect hourly consumption, and the data from January 2014 to June 2014 is taken as the complete historical data, and the data from September 2014 is taken as the missing data set. The complete historical data is eliminated with 20% data missing, and the constructed generative adversarial network is trained using the above method. After the training is completed, the missing data set is completed, and the calculated root mean square error is 0.064437, and the completion result is accurate.
[0129] Example 3
[0130] This embodiment provides an energy metering data completion system based on a generative adversarial network. Figure 3 As shown, including:
[0131] A data acquisition module, used to acquire complete historical data sets and missing data sets of electric energy metering data in matrix form;
[0132] The network training module is used to build a generative adversarial network and train the generative adversarial network using a complete historical data set to obtain a trained generative adversarial network.
[0133] A matrix generation module generates a mask matrix according to the location of missing data in the missing data set;
[0134] A preprocessing module, used to preprocess the missing data set to obtain a preprocessed missing data set;
[0135] The initial completion module is used to input the preprocessed missing data set and mask matrix into the trained generative adversarial network to obtain the initial completed data set;
[0136] The final completion module is used to process the initial completion data set, and use the processed initial completion data set to supplement the missing data set to obtain the final completion data set.
[0137] The same or similar reference numerals correspond to the same or similar components;
[0138] The terms used in the drawings to describe positional relationships are only used for illustrative purposes and should not be construed as limiting this patent;
[0139] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the claims of the present invention.
Claims
1. A method for completing electric energy metering data based on a generative adversarial network, characterized in that: include: S1: Obtain the complete historical data set and missing data set of electric energy metering data in matrix form; S2: Construct a generative adversarial network and train it using the complete historical data set to obtain a trained generative adversarial network, including: S2.1: Randomly remove data from the complete historical data set to convert it into a missing data set; S2.2: Generate a mask matrix based on the location of missing data in the missing data set; S2.3: preprocess the missing data set to obtain a preprocessed missing data set; S2.4: Use the preprocessed missing data set and mask matrix to train the constructed generative adversarial network until the generative adversarial network converges, save the corresponding network parameters, and obtain the trained generative adversarial network; S3: Generate a mask matrix based on the location of missing data in the missing data set; S4: preprocess the missing data set to obtain a preprocessed missing data set; S5: Input the preprocessed missing data set and mask matrix into the trained generative adversarial network to obtain the initial completed data set; S6: Process the initial completed data set, and use the processed initial completed data set to supplement the missing data set to obtain a final completed data set.
2. The method for completing electric energy metering data based on a generative adversarial network according to claim 1, characterized in that: In step S3, the specific method of generating a mask matrix according to the position of missing data in the missing data set is: The dimension of the mask matrix M is the same as that of the missing data set X, and the elements it contains are composed of 0 and 1. If the element x in the i-th row and j-th column of the missing data set X is ij When missing, the element m corresponding to the i-th row and j-th column in the mask matrix M is ij The value is set to 0; If the element x in row i and column j of the dataset X is missing ij When there is no missing, the element m corresponding to the i-th row and j-th column in the mask matrix M is ij Set the value to 1.
3. The method for completing electric energy metering data based on a generative adversarial network according to claim 2, characterized in that: The specific method of step S4 is: S4.1: Normalize the missing data set X to obtain the normalized missing data set X * ; S4.2: Generate random numbers between 0 and 1 to fill in the missing data set X after normalization * The missing data in the data is obtained to obtain the preprocessed missing data set 4. The method for completing electric energy metering data based on a generative adversarial network according to claim 3 is characterized in that: In step S4.1, the specific method for normalizing the data in the missing data set is: The data in the missing data set X is normalized in the time dimension. The normalization formula is: In the formula, x ij represents the missing element in the i-th row and j-th column of the data set X, min(X[:,j]) represents the minimum value of the j-th column of the missing data set X, and max(X[:,j]) represents the maximum value of the j-th column of the missing data set X.
5. The method for completing electric energy metering data based on a generative adversarial network according to claim 4 is characterized in that: The specific method of step S4.2 is: Use the random matrix generator to generate a random matrix Z, the dimension of which is the same as the mask matrix M, and the element z ij All are random numbers between 0 and 1; The dimension of the all-1 matrix is the same as that of the mask matrix M. After subtracting the dimension of the all-1 matrix from the mask matrix M, a Hadamard product operation is performed with the random matrix Z to make the element positions in the random matrix Z coincide with the missing data set X after normalization. * The missing data in the data correspond one by one, and the preprocessed missing data set is formed after addition. It is expressed as: Where Z represents a random matrix, ⊙ represents the Hadamard product, and 1 represents an all-1 matrix.
6. The method for completing electric energy metering data based on a generative adversarial network according to claim 5, characterized in that: The specific process of step S5 is as follows: S5.1: Generative adversarial networks include generators and discriminators; the preprocessed missing data sets After concatenating with the mask matrix M, it is input into the generator to generate the supplementary matrix X g , using the supplementary matrix X g Elements in Replace missing data sets after preprocessing The element z in ij , the generator outputs the initial completed data set S5.2: Generate a hint matrix H using a random number generator and complete the initial dataset After being concatenated with the prompt matrix H, it is input into the discriminator. At the same time, the mask matrix M is also input into the discriminator, and the discriminator outputs the probability matrix P; S5.3: Based on the preprocessed missing data set Supplementary Matrix X g , mask matrix M, probability matrix P construct the loss function of the generator and discriminator, calculate the loss value of the loss function, and use the back propagation algorithm to update the network parameters of the generator and discriminator; S5.4: Repeat steps S5.1-S5.3 until the generative adversarial network converges, and output the initial completed data set corresponding to the generative adversarial network convergence 7. The method for completing electric energy metering data based on a generative adversarial network according to claim 6, characterized in that: In step S5.3, the loss function of the generator is: The loss function of the discriminator is: L D =∑[M i log(P i )+(1-M i )log(1-P i )] In the formula, G represents the generator, Represents the supplementary matrix X g The i-th row element in Represents the missing data set after preprocessing The i-th row element in M i represents the i-th row element in the mask matrix M, P i Represents the i-th row element in the probability matrix P.
8. The method for completing electric energy metering data based on a generative adversarial network according to claim 7, characterized in that: In step S6, the initial completed data set is processed as a denormalization operation, and the specific method is: Complete the elements in the initial dataset Perform denormalization processing, the denormalization formula is: Where min(X[:,j]) represents the minimum value of the j-th column element in the missing data set X, and max(X[:,j]) represents the maximum value of the j-th element in the missing data set X.
9. An electric energy metering data completion system based on generative adversarial network, characterized in that: include: A data acquisition module, used to acquire complete historical data sets and missing data sets of electric energy metering data in matrix form; The network training module is used to build a generative adversarial network and train the generative adversarial network using a complete historical data set to obtain a trained generative adversarial network, including: Randomly remove data from the complete historical data set to convert it into a missing data set; Generate a mask matrix based on the location of missing data in the missing data set; Preprocess the missing data set to obtain a preprocessed missing data set; The preprocessed missing data set and mask matrix are used to train the constructed generative adversarial network until the generative adversarial network converges, and the corresponding network parameters are saved to obtain the trained generative adversarial network; A matrix generation module generates a mask matrix according to the location of missing data in the missing data set; A preprocessing module, used to preprocess the missing data set to obtain a preprocessed missing data set; The initial completion module is used to input the preprocessed missing data set and mask matrix into the trained generative adversarial network to obtain the initial completed data set; The final completion module is used to process the initial completion data set, and use the processed initial completion data set to supplement the missing data set to obtain the final completion data set.
Citation Information
Cited By
Bearing fault data non-uniform resampling method based on attention generative adversarial network
CN121188480A
