Unbalanced power data classification and grading equalization method based on CatGAN model

Through the unbalanced power data classification and grading equalization method based on the CatGAN model, the data distribution deviation and model instability problems are solved, high-quality and diverse power data samples are generated, and the data sets are balanced, which improves the performance of the classification and grading model.

CN119066199APending Publication Date: 2024-12-03GUANGXI POWER GRID CORP
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411192904.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

When the prior art deals with unbalanced data classification and grading, it is easy to lead to data distribution deviation and model training instability, and the diversity and quality of generated samples are insufficient, making it difficult to effectively improve the balance of the data set.

Method used

Using the unbalanced power data classification and grading equalization method based on the CatGAN model, the evolution and variation of the generator ensure the quality and quality of the generated samples Optimization in diversity and merge it into the original dataset to balance the dataset.

Benefits of technology

On the basis of not deviating from the original data distribution, a variety of controllable categories and high-quality power data samples are generated, which solves the problem of data imbalance, improves the correct classification ability of the classification and grading model, and reduces the instability of the model and Pattern collapse problem.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119066199A_ABST
    Figure CN119066199A_ABST
Patent Text Reader

Abstract

The invention discloses an unbalanced electric power data classification and grading equalization method based on a CatGAN model, and is used for solving the problem that data distribution of electric power data is unbalanced in the aspects of categories and grades when a large model for electric power data classification and grading is trained. According to the method, based on a CatGAN model, power data samples with higher quality can be generated, and power data samples of various controllable categories can be automatically generated, so that the problem that when a large model for power data classification and grading is trained, the training effect of the model is influenced by data imbalance in the aspect of a data set is solved; according to the method, the problem that original data distribution is deviated when a traditional mode such as resampling is used for solving the problem of data imbalance can be solved, and compared with other types of text data generation models, some auxiliary components and some learning strategies are removed from the model, so that the generation efficiency is improved. And it is ensured that the model can automatically generate a plurality of controllable types of high-quality power data samples.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of text processing algorithms, and specifically relates to a method for classifying, grading and balancing unbalanced power data based on a CatGAN model. Background Art

[0002] In data classification and grading tasks, the problem of imbalanced data classification and grading is a common challenge, especially in practical applications such as fraud detection and disease diagnosis. Imbalanced data refers to the situation in which the number of samples in some categories or levels is significantly greater than that in other categories or levels in a data set, which will lead to a decline in the performance of traditional classification algorithms because the algorithms tend to favor the majority category and ignore the minority category. To solve the problem of imbalanced data classification and grading, a variety of methods have been proposed. The processing methods at the data level mainly include resampling techniques, such as oversampling and undersampling. Oversampling increases the number of minority category samples by duplicating or synthesizing them, while undersampling balances the data set by reducing the majority category samples. However, these methods may introduce new problems, such as oversampling may lead to marginalization of data distribution, and undersampling may lose valuable information. At the algorithm level, a variety of classification algorithms such as decision trees, K-nearest neighbors, support vector machines (SVMs), naive Bayes, and classification algorithms based on artificial neurons are widely used. Among them, classification algorithms based on neural networks are favored due to their powerful nonlinear fitting capabilities. However, these methods usually require large-scale and well-distributed data sets for pre-training, so the problem of data imbalance is still an obstacle to their application.

[0003] In recent years, categorical text generation models such as improved models based on GAN (Generative Adversarial Network) have been used to generate minority category samples to alleviate the data imbalance problem. However, these models usually contain too many auxiliary components and learning strategies, which increases the difficulty of training and may lead to model collapse problems, so that the generated sample data is limited in diversity and quality.

[0004] In summary, although there are many methods that attempt to solve the problem of imbalanced data classification and grading, there are still many challenges in maintaining data distribution, improving sample diversity and quality, and ensuring the stability of the training process. Therefore, this patent proposes a method for balancing imbalanced power data classification and grading based on the CatGAN model, aiming to effectively improve the balance of the data set without deviating from the original data distribution, and solve the problems of training instability and model collapse in the category text generation model. Summary of the invention

[0005] In order to solve the above technical problems, the present invention proposes a method for classifying, grading and balancing unbalanced power data based on the CatGAN model. This method effectively solves the problem that the original data set deviates from the original data distribution when the traditional method improves the balance of unbalanced data. At the same time, it also overcomes the instability and pattern collapse problems of most category data generation models during training, thereby ensuring that the model can automatically generate a variety of controllable categories and high-quality power data samples.

[0006] In order to achieve the above technical effects, the present invention is implemented by the following technical solutions: a method for classifying and balancing unbalanced power data based on the CatGAN model, comprising the following steps:

[0007] S1: Data preprocessing: first perform word segmentation on the real power data and build the corresponding vocabulary;

[0008] S2: Position information encoding: In position encoding, we first need to create a zero matrix to store the position encoding. The shape of the tensor is [max_len, embedding_dim], where max_len represents the maximum sequence length and embedding_dim represents the dimension of word embedding. Then, we need to generate the position index, generate a one-dimensional vector from 0 to max_len, and add a dimension to it to ensure that each index is a separate row. Then, we calculate a decay factor to make the position encoding change more smoothly in higher dimensions. Then, we apply the sine and cosine functions to the indexes of even and odd positions respectively, generate an alternating sine or cosine value for each position index, and fill it into the specified position in the predefined encoding tensor. Then, we add another dimension to the obtained position encoding tensor to facilitate the addition of the actual word embedding.

[0009] S3: Word embedding: First, the input vocabulary index is converted into a word embedding vector. After conversion, the word embedding vector is scaled to prevent gradient explosion or gradient vanishing during training. Then the word embedding vector is merged with the position information encoding obtained in S2. Finally, the word embedding vector with position information is input into the Transformer encoder to learn the dependencies in the sequence and perform context-aware feature extraction.

[0010] S4: Build a generator: The generator includes an embedding layer, a RMC layer, and a fully connected output layer.

[0011] S5: constructing a recognizer: the recognizer includes an embedding layer, a convolution layer, a pooling layer, a high-speed network layer, and a fully connected output layer;

[0012] S6: Adversarial training of the generator and the discriminator, as well as the evolution and mutation of the generator; including the pre-training phase of the generator and the adversarial training phase of the generator and the discriminator;

[0013] S7: Final deployment: After several rounds of adversarial training, the training of the generator and the recognizer tends to a balanced state; at this time, the samples generated by the generator are optimal, and the generated minority class samples are merged into the original unevenly distributed data set to balance the data set and achieve data set balancing. The merged and balanced data set is then used to train the classification and grading model, thereby improving the classification and grading model's ability to correctly classify and grade.

[0014] Furthermore, in S4,

[0015] S4.1: The embedding layer includes word embedding and category embedding, where the word embedding vocabulary index is converted into an embedding vector with position information, and the category embedding converts the category label into an embedding vector and expands it to a sequence length that matches the word embedding. These embedding vectors are concatenated and the dimension becomes [batch_size, seq_len, embedding_dim*2], which is used as the input of the subsequent RMC layer;

[0016] S4.2: The vector of word embedding and category embedding is processed by RMC layer to extract the features of the sequence; its tensor dimension will be converted from [batch_size, seq_len, embedding_dim*2] to [batch_size, seq_len, hidden_dim]; hidden_dim represents the number of hidden units in the RMC layer; the output tensor obtained by the RMC layer will be used as the input of the fully connected output layer, and then the fully connected output layer will convert the output of RMC into the predicted distribution of the vocabulary size for the final prediction; its dimension conversion is from the input dimension [batch_size, seq_len, embedding_dim*2] to the output dimension [batch_size*seq_len, hidden_dim];

[0017] Furthermore, in S5,

[0018] S5.1: The embedding layer converts the input one-hot encoding into a word embedding vector. It converts the input tensor of dimension [batch_size, seq_len, vocab_size] into a tensor of dimension [batch_size, 1, seq_len, embedding_dim], where vocab_size represents the vocabulary size. This tensor is the input of the convolutional layer, which segments and performs convolution operations on the embedding dimension.

[0019] S5.2: After the convolutional layer is processed, the input tensor is subjected to a max pooling operation to reduce the feature dimension. The dimension of the pooled result is [batch_size, num_filters, num_rep], where num_filters represents the number of convolution kernels (or filters) used in each convolutional layer, and num_rep represents the number of parts into which the input embedding vector is split in the embedding dimension. After the pooling layer, the tensor reaches the highway network layer, which allows some inputs to pass directly through and some inputs to be processed through its internal gating mechanism.

[0020] S5.3: After that, the features are mapped to the scores of each sequence through the fully connected layer, and finally the discriminator outputs an independent score for each sample.

[0021] Furthermore, in S6,

[0022] S6.1: During the training phase, the generator is trained using maximum likelihood estimation [MLE]. After multiple preset training cycles, the generator learns to produce grammatically and structurally correct text. After the training is completed, the state of the generator is saved and loaded as the initial state of pre-training. After the generator completes pre-training, it enters an adversarial training cycle with the discriminator, including the evolution and mutation of the generator, the training and optimization of the discriminator, and the evaluation of the generator.

[0023] S6.2: During the training of the generator, the best parent generator state is loaded to make the generator evolve and mutate. The mutated generator generates fake data for the discriminator to evaluate, and then the parameters of the generator are updated according to the feedback of the discriminator. There are two evolution strategies: standard or with temperature adjustment according to the temperature parameter;

[0024] S6.3: During the training of the discriminator, the real data and the fake data generated by the generator are used to train the discriminator, and its accuracy in distinguishing real and fake data is improved by optimizing the parameters of the discriminator; after each round of adversarial training, the performance of all current generators is evaluated, and the generator with the best performance is selected for further training;

[0025] S6.4: During evaluation, the evaluation method is called to evaluate the performance of the generator, and the evaluation is performed from two aspects: generation quality and diversity. Finally, the score is combined into a total score, which comprehensively considers the quality and diversity of the generated samples. After that, a selection phase is entered, which updates the best generator state based on the obtained evaluation score. The state of the best generator will be saved for the next round of training or final deployment.

[0026] The beneficial effects of the present invention are:

[0027] The present invention proposes a balancing method for unbalanced power data classification and grading, which is used to solve the problem of unbalanced data distribution in categories and levels of power data when training a large model for power data classification and grading; this method is based on the CatGAN model. In addition to generating higher-quality power data samples, it can also automatically generate a variety of controllable category power data samples, thereby solving the problem of data imbalance in the data set affecting the training effect of the model when training a large model for power data classification and grading.

[0028] Secondly, compared with other categories of text data generation models, the model in the present invention removes some auxiliary components and some learning strategies, which greatly reduces the instability of the model during training and the problem of pattern collapse, thereby ensuring that the model can automatically generate a variety of controllable categories of high-quality power data samples; then these generated minority category data are added to the original unbalanced dataset, which alleviates the imbalance of the dataset and overcomes the deviation from the original data distribution that occurs when other methods alleviate the imbalance of the dataset. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solution of the embodiment of the present invention, the drawings required for describing the embodiment are briefly introduced below.

[0030] Figure 1 It is a generator architecture diagram of the unbalanced power data classification, grading and equalization method based on the CatGAN model;

[0031] Figure 2 It is a diagram of the architecture of an identifier for the unbalanced power data classification, grading and equalization method based on the CatGAN model;

[0032] Figure 3 It is an adversarial training graph of the unbalanced power data classification, grading and equalization method based on the CatGAN model. DETAILED DESCRIPTION

[0033] Example

[0034] The present invention discloses a method for classifying, grading and balancing unbalanced power data based on a CatGAN model, which mainly includes the following steps:

[0035] S1: Data preprocessing: First perform word segmentation on the real power data and build the corresponding vocabulary.

[0036] S2: Position information encoding: We introduced the transformer encoder in the process of word embedding, but its self-attention mechanism itself does not have the ability to handle the position of elements in the sequence. Therefore, we add a unique encoding to each word to enable the model to utilize the position information of the word, thereby achieving the purpose of representing the position of each word in the sentence.

[0037] S3: Word embedding: Here we first need to convert the input vocabulary index into a word embedding vector. After converting it into a word embedding vector, in order to prevent gradient explosion or gradient vanishing during training, we need to scale the obtained word embedding vector. Then merge the obtained word embedding vector with the position information encoding obtained in the above step 2. Finally, input the word embedding vector with position information into the Transformer encoder to learn the dependencies in the sequence and perform context-aware feature extraction.

[0038] S4: Build a generator: Here we build a generator for generating sample data. It mainly consists of a word embedding layer that generates word vectors for text information and category information, an RMC layer that processes sequence data, and a fully connected output layer. We define forward propagation, single-step generation, and sample generation methods in the generator class. The forward propagation method mainly completes data processing, forward calculation of the model, and predicts probability distribution. The single-step generation method is used for text generation in a dynamic environment, mainly to achieve single-step interactive text generation. The sample generation method generates sample sequences by cyclically calling the single-step generation method.

[0039] The generator mainly consists of three components: embedding layer, RMC layer and fully connected output layer. The first is the embedding layer, which includes two parts: word embedding and category embedding. The word embedding vocabulary index is converted into an embedding vector with position information. The category embedding converts the category label into an embedding vector and extends it to the sequence length that matches the word embedding. These embedding vectors are concatenated and the dimension becomes [batch_size, seq_len, embedding_dim*2] as the input of the subsequent RMC layer. The operation of the RMC layer is mainly to process the vector that combines the word embedding and the category embedding, extract the features of the sequence, and its tensor dimension will be converted from [batch_size, seq_len, embedding_dim*2] to [batch_size, seq_len, hidden_dim], where hidden_dim represents the number of hidden units in the RMC layer. The output tensor obtained in the RMC layer will be used as the input of the fully connected output layer. In the fully connected output layer, it converts the output of RMC into the predicted distribution of the vocabulary size for final prediction. Its dimension conversion is from the input dimension [batch_size, seq_len, embedding_dim*2] to the output dimension [batch_size*seq_len, hidden_dim]. In this class, a single-step forward propagation function for executing the generation process and a function for generating a specified number of text sequences are also defined.

[0040] S5: Constructing the recognizer: Here we construct a recognizer for distinguishing the authenticity of sample data and conducting adversarial training with the generator. It mainly consists of a word embedding layer, a convolution layer, a high-speed network layer, and a fully connected layer. In the word embedding layer, we convert the one-hot encoding vector obtained after preprocessing the text data and category information into a vector of the embedding dimension to help capture the semantic information and grammatical characteristics of the vocabulary. Then we reach the convolution layer. The main purpose of this layer is to extract features. We use convolution kernels of different sizes to extract sequence features and use the maximum pooling method to reduce the dimension of the features. After convolution and pooling the word embedding vector, we use the output of the convolution layer as the input of the high-speed network layer. There are two main purposes for adding the high-speed network layer here. One is to control the information flow during the model learning process, and the other is to alleviate the gradient vanishing or gradient exploding problems that occur during the model learning process. In this layer, we use the gating mechanism to determine the proportion of information that flows directly to the output and the proportion of information that needs to be processed through nonlinear transformation. Finally, these two parts are combined to obtain the final output of this layer. Finally, we pass the output of this layer through the final fully connected layer to obtain a single score for each sequence.

[0041] The constructed recognizer mainly includes embedding layer, convolution layer, pooling layer, high-speed network layer and fully connected output layer. The main function of the embedding layer is to convert the input one-hot encoding into a word embedding vector. It converts the input tensor with dimension [batch_size, seq_len, vocab_size] into a tensor with dimension [batch_size, 1, seq_len, embedding_dim], where vocab_size] represents the vocabulary size. This tensor is the input of the convolution layer. The function of this layer is to segment and perform convolution operations on the embedding dimension. The so-called segmentation is to let each convolution kernel only focus on a part of the input embedding to achieve the purpose of capturing sequence features from different aspects. After the convolution layer is processed, the input tensor is subjected to the maximum pooling operation to reduce the feature dimension. The dimension of the result after pooling is [batch_size, num_filters, num_rep], where num_filters represents the number of convolution kernels (or filters) used in each convolution layer, and num_rep represents how many parts the input embedding vector is divided into on the embedding dimension. After the pooling layer, the tensor reaches the highway layer, which allows some inputs to pass directly through its internal gating mechanism and some inputs to be processed. In this way, the network can learn when to allow information to pass directly and when to process it, which helps solve the gradient disappearance problem and improve the model's ability to learn complex data. Then, after passing through the fully connected layer, the features are mapped to the scores of each sequence, and finally the discriminator outputs an independent score for each sample.

[0042] S6: Adversarial training of generator and discriminator and evolution and mutation of generator: Adversarial training of generator and discriminator is a dynamic optimization process, which involves continuous evaluation, mutation and selection of generator. There are two main components involved here, namely generator and discriminator. The purpose of adversarial training is to make the generator generate fake data as close to the real data as possible to achieve the final effect of deceiving the discriminator. During the training process, the two models compete with each other, and finally the generator continuously learns how to better deceive the discriminator, while the discriminator strives to become better at identifying fake data. Their adversarial training can be roughly divided into the pre-training stage of the generator and the adversarial training stage of the generator and the discriminator. First, in the pre-training stage, this stage is for the generator. The maximum likelihood estimation [MLE] training will be performed on the generator, and the parameters of the generator will be optimized using real data. The purpose is to allow the generator to produce more reasonable output without adversarial pressure. After the pre-training phase of the generator is completed, the adversarial training phase of the generator and the discriminator begins. In adversarial training, the generator and the discriminator are trained alternately, where the discriminator is trained using real data and fake data generated by the generator, and then the parameters of the discriminator are optimized and updated according to the discriminator loss. Its goal is to minimize the discrimination error. During the training of the generator, we load the best parent generator state, and then the generator will evolve and mutate. Then the mutated generator will generate fake data for the discriminator to evaluate, and then the parameters of the generator will be updated according to the feedback of the discriminator. After each round of adversarial training, the performance of all current generators will be evaluated, and the best performing generator will be selected to continue training. During the evaluation, the evaluation method is called to evaluate the performance of the generator. In terms of performance evaluation, it is mainly evaluated from the two aspects of generation quality and diversity, and finally merged into a total score to comprehensively consider the quality and diversity of the generated samples. Then enter a selection phase, which will update the best generator state according to the obtained evaluation score. The state of the best generator will be saved for the next round of training or final deployment.

[0043] S7: Final deployment: After several rounds of adversarial training, the training of the generator and the discriminator will tend to a balanced state. At this time, both have reached the best state. The samples generated by the generator are optimal in both quality and diversity. Therefore, the minority class samples generated at this time can be merged into the original unevenly distributed data set to balance the data set and achieve the balance of the data set. Then, the merged balanced data set is used to train the classification and grading model, thereby improving the ability of the classification and grading model to correctly classify and grade.

[0044] Specifically in this embodiment, in S2, because the transformer encoder is introduced in the process of word embedding, in the position encoding, it is first necessary to create a zero matrix to store the position encoding. The shape of the tensor is [max_len, embedding_dim], where max_len represents the maximum sequence length, and embedding_dim represents the dimension of word embedding. After that, it is necessary to generate a position index, generate a one-dimensional vector from 0 to max_len, and add a dimension to it, ensuring that each index is a separate row, and then calculate an attenuation factor to make the position encoding change in a higher dimension smoother, and then apply sine and cosine functions to the indexes of even and odd positions respectively, generate an alternating sine or cosine value for each position index, and fill it into the specified position in the predefined encoding tensor. Then add another dimension to the obtained position encoding tensor to facilitate the addition of actual word embeddings.

[0045] The word embedding in S3 can be summarized into three parts. The first part is the word embedding layer used to convert the vocabulary index into a word vector. The second part is the position encoding in step 2, which is to add position information to the word embedding vector obtained in the first part, so that the model can understand the relative position of the word in the sequence. The third part is the Transformer encoder layer. First, in the first part, the vocabulary index is converted to a word vector using self.token_embedding, and the dimension conversion is to convert from the input dimension [batch_size, seq_len] to [batch_size, seq_len, embedding_dim] where batch_size is the batch size, seq_len is the length of each input sequence, and embedding_dim represents the dimension of each word embedding vector. The second is the position encoding part, in which the content in step 2 above is executed. The last part is the Transformer encoder processing. In this part, a multi-layer Transformer encoder is used to process the word embedding vector with position information added to learn the deep relationship between words in the sequence. The Transformer encoder processing does not change the input dimension, and its output dimension is consistent with the input dimension, which is [batch_size, seq_len, embedding_dim].

[0046] Through the above steps, the present invention effectively solves the problem that the original data set deviates from the original data distribution when the traditional method improves the balance of unbalanced data. It also overcomes the instability and pattern collapse problems of most category data generation models during training, thereby ensuring that the model can automatically generate a variety of controllable categories of high-quality power data samples.

[0047] The preferred embodiments of the present invention disclosed above are only used to help explain the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described.

Claims

1. A method for classifying, grading and balancing unbalanced power data based on CatGAN model, characterized in that: The following steps are involved: S1: Data preprocessing: first perform word segmentation on the real power data and build the corresponding vocabulary; S2: Position information encoding: In position encoding, we first need to create a zero matrix to store the position encoding. The shape of the tensor is [max_len, embedding_dim], where max_len represents the maximum sequence length and embedding_dim represents the dimension of word embedding. Then, we need to generate the position index, generate a one-dimensional vector from 0 to max_len, and add a dimension to it to ensure that each index is a separate row. Then, we calculate a decay factor to make the position encoding change more smoothly in higher dimensions. Then, we apply the sine and cosine functions to the indexes of even and odd positions respectively, generate an alternating sine or cosine value for each position index, and fill it into the specified position in the predefined encoding tensor. Then, we add another dimension to the obtained position encoding tensor to facilitate the addition of the actual word embedding. S3: Word embedding: First, the input vocabulary index is converted into a word embedding vector. After conversion, the word embedding vector is scaled to prevent gradient explosion or gradient vanishing during training. Then the word embedding vector is merged with the position information encoding obtained in S2. Finally, the word embedding vector with position information is input into the Transformer encoder to learn the dependencies in the sequence and perform context-aware feature extraction. S4: Build a generator: The generator includes an embedding layer, a RMC layer, and a fully connected output layer. S5: constructing a recognizer: the recognizer includes an embedding layer, a convolution layer, a pooling layer, a high-speed network layer, and a fully connected output layer; S6: Adversarial training of the generator and the discriminator, as well as the evolution and mutation of the generator; including the pre-training phase of the generator and the adversarial training phase of the generator and the discriminator; S7: Final deployment: After several rounds of adversarial training, the training of the generator and the recognizer tends to a balanced state; At this point, the samples generated by the generator are optimal. At the same time, the generated minority class samples are merged into the original unevenly distributed data set to balance the data set and achieve equalization of the data set. The merged and balanced data set is then used to train the classification and grading model, thereby improving the classification and grading model's ability to correctly classify and grade.

2. According to claim 1, a method for classifying and balancing unbalanced power data based on CatGAN model, characterized in that: In S4, S4.1: The embedding layer includes word embedding and category embedding, where the word embedding vocabulary index is converted into an embedding vector with position information, and the category embedding converts the category label into an embedding vector and expands it to a sequence length that matches the word embedding. These embedding vectors are concatenated and the dimension becomes [batch_size, seq_len, embedding_dim*2], which is used as the input of the subsequent RMC layer; S4.2: The RMC layer processes the vectors of merged word embedding and category embedding to extract the features of the sequence; its tensor dimension is converted from [batch_size, seq_len, embedding_dim*2] to [batch_size, seq_len, hidden_dim]; hidden_dim represents the number of hidden units in the RMC layer; the output tensor obtained by the RMC layer is then used as the input of the fully connected output layer, which converts the output of RMC into the predicted distribution of the vocabulary size for final prediction; Its dimension conversion is from the input dimension [batch_size, seq_len, embedding_dim*2] to the output dimension [batch_size*seq_len, hidden_dim].

3. According to the CatGAN model-based unbalanced power data classification and balancing method of claim 1, it is characterized in that: In S5, S5.1: The embedding layer converts the input one-hot encoding into a word embedding vector. It converts the input tensor of dimension [batch_size, seq_len, vocab_size] into a tensor of dimension [batch_size, 1, seq_len, embedding_dim], where vocab_size represents the vocabulary size. This tensor is the input of the convolutional layer, which segments and performs convolution operations on the embedding dimension. S5.2: After the convolutional layer is processed, the input tensor is subjected to a max pooling operation to reduce the feature dimension. The dimension of the pooled result is [batch_size, num_filters, num_rep], where num_filters is the number of convolution kernels used in each convolutional layer and num_rep is the number of parts into which the input embedding vector is split in the embedding dimension. After the pooling layer, the tensor reaches the high-speed network layer, which allows some inputs to pass directly and some to be processed through its internal gating mechanism. S5.3: After that, the features are mapped to the scores of each sequence through the fully connected layer, and finally the discriminator outputs an independent score for each sample.

4. According to the CatGAN model-based unbalanced power data classification and balancing method of claim 1, it is characterized in that: In S6, S6.1: In the training phase, the generator is trained using maximum likelihood estimation. After a number of preset training cycles, the generator learns to produce grammatically and structurally correct text. After the training is completed, the state of the generator is saved and loaded as the initial state of the pre-training. After the generator completes pre-training, it enters the adversarial training cycle with the discriminator, including the evolution and mutation of the generator, the training and optimization of the discriminator, and the evaluation of the generator; S6.2: During the training of the generator, the best parent generator state is loaded to make the generator evolve and mutate. The mutated generator generates fake data for the discriminator to evaluate, and then the parameters of the generator are updated according to the feedback of the discriminator. There are two evolution strategies: standard or with temperature adjustment according to the temperature parameter; S6.3: During the training of the discriminator, the real data and the fake data generated by the generator are used to train the discriminator, and its accuracy in distinguishing real and fake data is improved by optimizing the parameters of the discriminator; after each round of adversarial training, the performance of all current generators is evaluated, and the generator with the best performance is selected for further training; S6.4: During evaluation, the evaluation method is called to evaluate the performance of the generator, and the evaluation is performed from two aspects: generation quality and diversity. Finally, the score is combined into a total score, which comprehensively considers the quality and diversity of the generated samples. After that, a selection phase is entered, which updates the best generator state based on the obtained evaluation score. The state of the best generator will be saved for the next round of training or final deployment.

Citation Information

Patent Citations

  • Automatic text generation method and device

    CN108334497A

  • Image data balancing and classifying method based on CGAN

    CN111553424A

  • Emotional dialogue generation method based on improved generative adversarial network

    CN115795011A