Medical knowledge graph fusion method, device, equipment and medium
By integrating the medical knowledge graph with a multi-head attention neural network model, the problem of not considering node and edge attention in existing methods is solved, achieving more accurate medical entity expression and efficient fusion, and reducing labor costs.
Patent Information
- Application Number
- CN202310456683.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-18
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2043-04-18
AI Technical Summary
Existing medical knowledge graph fusion methods fail to effectively consider the attention of nodes and edges, resulting in their inapplicability in the medical field and a lack of unsupervised training schemes.
A multi-head attention neural network model is adopted to fuse the medical knowledge graph through the attention of nodes and edges, update the graph using adjacent nodes and adjacent edges, combine similarity fusion nodes, and adopt unsupervised training.
It improves the accuracy and efficiency of medical knowledge graph fusion, reduces manpower input, and achieves more precise medical entity expression and fusion.
Smart Images

Figure CN116501887B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method, device, equipment and medium for integrating medical knowledge graphs. Background Art
[0002] When building a medical knowledge graph, we encounter the problem of fusing data from different sources. Generally speaking, for entities that differ only in the string, such as the two entries "diarrhea" and "diarrhea disease", the two entities can be merged through edit distance calculation and certain rules. However, medical entities are usually shorter entity texts, and the distance between medical entities does not entirely depend on their character differences. For example, although "athlete's foot" and "athlete's foot disease" differ by only one character, one is tinea pedis, and the other is vitamin deficiency, which are completely different diseases. Or like "acetylsalicylic acid" and "aspirin", the two seem to have nothing to do with each other at the string level, but they are actually the same substance.
[0003] With the development of graph neural networks, methods for entity fusion using graph neural network models have emerged in other fields. However, these methods often use nodes to represent nodes, considering only the attention between nodes and ignoring the significance of attributes (edges) to entities in the medical graph domain. For example, using drugs A and B together can enhance or diminish their effectiveness. Therefore, existing entity fusion methods are not applicable to the medical field. Summary of the Invention
[0004] In view of this, the present application provides a medical knowledge graph fusion method, device, medium and equipment, while taking into account the attention between nodes and between nodes and edges, to solve the problem that the existing knowledge graph fusion method is not applicable to the medical field.
[0005] In a first aspect of the present application, a method for fusing medical knowledge graphs is provided, the method comprising:
[0006] Obtaining a first medical knowledge graph, wherein the first medical knowledge graph includes a plurality of first nodes and first edges, wherein the first edges are used to identify relationship attributes of the first nodes;
[0007] Inputting the first medical knowledge graph into a multi-head attention neural network model, wherein in the neural network model, the first medical knowledge graph is updated according to the first adjacent nodes adjacent to each first node and the first adjacent edges between the first node and the first adjacent nodes;
[0008] Obtaining a second medical knowledge graph, wherein the second medical knowledge graph is a medical knowledge graph that has been pre-updated using the neural network model, and the second medical knowledge graph includes a plurality of second nodes and second edges, wherein the second edges are used to identify attributes of the second nodes;
[0009] A first target node to be fused is determined in the updated first medical knowledge graph, and the first target node is merged into the second medical knowledge graph based on the similarity between the first target node and the second node.
[0010] In a second aspect of the present application, a medical knowledge graph fusion device is provided, the device comprising:
[0011] A first acquisition module is configured to acquire a first medical knowledge graph, wherein the first medical knowledge graph includes a plurality of first nodes and first edges, wherein the first edges are used to identify relationship attributes of the first nodes;
[0012] a processing module, configured to input the first medical knowledge graph into a multi-head attention neural network model, wherein the first medical knowledge graph is updated in the neural network model according to a first adjacent node adjacent to each first node and a first adjacent edge between the first node and the first adjacent node;
[0013] a second acquisition module, configured to acquire a second medical knowledge graph, wherein the second medical knowledge graph is a medical knowledge graph pre-updated using the neural network model, and the second medical knowledge graph includes a plurality of second nodes and second edges, wherein the second edges are used to identify attributes of the second nodes;
[0014] A fusion module is used to determine a first target node to be fused in the updated first medical knowledge graph, and merge the first target node into the second medical knowledge graph based on the similarity between the first target node and the second node.
[0015] The third aspect of the present application provides an electronic device, including a storage medium, a processor, and instructions or codes stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned medical knowledge graph fusion method when executing the instructions or codes.
[0016] In a fourth aspect of the present application, a storage medium is provided, on which instructions or codes are stored, and when the instructions or codes are executed by a processor, the above-mentioned medical knowledge graph fusion method is implemented.
[0017] The solution implemented by the above-mentioned medical knowledge graph fusion method, device, equipment and medium, through the method of graph neural network to fuse medical knowledge graphs, can make full use of the information of various edges and nodes. Compared with graph fusion based only on character similarity and semantic similarity, this method represents nodes through the adjacent edges and neighboring points of nodes, achieving a more multi-dimensional and accurate expression of nodes. And considering the different importance of different attributes (i.e. edges) to the fusion of medical entities, the attributes are incorporated into the attention network, which improves the accuracy and further solves the problem that the existing fusion method is not suitable for the medical field. Moreover, the model proposed in this article is unsupervised and can complete training without manual annotation of the training set. Through the model, the candidate items are calculated, and then professionals only need to confirm them, which greatly reduces the manpower investment cost.
[0018] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0020] Figure 1 A schematic diagram of a medical knowledge graph fusion method provided in an embodiment of the present application is shown;
[0021] Figure 2 A schematic diagram showing a flow chart of another medical knowledge graph fusion method provided in an embodiment of the present application is shown;
[0022] Figure 3 A structural block diagram of a medical knowledge graph fusion device provided in an embodiment of the present application is shown;
[0023] Figure 4 A structural block diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0024] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0025] The medical knowledge graph fusion method provided in the embodiments of this application can be applied to electronic devices capable of executing instructions or programs. These electronic devices include, but are not limited to, various servers, workstations, personal computers, and laptop computers. Running on different computing devices merely differs in the execution of the solution. Those skilled in the art can foresee that running on different computing devices can produce the same technical effects. The present invention is described in detail below using specific embodiments.
[0026] See also Figure 1 As shown, Figure 1 A flowchart of a medical knowledge graph fusion method provided in an embodiment of the present invention includes the following steps:
[0027] S10: Obtain a first medical knowledge graph, wherein the first medical knowledge graph includes a plurality of first nodes and a first edge, and the first edge is used to identify a relationship attribute of the first node.
[0028] The method provided by the present invention is used for the fusion of medical knowledge graphs. Specifically, for example, there is an internal medical knowledge graph, namely the second medical knowledge graph, and a new medical knowledge graph, namely the first medical knowledge graph, is purchased or crawled from other external channels. This solution can be used to fuse the information in the first medical knowledge graph into the second medical knowledge graph.
[0029] Based on this, we first obtain a first medical knowledge graph. The first medical knowledge graph includes multiple first nodes and first edges. A first node is a specific entity, while a first edge connects two nodes and is used to identify the relationship attribute between the two nodes. For example, there are two first nodes, "diabetes" and "insulin." There is a first edge between these two first nodes, which is used to identify the "treatment" relationship between diabetes and insulin.
[0030] S20: Input the first medical knowledge graph into a multi-head attention neural network model. In the neural network model, the first medical knowledge graph is updated according to the first adjacent nodes adjacent to each first node and the first adjacent edges between the first node and the first adjacent nodes.
[0031] In this step, the first medical knowledge graph is input into the trained multi-head attention neural network model, and the upgraded network model is used to process the first medical knowledge graph. The nodes are updated based on the nodes adjacent to each first node in the first medical knowledge graph, i.e., the first adjacent nodes, and the edges between the first node and the first adjacent nodes, i.e., the first adjacent edges, thereby updating the entire first medical knowledge graph. For example, if "insulin" is the first adjacent node adjacent to "diabetes," and there is a first adjacent edge "treatment" between "diabetes" and "insulin," the first node "diabetes" can be updated based on "insulin" and "treatment."
[0032] It's understandable that while ordinary neural networks treat every node equally, attention neural networks introduce the concept of attention to assign different weights to each adjacent node, thereby identifying more important adjacent nodes. Based on this, multi-head attention includes multiple attention modules, which are essentially multiple independent attention calculations. The results of these calculations are integrated to prevent overfitting.
[0033] Unlike traditional methods that only consider the attention between nodes, this solution uses the first adjacent node and the first adjacent edge to implement node updates. It also considers the attention between nodes and between nodes and edges, avoiding ignoring the physical meaning of edges, making the update results more applicable to the medical field.
[0034] Before step S20, the method further includes the following steps:
[0035] S001: Initialize the second node and the second edge to obtain the second node vector and the second edge vector;
[0036] S002: taking each second node as a node to be updated in turn, and determining a second attention parameter of the node to be updated using the node to be updated and the weight parameter in the multi-head attention neural network model;
[0037] S003: Normalize the second attention parameter to obtain the second normalized parameter of the node to be updated;
[0038] S004: updating a second node vector corresponding to the node to be updated according to the second adjacent node, the weight parameter, and the second normalization parameter, wherein the second adjacent node is a second node adjacent to the node to be updated;
[0039] S005: Setting a loss function according to the similarity between each second node vector and other second node vectors, and adjusting weight parameters according to the loss function until the loss function meets a preset condition.
[0040] In steps S001-S005, before inputting the first medical knowledge graph into the multi-head attention neural network model, the neural network model is first trained to optimize the model so that the processing effect of the model is better, and at the same time, the second medical knowledge graph is updated.
[0041] Specifically, first initialize the second node and the second edge in the second medical graph. Specifically, initialize embedding to obtain the vector representation of each second node, that is, the second node vector h i , where i represents the i-th second node; for the relationship between each two adjacent nodes, i.e., the second edge, one-hot encoding is used, and the encoding is initialized using the relationship matrix to obtain the second edge vector e with the same dimension as the second node vector ij , where j represents the jth neighboring edge of a node.
[0042] It is understood that in graph neural networks, embedding is a vector representation of each node in the graph that reasonably reflects the relationship between them. Transfer learning can be used to obtain pre-trained embeddings from others, or you can train your own, without any restrictions here. One-hot encoding, also known as single-bit effective encoding, mainly uses an N-bit state register to encode N states. Each state has its own independent register bit, and only one bit is valid at any time. One-hot encoding represents categorical variables as binary vectors. This first requires mapping the categorical values to integer values. Then, each integer value is represented as a binary vector, which is zero except for the integer index, which is marked as 1.
[0043] After vectorizing the second nodes and the second edges, each second node is sequentially treated as a node to be updated and the update operation is performed on the node until all second nodes are updated. Specifically, the weight parameters in the node to be updated and the multi-head attention neural network model are used.
[0044] Among them, in the neural network model of multi-head attention, there are multiple attention models, that is, multiple heads. Each attention model includes a weight matrix. When determining the second attention parameter of the node to be updated, the second attention parameter of the node to be updated corresponding to the head is calculated based on the weight matrix of each head, and then based on the vector representation of the node to be updated and the weight matrix of each head.
[0045] After determining the second attention parameter of the node to be updated, the second attention parameter is normalized to obtain the normalized parameter. Specifically, the normalization process can be achieved using softmax:
[0046]
[0047] Where j∈N i , N i represents the second adjacent node set of the i-th second node, represents the second attention parameter between the second node and its j-th second adjacent edge j under the k-th head; represents the normalized parameter obtained after the normalization of the second attention parameter, and k represents the kth head of the multi-head attention.
[0048] It's understandable that the softmax function, also known as the normalized exponential function, can display multi-classification results in the form of probabilities. Softmax doesn't uniquely determine a maximum value, but instead assigns a probability value to each output classification result, indicating the likelihood of belonging to each category.
[0049] Then, the second node vector corresponding to the node to be updated is updated using the second adjacent node adjacent to the node to be updated, the weight parameter, and the second normalization parameter. The update formula is as follows:
[0050]
[0051] Among them, h j represents the jth second adjacent node corresponding to the i-th second node i, W k is the weight parameter corresponding to the kth head to be trained, where the weight parameter is shared by nodes and edges. K represents the total number of heads and can be set according to actual needs. K is generally set to 6.
[0052] After each second node is updated, the neural network model is tuned according to the updated second node. Specifically, the loss function is set according to the similarity between each second node vector and other second node vectors, and the weight parameters are adjusted according to the value of the loss function. Then return to the step of taking each second node as the node to be updated, and using the weight parameters in the node to be updated and the multi-head attention neural network model to determine the second attention parameters of the node to be updated, and continue to execute subsequent steps until a new loss function value is obtained. If the new loss function value still does not meet the preset conditions, continue to adjust the weight parameters and return to the step of taking each second node as the node to be updated, and repeat this cycle until the loss function meets the preset conditions. The preset conditions can be that the loss function value is minimum or converges.
[0053] This embodiment implements the training of a multi-head attention neural network and the update processing of the second medical knowledge graph. Since the second attention parameter is affected by the second node, the second edge and the weight parameter, the nodes and edges are considered simultaneously during the neural network training process, avoiding ignoring the importance of edges in the medical knowledge graph and improving the accuracy of the fusion method.
[0054] In step S002, the second attention parameter of the node to be updated is determined by using the weight parameters in the node to be updated and the multi-head attention neural network model, including the following steps:
[0055] S0021: determining a second adjacent node adjacent to the node to be updated in the second node, and determining a second adjacent edge between the node to be updated and the second adjacent node in the second edge;
[0056] S0022: Determine the second attention parameter between the node to be updated and the second adjacent node based on the node to be updated, the second adjacent edge, and the weight parameters of each attention module in the neural network model of multi-head attention, wherein the second attention parameter corresponds to the attention module.
[0057] In steps S0021-S0022, the second adjacent node and the second adjacent edge adjacent to the node to be updated are determined, and the second attention parameter is determined based on the node to be updated, the second adjacent edge and the weight parameter. Specifically, as the second node in the second medical knowledge graph, the node to be updated has at least one adjacent second adjacent node, and the node to be updated is connected to each second adjacent node through a second adjacent edge. Based on this, the second adjacent node and the second adjacent edge adjacent to the node to be updated can be determined. Then, based on the node to be updated, the second adjacent edge and the weight parameter of each attention module in the multi-head attention neural network model, the specific formula is as follows:
[0058]
[0059] The meaning of each parameter is as described above and will not be repeated here.
[0060] This embodiment differs from the typical node-to-node attention approach by using a node-to-edge attention network. This approach prioritizes adjacent nodes based on the importance of their relationships. For example, for a disease entity, relationships such as the site of onset, department of care, treatment, and medication are more important than its English name or common symptoms (such as headache or dizziness).
[0061] In step S005, a loss function is set according to the similarity between each second node vector and other second node vectors, including the following steps:
[0062] S0051: In the second medical knowledge graph, determine adjacent nodes and non-adjacent nodes of each second node;
[0063] S0052: Determine a first distance between the second node and an adjacent node and a second distance between the second node and a non-adjacent node, and set a sub-loss function of the second node according to the first distance and the second distance;
[0064] S0053: Add up the sub-loss functions of all second nodes to obtain the loss function.
[0065] In steps S0051-S0053, after all second node vectors are updated, a loss function is set based on the similarity between the second node vectors. Since adjacent nodes are expected to be represented by similar vectors, and non-adjacent nodes are expected to be represented by vectors with larger distances, the loss function is composed of an adjacent node part and a non-adjacent node part. The adjacent nodes and non-adjacent nodes of the second node are determined separately, and the first distance between the second node and the adjacent node and the second distance between the second node and the non-adjacent node are calculated separately. The sub-loss function corresponding to the second node is then determined based on the first distance and the second distance. The specific calculation formula is as follows:
[0066]
[0067] Among them, L u is the loss function of the second node u, h u Represents the second node u, h v represents the adjacent nodes of the second node u, h w represents the non-adjacent nodes of the second node u.
[0068] After determining the sub-loss function of each second node separately, the sub-loss function of each second node is added together as the loss function of the entire second medical knowledge graph, and then the weight parameters of the neural network model can be adjusted according to the loss function value of the entire second medical knowledge graph.
[0069] In addition, since the second node may have a large number of non-adjacent nodes, which leads to excessive computation, N non-adjacent nodes of the second node u can be randomly sampled as h w The loss function is calculated without using all non-adjacent nodes. N can be set according to actual needs. By selecting N non-adjacent nodes, the amount of computation is reduced and the training efficiency of the model is improved.
[0070] In step S20, updating the first medical knowledge graph according to the first adjacent nodes adjacent to each first node and the first adjacent edges between the first node and the first adjacent nodes includes the following steps:
[0071] S21: Initialize the first node and the first edge to obtain a first node vector and a first edge vector;
[0072] S22: Determine a first attention parameter between the first node and the first adjacent node according to the first node, the first adjacent edge, and the weight parameter, and normalize the first attention parameter to obtain a first normalized parameter of the first node;
[0073] S23: Update the first node vector according to the first adjacent node, the weight parameter, and the first normalization parameter.
[0074] In steps S21-S23, the first medical knowledge graph is updated using the trained multi-head attention neural network model. Except for not including the steps of setting the loss function and adjusting the weight parameters according to the loss function, the updating steps of the first medical knowledge graph are similar to the training steps of the aforementioned neural network model. For details, please refer to steps S001-S004 and steps S0021-S0022, which will not be repeated here.
[0075] This embodiment obtains, for each first node in the first medical knowledge graph, the vector representation of its first adjacent node and the first adjacent edge, and then weights the vector representation of the first adjacent node and the first adjacent edge of the first node by the existing first attention parameter to obtain the final updated first node vector, which fully considers the influence of adjacent nodes and edges on the first node and improves the accuracy of the entire fusion method.
[0076] S30: Obtain a second medical knowledge graph, wherein the second medical knowledge graph is a medical knowledge graph that has been updated in advance using a neural network model, and the second medical knowledge graph includes multiple second nodes and second edges, and the second edges are used to identify attributes of the second nodes.
[0077] In this step, a second medical knowledge graph is acquired to merge entities, or nodes, from the first medical knowledge graph into the second medical knowledge graph. Similar to the first node and first edge of the first medical knowledge graph, the second medical knowledge graph includes a second node and a second edge. The second medical knowledge graph has already been updated using a multi-head attention neural network model. The update steps are as described above and will not be repeated here.
[0078] S40: Determine a first target node to be fused in the updated first medical knowledge graph, and merge the first target node into the second medical knowledge graph based on the similarity between the first target node and the second node.
[0079] In this step, in the updated first medical knowledge graph, the first target node to be fused is determined in the first node, wherein the first target node can be one or more, or can be all the first nodes in the first medical knowledge graph. After determining the first target node, the first target node is merged into the second medical knowledge graph. It can be understood that if the first target node has a high similarity with a second node in the second medical knowledge graph, the first target node and the second node may be the same node, otherwise the first target node and the second node may be different nodes. Therefore, the similarity between the first target node and the second node can be used to perform a node fusion operation. Among them, the distance between the first target node and the second node can be used as the similarity between the two.
[0080] In step S40, based on the similarity between the first target node and the second node, the first target node is merged into the second medical knowledge graph, which includes the following steps:
[0081] S41: Determine, from among the plurality of second nodes, first candidate nodes of the same type as the first target node, and respectively calculate a similarity between the first target node and each of the first candidate nodes as a candidate similarity;
[0082] S42: selecting a first candidate node whose candidate similarity is greater than a preset similarity threshold as a second candidate node, and determining a preset number of second candidate nodes with the largest candidate similarities as third candidate nodes;
[0083] S43: Determine a second target node from the third candidate nodes, and merge the first target node with the second target node.
[0084] In steps S41-S43, since the higher the similarity between two nodes, the more likely the two nodes are to be the same node, a node that may be the same as the first target node is determined from a plurality of second nodes based on the similarity between the first target node and the second node. Specifically, first, a first candidate node of the same type as the first target node is selected from the second nodes. It is understandable that the second medical knowledge graph may contain second nodes of different types, for example, "diabetes" is a second node of the disease type, and "acetylsalicylic acid" is a second node of the drug type. Since nodes of different types cannot be the same node, this embodiment only uses the second node of the same type as the first target node as the first candidate node, and eliminates the second nodes that cannot be the same as the first target node without performing similarity calculations on these eliminated second nodes, thereby reducing the amount of computation and improving fusion efficiency.
[0085] After the first candidate node is screened out, the similarity between each first candidate node and the first target node is calculated respectively as the alternative similarity corresponding to the first candidate node. It can be understood that the greater the alternative similarity, the more likely the first candidate node is the same node as the first target node. Therefore, the first candidate node with an alternative similarity greater than the preset similarity threshold is selected as the second candidate node. Since the similarity of the second candidate node is greater than the preset similarity threshold, it is considered that the second candidate node is likely to be the same node as the first target node. Among the second candidate nodes, a preset number of nodes with the largest alternative similarity are further determined as the third candidate node, and confirmed by professionals. A second target node is determined among the preset number of third candidate nodes. It is considered that the first target node and the second target node are the same node. The two nodes are fused to integrate the first target node into the second medical knowledge graph.
[0086] The preset number can be set according to actual needs and historical experience. Preferably, the preset number can be set to 5.
[0087] This embodiment first selects the first candidate node based on node type and only calculates similarity for the first candidate node, significantly reducing the amount of computation. Further confirmation by professionals is then performed based on node similarity, further improving the accuracy of the results through these two levels of screening.
[0088] In step S40, the first target node is merged into the second medical knowledge graph according to the similarity between the first target node and the second node, and the following steps are also included:
[0089] S44: If the similarities of all the alternatives are not greater than the preset similarity threshold, the first target node is added to the second medical knowledge graph as a new node.
[0090] In step S44, it is understood that the smaller the candidate similarity, the smaller the possibility that the first candidate node is the same as the first target node. Therefore, if the candidate similarity of the first candidate node is less than the preset similarity threshold, it is considered that the possibility that the first candidate node is the same as the first target node is very small. Based on this, if all candidate similarities are not greater than the preset similarity threshold, it is considered that the first target node and each first candidate node are not the same node. Therefore, the first target node is added as a new second node to the second medical knowledge graph.
[0091] Figure 2 A flowchart of a medical knowledge graph fusion method provided by another embodiment of the present application is shown, as shown in the figure, including the following steps:
[0092] S2-001: Obtain a first medical knowledge graph, wherein the first medical knowledge graph includes a plurality of first nodes and first edges, where the first edges are used to identify relationship attributes of the first nodes;
[0093] S2-002: Initialize the second node and the second edge to obtain the second node vector and the second edge vector;
[0094] S2-003: sequentially taking each second node as a node to be updated, determining a second adjacent node adjacent to the node to be updated in the second nodes, and determining a second adjacent edge between the node to be updated and the second adjacent node in the second edges;
[0095] S2-004: Determine a second attention parameter between the node to be updated and the second adjacent node based on the node to be updated, the second adjacent edge, and the weight parameter of each attention module in the multi-head attention neural network model, wherein the second attention parameter corresponds to the attention module;
[0096] S2-005: Normalize the second attention parameter to obtain the second normalized parameter of the node to be updated;
[0097] S2-006: updating a second node vector corresponding to the node to be updated according to the second adjacent node, the weight parameter, and the second normalization parameter, wherein the second adjacent node is a second node adjacent to the node to be updated;
[0098] S2-007: In the second medical knowledge graph, determine adjacent nodes and non-adjacent nodes of each second node;
[0099] S2-008: Determine a first distance between the second node and an adjacent node and a second distance between the second node and a non-adjacent node, and set a sub-loss function of the second node according to the first distance and the second distance;
[0100] S2-009: Add up the sub-loss functions of all second nodes to obtain the loss function;
[0101] S2-010: Adjust the weight parameters according to the loss function until the loss function meets the preset conditions;
[0102] S2-011: Input the first medical knowledge graph into the multi-head attention neural network model. In the neural network model, initialize the first node and the first edge to obtain the first node vector and the first edge vector;
[0103] S2-012: Determine a first attention parameter between the first node and the first adjacent node based on the first node, the first adjacent edge, and the weight parameter, and normalize the first attention parameter to obtain a first normalized parameter of the first node;
[0104] S2-013: Update the first node vector according to the first adjacent node, the weight parameter, and the first normalization parameter;
[0105] S2-014: Obtain a second medical knowledge graph, wherein the second medical knowledge graph is a medical knowledge graph that has been pre-updated using a neural network model, and the second medical knowledge graph includes a plurality of second nodes and second edges, where the second edges are used to identify attributes of the second nodes;
[0106] S2-015: Determine a first target node to be fused in the updated first medical knowledge graph;
[0107] S2-016: Determine, from the plurality of second nodes, first candidate nodes of the same type as the first target node, and calculate a similarity between the first target node and each of the first candidate nodes as a candidate similarity;
[0108] S2-017: The first candidate node whose candidate similarity is greater than a preset similarity threshold is selected as the second candidate node, and a preset number of second candidate nodes with the largest candidate similarities are determined as the third candidate node;
[0109] S2-018: Determine a second target node from the third candidate node, and merge the first target node with the second target node;
[0110] S2-019: If the similarities of all alternatives are not greater than the preset similarity threshold, the first target node is added to the second medical knowledge graph as a new node.
[0111] Regarding steps S2-001-S2-019, their principles and effects are similar to those of the aforementioned embodiments. Please refer to the relevant descriptions in the method embodiments. To avoid repetition, they will not be described here.
[0112] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0113] It can be seen that compared with the existing medical knowledge graph fusion method, the above scheme uses the graph neural network method to fuse medical knowledge graphs, which can make full use of the information of various edges and nodes. Compared with graph fusion based only on character similarity and semantic similarity, this method represents nodes through their adjacent edges and neighboring points, achieving a more multi-dimensional and accurate expression of nodes. Taking into account the different importance of different attributes (i.e. edges) to medical entity fusion, the attributes are incorporated into the attention network, which improves the accuracy and further solves the problem that the existing fusion method is not suitable for the medical field. Moreover, the model proposed in this article is unsupervised and can complete training without manual annotation of the training set. Through the model, the candidate items are calculated, and then professionals only need to confirm them, which greatly reduces the manpower investment cost.
[0114] In one embodiment, a medical knowledge graph fusion device is provided, which corresponds to the medical knowledge graph fusion method in the above embodiment. Figure 3 As shown, the medical knowledge graph fusion device includes: a first acquisition module, a processing module, a second acquisition module and a fusion module. The functional modules are described in detail as follows:
[0115] A first acquisition module is configured to acquire a first medical knowledge graph, wherein the first medical knowledge graph includes a plurality of first nodes and first edges, and the first edges are configured to identify relationship attributes of the first nodes;
[0116] a processing module, configured to input the first medical knowledge graph into a multi-head attention neural network model, and update the first medical knowledge graph in the neural network model according to a first adjacent node adjacent to each first node and a first adjacent edge between the first node and the first adjacent node;
[0117] a second acquisition module, configured to acquire a second medical knowledge graph, wherein the second medical knowledge graph is a medical knowledge graph that has been pre-updated using a neural network model, and the second medical knowledge graph includes a plurality of second nodes and second edges, wherein the second edges are used to identify attributes of the second nodes;
[0118] The fusion module is used to determine the first target node to be fused in the updated first medical knowledge graph, and merge the first target node into the second medical knowledge graph based on the similarity between the first target node and the second node.
[0119] In one embodiment, the processing module is configured to:
[0120] Initialize the second node and the second edge to obtain a second node vector and a second edge vector;
[0121] Taking each second node as a node to be updated in turn, and using the node to be updated and the weight parameters in the multi-head attention neural network model to determine the second attention parameter of the node to be updated;
[0122] Normalize the second attention parameter to obtain the second normalized parameter of the node to be updated;
[0123] updating a second node vector corresponding to the node to be updated according to the second adjacent node, the weight parameter, and the second normalization parameter, wherein the second adjacent node is a second node adjacent to the node to be updated;
[0124] A loss function is set according to the similarity between each second node vector and other second node vectors, and a weight parameter is adjusted according to the loss function until the loss function meets a preset condition.
[0125] In one embodiment, the processing module is configured to:
[0126] Determine, in the second node, a second adjacent node adjacent to the node to be updated, and determine, in the second edge, a second adjacent edge between the node to be updated and the second adjacent node;
[0127] According to the node to be updated, the second adjacent edge and the weight parameters of each attention module in the neural network model of multi-head attention, the second attention parameter between the node to be updated and the second adjacent node is determined, wherein the second attention parameter corresponds to the attention module.
[0128] In one embodiment, the processing module is configured to:
[0129] Initialize the first node and the first edge to obtain a first node vector and a first edge vector;
[0130] Determine a first attention parameter between the first node and the first adjacent node according to the first node, the first adjacent edge, and the weight parameter, and normalize the first attention parameter to obtain a first normalized parameter of the first node;
[0131] The first node vector is updated according to the first adjacent node, the weight parameter, and the first normalization parameter.
[0132] In one embodiment, the fusion module is used to:
[0133] Determine, among the plurality of second nodes, first candidate nodes of the same type as the first target node, and respectively calculate similarities between the first target node and each of the first candidate nodes as candidate similarities;
[0134] The first candidate node whose candidate similarity is greater than a preset similarity threshold is used as the second candidate node, and a preset number of second candidate nodes with the largest candidate similarities are determined as the third candidate node;
[0135] A second target node is determined in the third candidate node, and the first target node is merged with the second target node.
[0136] In one embodiment, the fusion module is used to:
[0137] If the similarities of all candidates are not greater than the preset similarity threshold, the first target node is added to the second medical knowledge graph as a new node.
[0138] In one embodiment, the processing module is configured to:
[0139] In the second medical knowledge graph, determining adjacent nodes and non-adjacent nodes of each second node respectively;
[0140] Determine a first distance between the second node and an adjacent node and a second distance between the second node and a non-adjacent node, and set a sub-loss function of the second node according to the first distance and the second distance;
[0141] Add up all the sub-loss functions of the second node to get the loss function.
[0142] In one embodiment, an electronic device is provided. The electronic device may be a mobile device such as a mobile phone, a tablet, a vehicle-mounted mobile terminal, or other device with program execution capability. The internal structure of the electronic device may be as shown in FIG. Figure 4 As shown. The electronic device includes a processor, a memory and a network module. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, instructions or code. The internal memory provides an environment for the operation of the operating system and instructions or codes in the non-volatile storage medium. When the instructions or codes are executed by the processor, they implement the functions or steps of the above-mentioned medical knowledge graph fusion method. The network module of the electronic device may include a network interface and / or a wireless network module, and the electronic device may communicate with other devices or service platforms through the network module. In addition, the electronic device may also include a display screen and an input device, etc.
[0143] In one embodiment, an electronic device is provided, including a memory, a processor, and instructions or codes stored in the memory and executable on the processor. When the processor executes the instructions or codes, the following steps are implemented:
[0144] Obtaining a first medical knowledge graph, wherein the first medical knowledge graph includes a plurality of first nodes and first edges, where the first edges are used to identify relationship attributes of the first nodes;
[0145] Inputting the first medical knowledge graph into a multi-head attention neural network model, and updating the first medical knowledge graph in the neural network model according to the first adjacent nodes adjacent to each first node and the first adjacent edges between the first node and the first adjacent nodes;
[0146] Obtaining a second medical knowledge graph, wherein the second medical knowledge graph is a medical knowledge graph that has been pre-updated using a neural network model, and the second medical knowledge graph includes a plurality of second nodes and second edges, where the second edges are used to identify attributes of the second nodes;
[0147] A first target node to be fused is determined in the updated first medical knowledge graph, and the first target node is merged into the second medical knowledge graph based on the similarity between the first target node and the second node.
[0148] In one embodiment, a storage medium is provided on which instructions or codes are stored. When the instructions or codes are executed by a processor, the following steps are implemented:
[0149] Obtaining a first medical knowledge graph, wherein the first medical knowledge graph includes a plurality of first nodes and first edges, where the first edges are used to identify relationship attributes of the first nodes;
[0150] Inputting the first medical knowledge graph into a multi-head attention neural network model, and updating the first medical knowledge graph in the neural network model according to the first adjacent nodes adjacent to each first node and the first adjacent edges between the first node and the first adjacent nodes;
[0151] Obtaining a second medical knowledge graph, wherein the second medical knowledge graph is a medical knowledge graph that has been pre-updated using a neural network model, and the second medical knowledge graph includes a plurality of second nodes and second edges, where the second edges are used to identify attributes of the second nodes;
[0152] A first target node to be fused is determined in the updated first medical knowledge graph, and the first target node is merged into the second medical knowledge graph based on the similarity between the first target node and the second node.
[0153] It should be noted that the functions or steps that can be implemented by the above-mentioned storage medium or electronic device can be referred to the relevant description in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0154] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through instructions or codes, and the instructions or codes can be stored in a non-volatile readable storage medium. When the instructions or codes are executed, they may include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0155] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0156] Those skilled in the art will appreciate that the accompanying drawings are merely schematic diagrams of a preferred implementation scenario, and that the units or processes in the accompanying drawings are not necessarily required for the implementation of this application. Those skilled in the art will appreciate that the units in the system in the implementation scenario can be distributed in the system of the implementation scenario according to the implementation scenario description, or can be changed accordingly and located in one or more systems different from the implementation scenario. The units of the above-mentioned implementation scenario can be combined into one unit, or can be further split into multiple sub-units.
[0157] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.
Claims
1. A method for entity fusion of medical knowledge graph, characterized in that: The method comprises: Obtaining a first medical knowledge graph, wherein the first medical knowledge graph includes a plurality of first nodes and first edges, wherein the first edges are used to identify relationship attributes of the first nodes; Inputting the first medical knowledge graph into a multi-head attention neural network model, wherein in the neural network model, the first medical knowledge graph is updated according to the first adjacent nodes adjacent to each first node and the first adjacent edges between the first node and the first adjacent nodes; Obtaining a second medical knowledge graph, wherein the second medical knowledge graph is a medical knowledge graph that has been pre-updated using the neural network model, and the second medical knowledge graph includes a plurality of second nodes and second edges, wherein the second edges are used to identify attributes of the second nodes; A first target node to be fused is determined in the updated first medical knowledge graph, and the first target node is merged into the second medical knowledge graph based on the similarity between the first target node and the second node.
2. The method according to claim 1, characterized in that Before inputting the first medical knowledge graph into the multi-head attention neural network model, the method further includes: Initializing the second node and the second edge to obtain a second node vector and a second edge vector; Taking each of the second nodes as a node to be updated in turn, and determining a second attention parameter of the node to be updated by using the node to be updated and a weight parameter in the multi-head attention neural network model; Normalizing the second attention parameter to obtain a second normalized parameter of the node to be updated; updating a second node vector corresponding to the node to be updated according to a second adjacent node, the weight parameter, and the second normalization parameter, wherein the second adjacent node is a second node adjacent to the node to be updated; A loss function is set according to the similarity between each second node vector and other second node vectors, and the weight parameter is adjusted according to the loss function until the loss function meets a preset condition.
3. The method according to claim 2, characterized in that The determining the second attention parameter of the node to be updated by using the node to be updated and the weight parameter in the multi-head attention neural network model includes: Determine a second adjacent node adjacent to the node to be updated in the second nodes, and determine a second adjacent edge between the node to be updated and the second adjacent node in the second edges; According to the node to be updated, the second adjacent edge and the weight parameters of each attention module in the neural network model of the multi-head attention, the second attention parameter between the node to be updated and the second adjacent node is determined, wherein the second attention parameter corresponds to the attention module.
4. The method according to claim 2, characterized in that The updating of the first medical knowledge graph according to the first adjacent nodes adjacent to each of the first nodes and the first adjacent edges between the first node and the first adjacent nodes includes: Initializing the first node and the first edge to obtain a first node vector and a first edge vector; Determining a first attention parameter between the first node and the first adjacent node according to the first node, the first adjacent edge, and the weight parameter, and normalizing the first attention parameter to obtain a first normalized parameter of the first node; The first node vector is updated according to the first adjacent node, the weight parameter, and the first normalization parameter.
5. The method according to claim 1, wherein The step of merging the first target node into the second medical knowledge graph according to the similarity between the first target node and the second node includes: Determine, from the plurality of second nodes, first candidate nodes of the same type as the first target node, and respectively calculate a similarity between the first target node and each of the first candidate nodes as a candidate similarity; The first candidate node whose candidate similarity is greater than a preset similarity threshold is used as the second candidate node, and a preset number of second candidate nodes with the largest candidate similarities are determined as the third candidate nodes; A second target node is determined among the third candidate nodes, and the first target node is merged with the second target node.
6. The method according to claim 5, characterized in that The method further comprises: If all the alternative similarities are not greater than the preset similarity threshold, the first target node is added to the second medical knowledge graph as a new node.
7. The method according to claim 2, characterized in that The setting of the loss function according to the similarity between each second node vector and other second node vectors includes: In the second medical knowledge graph, determining adjacent nodes and non-adjacent nodes of each second node respectively; Determine a first distance between the second node and the adjacent node and a second distance between the second node and the non-adjacent node, and set a sub-loss function of the second node according to the first distance and the second distance; The sub-loss functions of all second nodes are added together to obtain the loss function.
8. A medical knowledge graph entity fusion device, characterized in that: The device comprises: A first acquisition module is configured to acquire a first medical knowledge graph, wherein the first medical knowledge graph includes a plurality of first nodes and first edges, wherein the first edges are used to identify relationship attributes of the first nodes; a processing module, configured to input the first medical knowledge graph into a multi-head attention neural network model, wherein the first medical knowledge graph is updated in the neural network model according to a first adjacent node adjacent to each first node and a first adjacent edge between the first node and the first adjacent node; a second acquisition module, configured to acquire a second medical knowledge graph, wherein the second medical knowledge graph is a medical knowledge graph pre-updated using the neural network model, and the second medical knowledge graph includes a plurality of second nodes and second edges, wherein the second edges are used to identify attributes of the second nodes; A fusion module is used to determine a first target node to be fused in the updated first medical knowledge graph, and merge the first target node into the second medical knowledge graph based on the similarity between the first target node and the second node.
9. A storage medium having a program or instruction stored thereon, characterized in that: When the program or instruction is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. An electronic device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Entity updating method and system of knowledge graph
CN115809340A
Method and system for relation learning by multi-hop attention graph neural network
US20220092413A1