A method for filling in thermal metrology data based on dual-channel generative adversarial networks
By constructing a dual-channel generative adversarial network and utilizing the GRU layer to process heat metering and auxiliary data, combined with the Wasserstein loss function and weight pruning strategy, the problem of inaccurate heat metering data interpolation in existing technologies is solved, achieving more efficient data filling and improving the stability of the heating system and the accuracy of data analysis.
Patent Information
- Application Number
- CN202411568412.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-11-05
AI Technical Summary
Existing heat metering data interpolation methods have limited effectiveness when dealing with large amounts of high-dimensional data with nonlinear characteristics. They cannot effectively capture complex nonlinear patterns, resulting in large deviations in interpolation results and affecting the stability and efficiency of the heating system.
A dual-channel generative adversarial network (GAN) approach is adopted. By constructing a dual-channel GAN including a generator and a discriminator, a GRU layer is used to process calorimetric data and auxiliary data. The data is imputed by combining the Wasserstein loss function and a weight pruning strategy to ensure the stability and accuracy of the generated data.
It significantly improves the accuracy of missing data imputation, captures the time dimension information of heat metering data, generates imputation data that conforms to time logic, improves the operating efficiency of heating systems and the accuracy of data analysis, and avoids the pattern collapse problem during training.
Smart Images

Figure CN119357172B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of thermal energy management and heating system data processing, specifically relating to a method for filling in heat metering data based on a dual-channel generative adversarial network (GRU-WGAN), which aims to solve the problem of missing heat metering data in heating systems and improve data integrity and analysis accuracy. Background Technology
[0002] Heat metering data plays a crucial role in the efficient operation and optimization of heating systems. Since the accuracy and completeness of heat metering data directly affect load forecasting, energy consumption optimization, and operational management of the heating system, ensuring data continuity and integrity is particularly important for improving the reliability and efficiency of the heating system. In the current data acquisition process of heating systems, data loss often occurs due to equipment failures, communication interruptions, and other reasons. This not only hinders subsequent data analysis and system optimization but also negatively impacts the overall stability and heating efficiency of the heating system.
[0003] With the increasing data dimensions and complex application scenarios in heating systems, addressing the lack of heat metering data and ensuring the stable and efficient operation of heating systems has become a pressing problem in the heating field. Traditional heat metering data interpolation methods, such as mean interpolation, linear interpolation, and regression models, while effective in handling small amounts of missing data, prove quite limited when dealing with large amounts of high-dimensional, nonlinear data. They often ignore the time-series characteristics of the data, fail to capture complex nonlinear patterns, leading to significant deviations in the interpolation results, and consequently affecting the system's decision-making and optimization performance.
[0004] In recent years, with the rapid development of technologies such as deep learning and generative adversarial networks (GANs), researchers have begun to try using more advanced algorithms to solve the problem of interpolation of thermometric data. GANs effectively learn the complex distribution of data and generate samples similar to real data through adversarial training between the generator and discriminator. However, GAN models also face problems such as training instability and pattern collapse in practical applications, especially when dealing with high-dimensional and complex data, where it is often difficult to guarantee the stability and quality of the generated data. Summary of the Invention
[0005] The purpose of this invention is to provide a method for filling in heat metering data based on a dual-channel generative adversarial network, which can achieve more accurate missing value filling and significantly improve the operating efficiency of the heating system and the accuracy of data analysis.
[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0007] A method for filling in heat metering data based on a dual-channel generative adversarial network, the method comprising:
[0008] The heat metering data is acquired and reconstructed into a third-order heat metering tensor, and the weather and date information is acquired and reconstructed into an auxiliary third-order tensor.
[0009] The location of each missing value in the heat measurement data with missing data is marked, and the marked locations are recorded in a Boolean matrix to obtain a mask matrix. The value of the marked location in the mask matrix is 0, and the value of the unmarked location is 1.
[0010] A dual-channel generative adversarial network is constructed, comprising a generator and a discriminator. The generator includes two independent branches and a shared branch. The two independent branches are a heat metering data channel based on a bidirectional GRU layer and an auxiliary data channel based on a bidirectional GRU layer, respectively. The shared branch includes a first activation function, a fully connected layer, and a second activation function connected in sequence. The discriminator is constructed based on a convolutional neural network.
[0011] The third-order tensor of heat measurement and the auxiliary third-order tensor are simultaneously input into the generator. Based on the mask matrix, the output of the generator is used to fill in the data of the third-order tensor of heat measurement. The generated sample after data filling is input into the discriminator. The discriminator loss function is calculated based on the output of the discriminator. The weights of the discriminator are updated and pruned based on the discriminator loss function.
[0012] After multiple rounds of discriminator updates, the generator loss function is calculated by using the probability of the generated sample being judged as real data by the discriminator as the minimum probability. The generator weights are then updated based on the generator loss function.
[0013] The heat measurement data filling is completed based on the trained generator and the mask matrix of the heat measurement data to be filled.
[0014] Several alternative methods are provided below, but they are not intended as additional limitations on the overall solution above. They are merely further additions or optimizations. Provided there are no technical or logical contradictions, each alternative method can be combined individually with respect to the overall solution above, or multiple alternative methods can be combined with each other.
[0015] Preferably, the acquisition of heat metering data is reconstructed into a third-order heat metering tensor, including:
[0016] Acquire heat metering data, including supply temperature, return temperature, and instantaneous flow rate;
[0017] Normalize the heat metering data;
[0018] The normalized heat metering data is divided into days and hours. The heat metering data for each 24-hour period is reconstructed into a third-order tensor, denoted as the heat metering third-order tensor. The shape of the heat metering third-order tensor is (days, 24, meter_features), where days represents the number of days, 24 represents the number of hours in each day, and meter_features represents the divided heat metering data.
[0019] Preferably, the acquisition of weather and date information is reconstructed into an auxiliary third-order tensor, including:
[0020] Weather information includes temperature, humidity, wind speed, wind direction, and solar radiation; date information includes day type, weekday, and heating period.
[0021] Temperature, humidity, wind speed, wind direction, and solar radiation are normalized, and the day type, weekday, and heating period are converted into binary vectors using One-Hot encoding.
[0022] The normalized weather information and the date information converted into binary vectors are divided into days and hours. The weather and date information for each 24 hours are reconstructed into a third-order tensor, denoted as the auxiliary third-order tensor. The shape of the auxiliary third-order tensor is (days, 24, aux_features), where days represents the number of days, 24 represents the number of hours in each day, and aux_features represents the divided weather and date information.
[0023] Preferably, the processing procedure for the shared branch of the generator is as follows:
[0024] The heat extraction metering data channel and the auxiliary data channel at the time step The feature representations are respectively and First, regarding the features and The features after fusion Represented as:
[0025]
[0026] Next, the fused features Nonlinear transformation is performed using the first activation function:
[0027]
[0028] In the formula, Indicates time step The first activation feature, This represents the first activation function, which is the ReLU activation function.
[0029] Set the weight matrix of the fully connected layer as follows: and bias term are Then time step Output representation of fully connected layers Defined as:
[0030]
[0031] Subsequently, the output of the fully connected layer is processed through a second activation function. A nonlinear mapping is performed, as follows:
[0032] In the formula, Indicates time step The second activation feature, This represents the second activation function, which is the hyperbolic tangent activation function.
[0033] Preferably, the step of inputting the third-order heat measurement tensor into the generator, and using the generator's output to fill in the data of the third-order heat measurement tensor based on the mask matrix, includes:
[0034]
[0035] In the formula, This represents the generated sample after data imputation. Represents the mask matrix. This represents the third-order tensor of the heat metering input to the generator. This represents the generator's output, i.e., the time step. The second activation feature.
[0036] Preferably, the discriminator includes four convolutional layers, a flattening layer and a fully connected layer connected in sequence, and each convolutional layer is followed by a normalization layer, a ReLU activation function and an average pooling layer.
[0037] Preferably, the discriminator loss function is as follows:
[0038]
[0039] In the formula, Let the discriminator loss function be... Expressing expectations, Represents real samples Distribution from real data Real samples This represents the third-order thermal tensor corresponding to thermal data that does not have missing data in the training data. Indicates the generation of samples Distribution generated by the generator , This indicates that the discriminator is effective against real samples. The output score, This indicates that the discriminator evaluates the generated samples. The output score;
[0040] The generator loss function is as follows:
[0041]
[0042] In the formula, This represents the generator loss function.
[0043] Preferably, the weights of the cropping discriminator include:
[0044] For each weight of the discriminator The cropping strategy is as follows:
[0045]
[0046] In the formula, This indicates a cropping operation. This represents the pruning threshold and the weights after pruning. Limited to the range Within.
[0047] The present invention provides a method for filling in heat measurement data based on a dual-channel generative adversarial network, which has the following advantages compared with the prior art:
[0048] (1) The present invention can simultaneously model heat measurement data and auxiliary data in multiple dimensions through the design of dual-channel generative adversarial network, which significantly improves the accuracy of missing data filling; by combining the generator of GRU for data generation, it can better capture the information of the time dimension in heat measurement data to achieve better generation effect.
[0049] (2) This invention uses external weather information and date information as auxiliary inputs, which are then directly input into the generator. This method is more suitable for capturing complex time dependencies and helps to generate fill data that conforms to time logic.
[0050] (3) This invention addresses the problem of mode collapse during training by using the Wasserstein loss function and weight pruning strategy for the discriminator. Furthermore, it optimizes the generator by using feedback from the discriminator to ensure that the data generated by the model is stable and close to the distribution of real data. Attached Figure Description
[0051] Figure 1 This is a schematic diagram of a heat measurement data filling method based on a dual-channel generative adversarial network according to the present invention;
[0052] Figure 2 This is a model diagram of the generator of the present invention;
[0053] Figure 3 This is a model diagram of the discriminator of the present invention. Detailed Implementation
[0054] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0055] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to limit the invention.
[0056] To address the complexity of heat metering data and the limitations of existing methods, this invention proposes a heat metering data imputation method based on a dual-channel generative adversarial network (GRU). The dual-channel structure not only processes heat metering data but also integrates external weather information and date features, fully utilizing the interrelationships between time series and multidimensional features. By employing the Wasserstein loss function, the model's stability is improved, and problems such as model collapse are effectively avoided. Furthermore, this invention, through its dual-channel GRU structure, can better capture the short-term and long-term dependencies of heat metering data, thereby achieving more accurate missing value imputation and significantly improving the operating efficiency of the heating system and the accuracy of data analysis.
[0057] like Figure 1 As shown, this embodiment of a method for filling in heat measurement data based on a dual-channel generative adversarial network includes the following steps:
[0058] Step 1: Construct dual-channel data: Obtain heat metering data and reconstruct it into a heat metering third-order tensor, and obtain weather information and date information and reconstruct it into an auxiliary third-order tensor.
[0059] The heat metering data channel comes from the heating database and mainly includes information such as supply water temperature, return water temperature, and instantaneous flow rate. The weather data in the auxiliary data channel comes from NASA's public dataset and includes information such as air temperature, precipitation, and solar radiation. In this embodiment, a dual-channel input data structure is first constructed for the heat metering data and auxiliary data of the heating system to provide high-quality input data for the subsequent generative adversarial network model.
[0060] During the data construction process, heat metering data of the heating system were acquired and processed, including supply temperature (°C), return temperature (°C), and instantaneous flow rate (…). These data represent the core heat demand and heating efficiency within the system. To improve the efficiency and accuracy of data processing, the data is segmented by day and hour to construct time-series features. Specifically, the heat metering data for each 24-hour period is reconstructed into a third-order tensor, denoted as the heat metering third-order tensor. The shape of the heat metering third-order tensor is (days, 24, meter_features), where days represents the number of days, 24 represents the number of hours per day, and meter_features represents the heat metering data features. This structured data representation ensures that the model effectively captures the short-term and long-term dependencies in the heat metering data.
[0061] This embodiment also extracts weather information (including temperature, humidity, wind speed, wind direction, and solar radiation) and date information (including day type, weekday, and heating period). This auxiliary data is closely related to heat metering data and can affect system operation and users' heat demand. To enable the model to accurately understand the effects of these external factors, the auxiliary data is also segmented by day and hour, constructed as a time series, denoted as an auxiliary third-order tensor. The shape of the auxiliary third-order tensor is (days, 24, aux_features), where aux_features represents all weather and date features.
[0062] In the data preprocessing of this implementation example, a mask matrix is constructed to mark missing values in the data to ensure that the model can focus on generating missing value imputation results during model training. Specifically, the method involves identifying the specific locations of missing values in the calorimetric data, marking the location of each missing value, and recording the marked locations in a Boolean matrix to obtain the mask matrix. In the mask matrix, the value of the marked locations is 0, and the value of the unmarked locations is 1.
[0063] Furthermore, a normalization method was used to scale the weather information in the heat measurement data and auxiliary data to the [0,1] interval, eliminating dimensional differences between different features and ensuring data consistency. For discrete features such as date information, One-Hot encoding was used to process them, converting the category information into a binary vector that the computer can recognize, ensuring that the model can fully understand the impact of date features on the heating system. Table 1 shows the rules for converting discrete category information.
[0064] Table 1. Rules for converting discrete category information
[0065] data Value One-Hot encoding Daily Type Weekdays, holidays, and weekends 001,010,100 Week Monday to Sunday 0000001,0000010…1000000 Heating period Early / late heating season, middle heating season 10,01
[0066] Through the above steps, this embodiment successfully constructed a dual-channel data structure, enabling the model to simultaneously learn the internal variation patterns of heat measurement data and the external influences of auxiliary data, providing sufficient feature information support for subsequent data filling and generation.
[0067] Step 2: Construct a dual-channel generative adversarial network. The dual-channel generative adversarial network includes a generator and a discriminator. The generator contains two independent branches and one shared branch. The two independent branches are a heat metering data channel based on a bidirectional GRU layer and an auxiliary data channel based on a bidirectional GRU layer, respectively. The shared branch includes a first activation function, a fully connected layer and a second activation function connected in sequence. The discriminator is constructed based on a convolutional neural network.
[0068] Step 2.1, GRU generator construction.
[0069] (1) Heat metering data channel (independent branch).
[0070] The heat metering data channel is specifically designed to process heat metering data in the heating system, including key variables such as supply temperature and return temperature. To capture the time dependence of this data, this embodiment designs a two-layer GRU (Gated Cyclic Unit). This structure can dynamically learn the time-series characteristics of the heat metering data and extract dynamic changes in the data in a time-step-wise manner.
[0071] like Figure 2 This is the generator model diagram. The input to the heat metering data channel is a third-order tensor of shape (days, 24, meter_features), where days represents the number of days, 24 represents the time step (hour) per day, and meter_features represents the number of features in the heat metering data. First, for each time step... Take the third-order tensor of the heat metering of the input generator. In GRU layer computation, it is denoted as The hidden state of the previous time step Perform a linear transformation and calculate the update gate. and the ResetGate The specific calculation method is as follows:
[0072] The formula for updating the door is:
[0073]
[0074] in, and These represent the weight matrices for the input data and the hidden states, respectively. For bias terms, This is the Sigmoid activation function.
[0075] The calculation method for resetting the door is as follows:
[0076]
[0077] in, and Here are the weight matrices for the input and hidden states. To reset the door's bias. Update the door. Controlling the current time step Hidden state To what extent is the previous time step preserved? The information, and reset the door This determines the hidden state. How much information needs to be forgotten?
[0078] By using the reset gate, the hidden state of the previous time step is adjusted, and the candidate hidden state (CandidateHiddenState) is calculated. The calculation method is as follows:
[0079]
[0080] Among them, symbols This indicates element-wise multiplication. and These are the weight matrices for the input and the hidden state, respectively. This is a bias term. A reset gate is introduced. The model is able to selectively forget the previous moment. This allows for more effective adaptation to complex time series changes by utilizing the information within the data.
[0081] Hidden state at the current time step From the hidden state of the previous moment With candidate hidden states By updating the door Linear weighting yields:
[0082]
[0083] Among them, the update door The candidate hidden state is determined. Compared to the previous hidden state The weighting ratio is adjusted to flexibly control the information flow and memory between time steps. After two layers of GRU processing, the output of the heat metering data channel is mapped to a time series tensor of shape (days, 24, hidden_dim).
[0084] (2) Auxiliary data channel (independent branch).
[0085] Similar to the heat metering data channel, the auxiliary data channel processes auxiliary features derived from external environmental conditions (such as weather data, date information, etc.). These auxiliary data have a significant impact on the heat metering data, and therefore require a separate GRU channel for processing.
[0086] The auxiliary data channel employs a two-layer GRU structure. Its input is a tensor of shape (days, 24, aux_features), where aux_features represents external environmental features (such as temperature, humidity, wind speed, etc.). To maintain structural consistency with the heat metering data channel, the auxiliary data channel uses the same GRU layer design, with each layer containing 128 hidden units. Figure 2 The input data dimension of the auxiliary data channel is 12+5, where 12 represents the dimension of discrete data and 5 represents the dimension of weather information.
[0087] The core calculation steps of the auxiliary data channel are consistent with those of the heat metering data channel, including gate update, gate reset, candidate hidden state, and hidden state update. For the time step... Auxiliary data input The method for calculating and updating the gate is the same as that for the heat metering data channel:
[0088]
[0089] The calculation method for resetting the door is as follows:
[0090]
[0091] Among them, in the auxiliary data channel , , Let represent the weight matrix and bias term of the update gate, respectively. , , This represents the weight matrix and bias term of the reset gate. Reset gate The hidden state of the previous moment was determined. The extent to which the information in the current time step affects the current time step.
[0092] The formula for calculating the candidate hidden state after resetting the gate is as follows:
[0093]
[0094] The final formula for updating the hidden state of the auxiliary data is:
[0095]
[0096] After two layers of GRU processing, the output shape of the auxiliary data channel is a time series tensor of (days, 24, hidden_dim), where hidden_dim represents the feature dimension of each time step.
[0097] (3) Fusion and generation of channel features, feature transformation and output generation (shared branch).
[0098] After extracting time-series features from the heat metering data channel and the auxiliary data channel respectively, the two are summed point-by-point along their feature dimensions to generate a fused comprehensive feature representation. Specifically, the heat metering data channel and the auxiliary data channel are set at time steps... The feature representations are respectively and First, regarding the features and The features after fusion Represented as:
[0099]
[0100] This point-by-point summation fusion method effectively combines the dynamic characteristics of heat measurement data and auxiliary data, enabling the model to capture the complex correlation between heat measurement data and the external environment. Then, the fused features undergo a nonlinear transformation using the ReLU activation function:
[0101]
[0102] In the formula, Indicates time step The first activation feature, This represents the first activation function, which is the ReLU activation function.
[0103] After passing through the ReLU activation function, the features are fused. The data is input into the fully connected layer and mapped to the output dimension of the original heat measurement data. The weight matrix of the fully connected layer is set as follows: and bias term are Then time step Output representation of fully connected layers Defined as:
[0104]
[0105] Subsequently, the output of the fully connected layer is nonlinearly mapped using the hyperbolic tangent activation function (Tanh) to ensure that the generated data is within the normalization range:
[0106]
[0107] In the formula, Indicates time step The second activation feature, This represents the second activation function, which is the hyperbolic tangent activation function.
[0108] Finally, the generator's output is filtered through a mask matrix. Compared with the original input data This approach combines methods to fill in missing values only at their locations. The specific definition is as follows:
[0109]
[0110] In the formula, This represents the generated sample after data imputation. Represents the mask matrix. This represents the third-order tensor of the heat metering input to the generator. This represents the generator's output, i.e., the time step. The second activation feature. Through the above operations, the generator's final output only makes a reasonable estimate of the missing data, while preserving the positions of the non-missing data.
[0111] by Figure 2 Taking the data input dimension shown in the figure as an example, the data transmission process is explained. The shape of the third-order tensor of the heat metering data channel of the input generator is 32*24*1. After passing through the bidirectional GRU layer, the shape of the output feature is 32*24*128. The shape of the third-order tensor of the heat metering of the auxiliary data channel of the input generator is 32*24*(12+5). After passing through the bidirectional GRU layer, the shape of the output feature is 32*24*128. The two output features are fused and processed by the first activation function to obtain an output feature shape of 32*24*128. Then, after passing through the fully connected layer, the output feature shape is 32*24*128. Finally, after passing through the second activation function, the output feature shape is 32*24*128.
[0112] Step 2.2, Discriminator Construction.
[0113] like Figure 3 The diagram shows the discriminator model. In Generative Adversarial Networks (GANs), the discriminator is primarily used to distinguish between real and generated data. By continuously optimizing its discriminative ability, it helps the generator produce more realistic samples. In this example, the discriminator design is based on a Convolutional Neural Network (CNN). It progressively extracts temporal features from the input data through multiple layers of convolution, pooling, and normalization operations, and utilizes fully connected layers for classification. The overall architecture includes three main modules: convolutional feature extraction, nonlinear activation and pooling, and feature flattening and fully connected layers. The design and implementation of each module are as follows.
[0114] (1) Convolution feature extraction and normalization.
[0115] The discriminator consists of multiple convolutional layers and batch normalization layers, designed to extract the temporal features of the input data hierarchically. The time-series data is the input to the discriminator. (Including generated samples and real samples), its shape is (days, 24, 1), where days represents the number of days, 24 represents the time step (hour) of each day, and 1 represents a single-channel feature (heating or cooling data). First, the input data goes through the first convolutional operation, by the convolution kernel... and bias terms Perform a linear transformation to output a feature map. The calculation formula is:
[0116]
[0117] in, Indicates the output feature map at position The value at that location, For the input feature map at location The value at that location, For the convolution kernel (Filter) at position The weight matrix at the location, For bias terms, and These represent the height and width of the convolution kernel, respectively.
[0118] The output of the convolutional layer is normalized through a BatchNormalization layer to accelerate model training and stabilize the network's gradients. The specific operations of BatchNormalization are as follows:
[0119]
[0120] in, Indicates the output feature map at position The normalized value at that point and These represent the mean and variance of the input data, respectively. It is a minimum constant to prevent the denominator from being zero. and These are learnable affine transformation parameters used to recover the normalized data distribution. Through the BatchNormalization operation, the model can effectively avoid gradient vanishing and gradient exploding phenomena, and improve the convergence speed during training.
[0121] (2) Nonlinear activation and pooling.
[0122] To introduce a non-linear transformation, the discriminator adds a ReLU activation function after each convolutional layer. The ReLU activation function is defined as follows:
[0123]
[0124] in, This represents the data input to the ReLU activation function. The activated feature representation retains the positive parts of the input while setting the negative parts to zero, thus introducing non-linearity. Compared to other activation functions (such as Sigmoid or Tanh), the ReLU activation function has higher computational efficiency and can effectively alleviate the gradient vanishing problem.
[0125] Subsequently, the activated feature maps undergo dimensionality reduction using a pooling layer. This embodiment employs average pooling to downsample the features. The pooling window size is set to 2×2, and the stride is 2. The formula for calculating average pooling is as follows:
[0126]
[0127] in, For the pooled feature map at the location The value at that location, This represents the collection of all elements within the pooling window. Indicates the size of the pooling window. Indicates the internal position of the pooling window The element value at that location. Pooling operations can effectively reduce the spatial dimension of the feature map, thereby reducing computation and enhancing the model's translation invariance to features.
[0128] (3) Feature flattening and full connectivity layer design.
[0129] After multiple convolutional and pooling operations, a flattening layer flattens the discriminator's feature map into a one-dimensional vector. The flattened feature representation is defined as follows: Its shape is (batch_size, feature_dim), where batch_size is the batch size and feature_dim is the length of the feature vector. The flattened feature vector is input to a fully connected layer, and its linear transformation is as follows:
[0130]
[0131] in, This is the weight matrix of the fully connected layer. For bias terms, This is the output of the fully connected layer. Through the fully connected layer, the discriminator can map high-dimensional features into scalar representations, which are used to represent the discrimination results of the input data.
[0132] (4) The output of the discriminator and classification.
[0133] After the linear transformation by the fully connected layer, the discriminator passes the output to the Sigmoid activation function to map it to the interval [0,1], thus representing the probability that the input sample is real data. The Sigmoid activation function is defined as follows:
[0134]
[0135] in, This represents the result of a linear combination of input features. This represents the output of the Sigmoid activation function. The Sigmoid activation function compresses input features into the interval [0,1] and outputs a scalar value representing a probability. Ultimately, the discriminator uses this probability value as its judgment of the authenticity of the input data, guiding the optimization direction of the generator.
[0136] In this embodiment, the discriminator is a multi-layered structure. The overall design of the discriminator includes four convolutional layers, with the number of convolutional kernels gradually increasing between layers to enhance the model's ability to represent high-dimensional features. Specifically, it includes four sequentially connected convolutional layers, a flattening layer, and a fully connected layer. Each convolutional layer is followed by a normalization layer, a ReLU activation function, and an average pooling layer.
[0137] by Figure 3 Taking the input discriminator's feature shape of 32*24*1 as an example, the propagation process is explained as follows: After the input feature passes through four convolutional layers, the shape of the feature changes to 32*24*64, 32*12*128, 32*6*256 and 32*3*512 respectively. After the feature passes through the flattening layer, the shape becomes 32*1536. Then, after passing through the fully connected layer, the shape of the output feature is 32*1.
[0138] Step 3: Input the calorimetric third-order tensor and the auxiliary third-order tensor into the generator simultaneously. Based on the mask matrix, use the generator's output to impute the data in the calorimetric third-order tensor. Input the imputed sample into the discriminator. Calculate the discriminator loss function based on its output, and update and prune the discriminator's weights based on the loss function. In this embodiment, the generator and discriminator are optimized using the Wasserstein function.
[0139] (1) Generator loss function.
[0140] The generator aims to produce samples that closely resemble the real data distribution, making it difficult for the discriminator to effectively distinguish between generated and real samples. To achieve this, the generator employs the Wasserstein loss function, defined as follows:
[0141]
[0142] in, Let represent the generator loss function, whose objective is to minimize the discriminant's discrimination score for the generated samples. Indicates the generation of samples Distribution generated by the generator , This indicates that the discriminator evaluates the generated samples. The output score (i.e. the discrimination result).
[0143] The goal of the generator is to make the discriminator For generated samples Output score The score should be as close as possible to the true data, thereby minimizing... This forces the discriminator to believe that the generated sample is indistinguishable from the real sample.
[0144] (2) The loss function of the discriminator.
[0145] In generative adversarial networks (GANs), the discriminator is optimized by maximizing its ability to distinguish between real and generated samples. To this end, this embodiment employs the Wasserstein loss function, defined by the following objective function:
[0146]
[0147] in, The discriminator loss function aims to maximize the true sample score. With generated sample scores The differences between them Expressing expectations, Represents real samples Distribution from real data Real samples This represents the third-order thermal tensor corresponding to thermal data that does not have missing data in the training data. Indicates the generation of samples Distribution generated by the generator , This indicates that the discriminator is effective against real samples. The output score, This indicates that the discriminator evaluates the generated samples. The output score.
[0148] By minimizing and maximizing The discriminator can form a clear distinction between real data and generated data, thereby improving its discrimination ability.
[0149] (3) Weight trimming of the discriminator.
[0150] To ensure the discriminator satisfies the 1-Lipschitz continuity condition, this paper incorporates a weight clipping strategy during discriminator training. Specifically, for each weight of the discriminator... The cropping strategy is as follows:
[0151]
[0152] In the formula, This indicates a cropping operation. This represents the pruning threshold and the weights after pruning. Limited to the range Within. For all weights of the discriminator, by weight Limited to the range Within this range, the discriminator's output variation can be kept within a small range, thus avoiding its drastic response to the input data and ensuring that it satisfies 1-Lipschitz continuity. Simultaneously, based on the characteristics of the calorimetric data, different weight ranges are adopted at different training stages to obtain better training results.
[0153] Step 4: After multiple rounds of discriminator updates, use the probability of the generated sample being judged as real data by the discriminator as the generator loss function, and calculate the generator loss function to update the generator weights.
[0154] This embodiment employs an alternating optimization strategy for the generator and discriminator. Specifically, in each training iteration, the generator and discriminator undergo adversarial training through alternating optimization. Specifically, the discriminator is trained multiple times before each generator update (e.g., n_critic=5) to ensure it has sufficient discriminative power to guide the generator's optimization. The generator, in turn, improves its generation performance by minimizing the probability that its generated samples are judged as real data. The entire optimization process is as follows:
[0155] (1) Update the discriminator weight parameters :use Backpropagation is performed as the objective function, and discriminator weights are pruned.
[0156] (2) Update generator weight parameters :use Backpropagation is performed as the objective function, and the generated weights are updated.
[0157] This alternating optimization strategy ensures that the generator and discriminator maintain a dynamic balance during training, thereby gradually improving the overall generation performance of the model.
[0158] Step 5: Complete the heat measurement data imputation based on the trained generator and the mask matrix of the heat measurement data to be imputed. During the inference application, heat measurement data with missing data is acquired. A mask matrix is generated based on this missing data. Then, the missing data is converted into a third-order heat measurement tensor. The converted third-order heat measurement tensor is input into the generator. Based on the mask matrix, the generator's output is used to impute the missing data in the third-order heat measurement tensor, resulting in the imputed data.
[0159] This invention provides a heat metering data imputation method based on a dual-channel generative adversarial network (GAN), which effectively addresses the problem of missing multidimensional heat metering data in heating systems. By performing dual-channel modeling of heat metering data and auxiliary data (such as weather information and date features), the method fully captures the time dependence and nonlinear characteristics of the data. This method not only improves the accuracy of missing data imputation but also ensures the stability and consistency of the generated data, effectively avoiding the pattern collapse problem in GAN training.
[0160] In the experiment simulating missing data imputation, real heating data from a residential area in northern China was used as the heat metering dataset, and NASA meteorological data was used as the auxiliary dataset. Data imputation was performed under the condition of missing simulated data. After imputation, the imputation results were evaluated using MAE (Mean Absolute Error) and MAPE (Mean Absolute Percentage Error) methods, and compared with classic imputation methods (linear imputation, KNN (K-Nearest Neighbors) and mean imputation). The results are shown in Table 2.
[0161] Table 2 Experimental Results
[0162] method Evaluation indicator MAE Evaluation Indicator MAPE Method of the present invention 0.0455 0.1200 Linear interpolation 0.5209 1.3868 KNN 0.2189 0.5939 Mean interpolation 1.9508 5.2423
[0163] The experimental results show that the present invention can effectively improve the accuracy of filling missing values in thermal measurement data through adversarial training, especially in complex multidimensional time series data scenarios.
[0164] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0165] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the appended claims.
Claims
1. A method for filling in heat measurement data based on a dual-channel generative adversarial network, characterized in that, The heat measurement data filling method based on a dual-channel generative adversarial network includes: The heat metering data is acquired and reconstructed into a third-order heat metering tensor, and the weather and date information is acquired and reconstructed into an auxiliary third-order tensor. The location of each missing value in the heat measurement data with missing data is marked, and the marked locations are recorded in a Boolean matrix to obtain a mask matrix. The value of the marked location in the mask matrix is 0, and the value of the unmarked location is 1. A dual-channel generative adversarial network is constructed, comprising a generator and a discriminator. The generator includes two independent branches and a shared branch. The two independent branches are a heat metering data channel based on a bidirectional GRU layer and an auxiliary data channel based on a bidirectional GRU layer, respectively. The shared branch includes a first activation function, a fully connected layer, and a second activation function connected in sequence. The discriminator is constructed based on a convolutional neural network. The third-order tensor of heat measurement and the auxiliary third-order tensor are simultaneously input into the generator. Based on the mask matrix, the output of the generator is used to fill in the data of the third-order tensor of heat measurement. The generated sample after data filling is input into the discriminator. The discriminator loss function is calculated based on the output of the discriminator. The weights of the discriminator are updated and pruned based on the discriminator loss function. After multiple rounds of discriminator updates, the generator loss function is calculated by using the probability of the generated sample being judged as real data by the discriminator as the minimum probability. The generator weights are then updated based on the generator loss function. The heat measurement data filling is completed based on the trained generator and the mask matrix of the heat measurement data to be filled.
2. The heat measurement data filling method based on a dual-channel generative adversarial network according to claim 1, characterized in that, The acquisition of heat metering data is reconstructed into a third-order heat metering tensor, including: Acquire heat metering data, including supply temperature, return temperature, and instantaneous flow rate; Normalize the heat metering data; The normalized heat metering data is divided into days and hours. The heat metering data for each 24-hour period is reconstructed into a third-order tensor, denoted as the heat metering third-order tensor. The shape of the heat metering third-order tensor is (days, 24, meter_features), where days represents the number of days, 24 represents the number of hours in each day, and meter_features represents the divided heat metering data.
3. The heat measurement data filling method based on a dual-channel generative adversarial network according to claim 1, characterized in that, The acquisition of weather and date information is reconstructed into an auxiliary third-order tensor, including: Weather information includes temperature, humidity, wind speed, wind direction, and solar radiation; date information includes day type, weekday, and heating period. Temperature, humidity, wind speed, wind direction, and solar radiation are normalized, and the day type, weekday, and heating period are converted into binary vectors using One-Hot encoding. The normalized weather information and the date information converted into binary vectors are divided into days and hours. The weather and date information for each 24 hours are reconstructed into a third-order tensor, denoted as the auxiliary third-order tensor. The shape of the auxiliary third-order tensor is (days, 24, aux_features), where days represents the number of days, 24 represents the number of hours in each day, and aux_features represents the divided weather and date information.
4. The heat measurement data filling method based on a dual-channel generative adversarial network according to claim 1, characterized in that, The process for handling the shared branches of the generator is as follows: The heat extraction metering data channel and the auxiliary data channel at the time step The feature representations are respectively and First, regarding the features and The features after fusion Represented as: Next, the fused features Nonlinear transformation is performed using the first activation function: In the formula, Indicates time step The first activation feature, This represents the first activation function, which is the ReLU activation function. Set the weight matrix of the fully connected layer as follows: and bias term are Then time step Output representation of fully connected layers Defined as: Subsequently, the output of the fully connected layer is processed through a second activation function. A nonlinear mapping is performed, as follows: In the formula, Indicates time step The second activation feature, This represents the second activation function, which is the hyperbolic tangent activation function.
5. The heat measurement data filling method based on a dual-channel generative adversarial network according to claim 1, characterized in that, The step of inputting the third-order heat measurement tensor into the generator, and using the generator's output to fill in the data in the third-order heat measurement tensor based on the mask matrix, includes: In the formula, This represents the generated sample after data imputation. Represents the mask matrix. This represents the third-order tensor of the heat metering input to the generator. This represents the generator's output, i.e., the time step. The second activation feature.
6. The heat measurement data filling method based on a dual-channel generative adversarial network according to claim 1, characterized in that, The discriminator comprises four convolutional layers, a flattening layer, and a fully connected layer connected in sequence, with each convolutional layer followed by a normalization layer, a ReLU activation function, and an average pooling layer.
7. The heat measurement data filling method based on a dual-channel generative adversarial network according to claim 1, characterized in that, The discriminator loss function is as follows: In the formula, Let the discriminator loss function be... Expressing expectations, Represents real samples Distribution from real data Real samples This represents the third-order thermal tensor corresponding to thermal data that does not have missing data in the training data. Indicates the generation of samples Distribution generated by the generator , This indicates that the discriminator is effective against real samples. The output score, This indicates that the discriminator evaluates the generated samples. The output score; The generator loss function is as follows: In the formula, This represents the generator loss function.
8. The heat measurement data filling method based on a dual-channel generative adversarial network according to claim 1, characterized in that, The weights of the cropping discriminator include: For each weight of the discriminator The cropping strategy is as follows: In the formula, This indicates a cropping operation. This represents the pruning threshold and the weights after pruning. Limited to the range Within.
Citation Information
Patent Citations
Missing data filling generation method based on dual-condition generative adversarial network
CN114757335A
Classification system and method based on generative adversarial network
US20220207300A1