A medical knowledge graph construction method and system based on metric learning

By using an adversarial augmentation network generator and discriminator based on metric learning, the challenges of semantic invariance in data transformation and representative sample generation in medical knowledge graphs are solved, thereby improving the construction quality and accuracy of medical knowledge graphs.

CN119884385BActive Publication Date: 2025-11-04ANHUI MEDICAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing medical knowledge graphs suffer from a lack of sufficient contextual information during construction, making it difficult to maintain semantic invariance after data transformation and generating representative samples of task relationships, thus affecting the accuracy and effectiveness of the knowledge graph.

Method used

A metric learning-based approach is adopted to generate representative entity pair features through an adversarial augmentation network. By combining the adversarial augmentation network generator and discriminator with the minimization of the objective function and the distribution distance constraint, a medical knowledge graph is constructed.

Benefits of technology

It improves the quality and effectiveness of medical knowledge graph construction, generates more accurate and representative features, reduces data redundancy and noise, and enhances the model's generalization ability on unknown data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119884385B_ABST
    Figure CN119884385B_ABST
Patent Text Reader

Abstract

The application 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. Representative entity pairs are selected, the representative entity pairs are used to train an adversarial enhancement network model, representative features of the entity pairs are generated, a generator of the adversarial enhancement network is constructed, a constraint is applied to the adversarial enhancement network, a generator is trained by minimizing an objective function, a discriminator of the adversarial enhancement network is constructed, a support set is enhanced by using the trained adversarial enhancement network model, a relationship prototype is constructed, a dot product between a semantic representation of a query entity pair in a query set is corrected as a credibility score of a triple, an existing medical knowledge graph is input into the adversarial enhancement network model, a credibility probability of a new medical knowledge triple generated by the model is output, and medical knowledge graph construction is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of knowledge graph construction, and relates to a medical knowledge graph construction method and system based on metric learning. BACKGROUND

[0002] In today's information age, the amount of data is growing explosively, and how to effectively integrate and represent massive data has become an important issue. As an effective knowledge representation method, knowledge graph organizes knowledge into a graph in the form of triples (head entity, relationship, tail entity), making the connection between knowledge clear and 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 for promoting the development of new generation artificial intelligence technology.

[0003] Medicine is one of the most widely used vertical fields of knowledge graph. In medical knowledge graph, entities usually represent medical concepts or things, such as diseases, symptoms, drugs, genes, proteins, etc., and relationships represent medical concepts or things, such as disease types, clinical manifestations, inducing causes, pathogenesis, etc. At present, medical knowledge graph is mainly used for medical semantic precise search, medical question answering system, medical auxiliary diagnosis and intelligent clinical decision support, etc. Medical knowledge graph combines knowledge graph with medical knowledge, integrates Internet technology with medical context, and realizes the automation and intelligent processing of medical data.

[0004] Constructing medical knowledge graph can provide support for clinical decision-making, literature visualization analysis, intelligent question answering, and intelligent search. People consider using models to learn knowledge from existing medical knowledge graphs to generate new possible medical knowledge, i.e., the current hot knowledge graph completion problem. Knowledge graph completion methods automatically infer new triples from existing triples to expand the size of the existing knowledge graph. However, the effectiveness of these methods depends on a large number of training triples. In practical applications, the relationships in the knowledge graph usually follow a long-tail distribution, where most relationships have only a few triples. In order to learn as unbiased and reliable relationship prototypes as possible under the condition of 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 literature (Kumar V, Glaude H, de Lichy C, et al. A Closer Look At Feature Space Data Augmentation For Few-Shot Intent Classification [C] / / Proceedings of the 2nd Workshop on Deep Learning Approaches for Low-Resource NLP. 2019: 1-10.) and literature (Tang Z, Pei S, Zhang Z, et al. Positive-Unlabeled Learning with Adversarial Data Augmentation for Knowledge Graph Completion [C]. International Joint Conferences on Artificial Intelligence, 2022.), their application in the context of medical knowledge graphs is still relatively unexplored, due to the lack of sufficient context information in medical knowledge graphs to accurately understand the relationship semantics of triples, making it difficult to maintain semantic invariance after data conversion. Therefore, in order to generate new entity pairs while preserving the original relationship semantics, it is crucial to develop new data augmentation techniques specifically for medical knowledge graphs. (2) How to generate representative samples of the task relationship: Even if a large number of support samples are available, obtaining unbiased prototypes is still challenging, as some support entity pairs may be far from the unbiased prototype in the feature space, making it difficult to learn unbiased prototypes from these non-representative samples.In contrast, even with a small number of representative samples, accurate and unbiased prototypes can be achieved, as described 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 for generating representative samples to construct unbiased relationship prototypes. SUMMARY

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

[0006] The present application solves the above technical problems by the following technical solutions:

[0007] A medical knowledge graph construction method based on metric learning, comprising the following steps:

[0008] S1, acquire a medical knowledge graph and construct medical knowledge triples;

[0009] S2, split the medical knowledge triples into a training set and a background knowledge graph according to the relationship;

[0010] S3, randomly extract a relationship node from the training knowledge graph, select part of the triples corresponding to the relationship node to construct a support set for the relationship node, use the remaining triples of the relationship node to construct a query set, and replace all tail entities in the query set with entities that have no association with the head entity, thereby constructing a negative query set;

[0011] S4, select representative entity pairs to guide the generation of representative features by the adversarial enhancement network;

[0012] S5, use the 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 enhancement network, impose constraints on the adversarial enhancement network, and minimize the objective function to train the generator;

[0014] S52, construct a discriminator of the adversarial enhancement network;

[0015] S6, enhancing the support set by using the trained adversarial enhancement network model, constructing the relation prototype, and taking the dot product between the semantic representation of the query entity pair in the modified prototype and the query set as the confidence score of the triple;

[0016] S7, inputting the existing medical knowledge graph into the adversarial enhancement network model, outputting the confidence score of the new medical knowledge triple generated by the model, and outputting the medical knowledge triple with the highest score to realize the construction of the medical knowledge graph.

[0017] Further, the medical knowledge graph obtained in step S1 is constructed into medical knowledge triples, specifically: obtaining a medical knowledge graph, and constructing a medical knowledge graph G={(h, r, t)∈ε×R×ε} according to each entity in the medical knowledge graph and the relationship between each entity, wherein h represents a head entity node, r represents a relationship node, and t represents a tail entity node; ε and R are entity node sets and relationship node sets corresponding to the medical knowledge graph G, respectively.

[0018] Further, the medical knowledge triples are split into a training set and a background knowledge graph according to the relationship in step S2, specifically: extracting part of the triples from the medical knowledge graph G as a background knowledge graph G', the background knowledge graph G' contains part of the relationship nodes in the relationship node set R, and the triples corresponding to the remaining relationship nodes in the relationship node set R are taken as a training knowledge graph G train .

[0019] Further, the representative entity pairs are selected in step S4, specifically: given a training relationship r∈R train , the distribution center μ r of all entity pairs belonging to the relationship r is calculated by taking the average value of the semantic representation, the expression of the distribution center μ r is as follows:

[0020]

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

[0022]

[0023] In the formula, F θ (·) is a pre-trained feature extractor, F θ (h i ) and F θ (ti ) are respectively head entity h i and tail entity t i , which are respectively represented by feature extractor F θ (·) learned, and ∨ is concatenation operation;

[0024] Select the top M entity pairs between μ r and (h i , t i ) ∈ T r as representative entity pairs, and the specific expression is as follows:

[0025]

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

[0027] Further, the generator of the adversarial enhancement network constructed 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] In the formula, Ω1 and Ω2 are two feedforward neural networks with different parameters, z h and z t are random noises sampled from Gaussian distribution, is the synthesized feature representation with h as input, is the synthesized feature representation with t as input, N is Gaussian distribution, z h and z t are Gaussian distribution with mean 0 and variance δI, is an identity matrix whose size is controlled by the deviation of noise input δ, and d is the dimension of entity representation.

[0033] Further, the constraint imposed on the adversarial enhanced network in step S51 is specifically that: the distribution distance L advG between the original feature representation and the synthetic feature representation is minimized advG , and the expression of the distribution distance L rank is as follows:

[0034]

[0035] In the formula, is a matrix with the same dimension as by repeating three times in the row direction, refers to the expected output of the calculation judge in generating features , refers to the expected output of the calculation judge in ;

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

[0037]

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

[0039] Further, the training of the generator by minimizing the objective function in step S51 is specifically:

[0040]

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

[0042] Further, the discriminator of the adversarial augmented network in step S52 is specifically: maximizing the distribution distance between the synthetic feature and the original feature The distribution distance is expressed as follows:

[0043]

[0044] In the formula, L GP is the gradient penalty for enforcing the Lipchitz constraint, β is the penalty parameter, ε is a random noise number drawn from a uniform distribution, ε ~ U(0, 1), represents the gradient of the discriminator on the interpolated feature .

[0045] Further, the relationship prototype in step S6 is specifically constructed as follows: for a given relationship r, the adversarial augmented network takes the representation of all support entity pairs as input, generates a new feature representation, and the original features of the support entity pairs and the synthetic features are spliced to form an extended feature representation, denoted as the modified prototype of the task relationship r is calculated as follows:

[0046]

[0047] In the formula, is the i-th feature in , ω i is the weight of the relationship between the augmented support sample and the original prototype, and the weight ω i is expressed as follows:

[0048]

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

[0050] The application also provides a medical knowledge graph construction system based on metric learning, comprising a triple construction module, a dataset splitting module, a dataset 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 medical knowledge triples;

[0052] The dataset splitting module is used to split the medical knowledge triples into a training set and a background knowledge graph according to relationships;

[0053] The data set construction module is configured to randomly extract a relation node from the training knowledge graph, select part of the triple corresponding to the relation node to construct a support set for the relation node, use the rest of the triple of the relation node to construct a query set, and replace all tail entities in the query set with entities that have no associated relationship with the head entity, thereby constructing a negative query set;

[0054] The entity pair selection module is configured to select representative entity pairs to guide the generation of representative features by the adversarial enhancement network;

[0055] The feature generation module is configured to train the adversarial enhancement network using the 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 relation prototype construction module is configured to enhance the support set using the trained adversarial enhancement network model to construct a relation prototype, and correct the dot product between the semantic representation of the query entity pair in the prototype and the query set as the credibility score of the triple.

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

[0058] The advantages of the present application are:

[0059] (1) The present application provides a prototype enhancement framework, which generates credible entity pair features by introducing an adversarial enhancement network. Compared with the traditional technology of modeling the entire data distribution, the present application focuses on modeling the distribution of representative entity pairs, trains the adversarial enhancement network using representative entity pairs, generates more accurate and representative features, and significantly improves the construction quality and effectiveness of the medical knowledge graph; the generator is optimized by imposing constraints to minimize the objective function, combined with the effective evaluation of the discriminator, forming a generative adversarial mechanism, avoiding overfitting, enhancing the authenticity and credibility of the generated features; the support set is enhanced using the trained adversarial enhancement network, which helps to construct the prototype of complex relations, provides more accurate relation representation for the medical knowledge graph, and promotes knowledge mining and application.

[0060] (2) The application uses a small amount of representative samples as training data and provides a data enhancement framework for a medical knowledge graph. The representative entity pair can ensure the relevance and effectiveness of the training data, thereby improving the accuracy and reliability of the generated features, and improving the overall performance of the model. At the same time, the application focuses on a small amount of representative samples, which can reduce data redundancy and noise, accurately implement medical knowledge graph construction, and accurately generate new medical knowledge, improve the generalization ability of the model on unknown data, and provide strong support for medical research, medical education and medical knowledge management and other fields. BRIEF DESCRIPTION OF DRAWINGS

[0061] Figure 1 is a flowchart of a medical knowledge graph construction method based on metric learning according to an embodiment of the application;

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

[0063] Figure 3 (a)-(b) are simulation diagrams of model performance of different baseline models at different sample quantity values according to an embodiment of the application;

[0064] Figure 4 (a)-(b) are simulation diagrams of model performance of different baseline models at different enhancement sample quantity values according to an embodiment of the application;

[0065] Figure 5 is a schematic diagram of data feature representation described by a visualization tool according to an embodiment of the application. DETAILED DESCRIPTION

[0066] To make the purposes, technical solutions and advantages of the embodiments of the application clearer, the technical solutions in the embodiments of the application will be described clearly and completely below in conjunction with the embodiments of the application. Obviously, the described embodiments are part of the embodiments of the application, rather than all the embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the application.

[0067] The technical solutions of the application will be further described below in conjunction with the drawings in the specification and specific embodiments:

[0068] Embodiment One

[0069] As shown in Figure 1 , specifically, a medical knowledge graph construction method based on metric learning is disclosed, comprising the following steps:

[0070] S1, acquire a medical knowledge graph, and construct a medical knowledge triple;

[0071] Specifically, a medical knowledge graph is acquired, and a medical knowledge graph G = {(h, r, t) e e x R x e} is constructed according to each entity in the medical knowledge graph and the relationship between each entity, where h represents a head entity node, r represents a relationship node, and t represents a tail entity node; e and R are entity node sets and relationship node sets corresponding to the medical knowledge graph G respectively.

[0072] S2, splitting the medical knowledge triples according to the relationship into a training set and a background knowledge graph;

[0073] Specifically, part of the triples in the medical knowledge graph G are extracted as a background knowledge graph G', the background knowledge graph G' contains part of the 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 a training knowledge graph G train .

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

[0075] Specifically, the i-th relationship node r train is randomly extracted from the training knowledge graph G i , and part of the triples corresponding to the i-th relationship node r i are selected to construct a support set S i for the relationship node r i , the remaining triples of the i-th relationship node r i are used to construct a query set Q i , and all tail entities in the query set Q i are replaced with entities that have no associated relationship with the head entity of the tail entity, thereby constructing a negative query set Q - ;

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

[0077] S4, selecting representative entity pairs for guiding the generation of representative features by the adversarial enhancement network;

[0078] Specifically, given a training relationship r e R train , the distribution center μ is calculated by averaging the semantic representations of all entity pairs belonging to the relationship r.r , the distribution center μ r of the entity pair (h , t

[0079] ) is expressed as follows:

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

[0081]

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

[0083] The distance between the entity pair and the distribution center of its associated relation 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 application selects the top M entity pairs with the closest distance between μ r and (h i , t i ) ∈ T r as the representative entity pairs, and the specific expression is as follows:

[0084]

[0085] In the formula, topM(D r ) is an operation of selecting the top M elements in the distance set D r , T r ' is a set containing M representative entity pairs related to the relation r, and (h n , t n ) is a certain most representative entity pair.

[0086] S5, using the representative entity pairs to train an adversarial enhancement network model (ANet) to generate representative features of the entity pairs;

[0087] The adversarial augmented network (ANet) proposed in this embodiment is established on a conditional Wasserstein generative adversarial network architecture and is adaptively modified. In the adversarial augmented network, the generator Gφ(·) is responsible for synthesizing the trusted feature representation of the entity pair, which captures the corresponding relationship semantics in the KG feature space. Conversely, the discriminator tries to distinguish the synthesized false data from the real data distribution.

[0088] S51, constructing a generator G of an adversarial augmented network φ (·), imposing constraints on the adversarial augmented network, and minimizing the objective function to train the generator;

[0089] As Figure 2 shown, for each entity pair (h, t) ∈ T r ′, the generator G φ (·) generates a synthesized feature representation h and t by sampling random noise z and from a Gaussian distribution and taking the two random noises and the entity representations of the head entity node h and the tail entity node t as inputs. 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] In the formula, Ω1 and Ω2 are two feedforward neural networks with different parameters, z h and z t are random noises sampled from a Gaussian distribution, is the synthesized feature representation with h as input, is the synthesized feature representation with t as input, N is a Gaussian distribution, z h and z t are subject to a Gaussian distribution with a mean of 0 and a variance of δI, is a unit matrix whose size is controlled by the bias of the noise input δ, and d is the dimension of the entity representation. As can be seen from step S4, Fθ (h i ) and F θ (t i ) are the representations of head entity h i and tail entity t i respectively, so F θ (h) and F θ (t) are denoted as h and t in the following steps, as shown in Figure 2 .

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

[0096]

[0097] In the formula, is the augmented semantic representation of entity pair (h, t), which is the synthesized feature.

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

[0099] Minimize the distribution distance L advG between the original feature representation and the synthesized feature representation, specifically expressed as follows:

[0100]

[0101] In the formula, is a matrix with the same dimension as by repeating three times in the row direction, refers to the calculation judge in the expected output of the generated feature , refers to the calculation judge in the expected output of .

[0102] Enforce higher similarity L rank between the generated feature and the positive entity pair than between the generated feature and the negative entity pair, specifically expressed as follows:

[0103]

[0104] In the formula, [x] + =max(0, x) is the hinge loss, γ is the marginal hyperparameter and γ>0, · represents the dot product operation, (h + , t + ) represents a positive entity pair, T r ′ + It is a set of positive entity pairs, which is T. r A subset of ′, (h - , t - ) represents a negative entity pair, T r ′ - T is the set of negative entity pairs. r ′ - By replacing T with a fake entity r ′ + The tail entities of the entity pairs are used for construction. This constraint helps guide the synthetic features toward real entity pairs while keeping them away from fake entity pairs.

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

[0106]

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

[0108] Since knowledge graphs typically store structured relational facts containing abstract concepts from the real world, the geometric properties of their vector representations reflect the relational semantics of entities. Therefore, even small perturbations in the vector space can alter the geometrical positions of entities and relations, leading to significant deviations in the semantic information conveyed by related triples. To address this issue, this embodiment employs a generator to generate new feature representations for a single head or tail entity while keeping the feature representation of the other entity unchanged. The underlying principle is that when modifying entity pairs, focusing on only either the head or tail entity maximizes the preservation of the inherent relational semantics. Through this operation, the generator G... φ (·) 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 a discriminator for an adversarial enhancement network.

[0110] like Figure 2 As shown, the discriminator Pick and As input, used for identification It is fake. is true. Therefore, the discriminator needs to be trained to maximize the distribution distance between the synthetic features and the original features The specific expression is as follows:

[0111]

[0112] In the formula, L GP is the gradient penalty for enforcing the Lipchitz constraint, β is the penalty parameter, ε is a random noise number drawn from a uniform distribution, ε ~ U (0, 1), represents the interpolation feature The gradient of the discriminator is calculated.

[0113] The embodiment uses the representative samples in the training relationship R train given in step S4 to train the generator G φ (·) and the discriminator The trained adversarial augmented network learns to associate the feature distribution with the semantic representation of the true entity pair, and such association can be generalized to the entire training and testing task. When the training relationship is sufficient to train the model, new features consistent with the true unseen features can be generated based on the trained model for testing relationships.

[0114] S6, using the trained adversarial augmented network model to enhance the support set, constructing the relationship prototype, and taking the dot product between the corrected prototype and the semantic representation of the query entity pair in the query set as the confidence score of the triple;

[0115] In existing knowledge graph research, the relationship prototype is usually calculated based on a limited number of support entity pairs. Such a low-data system can cause deviation from the ideal prototype representation. To solve the above problem, the embodiment uses the trained adversarial augmented network ANet to enhance the support set.

[0116] Since some synthetic features are likely to be noisy, using simple averaging with the same weight in the prototype calculation process can cause serious deviation. To calculate the new prototype in a more reasonable way, the 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 support entity pair and the new features generated by ANet.

[0117] Specifically, for a given relationship r, the adversarial augmented network takes the representation of all its support entity pairs as input, generates a new feature representation, and the original features and the synthetic features of the support entity pairs are spliced 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, is is the i-th feature in i is a weight for enhancing the relationship between the support sample and the original prototype, and the weight ω i is expressed as follows:

[0121]

[0122] In the formula, is a scalar parameter, μ r is the distribution center calculated in step S4. The weight ω i assigned to each sample is determined according to the distance from the distribution center μ r , so that the samples with higher similarity to the distribution center will have a greater proportion in the prototype modification process.

[0123] Further, the trained adversarial enhancement network model in this embodiment predicts a query triple (h j , r,?) under a relationship as a meta-training task T r , and the model is optimized by training on the meta-training task T r , so as to predict a reasonable score for each entity pair in the query set Q r in the query triple, and the triple formed by the entity pair with a high score is considered to be a correct triple.

[0124] Specifically, each meta-training task T r includes a task relationship r, its support set S r and query set Q r , and the meta-training task T r is represented by the following logic:

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

[0126]

[0127]

[0128] In the formula, K is the small sample size, |Q r | is the number of triples in the query set Q r , and t j is the query triple (hj , the real tail entity of (h, r,?), 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 is trained using K support triples in S r to be able to predict the real tail entity t j on the candidate entity set in .

[0129] According to step S4, r∈R train , after completing the training of R train , the model can be used to predict new triples of relations in the test data set R test and the validation data set R valid , each test relation r'∈R test ∪R valid has its support set S r′ and query set Q r′ , which are defined in the same way as the above meta-training task.

[0130] In order to predict the query triple (h, r,?)∈Q r , the trained model is used to calculate the confidence score between K support triples and each candidate triple, and the candidate entity with the highest score is regarded as the real tail entity of (h j , r,?). The above process is repeated for all test tasks in R test .

[0131] The embodiment uses the dot product between the semantic representation of the query entity pair in the modified prototype and the query set Q r as the confidence score of the triple.

[0132] S7, input the existing medical knowledge graph into the adversarial enhancement network model, output the confidence score of the new medical knowledge triple generated by the model, output the medical knowledge triple with the highest score, and realize the construction of the medical knowledge graph.

[0133] The NELL-One and Wiki-One datasets are selected to evaluate the performance of the model in this embodiment, in which less than 500 but more than 50 triplets of relations are considered as few-shot relations, NELL-One contains 67 few-shot relations, and Wiki-One contains 183 few-shot relations. This embodiment splits the training, test and validation relations into 51 / 11 / 5 of NELL-One and 133 / 34 / 16 of Wiki One. The detailed statistics of the two datasets are summarized in Table 1 as follows, #Ent, #Triple, #Rel and #Task represent the number of entities, triplets, 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 metric learning-based knowledge graph methods. 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 weight of the entity neighbors when learning the entity representation.

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

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

[0139] The performance of the model is evaluated by Mean Reciprocal Rank (MRR) and Hits@N in this embodiment, MRR is the average of the reciprocal ranks of the correct entities, and Hits@N is the proportion of correct entities ranked in the top N, N can be 1, 5, 10, and the higher the MRR and Hits@N values, the better the model performance.

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

[0141] Table 2 Evaluation results of models on NELL-One and Wiki-One at different N values

[0142]

[0143] As shown in Table 2, this embodiment consistently improves the performance of all three baseline models on almost all indicators. Taking CIAN as an example, the average performance of CIAN+rANet on MRR is improved by 1.4%, on Hits@10 by 2.8%, on Hits@5 by 3.0%, and on Hits@1 by 0.3%. Similarly, on Wiki-One, the MRR of CIAN+rANet is improved by 1.0% on average, Hits@10 by 0.8%, Hits@5 by 2.2%, and Hits@1 by 1.6%. Notably, 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 for entity pairs to construct relationship prototypes can indeed improve model performance.

[0144] In addition, since Wiki-One is more sparse than NELL-One, it is more difficult to synthesize credible features from a limited number of real entity pairs, so the improvements observed in this embodiment on NELL-One are greater than on Wiki-One.

[0145] As Figure 3 shown, the selection of the representative sample number M plays a crucial role in the prototype, Figure 3The results of CIAN and CIAN+rANet on different M values during training. For CIAN, the computed prototypes come from support samples. For CIAN+rANet, the computed prototypes come from support samples and generated features. From the results, it can be seen that the computed prototypes of CIAN+rANet are closer to the true prototypes than those of CIAN. With the increase of M, the performance of CIAN+rANet first improves and then slightly decreases, reaching the peak when M = 500 on NELL-One and M = 1000 on Wiki-One. These results show that adding more representative samples can effectively improve the performance of the model. In addition, when using all training samples, the performance of CIAN+rANet slightly decreases. This finding highlights the need to generate 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, show that CIAN+rANet is always superior to 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, resulting in a significant decrease in the performance of CIAN+rANet.

[0147] As Figure 5 The feature representations of support data, query data, and generated data are described using the t-SNE visualization tool. Figure 5 It is clear that the generated feature representations always present a distribution pattern around the support features. In addition, the prototypes augmented by generated data are closer to the true prototypes than those computed from support data only, intuitively confirming the effectiveness and superiority of the proposed method.

[0148] The above embodiments are only used to illustrate the technical solutions of the present application, but not to limit it; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1.A method for constructing a medical knowledge graph based on metric learning, characterized in that, The method comprises the following steps: S1, acquiring a medical knowledge graph, and constructing a medical knowledge triple; S2, splitting the medical knowledge triple into a training set and a background knowledge graph according to a relationship; S3, randomly extracting a relationship node from the training knowledge graph, selecting part of the triple corresponding to the relationship node to construct a support set for the relationship node, constructing an inquiry set by using the remaining triple of the relationship node, and replacing all tail entities in the inquiry set with entities that have no associated relationship with the head entity of the tail entity, thereby constructing a negative inquiry set; S4, selecting representative entity pairs to guide the generation of representative features by the adversarial enhancement network; S5, training the adversarial enhancement network model by using the representative entity pairs to generate representative features of the entity pairs; S51, constructing a generator of the adversarial enhancement network, imposing constraints on the adversarial enhancement network, and minimizing an objective function to train the generator; S52, constructing a discriminator of the adversarial enhancement network; S6, enhancing the support set by using the trained adversarial enhancement network model, constructing a relationship prototype, and taking the dot product between the semantic representation of the corrected prototype and the query entity pair in the inquiry set as the credibility score of the triple; S7, inputting the existing medical knowledge graph into the adversarial enhancement network model, outputting the credibility score of the new medical knowledge triple generated by the model, and outputting the medical knowledge triple with the highest score to realize the construction of the medical knowledge graph. 2.The method of claim 1, wherein, In step S1, the medical knowledge graph is acquired, and the medical knowledge triple is constructed according to each entity in the medical knowledge graph and the relationship between the entities. The medical knowledge graph G is constructed as {(h, r, t) ∈ ε × R × ε}, wherein h represents a head entity node, r represents a relationship node, and t represents a tail entity node; ε and R are entity node sets and relationship node sets corresponding to the medical knowledge graph G, respectively. 3.The method of claim 2, wherein, The splitting of the medical knowledge triples according to the relations into the training set and the background knowledge graph in step S2 is specifically: extracting part of the triples from the medical knowledge graph G as a background knowledge graph G', the background knowledge graph G' contains part of the relation nodes in the relation node set R, and the triples corresponding to the remaining relation nodes in the relation node set R are taken as a training knowledge graph G train . 4.The method of claim 3, wherein, The selection of the representative entity pair in step S4 is specifically: given a training relation r e R train , the distribution center μ r of all entity pairs belonging to the relation r is calculated by averaging the semantic representations of the entity pairs, and the expression of the distribution center μ r is as follows: where |T r is the number of entity pairs of relation r, is the semantic representation of the i-th entity pair of relation r (h i , t i ) as a raw feature, and the expression of the raw feature is as follows: where F θ (·) is a pre-trained feature extractor, F θ (h i ) and F θ (t i ) are representations of head entity h i and tail entity t i , respectively, learned by feature extractor F θ (·), and ∨ is a concatenation operation. where F θ (·) is a pre-trained feature extractor, F θ (h i ) and F θ (t i ) are representations of head entity h i and tail entity t i , respectively, learned by feature extractor F θ (·), and ∨ is a concatenation operation. Selecting μ r and (h i , t i ) ∈ T r The first M entity pairs with the closest distance between μ and (h, t) are selected as representative entity pairs, and the specific expression is as follows: where topM(D r ) is the operation of selecting the top M elements from the distance set D r , T r ' is the set of M most representative entity pairs associated with the relation r, (h n , t n ) is the most representative entity pair. 5.The method of claim 4, wherein, In step S51, the generator of the adversarial enhancement network is constructed as follows: G φ (h; z h ) = Ω1(Ω2(F θ (h)) ∨ z h ) G φ (t; z t ) = Ω1(Ω2(F θ (t)) ∨ z t ) where Ω1and Ω2are two feedforward neural networks with different parameters, z h and z t are random noises sampled from a Gaussian distribution, is a feature representation synthesized with h as input, is a feature representation synthesized with t as input, N is a Gaussian distribution, z h and z t are subject to a Gaussian distribution with mean 0 and variance δI, is an identity matrix whose size is controlled by the bias of the noise input δ, d is the dimension of the entity representation. 6.The method of claim 5, wherein, The constraint imposed on the adversarial enhanced network in step S51 is specifically: minimizing the distribution distance L between the original feature representation and the synthesized feature representation advG The expression of the distribution distance L advG is as follows: wherein is configured by repeating three times in the row direction to construct a matrix denotes the calculation determiner in generating the expected output of the feature denotes the calculation determiner in the expected output; enforcing a higher similarity L between the generated feature and positive entity pairs than between the generated feature and negative entity pairs rank , the expression of the similarity L rank is as follows: In the formula, [x] + =max(0, x) is the hinge loss, γ is the marginal hyperparameter and γ > 0, · represents the dot product operation, (h + , t + ) represents a positive entity pair, T r ′ + It is a set of positive entity pairs, which is T. r A subset of ′, (h - , t - ) represents a negative entity pair, T r ′ - T is the set of negative entity pairs. r ′ - By replacing T with a fake entity r ′ + Construct from the tail entity of the middle entity pair. 7.The method of claim 6, wherein, In step S51, the generator is trained by minimizing the objective function as follows: In the formula, To minimize the objective function, λ is a hyperparameter that controls the trade-off between the two constraints. 8.The method of claim 7, wherein, The discriminator of the constructed adversarial enhanced network in step S52 is specifically: maximizing the distribution distance between the synthesized features and the original features The distribution distance The expression of the distribution distance is as follows: where L GP is a gradient penalty enforcing the Lipchitz constraint, β is a penalty parameter, and ε is a random noise number drawn from a uniform distribution, ε ~ U(0, 1), denotes the gradient of the interpolated feature with respect to the input image x. with respect to the input image x. 9.The method of claim 8, wherein, The constructing a relation prototype in step S6 is specifically: for a given relation r, the adversarial augmentation network is inputted with the representation of all supporting entity pairs, to generate a new feature representation, the original feature of the supporting entity pair and the synthetic feature are spliced to form an extended feature representation, denoted as the revised prototype of the task relation r is calculated as follows: wherein is the i-th feature in i is a weight that enhances the relationship between the support samples and the original prototypes, the weight ω i is expressed as follows: where ε is a scalar parameter, μ r is the distribution center calculated for step S4. 10.A medical knowledge graph construction system based on metric learning, characterized in that, The method comprises 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. The triple construction module is used to acquire a medical knowledge graph and construct a medical knowledge triple. The data set splitting module is used to split the medical knowledge triple into a training set and a background knowledge graph according to a relationship. The data set construction module is used to randomly extract a relationship node from the training knowledge graph, select part of the triple corresponding to the relationship node to construct a support set for the relationship node, construct an inquiry set by using the remaining triple of the relationship node, replace all tail entities in the inquiry set with entities that have no associated relationship with the head entity of the tail entity, and thereby construct a negative inquiry set. The entity pair selection module is used to select representative entity pairs to guide the generation of representative features by the adversarial enhancement network. The feature generation module is configured to train the adversarial enhancement network with representative entity pairs, generate representative features of the entity pairs, specifically, construct a generator of the adversarial enhancement network, apply constraints to the adversarial enhancement network, train the generator by minimizing an objective function, and construct a discriminator of the adversarial enhancement network. The relation prototype construction module is configured to enhance the support set by using the trained adversarial enhancement network model, construct a relation prototype, and correct the dot product between the semantic representations of the query entity pairs in the query set as the confidence score of the triple. The knowledge graph construction module is configured to input an existing medical knowledge graph into the adversarial enhancement network model, output the confidence score of the new medical knowledge triple generated by the model, output the medical knowledge triple with the highest score, and implement medical knowledge graph construction.

Citation Information

Patent Citations

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

    CN115269861A

  • Medical text generation method based on generative adversarial network technology

    WO2019179100A1