Biomedical relationship extraction method, device and medium based on multi-head attention and graph convolutional network combined with R-Drop mechanism
By combining multi-head attention and graph convolutional networks, using BERT and ELMo models to extract semantic and structural features, and using R-Drop regularization, the problem of low biomedical relationship extraction accuracy in the existing technology is solved, and high accuracy is achieved. Performance for multivariate cross-sentence-level relation extraction.
Patent Information
- Application Number
- CN202210131493.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-14
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-02-14
AI Technical Summary
Existing biomedical relationship extraction methods have low accuracy in complex contexts, cannot effectively utilize the semantic and syntactic information in the text, and are difficult to build a high-performance multi-sentence-level medical and biological relationship extraction model.
A biomedical relationship extraction model based on multi-head attention and graph convolution network combined with R-Drop mechanism is used to extract the contextual semantic and structural features of the text through BERT and ELMo pre-training models, and use the decoder and graph convolution network for decoding , and finally obtain the relationship category through R-Drop regularization.
It achieves high-performance biomedical relationship extraction in complex contexts, improves the generalization performance and relationship extraction accuracy of the model, and can achieve strong relationship extraction effects without introducing external knowledge.
Smart Images

Figure CN114547298B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a biomedical relationship extraction method based on a neural network. More specifically, the present invention proposes a biomedical relationship extraction method based on multi-head attention and graph convolutional network combined with R-Drop mechanism. Background Art
[0002] In the biomedical field, a vast amount of medical literature has gradually formed a huge treasure trove of knowledge. The relationships between various entities in medical literature provide important information for experts. Extracting entity relationships from documents can convert unstructured text into tuple-structured text, which can be used in many medical research projects such as clinical diagnosis and medical knowledge mapping. Therefore, automatic extraction of medical relationships from text is crucial: (1) From an application perspective, manual database annotation requires a lot of manpower and material resources. Not only is data quality difficult to guarantee, but it is also time-consuming and difficult to track the latest literature. Using text mining technology to assist database construction can improve data mining efficiency and data quality. (2) From the perspective of social value, the interaction between drugs and diseases is extracted from biomedical relationships. This interaction will bring huge benefits to pharmaceutical companies, medical institutions and the public, and reduce related costs.
[0003] In addition, in the vast amount of medical literature, a large number of relational facts are expressed in multiple sentences, and there are often complex relationships between multiple entities in the document. At present, the research on biomedical relationship extraction methods has gradually expanded from sentence-level relationships of binary entities to cross-sentence relationships of multi-entities. The extraction of multi-entity cross-sentence relationships needs to consider more complex entity semantic relationships and sentence structures.
[0004] So far, some methods based on automatic extraction of biomedical relations have been proposed, which are mainly divided into feature-based methods and neural network-based methods. The feature-based method extracts useful information including lexical information and syntactic information from the context of the relational sentence instance to construct a feature vector, and trains the relation extraction model by calculating the similarity of the feature vector. For example, the context information and entity information features are used to train the support vector machine; for example, the shortest independent path tree is used to obtain the semantic information and syntactic information between chemicals and diseases. Some feature-based methods have good performance, but manual feature extraction is a time-consuming and laborious task. With the rapid development of deep learning, many researchers have begun to choose methods based on deep neural networks, which can automatically extract features and achieve end-to-end learning. Two common basic models of neural networks are convolutional neural networks and long short-term memory networks. For example, character-based word representations are introduced into the relation extraction model based on convolutional neural networks, such as using long short-term memory networks to automatically extract the shortest dependency path features. However, the use of these traditional neural networks still has the problem of low accuracy and cannot be implemented in the medical field.
[0005] In 2017, some researchers (Peng et al.) constructed a medical corpus dataset based on PubMed, which is an entity relationship extraction dataset about drugs, genes and mutations. The researchers constructed it as complex data with binary and ternary relationships, which includes not only relationships within a single sentence, but also relationships across sentences, and contains 5 types of relationship categories.
[0006] In summary, how to make full use of the semantic and syntactic information in the text, improve the performance of medical entity relationship extraction in complex contexts, and build a high-performance multi-dimensional cross-sentence medical biological relationship extraction model so that it has practical application value is an urgent problem that needs to be solved. Summary of the invention
[0007] In order to overcome the deficiencies in the prior art, the present invention provides a biomedical relationship extraction model based on multi-head attention and graph convolutional network combined with R-Drop mechanism (abbreviated as R-AGN). The method first constructs a syntactic dependency tree for the constructed instance through the Stanford NLP tool, then uses the BERT pre-trained model and the multi-head attention network to extract the contextual semantic representation of the text, and then extracts the structured representation of the text through the ELMo pre-trained model and the graph convolutional network combined with the syntactic dependency tree. The features extracted by the two networks are concatenated and decoded by the decoder. (6) The neural network is regularized using the R-Drop mechanism to finally obtain the relationship category.
[0008] In order to achieve the above-mentioned invention purpose and solve the problems existing in the prior art, the technical solution adopted by the present invention is: a biomedical relationship extraction method based on multi-head attention and graph convolutional network combined with R-Drop mechanism, comprising the following steps:
[0009] Construct intra-sentence and inter-sentence instances of medical entity relations from the text-level medical corpus through heuristic rules;
[0010] The weighted contextual semantic feature representation of the text is extracted through the BERT pre-trained model and the multi-head attention network and the relationship representation interaction.
[0011] Extract structured feature representation of text through ELMo pre-trained model, graph convolutional network, and syntactic dependency tree;
[0012] Concatenate the extracted semantic feature representation and structural feature representation and decode them through the decoder;
[0013] The network is enhanced using R-Drop regularization to obtain biomedical relationship categories.
[0014] Furthermore, each pair of entities mentioned in the same sentence of the constructed medical entity relationship instance is constructed as an intra-sentence instance, entity pairs that do not appear in the same sentence in the same document are constructed as inter-sentence instances, only the closest pair of repeated entity pairs is selected as an instance, and each instance is annotated with the POS tag, syntactic dependency tag and absolute position of each word.
[0015] Furthermore, the nodes of the syntactic dependency tree are each word from the text, and the types of edges between the nodes include: syntactic dependency edges obtained by the Stanford parser are set as directed syntactic dependency edges within the sentence, adjacent sentence edges formed by connecting words as dependency roots in adjacent sentences, and self-node edges with self-nodes on each node.
[0016] Furthermore, the weighted contextual semantic feature representation of the extracted text is specifically:
[0017] (a) The input of the multi-head attention module uses the BERT pre-trained language model as the input representation, and the input representation is described by formula (1):
[0018] w 1 =[w BERT ;w POS ;w dis ] (1)
[0019] w BERT is the representation of the input text after BERT encodes it, w POS The part-of-speech tag embedding represents the part-of-speech information in the text, w disPosition embedding represents the location of the entity in the document;
[0020] (b) Use Bi-LSTM to encode the input representation forward and backward. The final text representation is the concatenation of two states, described by formula (2):
[0021]
[0022] is the hidden state of the forward LSTM, is the hidden state of the backward LSTM;
[0023] (c) The relationship vector is represented as the difference between the tail entity and the head entity vector, which is expressed by formula (3):
[0024] h relation =h tail -h head (3)
[0025] h tail is the output vector of the tail entity after Bi-LSTM encoding, h head is the output vector of the head entity after Bi-LSTM encoding;
[0026] (d) The text representation encoded by Bi-LSTM and the relation vector are interacted through a multi-head attention network. For each attention head, the normalized scaled dot product attention mechanism is used to calculate the relevance, which is expressed by formula (4):
[0027]
[0028] where Q,K,V∈R n×d Represents the query and key-value matrix. The query in the multi-head attention network is the output h of the Bi-LSTM t and the weight matrix W q Multiply them together to get the text sequence, where the key and value are the relation vector h. relation Respectively with the weight matrix W k and W v Multiply them together to get, d is the dimension of the Bi-LSTM model output, is the scaling factor;
[0029] (e) The results of the n heads are concatenated as the output representation of the multi-head attention layer as the weighted contextual semantic feature representation, described by Formula 5:
[0030] h att =[h 1 ;h 2 ;…;h n ] (5)
[0031] h 1 ,h 2 ,…,h n is the output representation of n attention heads.
[0032] Furthermore, the structured feature representation of the extracted text is specifically as follows:
[0033] (a) The input text of the graph convolutional network is represented by the ELMo pre-trained model as input, which is described by formula (6):
[0034] w 2 =[w ELMo ;w POS ;w dis ] (6)
[0035] w ELMo is the representation of the input text encoded by ELMo, w POS The part-of-speech tag embedding represents the part-of-speech information in the text, w dis Position embedding represents the location of the entity in the document;
[0036] (b) Use Bi-LSTM to encode the input representation forward and backward, and the final text representation is the concatenation of the two states;
[0037] (c) Convert the constructed syntactic dependency tree into an adjacency matrix A, where A i,j =1 means there is a dependency edge between word i and word j, A i,j =0 means no dependency, A i,i = 1 represents the self-node edge of each node. The graph convolution operation between the l-th layer node i and the adjacency matrix is described by formula (7):
[0038]
[0039] Where W (l) is the weight matrix, b (l) is the bias vector, is the degree of node i in the dependency graph, ρ is the activation function, and the input of the graph convolutional network is is the output of Bi-LSTM;
[0040] The structured feature representation is described by:
[0041]
[0042] Furthermore, the semantic feature representation and structural feature representation of the spliced extraction are described by the following formula:
[0043] h final =[h att ;h GCN] (9)
[0044] Input to a two-layer perceptron, expressed by formulas (10) and (11):
[0045]
[0046]
[0047] is the weight matrix, is the bias vector;
[0048] The Softmax function is then used to identify the type of biomedical relationship, which is described by formula (12):
[0049] o=softmax(W o h 2 +b o ) (12)
[0050] W o is the weight matrix, b o is the bias vector.
[0051] Furthermore, the neural network is regularized through the R-Drop mechanism to obtain a more accurate biomedical relationship category: the loss function is modified through the R-Drop mechanism to be a loss function that combines the cross entropy loss calculated twice during the entire neural network training and the bidirectional KL divergence regularization, as described by formulas (13), (14), and (15):
[0052]
[0053]
[0054] L=L CE +αL KL (15)
[0055] P 1 (y i |x i ) and P 2 (y i |x i ) represents the probability distribution predicted by the two sub-models obtained by two forward calculations, D KL () is the KL divergence calculation function, L CE The average cross entropy loss is obtained by training the network twice, L KL is the bidirectional KL divergence loss between the two sub-networks obtained by training the network twice. α is the weight coefficient used to adjust the KL divergence regularization. After regularization by the R-Drop mechanism, a more accurate relationship type is finally obtained.
[0056] A device includes a processor and a memory, wherein the processor executes a code in the memory to implement the method described.
[0057] A computer storage medium stores a computer program, wherein the computer program is executed by hardware to implement the method.
[0058] The beneficial effect of the present invention is: a biomedical relationship extraction method based on a neural network combined with an R-Drop mechanism, comprising the following steps: (1) constructing a relationship instance of a medical corpus, (2) constructing a syntactic dependency tree, (3) using a BERT pre-trained model and multi-head attention to extract a contextual semantic representation of the text, (4) using an ELMo pre-trained model and a graph convolutional network combined with a syntactic dependency tree to extract a structured representation of the text, (5) using a decoder to decode the feature representation, and (6) using an R-Drop mechanism to regularize the neural network, and finally obtaining a relationship category. Compared with the existing technology, the present invention has the following advantages: using an end-to-end training method, the semantic features and structural features in medical texts can be automatically learned; the R-Drop mechanism is introduced to improve the generalization performance of the model; and a strong relationship extraction performance is achieved without introducing external knowledge. The present invention has achieved good results in relationship extraction under different circumstances on the test set of the corpus for cross-sentence biomedical relationship extraction proposed by Peng. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 It is a flow chart of the steps of the method of the present invention.
[0060] Figure 2 This is a framework diagram of the medical relationship extraction model proposed in the present invention. DETAILED DESCRIPTION
[0061] The present invention will be further described below in conjunction with the accompanying drawings.
[0062] Example 1: Figure 1 As shown in the figure, the biomedical relationship extraction method based on multi-head attention and graph convolutional network combined with R-Drop mechanism includes the following steps:
[0063] Step 1: For the official training set, validation set, and test set, all instances of medical entity relationships were constructed, and heuristic rules were used to construct intra-sentence and inter-sentence instances:
[0064] (a) Each entity pair mentioned in the same sentence is constructed as an intra-sentence instance.
[0065] (b) In the same document, entity pairs that do not appear in the same sentence are constructed as inter-sentence instances.
[0066] (c) For repeated entity pairs, only the pair with the closest distance is selected as an instance.
[0067] Regarding other preprocessing processes, for each instance, the StanfordCoreNLP tool is used to mark the POS tag and syntactic dependency tag of each word; the absolute position of each word is marked.
[0068] Step 2: Construct a document-level syntactic dependency tree whose nodes are each word from the text and there are three types of edges between nodes:
[0069] (a) Syntactic dependency edges: The syntactic dependency edges obtained by the Stanford parser are set as directed edges within the sentence.
[0070] (b) Adjacent sentence edges: Connect the words in adjacent sentences that are dependency roots to form adjacent sentence edges. This enables the model to learn dependency information between sentences, which is useful for document-level relation extraction.
[0071] (c) Self-node edges: Add self-node edges to each node so that the model can also learn information from the node itself.
[0072] Step 3: Use the BERT pre-trained model and multi-head attention network to extract contextual semantic representation of the text.
[0073] (a) Based on the powerful performance of BERT, the BERT pre-trained language model is introduced as the embedding of the input text in the input representation layer. In addition, we also extract additional semantic information to enable the model to learn better. Part-of-speech tagging can represent the part-of-speech information in the text. The position embedding represents the position of the entity in the document, which enables the model to locate the entity pair and better learn the entity context information. The input representation of this module is described by formula (1):
[0074] w 1 =[w BERT ;w POS ;w dis ] (1)
[0075] w BERT is the representation of the input text after BERT encodes it, w POS The part-of-speech tag embedding represents the part-of-speech information in the text, w dis Position embeddings represent the location of an entity in a document.
[0076] (b) Use Bi-LSTM to encode the input representation forward and backward. Specify the hidden state of the forward LSTM as The hidden state of the backward LSTM is The final hidden state is the concatenation of the two states, described by formula (2):
[0077]
[0078] is the hidden state of the forward LSTM, is the hidden state of the backward LSTM.
[0079] (c) The relationship vector is represented as the difference between the tail entity and the head entity vector, which is expressed by formula (3):
[0080] h relation =h tail -h head (3)
[0081] h tail is the output vector of the tail entity after Bi-LSTM encoding, h head It is the output vector of the head entity after Bi-LSTM encoding.
[0082] Then, a multi-head attention network is used to interact the text representation and the relationship vector. For each attention head, the normalized scaled dot product attention mechanism is used to calculate the relevance, which is expressed by formula (4):
[0083]
[0084] where Q,K,V∈R n×d Represents the query and key-value matrix. The query in the multi-head attention network is the output h of the Bi-LSTM t and the weight matrix W q Multiply them together to get the text sequence, where the key and value are the relation vector h. relation Respectively with the weight matrix W k and W v Multiply them together to get, d is the dimension of the Bi-LSTM model output, is the scaling factor.
[0085] Finally, the results of the n heads are concatenated as the output representation of the multi-head attention layer, expressed by Formula 5:
[0086] h att =[h 1 ;h 2 ;…;h n ] (5)
[0087] Step 4: Extract the structured representation of the text through the ELMo pre-trained model and graph convolutional network (GCN) combined with the syntactic dependency tree.
[0088] (a) Since the nodes of the syntactic dependency tree are composed of words, and BERT's tokenizer will split the words, it cannot be effectively combined with the dependency tree and GCN. Therefore, the ELMo pre-trained model is selected as the input embedding of the GCN module. Similarly, the POS and position information of the text is added to the input representation, which is described by formula (6):
[0089] w 2 =[w ELMo ;w POS ;w dis ] (6)
[0090] w ELMo is the representation of the input text encoded by ELMo, w POS The part-of-speech tag embedding represents the part-of-speech information in the text, w dis Position embeddings represent the location of an entity in a document.
[0091] (b) Use Bi-LSTM to encode the input representation forward and backward. Specify the hidden state of the forward LSTM as The hidden state of the backward LSTM is The final hidden state is the concatenation of the two states.
[0092] (c) Use GCN to learn the structural information of the text. First, convert the constructed syntactic dependency graph into an adjacency matrix A, where A i,j =1 means there is a dependency edge between word i and word j, A i,j =0 means no dependency, A i,i = 1 represents the self-node edge of each node to learn information about the node itself. In addition, before using the activation function, the results in the graph convolution network are normalized to solve the problem of excessive number of nodes in the dependency graph. Finally, the graph convolution operation of the l-th layer node i and the adjacency matrix can be described by formula (7):
[0093]
[0094] Where W (l) is the weight matrix, b (l) is the bias vector, is the degree of node i in the dependency graph, and ρ is the activation function (such as ReLU). The input of the GCN network is the output of Bi-LSTM The output representation is obtained through the convolution operation of layer l
[0095] Step 5: Merge the outputs of the multi-head attention layer and the GCN layer into the final representation h final =[h att ;h GCN], and then fed into a two-layer perceptron, expressed by formulas (8) and (9):
[0096]
[0097]
[0098] is the weight matrix, is the bias vector.
[0099] The Softmax function is then used to identify the relationship type, which can be described by formula (10):
[0100] o=softmax(W o h 2 +b o ) (9)
[0101] W o is the weight matrix, b o is the bias vector.
[0102] Step 6: In order to enhance the performance and generalization ability of the model, the R-Drop mechanism is introduced, and the loss function is modified to be a loss function combining the cross entropy loss calculated twice by the model prediction and the bidirectional KL divergence regularization, which is described by formulas (10), (11), and (12):
[0103]
[0104]
[0105] L=L CE +αL KL (12)
[0106] P 1 (y i |x i ) and P 2 (y i |x i ) represents the probability distribution predicted by the two sub-models obtained by two forward calculations, D KL () is the KL divergence calculation function, L CE The average cross entropy loss is obtained by training the network twice, L KL is the bidirectional KL divergence loss between the two sub-networks obtained by training the network twice. α is the weight coefficient used to adjust the KL divergence regularization. After regularization by the R-Drop mechanism, a more accurate relationship type is finally obtained.
[0107] Embodiment 2: A method for extracting biomedical relationships based on a neural network, comprising the following steps:
[0108] Step 1: For the official training set, validation set, and test set, all instances of medical entity relationships were constructed, and heuristic rules were used to construct intra-sentence and inter-sentence instances:
[0109] (a) Each entity pair mentioned in the same sentence is constructed as an intra-sentence instance.
[0110] (b) In the same document, entity pairs that do not appear in the same sentence are constructed as inter-sentence instances.
[0111] (c) For repeated entity pairs, only the pair with the closest distance is selected as an instance.
[0112] Regarding other preprocessing processes, for each instance, the StanfordCoreNLP tool is used to mark the POS tag and syntactic dependency tag of each word; the absolute position of each word is marked.
[0113] Step 2: Construct a document-level syntactic dependency tree whose nodes are each word from the text and there are three types of edges between nodes:
[0114] (a) Syntactic dependency edges: The syntactic dependency edges obtained by the Stanford parser are set as directed edges within the sentence.
[0115] (b) Adjacent sentence edges: Connect the words in adjacent sentences that are dependency roots to form adjacent sentence edges. This enables the model to learn dependency information between sentences, which is useful for document-level relation extraction.
[0116] (c) Self-node edges: Add self-node edges to each node so that the model can also learn information from the node itself.
[0117] Step 3: Use the BERT pre-trained model and multi-head attention network to extract contextual semantic representation of the text.
[0118] (a) Based on the powerful performance of BERT, the BERT pre-trained language model is introduced as the embedding of the input text in the input representation layer. In addition, we also extract additional semantic information to enable the model to learn better. Part-of-speech tagging can represent the part-of-speech information in the text. The position embedding represents the position of the entity in the document, which enables the model to locate the entity pair and better learn the entity context information. The input representation of this module is described by formula (1):
[0119] w 1 =[w BERT ;w POS ;w dis ] (1)
[0120] w BERTis the representation of the input text after BERT encodes it, w POS The part-of-speech tag embedding represents the part-of-speech information in the text, w dis Position embeddings represent the location of an entity in a document.
[0121] (b) Use Bi-LSTM to encode the input representation forward and backward. Specify the hidden state of the forward LSTM as The hidden state of the backward LSTM is The final hidden state is the concatenation of the two states, described by formula (2):
[0122]
[0123] is the hidden state of the forward LSTM, is the hidden state of the backward LSTM.
[0124] (c) The relationship vector is represented as the difference between the tail entity and the head entity vector, which is expressed by formula (3):
[0125] h relation =h tail -h head (3)
[0126] h tail is the output vector of the tail entity after Bi-LSTM encoding, h head It is the output vector of the head entity after Bi-LSTM encoding.
[0127] Then, a multi-head attention network is used to interact the text representation and the relationship vector. For each attention head, the normalized scaled dot product attention mechanism is used to calculate the relevance, which is expressed by formula (4):
[0128]
[0129] where Q,K,V∈R n×d Represents the query and key-value matrix. The query in the multi-head attention network is the output h of the Bi-LSTM t and the weight matrix W q Multiply them together to get the text sequence, where the key and value are the relation vector h. relation Respectively with the weight matrix W k and W v Multiply them together to get, d is the dimension of the Bi-LSTM model output, is the scaling factor. It is expressed by formula 5:
[0130] h att =[h 1 ;h 2 ;…;hn ] (5)
[0131] Step 4: Extract the structured representation of the text through the ELMo pre-trained model and graph convolutional network (GCN) combined with the syntactic dependency tree.
[0132] (a) Since the nodes of the syntactic dependency tree are composed of words, and BERT's tokenizer will split the words, it cannot be effectively combined with the dependency tree and GCN. Therefore, the ELMo pre-trained model is selected as the input embedding of the GCN module. Similarly, the POS and position information of the text is added to the input representation, which is described by formula (6):
[0133] w 2 =[w ELMo ;w POS ;w dis ] (6)
[0134] w ELMo is the representation of the input text encoded by ELMo, w POS The part-of-speech tag embedding represents the part-of-speech information in the text, w dis Position embeddings represent the location of an entity in a document.
[0135] (b) Use Bi-LSTM to encode the input representation forward and backward. Specify the hidden state of the forward LSTM as The hidden state of the backward LSTM is The final hidden state is the concatenation of the two states.
[0136] (c) Use GCN to learn the structural information of the text. First, convert the constructed syntactic dependency graph into an adjacency matrix A, where A i,j =1 means there is a dependency edge between word i and word j, A i,j =0 means no dependency, A i,i = 1 represents the self-node edge of each node to learn information about the node itself. In addition, before using the activation function, the results in the graph convolution network are normalized to solve the problem of excessive number of nodes in the dependency graph. Finally, the graph convolution operation of the l-th layer node i and the adjacency matrix can be described by formula (7):
[0137]
[0138] Where W (l) is the weight matrix, b (l) is the bias vector, is the degree of node i in the dependency graph, and ρ is the activation function (such as ReLU). The input of the GCN network is the output of Bi-LSTM The output representation is obtained through the convolution operation of layer l
[0139] Step 5: Merge the outputs of the multi-head attention layer and the GCN layer into the final representation h final =[h att ;h GCN ], and then fed into a two-layer perceptron, expressed by formulas (8) and (9):
[0140]
[0141]
[0142] is the weight matrix, is the bias vector.
[0143] The Softmax function is then used to identify the relationship type, which can be described by formula (10):
[0144] o=softmax(W o h 2 +b o ) (9)
[0145] W o is the weight matrix, b o is the bias vector.
[0146] Step 6: In order to enhance the performance and generalization ability of the model, the R-Drop mechanism is introduced, and the loss function is modified to be a loss function combining the cross entropy loss calculated twice by the model prediction and the bidirectional KL divergence regularization, which is described by formulas (10), (11), and (12):
[0147]
[0148]
[0149] L=L CE +αL KL (12)
[0150] Wherein, α is a weight coefficient for adjusting the KL divergence regularization, which is set to 0.5 in the present invention. After regularization by the R-Drop mechanism, a more accurate relationship type is finally obtained.
[0151] The present invention belongs to software invention and relates to a device, which includes a processor and a memory, wherein the processor executes the code in the memory to implement the biomedical relationship extraction method based on multi-head attention and graph convolutional network combined with R-Drop mechanism. The present invention also relates to a computer storage medium, which stores a computer program, and the computer program is executed by hardware to implement the biomedical relationship extraction method based on multi-head attention and graph convolutional network combined with R-Drop mechanism.
[0152] The evaluation index used by the method of the present invention is the F1 value based on the precision (Precision, P) and recall (Recall, R). In order to verify the effectiveness of the model proposed by the present invention, the present invention conducts experiments on the data set proposed by Peng, and uses a five-fold cross-validation form to verify after partitioning the original data. The data examples in the data set are shown in Table 1.
[0153] The F1 value of the model results proposed in the present invention is compared with the F1 values of the three model results of GCN, AGGCN and LF-GCN to prove the improvement in accuracy. The GCN model is a method proposed in 2018 to encode pruned trees using graph convolutional neural networks, the AGGCN model is a biomedical relationship extraction model that constructs a dependency forest through an attention matrix proposed in 2019, and the LF-GCN model is a biomedical relationship extraction model that automatically induces dependency structures using a variant of the matrix tree theorem proposed in 2020. The experimental results are shown in Table 2.
[0154] Table 1
[0155]
[0156] Table 2
[0157]
[0158] From the experimental results in Table 2, it can be seen that the model proposed in the present invention has been significantly improved in both ternary and binary results in multi-classification relationship extraction, among which the F1 value of multi-classification relationship extraction of binary relationships is improved by 11.1% on the basis of the baseline, which can be explained that it is more accurate in capturing the features of multi-classification extraction of binary and ternary relationships, and effectively improves the efficiency of relationship extraction. In the case of binary classification, the F1 value is also improved by about 1%, which can be explained that the model proposed in the present invention has achieved good results in relationship extraction in different situations.
[0159] The method of the present invention has the following advantages: using an end-to-end training method, the semantic features and structural features in medical texts can be automatically learned; the R-Drop mechanism is introduced to improve the generalization performance of the model; and strong relation extraction performance is achieved without introducing external knowledge. The present invention has achieved good results in relation extraction under different circumstances on the test set of the corpus for cross-sentence biomedical relation extraction proposed by Peng.
Claims
1. A biomedical relationship extraction method based on multi-head attention and graph convolutional network combined with R-Drop mechanism, characterized in that: The following steps are involved: Construct intra-sentence and inter-sentence instances of medical entity relations from the text-level medical corpus through heuristic rules; Extract weighted contextual semantic feature representation of text through BERT pre-trained model and multi-head attention network and relation representation interaction; Extract structured feature representation of text through ELMo pre-trained model, graph convolutional network, and syntactic dependency tree; Concatenate the extracted semantic feature representation and structural feature representation and decode them through the decoder; Use R-Drop regularization to enhance the network to obtain biomedical relationship categories; Among them: The weighted contextual semantic feature representation of the extracted text is specifically: (a) The input of the multi-head attention module uses the BERT pre-trained language model as the input representation, and the input representation is described by formula (1): w1=[w BERT ;w POS ;w dis ] (1) w BERT is the representation of the input text after BERT encodes it, w POS The part-of-speech tag embedding represents the part-of-speech information in the text, w dis Position embedding represents the location of the entity in the document; (b) Use Bi-LSTM to encode the input representation forward and backward. The final text representation is the concatenation of two states, described by formula (2): is the hidden state of the forward LSTM, is the hidden state of the backward LSTM; (c) The relationship vector is represented as the difference between the tail entity and the head entity vector, which is expressed by formula (3): h relation =h tail -h head (3) h tail is the output vector of the tail entity after Bi-LSTM encoding, h head is the output vector of the head entity after Bi-LSTM encoding; (d) The text representation encoded by Bi-LSTM and the relation vector are interacted through a multi-head attention network. For each attention head, the normalized scaled dot product attention mechanism is used to calculate the relevance, which is expressed by formula (4): where Q,K,V∈R n×d Represents the query and key-value matrix. The query in the multi-head attention network is the output h of the Bi-LSTM t and the weight matrix W q Multiply them together to get the text sequence, where the key and value are the relation vector h. relation Respectively with the weight matrix W k and W v Multiply them together to get, d is the dimension of the Bi-LSTM model output, is the scaling factor; (e) The results of the n heads are concatenated as the output representation of the multi-head attention layer as the weighted contextual semantic feature representation, described by Formula 5: h att =[h1;h2;…;h n ] (5) h1,h2,…,h n is the output representation of n attention heads. Among them: The neural network is regularized by the R-Drop mechanism to obtain a more accurate biomedical relationship category: The loss function is modified by the R-Drop mechanism to be a loss function that combines the cross entropy loss calculated twice during the entire neural network training and the bidirectional KL divergence regularization, which is described by formulas (13), (14), and (15): L=L CE +αL KL (15) P1(y i |x i ) and P2(y i |x i ) represents the probability distribution predicted by the two sub-models obtained by two forward calculations, D KL () is the KL divergence calculation function, L CE The average cross entropy loss is obtained by training the network twice, L KL is the bidirectional KL divergence loss between the two sub-networks obtained by training the network twice. α is the weight coefficient used to adjust the KL divergence regularization. After regularization by the R-Drop mechanism, a more accurate relationship type is finally obtained.
2. The biomedical relationship extraction method based on multi-head attention and graph convolutional network combined with R-Drop mechanism as claimed in claim 1, characterized in that: Each pair of entities mentioned in the same sentence of the constructed medical entity relationship instance is constructed as an intra-sentence instance, entity pairs that do not appear in the same sentence in the same document are constructed as inter-sentence instances, and only the closest pair of repeated entity pairs is selected as an instance. Each instance is annotated with the POS tag, syntactic dependency tag and absolute position of each word.
3. The biomedical relationship extraction method based on multi-head attention and graph convolutional network combined with R-Drop mechanism as claimed in claim 1, characterized in that: The nodes of the syntactic dependency tree are each word from the text, and the types of edges between the nodes include: syntactic dependency edges obtained by the Stanford parser are set as directed syntactic dependency edges within the sentence, adjacent sentence edges formed by connecting words as dependency roots in adjacent sentences, and self-node edges with self-nodes on each node.
4. The biomedical relationship extraction method based on multi-head attention and graph convolutional network combined with R-Drop mechanism as claimed in claim 1, characterized in that: The structured feature representation of the extracted text is specifically: (a) The input text of the graph convolutional network is represented by the ELMo pre-trained model as input, which is described by formula (6): w2=[W ELMo ;In POS ;In dis ] (6) w ELMo is the representation of the input text encoded by ELMo, w POS The part-of-speech tag embedding represents the part-of-speech information in the text, w dis Position embedding represents the location of the entity in the document; (b) Use Bi-LSTM to encode the input representation forward and backward, and the final text representation is the concatenation of the two states; (c) Convert the constructed syntactic dependency tree into an adjacency matrix A, where A i,j =1 means there is a dependency edge between word i and word j, A i,j =0 means no dependency, A i,i = 1 represents the self-node edge of each node. The graph convolution operation between the l-th layer node i and the adjacency matrix is described by formula (7): Where W (l) is the weight matrix, b (l) is the bias vector, is the degree of node i in the dependency graph, ρ is the activation function, and the input of the graph convolutional network is is the output of Bi-LSTM; The structured feature representation is described by:
5. The biomedical relationship extraction method based on multi-head attention and graph convolutional network combined with R-Drop mechanism as described in claim 4, characterized in that: The semantic feature representation and structural feature representation of splicing extraction are described by the following formula: h final =[h att ;h GCN ] (9) Input to a two-layer perceptron, expressed by formulas (10) and (11): is the weight matrix, is the bias vector; The Softmax function is then used to identify the type of biomedical relationship, which is described by formula (12): o=softmax(W o h2+b o ) (12) W o is the weight matrix, b o is the bias vector.
6. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the processor executes the code in the memory to implement the method according to any one of claims 1 to 5.
7. A computer storage medium, characterized in that: A computer program is stored, and the computer program is executed by hardware to implement the method according to any one of claims 1 to 5.
