A domain overlapping entity relation extraction method based on an improved OneRel model

By improving the OneRel model and using MacBERT, Focal Loss, and Multi-sample Dropout, combined with data augmentation techniques, the imbalance between positive and negative samples in the extraction of overlapping entity relationships was solved, improving the model's accuracy and robustness, and enhancing its generalization ability.

CN116881452BActive Publication Date: 2025-12-09HUAZHONG AGRI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310790883.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-29
Publication Date
2025-12-09
Estimated Expiration
2043-06-29

AI Technical Summary

Technical Problem

Existing technologies suffer from problems such as error propagation, redundant computation, imbalance between positive and negative samples, and excessive negative samples during training when extracting overlapping entity relationships, resulting in insufficient model generalization ability.

Method used

An improved OneRel model is adopted, using the Chinese pre-trained model MacBERT. Focal Loss and Multi-sample Dropout are introduced, and EDA data augmentation technology is combined to optimize the model training process to solve the problem of imbalanced positive and negative samples and improve the model's generalization ability.

Benefits of technology

It improves the accuracy and robustness of the model in the task of extracting overlapping entity relationships, enhances the ability to identify positive samples, reduces redundant information, and improves the model's generalization ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116881452B_ABST
    Figure CN116881452B_ABST
Patent Text Reader

Abstract

The application discloses a field overlapping entity relation extraction method based on an improved OneRel model, and comprises the following steps: obtaining field data, screening the field data to obtain field data sentences beneficial to training a model, marking the field data sentences and performing feature extraction to obtain corresponding triplets of the field data sentences, and integrating the marked field data sentences and the corresponding triplets to form a field data set; improvement of the OneRel model: introducing a FocalLoss loss function in the model training stage to obtain an improved model, measuring the difference between the true value and the predicted value through the FocalLoss loss function, i.e., a loss value; inputting the field data set as a training set into the improved model; inputting a sentence in the same format as the field data sentence into the trained improved model to obtain triplets after extracting entity relations of the corresponding sentence. The application solves the problem of unbalanced positive and negative samples in the natural language processing task and improves the generalization ability of the model.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of text entity relation extraction, and particularly relates to a domain overlapping entity relation extraction method based on an improved OneRel model. BACKGROUND

[0002] Relation extraction is a typical information extraction task that extracts entity relations from text. It is an important foundation for knowledge graphs and artificial intelligence applications such as intelligent question answering and intelligent dialogue, and has always been of great concern. With the development of the times and the progress of technology, the related technology of relation extraction has been continuously improved and widely applied in the fields of medicine, finance, robot assistants, etc. Early relation extraction mainly focused on the relationship between a pair of entities, but in most cases, a sentence not only has a pair of entities but also has overlapping relationships between entities. Therefore, overlapping entity relation extraction has greater research value.

[0003] While the existing technology optimizes the extraction method of overlapping entity relations, it also produces new technical problems: there are errors of propagation and exposure bias; the interactive information between entities and relations is not fully utilized, resulting in a lot of redundant calculations; when entity recognition is wrong or missing, the result is irreversible; there are problems such as imbalance between positive and negative samples, too many negative samples during training, etc. Especially, the technical problems of imbalance between positive and negative samples and too many negative samples during training are most prominent. SUMMARY

[0004] The purpose of the present application is to provide a domain overlapping entity relation extraction method based on an improved OneRel model, which solves the problem of imbalance between positive and negative samples in natural language processing tasks and improves the generalization ability of the model.

[0005] To solve the above technical problems, the technical solution of the present application is as follows: a domain overlapping entity relation extraction method based on an improved OneRel model, comprising the following steps:

[0006] Domain dataset construction: obtain domain data, filter the domain data to obtain domain data sentences conducive to training the OneRel model, label and extract features from the domain data sentences to obtain corresponding triples of each domain data sentence, and integrate the labeled domain data sentences and corresponding triples to form a domain dataset; the types of domain data include at least the performance symptoms of pests and diseases, treatment drugs, multiple occurrence periods, and the main components, usage dosage, efficacy and side effects of drugs;

[0007] Improvements made to the OneRel model: introduce the Focal Loss loss function in the model training stage to obtain an improved model, and measure the difference between the true value and the predicted value through the Focal Loss loss function, that is, the loss value;

[0008] Training of the improved model: input the domain data set as the training set into the improved model;

[0009] Input the sentence with the same format as the domain data sentence into the trained improved model to obtain the triplets after extracting the entity relationship of the corresponding sentence.

[0010] The improvements made to the OneRel model also include: selecting a Chinese natural language pre-training model MacBERT as the pre-training model of the OneRel model.

[0011] The improvements made to the OneRel model also include: training the OneRel model through the Multi-sample Dropout method.

[0012] Through selecting a Chinese natural language pre-training model MacBERT as the pre-training module, reducing redundant information and making the network structure simple, introducing Focal Loss as the loss function to solve the problem of unbalanced positive and negative samples, and using the Multi-Sample Dropout method to improve the generalization ability of the model, the model improved through the three ways is named as IORM model.

[0013] The formation process of the Focal Loss loss function is:

[0014] Through improvement based on the cross-entropy loss function of binary classification, the binary classification cross-entropy loss function is represented as:

[0015]

[0016] Define p t as:

[0017]

[0018] Get:

[0019] CE(p,y)=CE(p t )=-log(p t )

[0020] Where CE is the binary cross-entropy loss function, p represents the probability that the predicted sample is 1, and y represents the label formed by the label;

[0021] Introduce a weight factor a t∈ [0, 1], get balanced binary cross-entropy loss function, denoted as:

[0022] CE(p t ) = -a t log(p t )

[0023] Introducing a dynamic adjustment factor in the balanced binary cross-entropy loss function, get Focal Loss loss function, denoted as:

[0024] FL(p t ) = -(1-p t ) γ log(p t )

[0025] Where, FL is the Focal Loss loss function, (1-p t ) γ is a dynamic adjustment factor, γ ≥ 0 represents an adjustable parameter, the greater γ, the smaller the loss value of easy-to-classify samples.

[0026] The specific steps of labeling and feature extraction of the domain data sentence to obtain the corresponding triplets of the domain data sentence are:

[0027] When there is an overlapping entity in a domain data sentence, the overlapping part is re-divided to form several new entities, and the domain data sentence is feature extracted to obtain triplets corresponding to each new entity; Where, the new entity and the overlapping entity belong to the same type in the division of the domain data type, and the overlapping entity is subordinate to the new entity;

[0028] When there are more than two types of domain data in a domain data sentence, the feature extraction of each type of domain data is performed to generate triplets corresponding to each type of domain data.

[0029] The specific method of training the improved model by the Multi-sample Dropout method is: set two Dropout samples, the Dropout samples obtain multiple different samples through different Dropout layers, respectively, the same activation function and loss function calculation as the initial Dropout sample corresponding to each sample, take the average value of the loss of each sample, and use the average value to update the network parameters of the improved model.

[0030] The training of the improved model also includes: using the data enhancement technology EDA suitable for text classification tasks, increasing the training samples by randomly inserting words, randomly deleting words and randomly splicing sentences in the domain data sentences of the training set.

[0031] An evaluation test method for evaluating the improved model is also provided, and the accuracy, recall rate and F1 value are selected as evaluation indexes; the F1 value is a harmonic mean of the accuracy and the recall rate, and is compatible with the accuracy and the recall rate; the evaluation test method is specifically represented as:

[0032]

[0033]

[0034]

[0035] Wherein, P is the accuracy, R is the recall rate, TP represents the number of correct prediction as positive samples, FP represents the number of false prediction as positive samples, FN represents the number of false prediction as negative samples, and TN represents the number of correct prediction as negative samples.

[0036] Also provided is a computer device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to realize the steps of the method according to any one of the above.

[0037] Also provided is a computer readable storage medium, which stores a computer program executable by a processor to realize the steps of the method according to any one of the above.

[0038] Compared with the prior art, the present application has the following beneficial effects:

[0039] The present application improves the OneRel model, adopts a Chinese pre-training model suitable for the data set in the field, uses Focal Loss to solve the problem of imbalance between positive and negative samples in natural language processing tasks, uses Multi-sample Dropout to improve the generalization ability of the model, and uses EDA for data enhancement to improve the performance of the model. BRIEF DESCRIPTION OF DRAWINGS

[0040] Figure 1 The figure is a flowchart of the embodiment of the present application;

[0041] Figure 2 The figure is a structural diagram of the improved model in the embodiment of the present application;

[0042] Figure 3 The figure is a schematic diagram of the single-module single-step relation extraction mode of the improved model in the embodiment of the present application;

[0043] Figure 4 The figure is an instance diagram of the specific relation angle annotation strategy in the improved model in the embodiment of the present application. DETAILED DESCRIPTION

[0044] In order to make the objectives, technical solutions and advantages of the present application clearer, further detailed description will be given below in combination with the drawings and examples. It should be understood that the specific examples described herein are only used to explain the present application and do not limit the present application. In addition, the technical features involved in each embodiment of the present application described below can be combined with each other as long as they do not conflict with each other.

[0045] The technical solution of the present application is: a domain overlapping entity relation extraction method based on an improved OneRel model, comprising the following steps:

[0046] Domain data set construction: obtaining domain data, screening the domain data to obtain domain data sentences beneficial to training the OneRel model, labeling the domain data sentences and performing feature extraction to obtain the corresponding triples of each domain data sentence, and integrating the labeled domain data sentences and the corresponding triples to form a domain data set; the types of the domain data at least include the performance symptoms of plant diseases and insect pests, treatment drugs, multiple occurrence periods, and the main components, usage dosage, efficacy and side effects of drugs;

[0047] Improvement of the OneRel model: introducing a Focal Loss loss function in the model training stage to obtain an improved model, and measuring the difference between the true value and the predicted value through the Focal Loss loss function, i.e. the loss value;

[0048] Training of the improved model: inputting the domain data set as a training set into the improved model;

[0049] Inputting a sentence in the same format as the domain data sentence into the trained improved model to obtain the triples after extracting the entity relationship of the corresponding sentence.

[0050] The improvement of the OneRel model also includes: selecting a Chinese natural language pre-training model MacBERT as the pre-training model of the OneRel model.

[0051] The improvement of the OneRel model also includes: training the OneRel model through the Multi-sample Dropout method.

[0052] The present application proposes an improved OneRel relation extraction model IORM model, which selects a Chinese natural language pre-training model MacBERT as a pre-training module for the OneRel model, reduces redundant information and makes the network structure simple, introduces Focal Loss as a loss function to solve the problem of unbalanced positive and negative samples, and uses the Multi-Sample Dropout method to improve the generalization ability of the model.

[0053] The forming process of the Focal Loss loss function is as follows:

[0054] The improvement is made through a binary classification-based cross-entropy loss function, and the binary classification cross-entropy loss function is represented as:

[0055]

[0056] Define p t as:

[0057]

[0058] Get:

[0059] CE(p,y)=CE(p t )=-log(p t )

[0060] Wherein, CE is a binary classification cross-entropy loss function, p represents the probability that the predicted sample is 1, and y represents the label formed by the label;

[0061] A weight factor α t ∈[0,1] is introduced into the binary classification cross-entropy loss function to obtain a balanced binary classification cross-entropy loss function, which is represented as:

[0062] CE(p t )=-α t log(p t )

[0063] A dynamic adjustment factor is introduced into the balanced binary classification cross-entropy loss function to obtain a Focal Loss loss function, which is represented as:

[0064] FL(p t )=-(1-p t ) γ log(p t )

[0065] Wherein, FL is a Focal Loss loss function, (1-p t ) γ is a dynamic adjustment factor, and γ≥0 represents an adjustable parameter. The greater γ is, the smaller the loss value of the easy-to-classify sample is.

[0066] The specific steps of labeling the field data sentences and extracting features to obtain the corresponding triplets of the field data sentences are as follows:

[0067] When there is an overlapping entity in a field data sentence, the overlapping part is re-divided to form several new entities, the new entities replace the overlapping entities to generate a new field data sentence, and the new field data sentence is subjected to feature extraction to obtain triples corresponding to each new entity; wherein the new entity and the overlapping entity belong to the same type in the division of the field data type, and the overlapping entity is subordinate to the new entity.

[0068] When there are more than two types of field data in a field data sentence, feature extraction is performed on each type of field data to generate triples corresponding to each type of field data.

[0069] The specific method for training the improved model through the Multi-sample Dropout method is: two Dropout samples are set, the Dropout samples obtain multiple different samples through different Dropout layers, the same activation function and loss function calculation as the initial Dropout sample corresponding to each sample are performed on each sample, the average value of the loss of each sample is taken, and the average value is used to update the network parameters of the improved model.

[0070] The training of the improved model also includes: adopting the data enhancement technology EDA suitable for the text classification task, and increasing the training samples by randomly inserting characters, randomly deleting characters and randomly splicing sentences in the field data sentences of the training set.

[0071] An evaluation test method for evaluating the improved model is also provided, and the accuracy, recall rate and F1 value are selected as evaluation indexes; wherein the F1 value is the harmonic mean of the accuracy and the recall rate, and is compatible with the accuracy and the recall rate; the evaluation test method is specifically represented as:

[0072]

[0073]

[0074]

[0075] Wherein, P is the accuracy, R is the recall rate, TP represents the number of correctly predicted positive samples, FP represents the number of incorrectly predicted positive samples, FN represents the number of incorrectly predicted negative samples, and TN represents the number of correctly predicted negative samples.

[0076] A computer device is also provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of the above when executing the computer program.

[0077] A computer readable storage medium is also provided, which stores a computer program, and the computer program is executed by a processor to implement the steps of the method according to any one of the above.

[0078] Embodiments:

[0079] 1. Field dataset construction

[0080] At present, the integrity and standardization of agricultural big data need to be improved. The existing datasets that can be used for relation extraction tasks are mainly the NYT dataset and the WebNLG dataset, and the datasets applied to the field of crop diseases and insect pests are very scarce. In order to conduct in-depth exploration in the field of agriculture and find an entity relation extraction model suitable for this field, the present embodiment constructs a dataset in the field of crop diseases and insect pests.

[0081] 1.1 Field data acquisition

[0082] In the present embodiment, the data of websites such as Baidu Encyclopedia (https: / / baike.baidu.com / ) and Micro Agricultural Resources Network (http: / / www.weinongzi.com) are crawled through the Beautiful Soup framework. Under the guidance of professionals, high-quality plant disease and insect pest and related pesticide application information are selected, mainly including a large amount of crop disease, pest, and drug information, such as the performance symptoms of diseases and insect pests, treatment drugs, frequent periods, and the main components, dosage, efficacy, and side effects of drugs.

[0083] 1.2 Field data annotation

[0084] In order to make the relation extraction task more efficient and accurate, in the present embodiment, sentences suitable for training are selected, each sentence is annotated, and triplets are extracted. The specific details are as follows:

[0085] The overlapping entity in the sentence is re-divided as a new entity in the present embodiment, for example: “Fomefenzinc belongs to a benzene ring fungicide”. The benzene ring fungicide is also a fungicide, which can be subdivided into two entities. Therefore, the triplets extracted from the sentence are [Fomefenzinc, belongs to, benzene ring fungicide], [Fomefenzinc, belongs to, fungicide].

[0086] (2) The sentence contains multiple relationships, for example: “Pythium root rot mainly invades the stem base, causing stem base soft rot”. The affected site of pythium root rot is the stem base, and the symptom is stem base soft rot. Therefore, the triplets extracted are [Pythium root rot, affected site, stem base], [Pythium root rot, symptom, stem base soft rot].

[0087] Based on the above rules, the 2712 obtained statements were labeled in this embodiment, resulting in 26080 sets of triples. The labeled data samples are shown in Table 1. The types and quantities of relations involved in the dataset are shown in Table 2. The distribution of relations in the statements is shown in Table 3. It can be seen that the number of relations contained in each statement sample is different. The statement samples containing the three types of relations are the most numerous, totaling 1797 statements.

[0088] Table 1

[0089]

[0090]

[0091] Table 2

[0092]

[0093] Table 3

[0094]

[0095] 2. Improved OneRel model

[0096] Previously, most modeling methods for joint entity relation extraction involved multi-module modeling and multi-step decoding, neglecting the dependency between entities and relations, and leading to redundant computation and error accumulation. This embodiment proposes an improved OneRel relation extraction model (IORM), which utilizes a single-module, single-step decoding method to reduce redundant information and simplify the network structure. Focal Loss is introduced as the loss function to address the imbalance between positive and negative samples, and Multi-Sample Dropout is used to improve the model's generalization ability. Furthermore, considering the characteristics of Chinese corpora, the MacBERT model is used as the input pre-training model. The improved OneRel relation extraction model is as follows: Figure 2 As shown.

[0097] 2.1 OneRel Model Construction

[0098] 2.1.1 Word Vector Representation

[0099] OneRel proposes a new relation extraction method that adopts a single-module, single-step decoding mode. The single-module, single-step relation extraction mode is as follows: Figure 3 As shown, this pattern can better utilize the dependencies between triples and reduce redundant information. The task is defined as: identifying statements of length N S = {w1, w2, w3, ..., w...} N All possible triples in} Where K represents the number of triples, h iand t i respectively represent the subject and object of a relation, a triple contains a head entity h i and a tail entity t i , and the relation between them, which can be chosen from a predefined M relations R = {r1, r2, r3,..., r M}.

[0100] 2.1.2 Relation Specific Horns Tagging

[0101] Shang et al. designed a classifier to assign labels for all possible (w i , r m , w j ) combinations, where w i , w j ∈ S, r m ∈ R, and a three-dimensional matrix M N×M×N is used to store the relation classification results. The "BIE" (Begin, Inside, End) tagging scheme is used to represent the position information of the head entity and the tail entity in the triple (h, r, t). Among them, "HB" represents the initial position of the head entity, "HE" represents the end position of the head entity. "TB" represents the initial position of the tail entity, "TE" represents the end position of the tail entity, and "-" represents all cases other than the above three cases. In the OneRel model, in order to narrow down the potential search space during classification, ensure the simplicity and efficiency of triple decoding, in a triple, the OneRel model only marks the initial positions of the head and tail entities (HB-TB), the initial position of the head entity and the end position of the tail entity (HB-TE), and the end positions of the head and tail entities (HE-TE), that is, the position information of the three corners of the rectangle formed by the head and tail entities. For example, in "Citrus scab will cause fruit malformation", [citrus, cause, fruit] is marked as "HB-TB", [citrus, cause, shape] is marked as "HB-TE", and [disease, cause, shape] is marked as "HE-TE". An example of specific relation angle tagging is shown in Figure 4 .

[0102] 2.1.3 Scoring-based Classifier

[0103] After the pre-training model is encoded, the input sentence of length N obtains the d-dimensional token embedding e i :

[0104] {e1, e2,..., e N} = BERT({x1, x2,..., x N}) (1)

[0105] where x i is the input representation of each token, which is the sum of the corresponding token embedding and position embedding. Shang et al. designed a scoring function:

[0106] f r (h; t) = r T (h * t) (2)

[0107] where h, t represent head entity and tail entity, * is used to mine the potential dependency between entity pairs, represents the cyclic correlation, and the * operator is defined as follows:

[0108] h * t = φ(W[h; t] T + b) (3)

[0109] where the matrix d e represents the dimension of the entity pair, φ(·) is the Relu activation function, [;] is the concatenation operation, and b is the weight and bias. This scoring function can seamlessly connect with the output of the BERT encoder, while fully utilizing the dependency and mutual exclusivity between relationships, and finally obtain the score function as:

[0110]

[0111] represents the score vector, drop(·) is the dropout strategy to prevent model overfitting, and all relationship representations are used to calculate the significance of i j for all token pairs (w , r m , w j ), where 4 represents the number of classification labels, i.e. the four tokenization methods mentioned above. Finally, using the Softmax function, the score vector of (w i , r m , w j ) is taken as input to obtain the corresponding predicted label

[0112]

[0113] The objective function of OneRel is defined as:

[0114]

[0115] represents the gold label obtained from the annotation, i.e. the true tokenization.

[0116] 2.2 Model improvement

[0117] 2.2.1 Selection of pre-trained model

[0118] BERT (Bidirectional Encoder Representation from Transformers) [5] BERT is a pre-trained language model specifically applied to natural language processing tasks, trained on a large amount of unlabeled data, effectively improving the efficiency and accuracy of various natural language processing tasks. The BERT model is composed of three modules, including Embedding, Transformer and pre-training module. Among them, the Embedding module contains word vectors, position vectors and text vectors. The Transformer module uses the Encoder part of the classic Transformer, which has 12 hidden layers, outputs a 768-dimensional tensor, and has 12 self-attention heads. The pre-training module is adjusted according to different task requirements. Since BERT was proposed, people have proposed many optimization models based on BERT, such as ERNIE (Enhanced Representation through Knowledge Integration) model, RoBERTa (ARobustly Optimized BERT Pretraining Approach) model, MacBERT model, etc.

[0119] OneRel model uses English pre-trained model BERT-Base, Cased. Due to the differences between English and Chinese in masking methods and segmentation methods, Chinese corpus usually has no obvious separator and is composed of continuous characters, so the English pre-trained model is not suitable for this research task. Therefore, this embodiment tries several Chinese pre-trained models, including BERT-Base, Chinese developed by Google, which uses single-character masking method, Bert-wwm-ext model developed by HFL joint laboratory, which uses whole word masking method, SpanBERT pre-training model based on random adjacent segmentation, RoBERTa model based on dynamic masking and text encoding, and MacBERT error correction type masking pre-training model, and their effects are compared.

[0120] 2.2.2 Focal Loss

[0121] In the model training stage, the data input model through the forward propagation to get the predicted value, the loss function is used to measure the difference between the true value and the predicted value, that is, the loss value. The model updates the parameters through back propagation to reduce the loss value, so that the predicted value is closer to the true value. In 2017, He Kai-ming et al. proposed Focal Loss loss function in RetinaNet network. The purpose of this method is to solve two problems in the target detection task, namely, the difficulty of learning samples and the imbalance of positive and negative samples. Focal Loss adopts the dynamic weighting idea, and gives higher weight to samples with low confidence to obtain more information from this kind of samples in back propagation, and reduces the weight of samples with high confidence.

[0122] Focal Loss is an improved function based on cross-entropy function, which uses a dynamic scaling factor to control the sample weight. Among them, the form of cross-entropy loss function based on binary classification is as follows:

[0123]

[0124] Define p t As follows:

[0125]

[0126] Get

[0127] CE(p t )=-log(p t ) (9)

[0128] Where p represents the probability that the predicted sample is 1, and y represents the label. In order to solve the class imbalance problem, a weight factor a t ∈[0,1] is added to the loss function, which is defined in a similar way to p t , and the balanced binary cross-entropy loss function is obtained, which is as follows:

[0129] CE(p t )=-α t log(p t ) (10)

[0130] But this loss function does not distinguish between easy and difficult samples, which will lead to the overall loss value mainly composed of classification errors of easy samples. Therefore, Focal Loss introduces a dynamic adjustment factor on this basis, which mainly focuses on the learning of difficult samples, and solves the problem of low classification accuracy caused by small sample size. The definition of Focal Loss loss function is as follows:

[0131] FL(p t )=-(1-p t )γ log(p t

[0132] wherein, (1-p t ) γ is a dynamic adjustment factor, γ≥0 represents an adjustable parameter, the larger γ is, the smaller the loss value of the easy-to-classify sample is, so that the research can focus on the difficult-to-classify sample, and the value of γ can be defined by oneself as needed in the research process. Focal Loss is originally used to improve the accuracy of the target detection task, but in the relationship extraction task, it also faces the same problems as the target detection task, for example, the embodiment requires extracting triplets from sentences, and the number of negative samples is much larger than that of positive samples, therefore, the embodiment introduces the Focal Loss loss function into the OneRel model in order to improve the accuracy of the relationship extraction task.

[0133] 2.2.3Multi-sample Dropout

[0134] Dropout was proposed by Hinton in 2012 to prevent model overfitting. The principle is to ignore part of the feature detectors during forward propagation, so that the model has stronger generalization performance. On this basis, Inoue

[13] proposed the Multi-sample Dropout method in 2019, that is, using the Dropout technology to create multiple Dropout samples, taking the average value of the loss of these samples, and using the average loss to update the network parameters, so that the final loss value is lower than the loss value of any Dropout sample. This approach can effectively alleviate the problem of overfitting. The embodiment introduces this method into the model, sets two Dropout samples, and the Dropout layers with different masks can generate multiple different samples. Finally, the same activation function and loss function as the initial Dropout are calculated for these samples, and the average value of the loss of multiple samples is taken. This method not only reduces the number of training iterations, but also effectively improves the generalization effect of the model.

[0135] 3. Experimental and Results

[0136] 3.1 Evaluation Index

[0137] ​In the experiment of the embodiment, the precision, recall and F1 value are used as evaluation indexes to evaluate the effect of the IORM model, and the calculation formulas are shown in (12), (13) and (14). Among them, TP (True Positive) represents the number of correctly predicted positive samples, FP (False Positive) represents the number of incorrectly predicted positive samples, FN (False Negative) represents the number of incorrectly predicted negative samples, and TN (True Negative) represents the number of correctly predicted negative samples. In the embodiment, the accuracy is used to evaluate the recognition ability of the model for negative samples, the recall is used to evaluate the recognition ability of the model for positive samples, and the F1 value is an evaluation index considering the accuracy and recall comprehensively, and reflects the robustness of the model.

[0138]

[0139]

[0140]

[0141] 3.2 Experimental environment and parameter setting

[0142] The experimental processing platform of the embodiment is AutoDL, the processor is 10vCPU Intel Xeon Gold6248R, the memory size is 72GB, the system disk is 25GB, the data disk is 50GB, the GPU model is A100-PCIE-40GB (40GB) *1, and the python version used in the experiment is 3.7.

[0143] The experimental parameter setting is shown in Table 4.

[0144] Table 4

[0145]

[0146] 3.3 Experimental result analysis

[0147] Under the above experimental environment and parameter configuration, the embodiment divides the well-arranged data set into a training set, a validation set and a test set according to 6:2:2, uses different pre-training models for the relationship extraction task, and the effects of different pre-training models are shown in Table 5.

[0148] Table 5

[0149]

[0150] From Table 6, it can be seen that when MacBERT is used as the pre-training model, the accuracy is the best among the five pre-training models. In this embodiment, MacBERT is selected as the pre-training model for subsequent improvement.

[0151] In this embodiment, Multi-sample Dropout is introduced into the OneRel model, and the model effect is improved. Compared with the OneRel model based on MacBERT, the accuracy is improved by 0.38%. On this basis, the Focal Loss function is introduced, and the F1 value and recall rate are improved, and the model robustness is enhanced. Compared with the initial model, the model with Multi-sample Dropout and Focal Loss function has an accuracy of 0.14%, an F1 value of 0.32%, and a recall rate of 0.36%. Finally, in order to better improve the model generalization and solve the problem of overfitting, the data enhancement technology EDA (Easy Data Augmentation) suitable for text classification tasks is used in this embodiment. By randomly inserting words, randomly deleting words, and randomly splicing sentences in the sentence samples, the training samples are increased. Finally, the model accuracy reaches 77.86%, the F1 value reaches 64.88%, and the recall rate reaches 55.62%. The specific model performance is shown in Table 6.

[0152] Table 6

[0153]

[0154] 4. Conclusion

[0155] 1) This embodiment mainly studies the overlapping entity relation extraction method in the field of crop diseases and insect pests, mainly including constructing a crop disease and insect pest field dataset, and proposing an improved OneRel model IORM for this field. The IORM model is improved on the basis of the original model, using a Chinese pre-training model suitable for this dataset, and using Focal Loss to solve the problem of unbalanced positive and negative samples in natural language processing tasks. In addition, Multi-sample Dropout is used to improve the generalization ability of the model, and EDA (Easy Data Augmentation) is used for data enhancement to improve the performance of the model.

[0156] 2) This embodiment shows that data augmentation, Focal Loss loss function and Multi-sample Dropout method can improve the overlapping entity relation extraction task in the field of plant diseases and insect pests, and data augmentation is one of the most effective means to improve the model effect. The experimental results show that Multi-sample Dropout plays an active role in improving the accuracy of the model, and Focal Loss function mainly improves the model robustness and the ability to identify positive samples. Under the condition of consistent data set, experimental environment and experimental parameters, the improved OneRel model proposed in this paper achieves good results, with an accuracy of 77.86%, a recall rate of 55.62%, and an F1 value of 64.88%.

[0157] Those skilled in the art will readily understand that the above description is only preferred embodiments of the present application, and is not intended to limit the present application. Any modification, equivalent replacement and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A domain overlapping entity relation extraction method based on an improved OneRel model, characterized in that, Comprise the following steps: Field data set construction: obtain field data, filter the field data to obtain field data sentences conducive to training the OneRel model, label the field data sentences and extract features to obtain triples corresponding to each field data sentence, and integrate the labeled field data sentences and their corresponding triples to form a field data set; the types of field data at least include the performance symptoms of pests and diseases, treatment drugs, and the main components, dosage, efficacy and side effects of drugs; The specific steps of labeling the field data sentences and extracting features to obtain triples corresponding to each field data sentence are: When there are overlapping entities in a field data sentence, the overlapping part is re-divided to form several new entities, and the field data sentence is extracted to obtain triples corresponding to each new entity; wherein the new entity and the overlapping entity belong to the same type in the division of the field data type, and the overlapping entity is subordinate to the new entity; When there are more than two types of field data in a field data sentence, the field data of each type is extracted to generate triples of each type of field data corresponding to the field data; Improvements to the OneRel model: introduce the Focal Loss loss function in the model training stage to obtain an improved model, and use the Focal Loss loss function to measure the difference between the true value and the predicted value, i.e. the loss value; The improvement of the OneRel model also includes: selecting a Chinese natural language pre-training model MacBERT as the pre-training model of the OneRel model; training of the improved model: input the field data set as the training set into the improved model; The improvement of the OneRel model also includes: training the OneRel model by the Multi-sample Dropout method; Input a sentence in the same format as the field data sentence into the trained improved model to obtain the triples after extracting entities and relationships from the corresponding sentence.

2. The method of claim 1, wherein the method is based on an improved OneRel model. The formation process of the Focal Loss loss function is: Improved by a binary classification-based cross-entropy loss function, which is represented as: Definitions are defined as: Get: wherein, is the binary cross-entropy loss function, p represents the probability of predicting the sample as 1, and y represents the label formed by the label. Introducing a weight factor in binary cross-entropy loss function , which is denoted as: Introduce a dynamic adjustment factor in the balanced binary classification cross-entropy loss function to obtain the Focal Loss loss function, which is represented as: Wherein, FL is a Focal Loss loss function, is a dynamic adjustment factor, represents an adjustable parameter, The greater the loss value of the easy-to-classify sample is smaller.

3. The method of claim 1, wherein the method is based on an improved OneRel model. The specific method for training the improved model by the Multi-sample Dropout method is: set two Dropout samples, and the Dropout samples obtain multiple different samples through different Dropout layers, calculate the same activation function and loss function for each sample as the initial Dropout sample, take the average of the loss of each sample, and use the average to update the network parameters of the improved model.

4. The domain overlapping entity relation extraction method based on the improved OneRel model according to claim 1, characterized in that, The training of the improved model also includes: using the data augmentation technique EDA suitable for text classification tasks, and increasing the training samples by randomly inserting characters, randomly deleting characters and randomly splicing sentences in the field data sentences of the training set.

5. The method of claim 1, wherein the method is based on an improved OneRel model. An evaluation test method for evaluating the improved model is also provided, and the accuracy, recall rate and F1 value are selected as evaluation indexes; the F1 value is a harmonic mean of the accuracy and the recall rate, and is compatible with the accuracy and the recall rate; the evaluation test method is specifically represented as: Wherein, P is the accuracy, R is the recall rate, TP represents the number of correctly predicted positive samples, FP represents the number of incorrectly predicted positive samples, FN represents the number of incorrectly predicted negative samples, and TN represents the number of correctly predicted negative samples.

6. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1-5.

7. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Entity relation joint extraction method based on global pointer network

    CN114417839A

  • Multi-triplet extraction method based on entity-relation joint extraction model

    US20200073933A1