A small sample learning method and system based on data enhancement
By constructing a multi-task adversarial learning model in the field of power operation and maintenance and dynamically adjusting the data augmentation strategy, the problem of noisy data in small sample learning is solved, and the model's recognition ability and accuracy in power operation and maintenance scenarios are improved.
Patent Information
- Application Number
- CN202411521429.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2044-10-29
AI Technical Summary
In the field of power operation and maintenance, existing few-shot learning techniques are difficult to effectively identify named entities and are far behind human classification accuracy, especially in Chinese text data, where data augmentation methods are prone to introducing noisy data.
We employ a data-augmented few-shot learning approach, combining multi-task adversarial learning and adaptive multi-strategy data augmentation strategies with knowledge from the power operation and maintenance domain to construct a multi-task adversarial learning model. We then use a power domain corpus for fine-tuning and data prediction, and dynamically adjust the weights of the augmentation strategies.
It improves the model's generalization ability and accuracy in power operation and maintenance scenarios with small sample sizes, approaching or even surpassing the performance of supervised learning models with sufficient samples.
Smart Images

Figure CN119493996B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of electric power operation and maintenance and machine learning, and particularly relates to a small sample learning method and system based on data enhancement. BACKGROUND
[0002] Under the trend of big data training model, machine learning and deep learning have achieved success in many fields, but in many application scenarios in the real world, the sample size is small or the labeled sample is small, and labeling a large number of unlabeled samples will consume a lot of manpower. How to learn with a small amount of samples has become a problem that needs to be concerned. Small sample learning aims to learn a model to solve problems through a small amount of samples. The current small sample learning technology mainly includes three kinds of model fine-tuning, data enhancement and transfer learning. With the continuous increase of unstructured text data in electric power operation and maintenance, and the special syntax and grammar structure of Chinese compared with other languages, the difficulty of named entity recognition of Chinese text is increased, and the small sample scene of electric power operation further increases the difficulty of entity recognition. Small sample learning technology has made great progress, but there is still a big gap compared with the classification accuracy of human beings. For example, the data enhancement based method is to expand or enhance the features of the small sample data set. This method can not adjust the parameters of the model, but it is easy to introduce noise data. SUMMARY
[0003] In order to solve the problems in the prior art, the present application provides a small sample learning method and system based on data enhancement, to improve the performance in the small sample scene and achieve or approach the performance of the supervised learning model under sufficient samples.
[0004] To solve the above technical problems, the present application adopts the following technical solutions.
[0005] The present application first discloses a small sample learning method based on data enhancement, which comprises the following steps:
[0006] Step 1: Collect electric power operation text data from multiple data sources and pre-process, and label the pre-processed data, the labeling including named entity recognition, relation extraction and text classification, to construct an electric power field corpus;
[0007] Step 2: Fine-tune the pre-defined pre-training language model using the electric power field corpus, train the electric power field word vector and entity vector from the electric power field corpus using the model, and integrate the electric power field word vector and entity vector into the pre-training language model;
[0008] Step 3: based on the pre-trained language model, perform named entity recognition and multi-task learning of power operation and maintenance knowledge, construct a multi-task adversarial learning model combining an adversarial learning algorithm, train the multi-task adversarial learning model using a variety of data augmentation strategies, and use the trained multi-task adversarial learning model to perform data prediction through ensemble learning and self-training.
[0009] Step 4: evaluate the model prediction results, and dynamically adjust the weights of each data augmentation strategy based on the evaluation results.
[0010] The application further includes the following preferred schemes:
[0011] The data sources include internal operation and maintenance databases of power enterprises, power operation and maintenance literature, and Internet public data; the internal operation and maintenance databases of power enterprises include equipment inspection records, fault diagnosis reports, and operation and maintenance procedures; the power operation and maintenance literature includes power industry standards, academic papers, and technical blogs; and the Internet public data includes power forums and news websites.
[0012] The preprocessed data is further labeled, which further includes:
[0013] Entities in the text are labeled through named entity recognition, including power equipment, fault types, and operating states; the relationship between entities is labeled through relationship extraction, including the relationship between equipment and faults and the relationship between faults and causes; and a category label is added to the text through text classification, including fault diagnosis reports, inspection records, and safety procedures.
[0014] The power field word vector and entity vector are further trained from the power field corpus using the model, which further includes:
[0015] Text data related to the power field is collected, a power field corpus is constructed, and a power field word vector is trained using a word vector training method; the quality of the word vector is evaluated using word similarity and word class comparison; and a knowledge graph of entities such as power equipment, fault types, and operating states is constructed. A power field entity vector is trained using a knowledge representation learning method; and the quality of the entity vector is evaluated using link prediction and triple classification.
[0016] The power field word vector and entity vector are further integrated into the pre-trained language model, which further includes:
[0017] A suitable pre-trained language model is selected as a base model, the pre-trained language model is fine-tuned using the constructed power field corpus to update the model parameters; and the trained power field word vector and entity vector are spliced with the word embedding matrix of the pre-trained language model as the input of the model.
[0018] The training of the multi-task adversarial learning model by using multiple data enhancement strategies further comprises:
[0019] Each word in the sample is matched with a power operation and maintenance field dictionary to determine a synonym set of the word; according to the word frequency, part of speech or context semantic factors of the synonym, the synonym is selected for replacement;
[0020] A pre-trained language model is used to generate a candidate replacement word list for each word in the sample according to the context; the candidate replacement word list is filtered using the power operation and maintenance knowledge base to remove words unrelated to the power operation and maintenance field; different replacement probabilities are set according to the semantic similarity or part of speech consistency of the candidate word and the replaced word;
[0021] The technical language related to the power operation and maintenance field is back translated, and then the performance of the neural machine translation model is selected for back translation, the model is fine-tuned according to the power operation and maintenance text, and the samples generated by back translation are screened to remove samples with grammatical errors and semantic inconsistencies;
[0022] The entity recognition and entity linking technology is used to link the entity in the sample to the corresponding entity in the power operation and maintenance knowledge graph; a candidate replacement entity list is generated for each entity according to the relationship and attribute information in the knowledge graph; the entity is selected for replacement according to the semantic similarity and context relevance of the candidate entity and the replaced entity; the entity replacement proportion threshold is set;
[0023] The prediction probability entropy or maximum probability difference index is used to measure the uncertainty of the model prediction; the unlabeled samples are sorted according to the uncertainty measurement value; the samples ranked in the predefined number are selected for manual annotation, and the model is updated using the newly annotated samples.
[0024] The dynamic adjustment of the weight of each data enhancement strategy further comprises:
[0025] The weight of the synonym replacement based on the field dictionary and the entity replacement strategy based on the knowledge graph is increased;
[0026] The weight of the sentence enhancement strategy based on back translation is increased; or
[0027] The enhancement sample of a specific type of entity is increased.
[0028] The application also discloses a data enhancement based small sample learning system based on the data enhancement based small sample learning method, comprising:
[0029] A data set construction module is configured to collect power operation and maintenance text data from multiple data sources and perform preprocessing, and to label the preprocessed data, including named entity recognition, relation extraction and text classification, to construct a power field corpus;
[0030] A vector integration module is configured to fine-tune a predefined pre-training language model using the power field corpus, train power field word vectors and entity vectors from the power field corpus using the model, and integrate the power field word vectors and entity vectors into the pre-training language model;
[0031] A multi-task adversarial learning module is configured to perform multi-task learning of named entity recognition and power operation and maintenance knowledge based on the pre-training language model, construct a multi-task adversarial learning model in combination with an adversarial learning algorithm, train the multi-task adversarial learning model using a plurality of data augmentation strategies, and perform data prediction using the trained multi-task adversarial learning model through ensemble learning and self-training;
[0032] A model evaluation module is configured to evaluate the model prediction results and dynamically adjust the weights of the various data augmentation strategies based on the evaluation results.
[0033] Correspondingly, the present application also discloses a terminal comprising a processor and a storage medium;
[0034] The storage medium is configured to store instructions;
[0035] The processor is configured to operate according to the instructions to perform the steps of the foregoing data augmentation-based small sample learning method.
[0036] Correspondingly, the present application also discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the foregoing data augmentation-based small sample learning method.
[0037] The application has the beneficial effect that, compared with the prior art, the application provides a small sample learning method and system based on data enhancement, adopts data enhancement technology, effectively expands the scale and diversity of training data, and reduces the dependence of the model on large-scale labeled data. Through the multi-task learning framework, the professional knowledge in the power operation and maintenance field is integrated into the training process, so that stronger generalization ability can be obtained even in the case of a small number of samples. The multi-task learning framework is used to enhance the expression of domain knowledge, and the understanding ability of the model for power operation and maintenance data is improved. The adversarial learning mechanism is introduced to promote the generation of high-quality augmented samples and enhance the generalization ability of the model. Through the adaptive multi-strategy data enhancement method, the enhancement strategy is dynamically adjusted according to the model learning situation, the sample diversity is improved, and the generalization ability of the model is further enhanced. The experimental results show that the application effectively improves the model learning performance in the small sample scene of power operation and maintenance, and under the condition of limited labeled data, the performance of the supervised learning model under the condition of sufficient samples can be approached or even surpassed. BRIEF DESCRIPTION OF DRAWINGS
[0038] Figure 1 is the information extraction scheme in the small sample scene in the application.
[0039] Figure 2 is the data enhancement flowchart in the application. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical scheme and advantages of the application clearer, the technical scheme of the application will be described clearly and completely in combination with the drawings in the embodiments of the application.
[0041] The embodiments described in the application are only part of the embodiments of the application, not all embodiments. Based on the spirit of the application, other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the application.
[0042] In view of the deficiencies of the prior art, the present application proposes a small sample learning method and system based on data enhancement, which is to generate multiple new samples with the same / similar semantics as the original samples without changing the semantics of the original samples, and the labels of the new samples are the same as those of the original samples. Common sample enhancement methods include: Obviously, the new samples obtained through sample enhancement contain certain noise, and the new samples even have opposite semantics to the original samples. Therefore, the present application uses the following learning strategy to process these noisy new samples. First, train the model with standard data; after the model converges to a certain extent, add certain enhanced data to the standard data for further training; when the model converges to a certain extent again, continue to add certain enhanced data for further training, and so on. Combine multi-task adversarial learning with adaptive multi-strategy data enhancement strategy, effectively utilize power operation and maintenance field knowledge and data, and improve the model performance. According to the characteristics of power operation and maintenance text data, design a data enhancement method, and dynamically adjust the model prediction results to improve the generalization ability and accuracy of the model. Introduce the adversarial learning mechanism to further improve the stability of the model and make it have stronger adaptability to data noise and sample distribution changes.
[0043] Referring to Figure 1 The small sample learning method based on data enhancement disclosed by the present application comprises the following steps:
[0044] Step 1: Collect power operation and maintenance text data from multiple data sources and perform preprocessing, and label the preprocessed data, which includes named entity recognition, relation extraction and text classification, to construct a power field corpus.
[0045] Step 1 is used to construct a power field corpus for the power operation and maintenance field through data collection and preprocessing operations, to prepare for subsequent model training.
[0046] First, collect power operation and maintenance text data from heterogeneous data sources. The heterogeneous data sources include power enterprise internal operation and maintenance databases, public power operation and maintenance literature and Internet public data. The power enterprise internal operation and maintenance database includes equipment inspection records, fault diagnosis reports, operation and maintenance procedures, etc. The power operation and maintenance literature includes power industry standards, academic papers, technical blogs, etc. The Internet public data includes power forums, news websites, etc.
[0047] The collected raw data is preprocessed, including text cleaning, such as removing irrelevant information, removing HTML tags, special symbols, case conversion, spelling correction, etc., and unifying the text format; filtering the text related to power operation and maintenance, and removing irrelevant content; identifying and deleting duplicate data to ensure data uniqueness. Remove noise data such as punctuation marks, special characters, etc. Remove common but meaningless stop words such as "of", "was", "is", etc. Use power field professional segmentation tools such as Jieba segmenter, and load power field dictionary to improve segmentation accuracy. According to the training set, build a vocabulary table, and convert the text into a digital sequence as the input of the model. According to the characteristics of power operation and maintenance text data, extract key features such as device name, fault type, operation steps, etc., and use word vector model to convert text features into vector representation.
[0048] According to the characteristics of the power operation and maintenance field and the specific task requirements, a reasonable labeling system is designed, including named entity recognition, relation extraction and text classification. Through named entity recognition, the entities in the text such as power equipment, fault type, running state, etc. are labeled. Through relation extraction, the relationship between entities is labeled, such as "device-fault" relationship, "fault-cause" relationship, etc. Through text classification, the text is added with category labels, such as fault diagnosis report, patrol record, safety regulations, etc. Choose appropriate text labeling tools, such as Label Studio, etc., to improve the efficiency and accuracy of labeling. To ensure the quality of labeling, multiple annotators label the same data, cross-validation is used to improve the consistency of labeling, or power field experts review the labeling results to ensure the accuracy and professionalism of the labeling.
[0049] Divide the labeled data set into training set, validation set and test set, the proportion is generally 8:1:1.
[0050] Step 2: Fine-tune the pre-defined pre-training language model using the power field corpus, and use the model to train power field word vectors and entity vectors from the power field corpus, and integrate power field word vectors and entity vectors into the pre-training language model.
[0051] Collect text data related to the power field and build a power field corpus. Use Word2Vec, GloVe, etc. Word vector training method to train power field word vector; use word similarity, word class comparison, etc. Task to evaluate the quality of word vector. Build a knowledge graph of power equipment, fault type, running state, etc. Use TransE, RotatE, etc. Knowledge representation learning method to train power field entity vector. Use link prediction, triple classification, etc. Task to evaluate the quality of entity vector.
[0052] A suitable pre-trained language model, such as BERT, ChatGLM3, etc., is selected as the base model. Using the constructed power field corpus, the pre-trained language model is fine-tuned, and the model parameters are updated to better adapt to the language characteristics and knowledge distribution of power field text.
[0053] The trained power field word vectors and entity vectors are spliced with the word embedding matrix of the pre-trained language model as the input of the model. For example, in the input layer of the BERT model, the power field word vectors are spliced with the word embedding vectors of BERT to generate a new input vector E(x i ):
[0054] E(x i )=[E BERT (x i );E domain (x i )]
[0055] E BERT (x i ) represents the word embedding vector of input word x i in the BERT model; E domain (x i ) represents the power field word vector, (;) represents the splicing operation of the vector. The power field word vector and the entity vector are injected as additional features into the input of the Transformer layer, for example, in each Transformer layer of the BERT model, the power field word vector is spliced with the hidden state vector of the corresponding word:
[0056] H' l (x i )=[H l (x i );E entity (x i )];H' l (x i ) represents the hidden state vector of word x i in the Transformer of the first layer of BERT; E entity (x i ) represents the power field entity vector; the new hidden state H' l (x i ) introduces the entity vector of the power field as an additional feature.
[0057] Step 3: Based on the pre-trained language model, perform named entity recognition and multi-task learning of power operation and maintenance knowledge, construct a multi-task adversarial learning model combining adversarial learning algorithm, train the multi-task adversarial learning model using various data augmentation strategies, and use the trained multi-task adversarial learning model to perform data prediction through ensemble learning and self-training.
[0058] Multi-task learning improves the generalization ability of the model by sharing information between different tasks. In the field of power operation and maintenance, tasks such as named entity recognition, relation extraction, and text classification can be jointly trained to improve model performance using the associated information between tasks. Multi-task learning can fully utilize the associated information between different tasks in the field of power operation and maintenance, improve data utilization, especially in the case of scarce labeled data; help the model learn more general feature representation, improve the generalization ability of the model on different tasks, and train multiple models to reduce model training cost.
[0059] Adversarial learning trains discriminators and generator networks to be in opposition, which can generate more realistic data and improve the stability of the model. The generative adversarial network consists of two main parts: the generator and the discriminator. The generator receives random noise as input and generates samples similar to the distribution of real samples. The discriminator judges whether the input sample is from the real data set or the sample generated by the generator. The generator and the discriminator are in opposition during training, with the generator trying to generate samples that deceive the discriminator, while the discriminator tries to accurately distinguish between real samples and generated samples. Through continuous adversarial training, the generator can generate more and more realistic samples.
[0060] A multi-task adversarial learning model is constructed, which simultaneously performs named entity recognition and power operation and maintenance related knowledge learning, and introduces an adversarial learning mechanism to improve model performance.
[0061] A pre-trained language model, such as BERT, is used in conjunction with a BiLSTM-CRF network for named entity recognition. A knowledge graph is constructed using power operation and maintenance knowledge base, such as device information and fault types, and is integrated into the model training process as auxiliary information. A discriminator network is introduced to distinguish between real data and augmented data, allowing the generator network to generate more realistic data and improve the generalization ability of the model.
[0062] An adaptive multi-strategy data augmentation method is designed for the characteristics of power operation and maintenance text data, including:
[0063] 3.1: Utilize the power operation and maintenance field dictionary to perform synonym replacement, ensuring that the data augmentation process does not change the semantics of the text. First, match each word in the sample with the power operation and maintenance field dictionary to determine the synonym set of the word. According to the word frequency, part of speech, context semantics and other factors, select the appropriate synonym for replacement. For example, prefer to select synonyms with higher word frequency, or synonyms with the same part of speech as the replaced word. Set a synonym replacement proportion threshold, for example 20%, to avoid excessive replacement affecting the fluency and readability of the sample.
[0064] 3.2: Use pre-trained language models for word replacement, and filter according to the characteristics of power operation and maintenance text to avoid introducing irrelevant words. Specifically, use a pre-trained language model to generate a list of candidate replacement words for each word in the sample based on the context. Use the power operation and maintenance knowledge base to filter the list of candidate replacement words to remove words unrelated to the power operation and maintenance field. According to the semantic similarity, part of speech consistency and other factors of the candidate word and the replaced word, set different replacement probabilities, for example, the higher the semantic similarity and the more consistent the part of speech, the greater the replacement probability.
[0065] 3.3: Combine power operation and maintenance field knowledge for targeted back-translation to generate samples closer to real-world scenarios. Specifically, select technical languages related to the power operation and maintenance field for back-translation, such as English, German, etc., which can better preserve professional terminology and semantic information, then select the best-performing neural machine translation model for back-translation, such as the Transformer model, and fine-tune the model according to the characteristics of power operation and maintenance text to improve back-translation quality. Filter the samples generated by back-translation to remove samples with grammatical errors and semantic inconsistencies.
[0066] 3.4: Use the power operation and maintenance knowledge graph to replace entities and generate new samples while maintaining semantic consistency. Specifically, use entity recognition and entity linking technology to link entities in the sample to corresponding entities in the power operation and maintenance knowledge graph. According to the relationship and attribute information in the knowledge graph, generate a list of candidate replacement entities for each entity. For example, for the "transformer" entity, based on "model", "voltage level" and other attribute information, determine other transformer entities with similar attributes as candidate replacement entities; select the appropriate entity for replacement based on the semantic similarity, context relevance and other factors of the candidate entity and the replaced entity; set an entity replacement proportion threshold to avoid excessive replacement affecting the semantic integrity of the sample.
[0067] 3.5: Using the prediction results of the model, samples with uncertainty higher than a threshold are selected for manual annotation to further optimize model training. Specifically, use prediction probability entropy, maximum probability difference, etc. to measure the uncertainty of the model prediction of the sample; according to the uncertainty measurement value, the unannotated samples are sorted; select the samples ranked before the pre-defined number for manual annotation, for example, you can select the samples with the highest prediction probability entropy, the samples with the most uniform distribution of prediction results between different categories, etc.; use the newly annotated samples to update the model to improve the prediction ability of the model.
[0068] The prediction probability entropy is used to measure the uncertainty of the model in predicting the category; if the output of the model is a probability distribution p(y|x), where p(y i |x) is the probability of the model predicting that the sample x belongs to category i, then the formula of the entropy is:
[0069]
[0070] where H(p(y|x)) represents the prediction probability entropy of sample x; C is the number of categories, p(y i |x) is the prediction probability of the model for category i. The greater the entropy, the more uncertain the model's prediction of the sample x.
[0071] The maximum probability difference is used to measure the confidence difference of the model in predicting the category, which represents the difference between the highest and the second highest probability prediction of the model, and the calculation formula is:
[0072] Δp(x)=p(y max |x)-p(y second |x)
[0073] where p(y max |x) is the maximum probability of the model's prediction for category y max ; p(y second |x) is the probability of the model's prediction for the second highest category y second . The smaller Δp(x) is, the higher the uncertainty of the model's prediction of the sample is.
[0074] For unannotated samples, sort them according to the uncertainty measurement (such as entropy or maximum probability difference), and select the samples with the highest entropy or the smallest maximum probability difference:
[0075] or
[0076] The data augmentation flowchart is shown in Figure 2 .
[0077] Integrated learning is based on the idea that "majority decision is better than single decision", that is, the joint inference result of multiple models is more reliable and stable than the inference result of a single model. By integrating multiple different models, the variance of the model can be effectively reduced, and the generalization ability of the model on unseen data can be improved. Self-training is a semi-supervised learning method that combines a small amount of labeled data and a large amount of unlabeled data. The specific steps are as follows:
[0078] 1. Use a small amount of labeled data to preliminarily train the model;
[0079] 2. Use the trained model to predict the unlabeled data, and select the prediction results with high confidence as pseudo labels;
[0080] 3. Add the unlabeled data with pseudo labels to the training set and continue training the model;
[0081] 4. Repeat steps 2 and 3 to iteratively optimize the model.
[0082] Through self-training, the training data set can be gradually expanded in the case of scarce labeled data, thereby improving the learning ability and generalization performance of the model.
[0083] By combining integrated learning and self-training, multiple models are trained using a small amount of labeled data (and data augmentation), and these models jointly infer the unlabeled data to generate pseudo labels for the next iteration. Integrated learning can ensure that the pseudo labels are closer to the true labels, improving the reliability of the self-training phase.
[0084] Step 4: Evaluate the model prediction results and dynamically adjust the weights of each data augmentation strategy based on the evaluation results.
[0085] In order to further improve the performance of small sample learning, the present application also combines semi-supervised learning and active learning data augmentation strategies. The preprocessed data and augmented samples are used to train a multi-task adversarial learning model. A joint training strategy is used to jointly optimize the named entity recognition task, power operation related knowledge learning task and adversarial learning task. An adaptive multi-strategy data augmentation strategy is used to dynamically adjust the data augmentation method and weight based on the model prediction results, improving the generalization ability and stability of the model. Each part and its process are as follows:
[0086] At time step t=0, the system enters the training phase.
[0087] Store the collected small amount of field labeled data and field related unlabeled data in the sample pool.
[0088] Use the field related unlabeled data for unsupervised pre-training.
[0089] Multi-task learning using pre-trained language models.
[0090] In the domain feature learning process, data with domain labels is generated.
[0091] Multi-task training using a small number of labeled samples.
[0092] In some cases, human-labeled samples are needed to enhance the dataset.
[0093] Using a generative adversarial network to generate data increases the number of samples, increasing the diversity of samples and improving the generalization ability of the model.
[0094] Through active learning, samples with high uncertainty are selected for further labeling, more effectively utilizing limited labeling resources and improving learning efficiency.
[0095] The entire process emphasizes the collection and enhancement of data through multiple ways, and the continuous optimization of the model through iterative cycles, thereby improving the performance and adaptability of the model.
[0096] For example, when the model performs poorly on a specific type of entity recognition, increase the number of enhanced samples of that type of entity. First, use accuracy, recall, F1 value, etc. to evaluate the performance of the model on the validation set; according to the performance of the model on different tasks and different types of data, dynamically adjust the weights of different data enhancement strategies.
[0097] For example, comparative experiments are conducted to verify the effectiveness of multi-task adversarial learning and adaptive multi-strategy data enhancement methods. The multi-task adversarial learning objective function L is used to simultaneously optimize the named entity recognition task, power operation and maintenance knowledge learning task, and adversarial learning task:
[0098] L = LNER + λ1*LKG + λ2*LGAN
[0099] Where LNER is the loss function of the named entity recognition task, LKG is the loss function of the power operation and maintenance knowledge learning task, LGAN is the loss function of the adversarial learning task, and λ1 and λ2 are weight coefficients.
[0100]
[0101] N is the number of words in the sentence; C is the number of entity categories; y i,c is the indicator of the i-th word belonging to the c-th category, which is 1 if the word belongs to the category, otherwise 0; is the probability of the i-th word belonging to the c-th category predicted by the model.
[0102]
[0103] P(t|h, r) is the probability of the model predicting t given h and r, normalized by the softmax function:
[0104]
[0105] h is the head entity, t is the tail entity, and r is the relationship; f(h, r, t) is the score of the model predicting that there is a relationship r between the head entity h and the tail entity t. τ is the set of all knowledge triples. Among them, ε is the entity set, which represents all possible tail entities.
[0106] LGAN=-E x~pdata [logD(x)]-E z~pz [log(1-D(G(z)))]-E z~pz [logD(G(z))]
[0107] x is the real sample, G(z) is the generated sample; p data is the distribution of real data, p z is the noise distribution; D(x) and D(G(z)) are the predicted probabilities of the discriminator for real samples and generated samples, respectively.
[0108] For the named entity recognition strategy (NER), directly affects the performance of the model on the entity recognition task. Without additional weighting, directly optimize LNER.
[0109] For the power operation and maintenance knowledge learning strategy (KG), the weight λ1 determines the contribution of the power operation and maintenance knowledge learning task in the overall optimization process of the model. The power operation and maintenance knowledge enhancement in the training process, the weight λ1 controls the proportion of its gradient update in the total loss. The update gradient formula is:
[0110] ▽θ LKG ∝λ1·▽LKG
[0111] For the adversarial learning strategy (GAN), its contribution is controlled through the weight λ2. In the process of generating and discriminating against samples, the weight λ2 affects the update of this part of the loss to the model parameters. The update gradient formula is:
[0112] ▽θ LGAN ∝λ2·▽LGAN
[0113] In each training iteration, the total loss (L) of the model is the weighted sum of the three parts of the loss. The specific gradient update formula is as follows:
[0114] ▽θ←▽L=▽LNER+λ1·▽LKG+λ2·▽LGAN
[0115] If λ1 is larger, the weight of power operation and maintenance knowledge learning task in gradient update is larger, and the model will tend to optimize this task faster; the larger λ2 is, the more significant the contribution of the adversarial learning task is. During the training process, the weights λ1 and λ2 can be dynamically adjusted, so that the model pays more attention to the current task. For example: in the early stage, λ1 can be increased to make the model focus more on learning power operation and maintenance knowledge; as the model masters the knowledge, λ2 can be increased to improve the stability of the model against noise and abnormal data. This weight adjustment mechanism allows the model to fully utilize multi-task learning and adaptive enhancement strategies during different stages of the training process.
[0116] The adaptive data enhancement strategy dynamically adjusts the data enhancement method and weight according to the prediction results of the model, for example:
[0117] D' = A(D, M, p)
[0118] where D is the original data set, M is the model, D' is the enhanced sample set, p is the prediction result of the model on the original data, A is the adaptive data enhancement function, which dynamically selects different data enhancement methods and adjusts their weights according to the prediction results of the model.
[0119] For example: when the model performs poorly on the entity recognition task, the weights of the synonym replacement based on the domain dictionary and the entity replacement strategy based on the knowledge graph can be appropriately increased to expand the entity vocabulary and improve the model's ability to recognize entities. When the model performs poorly on the relationship classification task, the weight of the sentence enhancement strategy based on back-translation can be appropriately increased to enrich the language expression of the samples and improve the model's ability to understand semantic relationships. When the model performs poorly on a specific type of entity recognition, the enhancement samples of that type of entity can be increased, such as increasing the number of samples containing that type of entity, increasing the replacement ratio of that type of entity, etc.
[0120] The beneficial effects of the present application are that, compared with the prior art, the present application provides a small sample learning method and system based on data enhancement, which effectively expands the scale and diversity of training data by using data enhancement technology, and reduces the dependence of the model on large-scale labeled data. Through the multi-task learning framework, the professional knowledge in the power operation and maintenance field is integrated into the training process, so that stronger generalization ability can be obtained even in the case of a small number of samples. The multi-task learning framework is used to enhance the expression of domain knowledge, which improves the understanding ability of the model for power operation and maintenance data. The introduction of the adversarial learning mechanism promotes the generation of high-quality augmented samples and enhances the generalization ability of the model. Through the adaptive multi-strategy data enhancement method, the enhancement strategy is dynamically adjusted according to the model learning situation, the sample diversity is improved, and the generalization ability of the model is further enhanced. The experimental results show that the present application effectively improves the model learning performance in the small sample scene of power operation and maintenance, and under the condition of limited labeled data, the performance of the supervised learning model can be close to or even exceed that in the case of sufficient samples.
[0121] The present application can be a system, a method and / or a computer program product. The present application also discloses a small sample learning system based on data enhancement based on the foregoing small sample learning method based on data enhancement, comprising:
[0122] A data set construction module is configured to collect power operation and maintenance text data from multiple data sources and perform preprocessing, and label the preprocessed data, wherein the labeling includes named entity recognition, relation extraction and text classification, so as to construct a power field corpus;
[0123] A vector integration module is configured to fine-tune a pre-defined pre-training language model using the power field corpus, and train power field word vectors and entity vectors from the power field corpus using the model, and integrate the power field word vectors and entity vectors into the pre-training language model;
[0124] A multi-task adversarial learning module is configured to perform multi-task learning of named entity recognition and power operation and maintenance knowledge based on the pre-training language model, construct a multi-task adversarial learning model in combination with an adversarial learning algorithm, train the multi-task adversarial learning model using a plurality of data enhancement strategies, and use the trained multi-task adversarial learning model to perform data prediction through ensemble learning and self-training;
[0125] A model evaluation module is configured to evaluate the model prediction results, and dynamically adjust the weights of each data enhancement strategy based on the evaluation results.
[0126] Based on the spirit of the present application, those skilled in the art can easily think of a computer program product based on the foregoing data enhancement-based small sample learning method. The computer program product can include a computer readable storage medium having computer readable program instructions loaded thereon for causing a processor to implement various aspects of the present disclosure. That is, the present application also includes a terminal including a processor and a storage medium; the storage medium is used to store instructions; the processor is used to operate according to the instructions to perform the steps according to the foregoing data enhancement-based small sample learning method.
[0127] The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium can be, for example but not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium include a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punched card or a hole and protrusion structure, and any suitable combination of the foregoing. The computer readable storage medium used herein is not to be interpreted as a transitory signal per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through an optical fiber cable), or electrical signals transmitted through a wire.
[0128] The computer readable program instructions described herein can be downloaded from a computer readable storage medium to various computing / processing devices, or from a network, such as the Internet, a local area network, a wide area network, and / or a wireless network, to an external computer or an external storage device. The network can include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer readable program instructions from the network and forwards the computer readable program instructions to the computer readable storage medium for storage in the computer readable storage medium in each computing / processing device.
[0129] Computer readable program instructions for carrying out operations of the present disclosure can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or any combination of source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer readable program instructions can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) can execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present disclosure.
[0130] Finally, it should be noted that the above-mentioned embodiments are merely used to illustrate the technical solutions of the present application, rather than limiting the present application. Although the present application has been described in detail with reference to the above-mentioned embodiments, those skilled in the art should understand that the specific embodiments of the present application can be modified or replaced equivalently without departing from the spirit and scope of the present application, and any modification or equivalent replacement without departing from the spirit and scope of the present application should be covered in the protection scope of the claims of the present application.
Claims
1. A few-shot learning method based on data augmentation, characterized in that, Includes the following steps: Step 1: Collect power operation and maintenance text data from multiple data sources and preprocess it. Label the preprocessed data. The labeling includes named entity recognition, relation extraction and text classification to build a power domain corpus. Step 2: Fine-tune the predefined pre-trained language model using a corpus in the power industry, and use this model to train power industry word vectors and entity vectors from the power industry corpus, and then integrate the power industry word vectors and entity vectors into the pre-trained language model; Step 3: Based on the pre-trained language model, perform multi-task learning of named entity recognition and power operation and maintenance knowledge, construct a multi-task adversarial learning model by combining adversarial learning algorithm, use a variety of data augmentation strategies to train the multi-task adversarial learning model, and use the trained multi-task adversarial learning model to perform data prediction through ensemble learning and self-training. Step 4: Evaluate the model prediction results and dynamically adjust the weights of each data augmentation strategy based on the evaluation results; The method of using multiple data augmentation strategies to train the multi-task adversarial learning model further includes: Each word in the sample is matched with a dictionary of power operation and maintenance to determine the set of synonyms for that word; synonyms are selected for replacement based on word frequency, part of speech, or contextual semantic factors. Using a pre-trained language model, a list of candidate replacement words is generated for each word in the sample based on the context; the list of candidate replacement words is filtered using a power operation and maintenance knowledge base to remove words irrelevant to the power operation and maintenance field; different replacement probabilities are set based on the semantic similarity or part-of-speech consistency between the candidate words and the words to be replaced. We selected technical language related to the power operation and maintenance field for back translation, then selected the best-performing neural machine translation model for back translation, fine-tuned the model based on the power operation and maintenance text, and screened the back-translated samples to remove those with grammatical errors or semantic incoherence. Using entity recognition and entity linking technologies, entities in the sample are linked to corresponding entities in the power operation and maintenance knowledge graph; based on the relationship and attribute information in the knowledge graph, a candidate replacement entity list is generated for each entity; based on the semantic similarity and contextual relevance between the candidate entity and the entity to be replaced, the entity is selected for replacement; and an entity replacement ratio threshold is set. The uncertainty of the model's prediction of samples is measured using the prediction probability entropy or maximum probability difference index; the unlabeled samples are ranked according to the uncertainty measure; samples ranked before a predefined number are manually labeled, and the model is updated using the newly labeled samples; The dynamic adjustment of the weights of each data augmentation strategy further includes: Increase the weights of domain dictionary-based synonym replacement and knowledge graph-based entity replacement strategies; Increase the weight of sentence enhancement strategies based on back-translation; or Add enhanced samples for specific types of entities.
2. The few-shot learning method based on data augmentation according to claim 1, characterized in that, The data sources include internal operation and maintenance databases of power companies, power operation and maintenance literature, and publicly available data on the Internet; the internal operation and maintenance databases of power companies include equipment inspection records, fault diagnosis reports, and operation and maintenance procedures; the power operation and maintenance literature includes power industry standards, academic papers, and technical blogs. The publicly available internet data includes power forums and news websites.
3. The few-shot learning method based on data augmentation according to claim 2, characterized in that, The annotation of the preprocessed data further includes: Named entity recognition identifies entities in the text, including power equipment, fault types, and operating status; relation extraction identifies relationships between entities, including the relationship between equipment and faults, and the relationship between faults and causes; and text classification adds category labels to the text, including fault diagnosis reports, inspection records, and safety procedures.
4. The few-shot learning method based on data augmentation according to claim 3, characterized in that, The step of training word vectors and entity vectors in the power sector from a corpus of power-related terms using this model further includes: We collect relevant text data in the power industry, construct a power industry corpus, and train power industry word vectors using word vector training methods. We evaluate the quality of word vectors using word similarity and word analogy. We construct a knowledge graph of power equipment, fault types, and operating status. We train power industry entity vectors using knowledge representation learning methods. We evaluate the quality of entity vectors using link prediction and triple classification.
5. The few-shot learning method based on data augmentation according to claim 4, characterized in that, The integration of word vectors and entity vectors from the power sector into the pre-trained language model further includes: Select a suitable pre-trained language model as the base model, use the constructed power domain corpus to fine-tune the pre-trained language model and update the model parameters; concatenate the trained power domain word vectors and entity vectors with the word embedding matrix of the pre-trained language model as the input of the model.
6. A few-shot learning system based on data augmentation, characterized in that, include: The dataset construction module is used to collect and preprocess power operation and maintenance text data from multiple data sources, and to annotate the preprocessed data. The annotation includes named entity recognition, relation extraction and text classification to build a corpus in the power field. The vector integration module is used to fine-tune a predefined pre-trained language model using a corpus in the power industry. This model is used to train word vectors and entity vectors in the power industry from the corpus, and then integrates the word vectors and entity vectors in the power industry into the pre-trained language model. The multi-task adversarial learning module is used to perform multi-task learning of named entity recognition and power operation and maintenance knowledge based on the pre-trained language model. It combines adversarial learning algorithms to construct a multi-task adversarial learning model, uses various data augmentation strategies to train the multi-task adversarial learning model, and uses the trained multi-task adversarial learning model to perform data prediction through ensemble learning and self-training. The model evaluation module is used to evaluate the model's prediction results and dynamically adjust the weights of each data augmentation strategy based on the evaluation results. The method of using multiple data augmentation strategies to train the multi-task adversarial learning model further includes: Each word in the sample is matched with a dictionary of power operation and maintenance to determine the set of synonyms for that word; synonyms are selected for replacement based on word frequency, part of speech, or contextual semantic factors. Using a pre-trained language model, a list of candidate replacement words is generated for each word in the sample based on the context; the list of candidate replacement words is filtered using a power operation and maintenance knowledge base to remove words irrelevant to the power operation and maintenance field; different replacement probabilities are set based on the semantic similarity or part-of-speech consistency between the candidate words and the words to be replaced. We selected technical language related to the power operation and maintenance field for back translation, then selected the best-performing neural machine translation model for back translation, fine-tuned the model based on the power operation and maintenance text, and screened the back-translated samples to remove those with grammatical errors or semantic incoherence. Using entity recognition and entity linking technologies, entities in the sample are linked to corresponding entities in the power operation and maintenance knowledge graph; based on the relationship and attribute information in the knowledge graph, a candidate replacement entity list is generated for each entity; based on the semantic similarity and contextual relevance between the candidate entity and the entity to be replaced, the entity is selected for replacement; and an entity replacement ratio threshold is set. The uncertainty of the model's prediction of samples is measured using the prediction probability entropy or maximum probability difference index; the unlabeled samples are ranked according to the uncertainty measure; samples ranked before a predefined number are manually labeled, and the model is updated using the newly labeled samples; The dynamic adjustment of the weights of each data augmentation strategy further includes: Increase the weights of domain dictionary-based synonym replacement and knowledge graph-based entity replacement strategies; Increase the weight of sentence enhancement strategies based on back-translation; or Add enhanced samples for specific types of entities.
7. A terminal, comprising a processor and a storage medium; characterized in that: The storage medium is used to store instructions; The processor is configured to operate according to the instructions to perform the steps of the data augmentation-based few-shot learning method according to any one of claims 1-5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the few-shot learning method based on data augmentation as described in any one of claims 1-5.
Citation Information
Patent Citations
Adaptive small sample learning intelligent error correction method based on ALBERT model
CN114757169A
Few-sample knowledge graph representation learning method and system based on context data enhancement
CN115525771A