Medical knowledge graph construction method and system based on metric learning

By using adversarial enhancement networks to generate representative features in the medical knowledge graph, the problem of constructing unbiased relationship prototypes under limited support samples is solved, and a higher quality and effective medical knowledge graph construction is achieved.

CN119884385AActive Publication Date: 2025-04-25ANHUI MEDICAL UNIV
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411784662.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-04-25
Estimated Expiration
2044-12-02

AI Technical Summary

Technical Problem

In the medical knowledge graph, how to learn as unbiased and reliable relational prototypes as possible with limited support samples, especially in the absence of sufficient contextual information.

Method used

Using a metric learning-based method, a network generates representative features through adversarial augmentation network to build a prototype of complex relationships. The specific steps include obtaining the medical knowledge graph, splitting it into training sets and background knowledge graphs, randomly selecting relational nodes to build support sets and query sets, selecting representative entity pairs to train adversarial enhancement networks, generating representative features of entity pairs, and querying the dot product between the semantic representations of the entity pairs as the trustworthiness score of the triple by correcting the prototype and querying the semantic representations of the entity pairs in the query set.

Benefits of technology

It significantly improves the construction quality and effectiveness of medical knowledge graphs, and the generated features are more accurate and representative, which can more accurately represent complex relationships in medical knowledge graphs, and improves the generalization ability of the model on unknown data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119884385A_ABST
    Figure CN119884385A_ABST
Patent Text Reader

Abstract

The invention discloses a medical knowledge graph construction method and system based on metric learning, belongs to the technical field of knowledge graph construction, and solves the problem of how to construct a medical knowledge graph by using a small amount of training data and accurately generate new medical knowledge. The method comprises the following steps: selecting representative entity pairs, training an adversarial enhancement network model by using the representative entity pairs, generating representative features of the entity pairs, constructing a generator of the adversarial enhancement network, applying constraints to the adversarial enhancement network, training the generator by minimizing a target function, and constructing a discriminator of the adversarial enhancement network. Adopting the trained adversarial enhancement network model to enhance the support set, constructing a relationship prototype, correcting the dot product between semantic representations of query entity pairs in the prototype and query set as a credibility score of a triple, inputting the existing medical knowledge graph into the adversarial enhancement network model, and obtaining the credibility score of the triple. And outputting the credibility probability of the new medical knowledge triad generated by the model, and outputting the medical knowledge triad with the higher probability to realize the construction of the medical knowledge graph.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of knowledge graph construction, and relates to a method and system for constructing a medical knowledge graph based on metric learning. Background Art

[0002] In today's information age, the amount of data is growing explosively. How to effectively integrate and represent massive data has become an important issue. As an effective way to represent knowledge, knowledge graph organizes knowledge into graphs in the form of triples (head entity, relationship, tail entity), making the connections between knowledge clearly visible. As an important form of knowledge organization, knowledge graph has been widely used in intelligent question answering, natural language understanding, big data analysis, explainable artificial intelligence and other fields, and has important significance and value in promoting the development of a new generation of artificial intelligence technology.

[0003] Medicine is one of the most widely used vertical fields for knowledge graphs. In medical knowledge graphs, entities usually represent medical concepts or things, such as diseases, symptoms, drugs, genes, proteins, etc., while relationships represent medical concepts or things, such as disease types, clinical manifestations, induced causes, pathogenesis, etc. At present, medical knowledge graphs are mainly used for precise medical semantic search, medical question-and-answer systems, medical auxiliary diagnosis, and intelligent clinical decision support. Medical knowledge graphs combine knowledge graphs with medical knowledge, and integrate Internet technology with medical contexts to achieve automated and intelligent processing of medical data.

[0004] Constructing a medical knowledge graph can provide support for clinical decision support, literature visualization analysis, intelligent question and answer, and smart search. People consider using models to learn knowledge from existing medical knowledge graphs to generate new possible medical knowledge, which is the current hot problem of knowledge graph completion. Knowledge graph completion methods automatically infer new triplets from existing triplets to expand the scale of existing knowledge graphs. However, the effectiveness of these methods depends on a large number of training triplets. In practical applications, the relationships in knowledge graphs usually follow a long-tail distribution, where most relationships have only a few triplets. In order to learn relational prototypes that are as unbiased and reliable as possible with limited support samples, two main problems are faced: (1) How to design a data augmentation strategy for medical knowledge graphs: Although data augmentation techniques have been successful in the text field, such as in the literature (Kumar V, Glaude H, de Lichy C, et al. A Closer Look At Feature Space DataAugmentation For Few-Shot Intent Classification[C] / / Proceedings of the 2ndWorkshop on Deep Learning Approaches for Low-Resource NLP.2019:1-10.) and the literature (Tang Z, Pei S, Zhang Z, et al. Positive-Unlabeled Learning with Adversarial DataAugmentation for Knowledge Graph Completion[C].Intemational Joint Conferenceson Artificial Intelligence, 2022.), its application in the context of medical knowledge graphs is still relatively unexplored. The reason is that medical knowledge graphs lack sufficient contextual information to accurately understand the relational semantics of triples, making it difficult to maintain semantic invariance after data transformation. Therefore, in order to generate new entity pairs while preserving the semantics of the original relations, it is crucial to develop new data augmentation techniques specifically for medical knowledge graphs. (2) How to generate representative samples of task relations: Even if a large number of support samples are available, obtaining unbiased prototypes is still challenging because some support entity pairs may be far away from the unbiased prototypes in the feature space, which brings difficulties to learning unbiased prototypes from these non-representative samples.In contrast, even with only a small number of representative samples, accurate and unbiased prototypes can be achieved, such as in the literature (Xu J, Le H. Generating representative samples for few-shot classification [C] / / Proceedings of the IEEE / CVF Conference on Computer Vision and Pattern Recognition. 2022: 9003-9013.). Therefore, it is crucial to propose a method to generate representative samples to construct unbiased relational prototypes. Summary of the invention

[0005] The technical solution of the present invention is used to solve the problem of how to construct a medical knowledge graph using a small amount of training data and accurately generate new medical knowledge.

[0006] The present invention solves the above technical problems through the following technical solutions:

[0007] A method for constructing a medical knowledge graph based on metric learning includes the following steps:

[0008] S1. Obtain medical knowledge graph and construct medical knowledge triples;

[0009] S2, split the medical knowledge triples into training sets and background knowledge graphs according to their relationships;

[0010] S3, randomly extracting relationship nodes from the training knowledge graph, and selecting some triples corresponding to the relationship nodes to construct a support set for the relationship nodes, using the remaining triples of the relationship nodes to construct a query set, and then replacing all tail entities in the query set with entities that have no association with their head entities, thereby constructing a negative query set;

[0011] S4. Select representative entity pairs to guide the adversarial enhancement network to generate representative features;

[0012] S5. Use representative entity pairs to train the adversarial enhancement network model to generate representative features of the entity pairs;

[0013] S51. Construct a generator of the adversarial enhanced network, impose constraints on the adversarial enhanced network, and minimize the objective function to train the generator;

[0014] S52, build a discriminator for adversarial enhanced networks;

[0015] S6. Use the trained adversarial enhancement network model to enhance the support set, construct the relationship prototype, and use the dot product between the semantic representation of the modified prototype and the query entity pair in the query set as the credibility score of the triple;

[0016] S7. Input the existing medical knowledge graph into the adversarial enhanced network model, output the credibility score of the new medical knowledge triples generated by the model, output the medical knowledge triples with the highest scores, and realize the construction of the medical knowledge graph.

[0017] Furthermore, the step S1 of obtaining a medical knowledge graph and constructing a medical knowledge triple is specifically as follows: obtaining a medical knowledge graph, and constructing a medical knowledge graph G = {(h, r, t)∈ε×R×ε} according to the entities in the medical knowledge graph and the relationships between the entities, wherein h represents the head entity node, r represents the relationship node, and t represents the tail entity node; ε and R are the entity node set and the relationship node set corresponding to the medical knowledge graph G, respectively.

[0018] Furthermore, the step S2 of splitting the medical knowledge triples into the training set and the background knowledge graph according to the relationships is specifically as follows: extracting some triples from the medical knowledge graph G as the background knowledge graph G′, wherein the background knowledge graph G′ contains some relationship nodes in the relationship node set R, and the triples corresponding to the remaining relationship nodes in the relationship node set R are used as the training knowledge graph G train .

[0019] Furthermore, the representative entity pairs selected in step S4 are specifically: given a training relation r∈R train , by taking the average of the semantic representations of all entity pairs belonging to relation r to calculate its distribution center μ r , the distribution center μ r The expression is as follows:

[0020]

[0021] In the formula, |T r | is the number of entity pairs of relation r, is the i-th entity pair of relation r (h i , t i ), as the original feature, the original feature The expression is as follows:

[0022]

[0023] In the formula, F θ (·) is the pre-trained feature extractor, F θ (h i ) and F θ (ti ) are the head entities h i and the tail entity t i The representation of θ (·) is learned, ∨ is a serial operation;

[0024] Select μ r and (h i , t i )∈T r The first M entity pairs with the closest distance between them are regarded as representative entity pairs. The specific expression is as follows:

[0025]

[0026] In the formula, topM(D r ) is the distance set D r The operation of selecting the first M elements in r ′ is a set of M representative entity pairs related to relation r, (h n , t n ) is the most representative entity pair.

[0027] Furthermore, the generator for constructing the adversarial enhancement network in step S51 is specifically:

[0028] G φ (h; z h )=Ω1(Ω2(F θ (h))∨z h )

[0029]

[0030] G φ (t; z t )=Ω1(Ω2(F θ (t))∨z t )

[0031]

[0032] Where Ω1 and Ω2 are two feedforward neural networks with different parameters, z h and z t is random noise sampled from a Gaussian distribution, is the feature representation synthesized with h as input, is the feature representation synthesized with t as input, N is the Gaussian distribution, z h and z t It follows a Gaussian distribution with a mean of 0 and a variance of δI. is the identity matrix whose size is controlled by the deviation of the noise input δ, and d is the dimension of the entity representation.

[0033] Furthermore, the constraint imposed on the adversarial enhancement network in step S51 is specifically: minimizing the distribution distance L between the original feature representation and the synthesized feature representation advG , the distribution distance L advG The expression is as follows:

[0034]

[0035] In the formula, To do this by repeating in the row direction Three times to construct Matrices with the same dimensions, Calculation and judgment unit In generating features The expected output is It refers to the calculation judgement exist The expected output of

[0036] A higher similarity L is enforced between generated features and positive entity pairs than between generated features and negative entity pairs. rank , the similarity L rank The expression is as follows:

[0037]

[0038] Where, [x] + =max(0,x) is the hinge loss, γ is the marginal hyperparameter and γ>0, · represents the dot product operation, (h + , t + ) is a positive entity pair, T r ' + is the set of positive entity pairs, which is T r ′ is a subset of (h - , t - ) is a negative entity pair, T r ' - is the set of negative entity pairs, T r ' - By replacing T with a fake entity r ' + It is constructed from the tail entity of the entity pair in .

[0039] Furthermore, the step S51 of minimizing the objective function to train the generator is specifically:

[0040]

[0041] In the formula, To minimize the objective function, λ is a hyperparameter used to control the trade-off between the two constraints.

[0042] Furthermore, the discriminator of building the adversarial enhancement network in step S52 is specifically: maximizing the distribution distance between the synthetic features and the original features The distribution distance The expression is as follows:

[0043]

[0044] Where, L GP To enforce the Lipchitz constraint gradient penalty, β is the penalty parameter, ε is the number of random noise drawn from a uniform distribution, ε~U(0,1), Represents the interpolation feature Find the discriminator gradient.

[0045] Furthermore, the construction of the relation prototype in step S6 is specifically as follows: for a given relation r, the adversarial enhancement network takes the representations of all its supporting entity pairs as input, generates a new feature representation, and the original feature representation of the supporting entity pairs and synthetic features are concatenated to form an extended feature representation, denoted as Modified prototype of task relation r The calculation is as follows:

[0046]

[0047] In the formula, for The i-th feature in ω i To enhance the weight of the relationship between the supporting sample and the original prototype, the weight ω i The expression is as follows:

[0048]

[0049] Where ε is a scalar parameter, μ r is the distribution center calculated in step S4.

[0050] The present invention also provides a medical knowledge graph construction system based on metric learning, including a triple construction module, a data set splitting module, a data set construction module, an entity pair selection module, a feature generation module, a relationship prototype construction module, and a knowledge graph construction module:

[0051] The triple construction module is used to obtain a medical knowledge graph and construct a medical knowledge triple;

[0052] The data set splitting module is used to split the medical knowledge triples into training sets and background knowledge graphs according to their relationships;

[0053] The data set construction module is used to randomly extract relationship nodes from the training knowledge graph, select some triples corresponding to the relationship nodes to construct a support set for the relationship nodes, use the remaining triples of the relationship nodes to construct a query set, and then replace all tail entities in the query set with entities that have no association relationship with their own head entities, so as to construct a negative query set;

[0054] The entity pair selection module is used to select representative entity pairs to guide the adversarial enhancement network to generate representative features;

[0055] The feature generation module is used to train the adversarial enhancement network using representative entity pairs to generate representative features of the entity pairs, specifically to construct a generator of the adversarial enhancement network, impose constraints on the adversarial enhancement network, minimize the objective function to train the generator, and construct a discriminator of the adversarial enhancement network;

[0056] The relationship prototype construction module is used to enhance the support set using the trained adversarial enhancement network model, construct the relationship prototype, and use the dot product between the semantic representation of the modified prototype and the query entity pair in the query set as the credibility score of the triple;

[0057] The knowledge graph construction module is used to input the existing medical knowledge graph into the adversarial enhancement network model, output the credibility score of the new medical knowledge triples generated by the model, output the medical knowledge triples with the highest scores, and realize the construction of the medical knowledge graph.

[0058] The advantages of the present invention are:

[0059] (1) The present invention provides a prototype enhancement framework that generates credible entity pair features by introducing an adversarial enhancement network. Compared with traditional technologies that model the entire data distribution, the present invention focuses on modeling the distribution of representative entity pairs, using representative entity pairs to train adversarial enhancement networks to generate more accurate and representative features, significantly improving the quality and effectiveness of the construction of medical knowledge graphs; the generator is optimized by applying a constrained minimization objective function, combined with the effective evaluation of the discriminator, to form a generative adversarial mechanism to avoid overfitting and enhance the authenticity and credibility of the generated features; the use of a trained adversarial enhancement network to enhance the support set helps to build prototypes of complex relationships, provide more accurate relationship representations for medical knowledge graphs, and promote knowledge mining and application.

[0060] (2) The present invention uses a small number of representative samples as training data and provides a data enhancement framework for the medical knowledge graph. The representative entity pairs can ensure the relevance and effectiveness of the training data, thereby improving the accuracy and credibility of the generated features, and further improving the overall performance of the model. At the same time, the present invention focuses on a small number of representative samples, which can reduce data redundancy and noise, accurately realize the construction of the medical knowledge graph, and accurately generate new medical knowledge, thereby improving the generalization ability of the model on unknown data, thereby providing strong support for medical research, medical education, and medical knowledge management. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 is a flowchart of a method for constructing a medical knowledge graph based on metric learning according to an embodiment of the present invention;

[0062] Figure 2 is a structural diagram of a prototype enhancement framework of an adversarial enhancement network according to an embodiment of the present invention;

[0063] Figure 3 (a) to (b) are simulation diagrams of model performance of different baseline models of the embodiment of the present invention when different sample numbers are taken;

[0064] Figure 4 (a) to (b) are simulation diagrams of model performance of different baseline models in the embodiment of the present invention when the number of enhanced samples is different;

[0065] Figure 5 It is a schematic diagram of describing data feature representation using visualization tools according to an embodiment of the present invention. DETAILED DESCRIPTION

[0066] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in combination with the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0067] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and specific embodiments:

[0068] Embodiment 1

[0069] like Figure 1 Specifically, a method for constructing a medical knowledge graph based on metric learning is disclosed, comprising the following steps:

[0070] S1. Obtain medical knowledge graph and construct medical knowledge triples;

[0071] Specifically, a medical knowledge graph is obtained, and a medical knowledge graph G = {(h, r, t)∈ε×R×ε} is constructed according to each entity in the medical knowledge graph and the relationship between entities, wherein h represents the head entity node, r represents the relationship node, and t represents the tail entity node; ε and R are the entity node set and the relationship node set corresponding to the medical knowledge graph G, respectively.

[0072] S2, split the medical knowledge triples into training sets and background knowledge graphs according to their relationships;

[0073] Specifically, some triples are extracted from the medical knowledge graph G as the background knowledge graph G′, wherein the background knowledge graph G′ contains some relationship nodes in the relationship node set R, and the triples corresponding to the remaining relationship nodes in the relationship node set R are used as the training knowledge graph G train .

[0074] S3, randomly extracting relationship nodes from the training knowledge graph, and selecting some triples corresponding to the relationship nodes to construct a support set for the relationship nodes, using the remaining triples of the relationship nodes to construct a query set, and then replacing all tail entities in the query set with entities that have no association with their head entities, thereby constructing a negative query set;

[0075] Specifically, from the training knowledge graph G train Randomly select the i-th relationship node r i , and select the i-th relationship node r i The corresponding partial triples are used to construct the support set S for the relationship node ri i , using the i-th relationship node r i The remaining triples form the query set Q i , and then the query set Q i All tail entities in are replaced with entities that have no association with their head entities, thus constructing a negative query set Q i - ;

[0076] In this embodiment, according to the i-th relationship node r i For each relationship, k entity pairs are selected to construct the support set S r ,q query sets Q r And q negative samples of the query set.

[0077] S4. Select representative entity pairs to guide the adversarial enhancement network to generate representative features;

[0078] Specifically, given a training relation r∈R train , by taking the average of the semantic representations of all entity pairs belonging to relation r to calculate its distribution center μr , the distribution center μ r The expression is as follows:

[0079]

[0080] In the formula, |T r | is the number of entity pairs of relation r, is the i-th entity pair of relation r (h i , t i ), as the original feature, the original feature The expression is as follows:

[0081]

[0082] In the formula, F θ (·) is the pre-trained feature extractor, F θ (h i ) and F θ (t i ) are the head entities h i and the tail entity t i The representation of θ (·) is learned, and ∨ is a concatenation operation.

[0083] The distance between an entity pair and the distribution center of its associated relationship reflects the representativeness of the entity pair, that is, the closer the distance, the stronger the representativeness of the entity pair. Based on the obtained distribution center, the present invention selects μ r and (h i , t i )∈T r The first M entity pairs with the closest distance between them are regarded as representative entity pairs. The specific expression is as follows:

[0084]

[0085] In the formula, topM(D r ) is the distance set D r The operation of selecting the first M elements in r ′ is a set of M representative entity pairs related to relation r, (h n , t n ) is the most representative entity pair.

[0086] S5. Use representative entity pairs to train the Adversarial Enhanced Network Model (ANet) to generate representative features of entity pairs;

[0087] The Adversarial Enhanced Network (ANet) proposed in this embodiment is built on a conditional Wasserstein generative adversarial network architecture and adaptively modified. In the Adversarial Enhanced Network, the generator Gφ(·) is responsible for synthesizing credible feature representations of entity pairs that capture the corresponding relational semantics in the KG feature space. In contrast, the discriminator Trying to distinguish synthetic fake data from real data distribution.

[0088] S51. Constructing the generator G of the adversarial enhanced network φ (·), imposes constraints on the adversarial enhancement network to minimize the objective function To train the generator;

[0089] like Figure 2 As shown, for each entity pair (h, t)∈T r ′, generator G φ (·) By sampling random noise z from a Gaussian distribution h and z t , and take the two random noises and the entity representation of the head entity node h and the tail entity node as input to generate a synthetic feature representation and This process can be formalized as follows:

[0090] G φ (h; z h )=Ω1(Ω2(F θ (h))∨z h )

[0091]

[0092] G φ (t; z t )=Ω1(Ω2(F θ (t))∨z t )

[0093]

[0094] Where Ω1 and Ω2 are two feedforward neural networks with different parameters, z h and z t is random noise sampled from a Gaussian distribution, is the feature representation synthesized with h as input, is the feature representation synthesized with t as input, N is the Gaussian distribution, z h and z t It follows a Gaussian distribution with a mean of 0 and a variance of δI. is the unit matrix, whose size is controlled by the deviation of the noise input δ, and d is the dimension of the entity representation. From step S4, we can see that Fθ (h i ) and F θ (t i ) are the head entities h i and the tail entity t i Therefore, the F θ (h) and F θ (t) are expressed as h and t, such as Figure 2 shown.

[0095] Generator G φ (·) The representative entity pair set T r ′ takes the entity pair (h, t) in as input and outputs the synthetic feature representation respectively. and By connecting the synthetic features and the original features into a matrix, a new semantic feature is constructed for the entity pair (h, t), which is expressed as follows:

[0096]

[0097] In the formula, It is the augmented semantic representation of the entity pair (h, t) as a synthetic feature.

[0098] The generator G of this embodiment φ (·) Aims to generate features that are very similar to the original feature representation of the entity pair (h, t) To achieve this goal, this embodiment imposes the following constraints, specifically:

[0099] Minimize the distribution distance L between the original feature representation and the synthesized feature representation advG , the specific expression is as follows:

[0100]

[0101] In the formula, To do this by repeating in the row direction Three times to construct Matrices with the same dimensions, Calculation and judgment unit In generating features The expected output is It refers to the calculation judgement exist The expected output.

[0102] A higher similarity L is enforced between generated features and positive entity pairs than between generated features and negative entity pairs. rank , the specific expression is as follows:

[0103]

[0104] Where, [x] + =max(0,x) is the hinge loss, γ is the marginal hyperparameter and γ>0, · represents the dot product operation, (h + , t + ) is a positive entity pair, T r ' + is the set of positive entity pairs, which is T r ′ is a subset of (h - , t - ) is a negative entity pair, T r ' - is the set of negative entity pairs, T r ' - By replacing T with a fake entity r ' + This constraint helps guide the synthesized features to move closer to the real entity pairs while keeping them away from the fake entity pairs.

[0105] By minimizing the objective function To train the generator, the objective function The expression is as follows:

[0106]

[0107] Where λ is a hyperparameter used to control the trade-off between the two constraints.

[0108] Since knowledge graphs usually store structured relational facts that contain abstract concepts in the real world, the geometric properties of their vector representations reflect the relational semantics of entities. Therefore, even a small disturbance in the vector space may change the geometric positions of entities and relationships, resulting in significant deviations in the semantic information conveyed by the relevant triples. In order to solve the above problems, this embodiment uses a generator to generate a new feature representation for a single head or tail entity while keeping the feature representation of the other entity unchanged. The technical principle is that when modifying an entity pair, only focusing on either the head or tail entity can maintain the intrinsic relational semantics to the greatest extent. Through the above operations, the generator G φ (·) It can effectively enhance the diversity of supporting entity pairs while preserving the original semantics, thereby reducing the potential impact of feature space enhancement.

[0109] S52. Constructing the discriminator of adversarial enhanced network

[0110] like Figure 2 As shown, the discriminator Pick and As input, used to identify is false, is true. Therefore, the discriminator Train to maximize the distribution distance between the synthetic features and the original features The specific expression is as follows:

[0111]

[0112] Where, L GP To enforce the Lipchitz constraint gradient penalty, β is the penalty parameter, ε is the number of random noise drawn from a uniform distribution, ε~U(0,1), Represents the interpolation feature Find the discriminator gradient.

[0113] This embodiment uses the training relationship R given in step S4 train Representative samples in , train the generator G in an adversarial way φ (·) and the discriminator The trained adversarial reinforcement network learns to associate feature distributions with semantic representations of real entity pairs. Such associations can be generalized to the entire training and testing tasks. When there is enough data to train the model based on the training relationship, new features that are consistent with real unseen features can be generated based on the training model for testing the relationship.

[0114] S6. Use the trained adversarial enhancement network model to enhance the support set, construct the relationship prototype, and use the dot product between the semantic representation of the modified prototype and the query entity pair in the query set as the credibility score of the triple;

[0115] In existing knowledge graph research, relation prototypes are usually calculated based on only a limited number of supporting entity pairs. This low-data system can lead to deviations from the ideal prototype representation. To solve the above problem, this embodiment uses a trained adversarial enhancement network ANet to enhance the support set.

[0116] Since some synthetic features are likely to be noisy, using a simple average with the same weights may lead to serious deviations during prototype calculation. In order to calculate a new prototype in a more reasonable way, this embodiment uses the weighted sum of the augmented features of the entity pair as the corrected prototype. The augmented features refer to the features of the original supporting entity pair and the new features generated by ANet.

[0117] Specifically, for a given relation r, the adversarial enhancement network takes the representations of all its supporting entity pairs as input and generates a new feature representation, which supports the original features of the entity pairs. and synthetic features are concatenated to form an extended feature representation, denoted as

[0118] Modified prototype of task relation r The calculation is as follows:

[0119]

[0120] In the formula, for The i-th feature in ω i To enhance the weight of the relationship between the supporting sample and the original prototype, the weight ω i The expression is as follows:

[0121]

[0122] In the formula, is a scalar parameter, μ r is the distribution center calculated in step S4. The weight ω assigned to each sample i is based on its distribution center μ r Therefore, samples with higher similarity to the distribution center will account for a larger proportion in the prototype rectification process.

[0123] Furthermore, the trained adversarial enhancement network model in this embodiment is based on the idea of ​​meta-learning to predict the query triple (h j , r,? ) is regarded as a meta-training task T r , the model is trained on the meta-training task T r The training optimization is to query the query set Q in the query triple r A plausibility score is predicted for each entity pair in , and the triples consisting of entity pairs with high scores are considered to be correct triples.

[0124] Specifically, each meta-training task T r Including task relationship r and its support set S r and query set Q r , using the following logic to represent the meta-training task T r :

[0125] T r ={S r , Q r}

[0126]

[0127]

[0128] In the formula, K is the small sample size, |Q r |For the query set Q r The number of triplets in t j For the query triple (hj , r,? )'s real tail entity, is the corresponding candidate entity set, which is constructed based on entity type constraints. In the meta-training phase, for each task relation r, the model uses the support set S r In order to be able to train the true tail entity t j exist Rank the candidate entity set in .

[0129] According to step S4, r∈R train After completing the R train After training, the model can be used to predict the test data set R test and validation dataset R valid A new triple of relations in R, for each test relation r′∈R test ∪R valid All have their support set S r′ and the query set Q r′ , these sets are defined in the same way as for the meta-training task above.

[0130] To predict the query triple (h, r, ?) ∈ Q r ,,The trained model is used to calculate the credibility score between the K supporting triples and each candidate triple, and the candidate entity with the highest score is regarded as (h j , r,? ), the above process is effective for R test All test tasks in are repeated.

[0131] This example uses a modified prototype and query set Q r The dot product between the semantic representations of the query entity pair in is used as the credibility score of the triplet.

[0132] S7. Input the existing medical knowledge graph into the adversarial enhanced network model, output the credibility score of the new medical knowledge triples generated by the model, output the medical knowledge triples with the highest scores, and realize the construction of the medical knowledge graph.

[0133] This embodiment uses the NELL-One and Wiki-One datasets to evaluate the model performance. In these two datasets, relations with less than 500 but more than 50 triples are considered few-shot relations. NELL-One contains 67 few-shot relations, while Wiki-One contains 183 few-shot relations. This embodiment splits the training, testing, and validation relations into 51 / 11 / 5 for NELLOne and 133 / 34 / 16 for Wiki One. The following Table 1 summarizes the detailed statistics of the two datasets, where #Ent, #Triple, #Rel, and #Task represent the number of entities, triples, relations, and task relations, respectively.

[0134] Table 1 Statistics of NELL-One and Wiki-One datasets

[0135]

[0136] The framework of this embodiment can be combined with various knowledge graph methods based on metric learning. This embodiment combines three state-of-the-art metric learning-based baselines to study the effectiveness of the framework provided by this embodiment: FSRL, FAAN, and CIAN. The main difference between the three methods is how to calculate the weights of entity neighbors when learning entity representations.

[0137] This example uses a two-step training process. In the first step, each baseline is trained using the official code and default hyperparameters. Then the neighboring encoder from each baseline is used as the pre-trained feature extractor F θ (·), in the second step, by alternately training the generator and the discriminator, and Update the generator G after every 5 updates φ (·). To optimize the proposed ANet, the Adam optimizer is used with a learning rate of 1e -5 During the training process, the e-value of the model was evaluated on the validation set every 5000 steps, and the best model was saved when the MRR reached the maximum value within 100,000 steps. For the hyperparameters, β=10, λ=1 and γ=5.0 for both datasets were set. In the testing phase, this embodiment synthesized 20 feature representations for each supporting entity pair.

[0138] For the proposed ANet, the generator is implemented by using a two-layer feed-forward neural network with LeakyReLU activation in the first layer and Tanh activation in the second layer. The discriminator is also a two-layer feed-forward neural network with LeakyReLU activation in the first layer.

[0139] This embodiment uses mean reciprocal rank (MRR) and Hits@N to evaluate the performance of the model. MRR is the average of the reciprocal rankings of correct entities, and Hits@N is the proportion of correct entities ranked in the top N positions. N can be 1, 5, or 10. The higher the MRR and Hits@N values, the better the model performance.

[0140] Table 2 below shows the evaluation results of each method on NELL-One and Wiki-One for MRR and Hits@1, 5, and 10. For each indicator, the bold number marks the best result. rANet represents ANet trained using representative entity pairs, i.e., the prototype enhancement framework provided in this embodiment.

[0141] Table 2 Model evaluation results of NELL-One and Wiki-One when N values ​​are different

[0142]

[0143] As shown in Table 2, this embodiment consistently improves the performance of all three baseline models on almost all metrics. Taking CIAN as an example, CIAN+rANet improves the average performance by 1.4% on MRR, 2.8% on Hits@10, 3.0% on Hits@5, and 0.3% on Hits@1. Similarly, on Wiki-One, CIAN+rANet improves MRR by 1.0% on average, Hits@10 by 0.8%, Hits@5 by 2.2%, and Hits@1 by 1.6%. It is worth noting that CIAN+rANet shows the best performance on both NELL-One and Wiki-One. These improvements observed on all three baselines indicate that generating more representative features of entity pairs to construct relationship prototypes can indeed improve model performance.

[0144] In addition, since Wiki-One is sparser than NELL-One, it becomes more difficult to synthesize credible features from a limited number of real entity pairs, so NELL-One shows greater improvement than Wiki-One in this embodiment.

[0145] like Figure 3 As shown in Figure 2, the selection of the number of representative samples M plays a crucial role in the prototype. Figure 3Results of CIAN and CIAN+rANet for different M values ​​during training. For CIAN, the calculated prototype comes from the support samples. For CIAN+rANet, the calculated prototype comes from the support samples and the generated features. From the results, it can be seen that the prototype calculated by CIAN+rANet is closer to the true prototype than the prototype calculated by CIAN. As M increases, the performance of CIAN+rANet first improves and then decreases slightly, reaching a peak at M=500 on NELL-One and M=1000 on Wiki-One. These results show that adding more representative samples can effectively improve model performance. In addition, the performance of CIAN+rANet decreases slightly when all training samples are used. This finding emphasizes the necessity of generating new features only from representative samples.

[0146] Figure 4 The results of CIAN+rANet under different numbers of augmented samples, ranging from 4 to 100. It can be seen that CIAN+rANet always outperforms CIAN, highlighting the beneficial effect of generating additional samples. In addition, when the number of augmented samples reaches 100, the number of generated samples is too large, which may introduce additional noise, causing the performance of CIAN+rANet to drop significantly.

[0147] like Figure 5 To describe the feature representation of support data, query data, and generated data using t-SNE visualization tools. Figure 5 It is clear that the generated feature representation always presents a distribution pattern around the support features. In addition, compared with the prototype calculated only from the support data, the prototype enhanced by the generated data is closer to the real prototype, which intuitively confirms the effectiveness and superiority of the proposed method.

[0148] The above embodiments 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 the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, 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 embodiments of the present invention.

Claims

1. A method for constructing a medical knowledge graph based on metric learning, characterized in that: The following steps are involved: S1. Obtain medical knowledge graph and construct medical knowledge triples; S2, split the medical knowledge triples into training sets and background knowledge graphs according to their relationships; S3, randomly extracting relationship nodes from the training knowledge graph, and selecting some triples corresponding to the relationship nodes to construct a support set for the relationship nodes, using the remaining triples of the relationship nodes to construct a query set, and then replacing all tail entities in the query set with entities that have no association with their head entities, thereby constructing a negative query set; S4. Select representative entity pairs to guide the adversarial enhancement network to generate representative features; S5. Use representative entity pairs to train the adversarial enhancement network model to generate representative features of the entity pairs; S51. Construct a generator of the adversarial enhanced network, impose constraints on the adversarial enhanced network, and minimize the objective function to train the generator; S52, build a discriminator for adversarial enhanced networks; S6. Use the trained adversarial enhancement network model to enhance the support set, construct the relationship prototype, and use the dot product between the semantic representation of the modified prototype and the query entity pair in the query set as the credibility score of the triple; S7. Input the existing medical knowledge graph into the adversarial enhanced network model, output the credibility score of the new medical knowledge triples generated by the model, output the medical knowledge triples with the highest scores, and realize the construction of the medical knowledge graph.

2. The method for constructing a medical knowledge graph based on metric learning according to claim 1, characterized in that: The step S1 of obtaining a medical knowledge graph and constructing a medical knowledge triple is specifically as follows: obtaining a medical knowledge graph, and constructing a medical knowledge graph G = {(h, r, t)∈ε×R×ε} according to the entities in the medical knowledge graph and the relationships between the entities, wherein h represents the head entity node, r represents the relationship node, and t represents the tail entity node; ε and R are the entity node set and the relationship node set corresponding to the medical knowledge graph G, respectively.

3. The method for constructing a medical knowledge graph based on metric learning according to claim 2, characterized in that: The step S2 of splitting the medical knowledge triples into the training set and the background knowledge graph according to the relationships is as follows: extracting some triples from the medical knowledge graph G as the background knowledge graph G′, wherein the background knowledge graph G′ contains some relationship nodes in the relationship node set R, and the triples corresponding to the remaining relationship nodes in the relationship node set R are used as the training knowledge graph G. train .

4. The method for constructing a medical knowledge graph based on metric learning according to claim 3, characterized in that: The representative entity pairs selected in step S4 are as follows: given a training relation r∈R train , by taking the average of the semantic representations of all entity pairs belonging to relation r to calculate its distribution center μ r , the distribution center μ r The expression is as follows: In the formula, |T r | is the number of entity pairs of relation r, is the i-th entity pair of relation r (h i , t i ), as the original feature, the original feature The expression is as follows: In the formula, F θ (·) is the pre-trained feature extractor, F θ (h i ) and F θ (t i ) are the head entities h i and the tail entity t i The representation of θ (·) is learned, ∨ is a serial operation; Select μ r and (h i , t i )∈T r The first M entity pairs with the closest distance between them are regarded as representative entity pairs. The specific expression is as follows: In the formula, topM(D r ) is the distance set D r The operation of selecting the first M elements in r ′ is a set of M representative entity pairs related to relation r, (h n , t n ) is the most representative entity pair.

5. The method for constructing a medical knowledge graph based on metric learning according to claim 4, characterized in that: The generator for constructing the adversarial enhancement network in step S51 is specifically: G φ (h;z h )=Ω1(Ω2(F θ (h))∨z h ) G φ (t;z t )=Ω1(Ω2(F θ (t))∨z t ) Where Ω1 and Ω2 are two feedforward neural networks with different parameters, z h and z t is random noise sampled from a Gaussian distribution, is the feature representation synthesized with h as input, is the feature representation synthesized with t as input, N is a Gaussian distribution, z h and z t It follows a Gaussian distribution with a mean of 0 and a variance of δI. is the identity matrix whose size is controlled by the deviation of the noise input δ, and d is the dimension of the entity representation.

6. The method for constructing a medical knowledge graph based on metric learning according to claim 5, characterized in that: The constraint imposed on the adversarial enhancement network in step S51 is specifically: minimizing the distribution distance L between the original feature representation and the synthesized feature representation advG , the distribution distance L advG The expression is as follows: In the formula, To do this by repeating in the row direction Three times to construct Matrices with the same dimensions, Refers to the calculation judgment device In generating features The expected output is It refers to the calculation judgement exist The expected output of A higher similarity L is enforced between generated features and positive entity pairs than between generated features and negative entity pairs. rank , the similarity L rank The expression is as follows: Where, [x] + =max(0,x) is the hinge loss, γ is the marginal hyperparameter and γ>0, · represents the dot product operation, (h + , t + ) is a positive entity pair, T r ' + is the set of positive entity pairs, which is T r ′ is a subset of (h - , t - ) is a negative entity pair, T r ' - is the set of negative entity pairs, T r ' - By replacing T with a fake entity r ' + It is constructed from the tail entity of the entity pair in .

7. The method for constructing a medical knowledge graph based on metric learning according to claim 6, characterized in that: The method of minimizing the objective function to train the generator in step S51 is specifically: In the formula, To minimize the objective function, λ is a hyperparameter used to control the trade-off between the two constraints.

8. The method for constructing a medical knowledge graph based on metric learning according to claim 7, characterized in that: The discriminator of building the adversarial enhancement network in step S52 is specifically: maximizing the distribution distance between the synthetic features and the original features The distribution distance The expression is as follows: Where, L GP To enforce the Lipchitz constraint gradient penalty, β is the penalty parameter, ε is the number of random noise drawn from a uniform distribution, ε~U(0,1), Represents the interpolation feature Find the discriminator gradient.

9. The method for constructing a medical knowledge graph based on metric learning according to claim 8, characterized in that: The construction of the relation prototype in step S6 is as follows: for a given relation r, the adversarial enhancement network takes the representations of all its supporting entity pairs as input, generates a new feature representation, and the original feature representation of the supporting entity pairs and synthetic features are concatenated to form an extended feature representation, denoted as Modified prototype of task relation r The calculation is as follows: In the formula, for The i-th feature in ω i To enhance the weight of the relationship between the supporting sample and the original prototype, the weight ω i The expression is as follows: Where ε is a scalar parameter, μ r is the distribution center calculated in step S4.

10. A medical knowledge graph construction system based on metric learning, characterized in that: Including triple building module, data set splitting module, data set building module, entity pair selection module, feature generation module, relationship prototype building module, knowledge graph building module: The triple construction module is used to obtain a medical knowledge graph and construct a medical knowledge triple; The data set splitting module is used to split the medical knowledge triples into training sets and background knowledge graphs according to their relationships; The data set construction module is used to randomly extract relationship nodes from the training knowledge graph, select some triples corresponding to the relationship nodes to construct a support set for the relationship nodes, use the remaining triples of the relationship nodes to construct a query set, and then replace all tail entities in the query set with entities that have no association relationship with their own head entities, so as to construct a negative query set; The entity pair selection module is used to select representative entity pairs to guide the adversarial enhancement network to generate representative features; The feature generation module is used to train the adversarial enhancement network using representative entity pairs to generate representative features of the entity pairs, specifically to construct a generator of the adversarial enhancement network, impose constraints on the adversarial enhancement network, minimize the objective function to train the generator, and construct a discriminator of the adversarial enhancement network; The relationship prototype construction module is used to enhance the support set using the trained adversarial enhancement network model, construct the relationship prototype, and use the dot product between the semantic representation of the modified prototype and the query entity pair in the query set as the credibility score of the triple; The knowledge graph construction module is used to input the existing medical knowledge graph into the adversarial enhancement network model, output the credibility score of the new medical knowledge triples generated by the model, output the medical knowledge triples with the highest scores, and realize the construction of the medical knowledge graph.

Citation Information

Patent Citations

  • Reinforcement learning knowledge graph reasoning method based on generative adversarial imitation learning

    CN115269861A

  • Training method and system of small classification model based on cross-modal migration knowledge data

    CN118035794A

  • Small-sample knowledge graph reasoning method based on graph neural network

    CN118916494A

  • Generating combined feature embedding for minority class upsampling in training machine learning models with imbalanced samples

    US20210073671A1

  • Generating knowledge graph databases for online system using large language machine-learned models

    US20240330718A1