Knowledge graph link prediction method and device, equipment and medium

By normalizing the entity and relationship types of the knowledge graph, and grouping and parallel training, the problem of low prediction efficiency of knowledge graph link prediction is solved, and a more efficient prediction process and more balanced load distribution is achieved.

CN119669484AActive Publication Date: 2025-03-21NAT UNIV OF DEFENSE TECH

Patent Information

Application Number
CN202411809520.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-03-21
Estimated Expiration
2044-12-10

AI Technical Summary

Technical Problem

Currently, the prediction efficiency of knowledge graph links is low, especially when processing large-scale graph data, the number of nodes is huge and the graph structure is complex, resulting in increased traffic and unbalanced workloads, reducing the overall training efficiency.

Method used

The standardized knowledge graph is obtained by normalizing the entity type and relationship type of the initial knowledge graph. Then, the target entity relationship between each two entity types in the normalized knowledge graph is grouped to obtain a target number group entity relationship sample. These samples are distributed evenly to multiple computing nodes and are trained in parallel through replica networks, updating graph neural network parameters to achieve link prediction.

Benefits of technology

Through standardized processing and group distribution, the prediction speed reduction caused by irregular entity types and relationship types is avoided, and the prediction efficiency is improved. Parallel training and load balancing processing further improves processing speed and overall prediction efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119669484A_ABST
    Figure CN119669484A_ABST
Patent Text Reader

Abstract

The invention discloses a knowledge graph link prediction method and device, equipment and a medium, and relates to the technical field of knowledge graph link prediction, and the method comprises the steps: carrying out the entity type normalization processing and relation type normalization processing of an initial knowledge graph, and obtaining a normalized knowledge graph; grouping a plurality of target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph to obtain a target number group of entity relationship samples; all target entity relationships in one group of entity relationship samples correspond to two entity types; the entity relationship comprises a head entity, a relationship type and a tail entity; uniformly distributing the target number of groups of entity relationship samples to computational nodes through a graph neural network to obtain a number of sample groups of computational nodes, and training the sample groups in parallel through a replica network to update graph neural network parameters, obtain a link prediction model and realize knowledge graph link prediction; a copy network of a graph neural network exists in each computing node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of knowledge graph link prediction, and in particular to a knowledge graph link prediction method, device, equipment and medium. Background Art

[0002] Knowledge graph link prediction is a method for predicting entity relationships. By analyzing knowledge graph data, we can complete and expand the graph, thereby improving the efficiency of recommendation systems, information retrieval, data cleaning, and scientific research discovery.

[0003] Currently, large-scale knowledge graphs extract fact triplets from literature through text mining and database integration. The triplets are in the form of (head entity, relationship, tail entity), such as (compound, enhanced expression, gene). Today, knowledge graphs are widely used in various fields to provide support for tracing the knowledge principles and discovering new knowledge in various fields. Unlike manually compiled knowledge graphs, automatically / semi-automatically generated knowledge graphs are extremely sparse and incomplete.

[0004] Convolutional Neural Networks (CNNs) are graph-based deep learning models that have been widely used in many fields, including social network analysis, recommendation systems, and bioinformatics drug screening. CNNs can effectively learn and utilize the complex relationships between nodes in knowledge graphs, thereby achieving efficient information propagation and feature learning. However, there are still some challenges in extending GNNs to process large-scale graph data, such as the large number of nodes and complex graph structure. To overcome these challenges, distributed computing provides abundant computing resources and has become a promising solution for training large-scale GNNs. However, there are still some technical challenges in achieving efficient distributed GNN training. One of the key issues is that the dependency of the graph structure increases the challenge of communication volume. The information exchange between entities may involve a large amount of data transmission, resulting in reduced prediction efficiency. In addition, due to the special nature of graph data, the workload may be unbalanced, and some entities may bear more computing tasks, thereby reducing the overall training efficiency.

[0005] In summary, how to improve the efficiency of knowledge graph link prediction is a problem that needs to be solved urgently. Summary of the invention

[0006] In view of this, the purpose of the present invention is to provide a knowledge graph link prediction method, device, equipment and medium, which can improve the efficiency of knowledge graph link prediction. The specific scheme is as follows:

[0007] In a first aspect, the present application discloses a knowledge graph link prediction method, comprising:

[0008] Perform entity type normalization and relationship type normalization on the initial knowledge graph constructed based on the target content to obtain a normalized knowledge graph;

[0009] A plurality of target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph are grouped to obtain a target number of entity relationship samples; wherein all the target entity relationships in a group of entity relationship samples correspond to the same two entity types; and an entity relationship includes a head entity, a relationship type, and a tail entity;

[0010] The target number group of entity relationship samples are evenly distributed to a number of computing nodes through the graph neural network to obtain sample groups with the number of computing nodes. The sample groups with the number of computing nodes are trained in parallel through the replica network to update the graph neural network parameters and obtain a link prediction model to realize knowledge graph link prediction. There is a replica network of the graph neural network in each computing node.

[0011] The number of the target entity relationships in different entity relationship samples is the same, and the number of the entity relationship samples in different sample groups is the same.

[0012] The step of grouping a plurality of target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph to obtain a target number of entity relationship samples includes:

[0013] Determine an initial number of target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph, and select one of the initial numbers as a reference number according to a target rule;

[0014] The initial number that is smaller than the reference number is removed, and the other initial number of target entity relationships are grouped to obtain a target number group of entity relationship samples including the reference number of target entity relationships.

[0015] The step of performing entity type normalization processing and relationship type normalization processing on the initial knowledge graph constructed based on the target content to obtain a normalized knowledge graph includes:

[0016] Determine the initial knowledge graph built based on the target content;

[0017] Determine a number of standardized entity types corresponding to the target content, and determine a standardized entity relationship between every two entity types and every two entities corresponding to each other;

[0018] Classifying several initial entities representing the same content in the initial knowledge graph as the same entity, and classifying the classified target entity into a corresponding entity type;

[0019] The initial entity relationship corresponding to each two target entities between each two entity types is classified into the normalized entity relationship to determine the target entity relationship between each two target entities.

[0020] The statistical classification results are used to obtain a normalized knowledge graph.

[0021] The step of classifying the initial entity relationship corresponding to each two target entities between each two entity types into the normalized entity relationship to determine the target entity relationship between each two target entities includes:

[0022] Determine an initial entity relationship corresponding to every two target entities between every two entity types in the initial knowledge graph;

[0023] A target entity relationship in the normalized entity relationship that is most similar to the initial entity relationship is determined through a retrieval system, and the initial entity relationship is classified into the target entity relationship.

[0024] The step of determining the target entity relationship in the normalized entity relationship that is most similar to the initial entity relationship through a retrieval system and classifying the initial entity relationship into the target entity relationship further includes:

[0025] Using a semantic similarity model, the initial entity relationship is encoded to obtain a first encoding function, and other initial entity relationships are encoded to obtain a second encoding function;

[0026] Calculate the cosine similarity between the initial entity relationship and the other initial entity relationships based on the first encoding function and the second encoding function;

[0027] The other initial entity relations whose cosine similarities satisfy a similarity condition are classified into the target entity relation.

[0028] The method of training the number of sample groups of computing nodes in parallel through the replica network to update the graph neural network parameters and obtain a link prediction model includes:

[0029] The number of sample groups of the computing nodes are trained in parallel through the replica network to obtain the initial prediction result, and the gradient calculation is performed on each of the computing nodes to obtain the target gradient corresponding to each of the computing nodes;

[0030] Performing gradient sharing among all the computing nodes and calculating an average gradient to achieve gradient fusion among the computing nodes;

[0031] The initial prediction results corresponding to the sample groups of the number of nodes are processed in parallel by the graph neural network based on the average gradient to obtain the final prediction results, so as to update the graph neural network parameters and obtain the link prediction model; wherein the final prediction results of all nodes are the same.

[0032] The step of training the number of sample groups of computing nodes in parallel through the replica network to obtain the initial prediction result includes:

[0033] Determine, by the replica network, a first entity relationship corresponding to the first entity type and a second entity relationship corresponding to the second entity type in the sample groups of the number of computing nodes for training;

[0034] Obtaining a first primary embedding representation of the first entity type based on the first entity relationship, and obtaining a second primary embedding representation of the second entity type based on the second entity relationship;

[0035] Obtaining initial prediction results corresponding to every two target entities between the first entity type and the second entity type based on the first primary embedding representation and the second primary embedding representation;

[0036] The first entity relationship is an entity relationship between the first entity type and other entity types except the second entity type; the second entity relationship is an entity relationship between the second entity type and other entity types except the first entity type.

[0037] In a second aspect, the present application discloses a knowledge graph link prediction device, comprising:

[0038] A normalization processing module is used to perform entity type normalization processing and relationship type normalization processing on the initial knowledge graph constructed based on the target content to obtain a normalized knowledge graph;

[0039] A grouping processing module is used to group a number of target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph to obtain a target number of entity relationship samples; wherein all the target entity relationships in a group of entity relationship samples correspond to the same two entity types; and the entity relationship includes a head entity, a relationship type, and a tail entity;

[0040] A parallel training module is used to evenly distribute the entity relationship samples of the target number group to several computing nodes through the graph neural network to obtain sample groups of computing nodes, and to train the sample groups of computing nodes in parallel through the replica network to update the graph neural network parameters and obtain a link prediction model to realize knowledge graph link prediction; there is a replica network of the graph neural network in each computing node.

[0041] In a third aspect, the present application discloses an electronic device, comprising:

[0042] Memory, used to store computer programs;

[0043] A processor is used to execute the computer program to implement the aforementioned disclosed knowledge graph link prediction method.

[0044] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned knowledge graph link prediction method is implemented.

[0045] It can be seen that the present application performs entity type normalization processing and relationship type normalization processing on the initial knowledge graph constructed based on the target content to obtain a normalized knowledge graph; groups several target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph to obtain a target number of groups of entity relationship samples; wherein, all the target entity relationships in a group of the entity relationship samples correspond to the same two entity types; the entity relationship includes a head entity, a relationship type and a tail entity; the target number of groups of the entity relationship samples are evenly distributed to a number of the computing nodes through the graph neural network to obtain a number of sample groups of computing nodes, and the number of sample groups of computing nodes are trained in parallel through the replica network to update the graph neural network parameters to obtain a link prediction model to realize knowledge graph link prediction; there is a replica network of the graph neural network in each of the computing nodes. It can be seen that the normalization of the initial knowledge graph in the present application avoids the situation where the subsequent prediction speed is reduced due to the non-standard entity types and relationship types, thereby improving efficiency; the grouping and distribution have been completed before training in the present application, and the knowledge graph link prediction is realized directly based on the sample group, so there is no need to transmit data between entities during the prediction process, thereby improving speed and prediction efficiency; the grouping and distribution have been completed before training in the present application, and the entity relationship samples in the target number group are evenly distributed to several of the computing nodes to obtain sample groups with the number of computing nodes, ensuring that the number of target entity relationships in different sample groups is the same, so that the load of each node is balanced, which is conducive to improving prediction efficiency; the present application processes each sample group in parallel, improves processing speed, and further improves prediction efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0047] Figure 1 A flow chart of a knowledge graph link prediction method disclosed in this application;

[0048] Figure 2 A specific standardized process diagram disclosed in this application;

[0049] Figure 3 A schematic diagram of a grouping and distribution process disclosed in this application;

[0050] Figure 4 A flowchart of a specific knowledge graph link prediction method disclosed in this application;

[0051] Figure 5 A schematic diagram of a specific knowledge graph normalization process disclosed in this application;

[0052] Figure 6 A flowchart of a specific knowledge graph link prediction method disclosed in this application;

[0053] Figure 7 A schematic diagram of the initial prediction of a portion of the knowledge graph disclosed in this application;

[0054] Figure 8 A schematic diagram of initial prediction of another part of the knowledge graph disclosed in this application;

[0055] Fig. 9 A schematic diagram of an initial knowledge graph disclosed in this application;

[0056] Fig.10 A schematic diagram of a sub-diagram disclosed in this application;

[0057] Fig.11 A schematic diagram of the structure of a knowledge graph link prediction device disclosed in this application;

[0058] Fig.12 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0059] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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.

[0060] Currently, large-scale knowledge graphs extract fact triplets from literature through text mining and database integration. The triplets are in the form of (head entity, relationship, tail entity), such as (compound, enhanced expression, gene). Today, knowledge graphs are widely used in various fields to provide support for tracing the knowledge principles and discovering new knowledge in various fields. Unlike manually compiled knowledge graphs, automatically / semi-automatically generated knowledge graphs are extremely sparse and incomplete.

[0061] Graph Neural Networks (CNNs) are graph-based deep learning models that have been widely used in many fields, including social network analysis, recommendation systems, and bioinformatics drug screening. GNNs can effectively learn and utilize the complex relationships between nodes in knowledge graphs, thereby achieving efficient information propagation and feature learning. However, there are still some challenges in extending GNNs to process large-scale graph data, such as the large number of nodes and complex graph structure. To overcome these challenges, distributed computing provides abundant computing resources and has become a promising solution for training large-scale GNNs. However, there are still some technical challenges in achieving efficient distributed GNN training. One of the key issues is that the dependency of the graph structure increases the challenge of communication volume. The information exchange between entities may involve a large amount of data transmission, resulting in reduced prediction efficiency. In addition, due to the special nature of graph data, the workload may be unbalanced, and some entities may bear more computing tasks, thereby reducing the overall training efficiency.

[0062] To this end, an embodiment of the present application proposes a knowledge graph link prediction solution that can improve the efficiency of knowledge graph link prediction.

[0063] The present application embodiment discloses a knowledge graph link prediction method, see Figure 1 As shown, the method includes:

[0064] Step S11: Perform entity type normalization and relationship type normalization on the initial knowledge graph constructed based on the target content to obtain a normalized knowledge graph.

[0065] In this embodiment, the target content may be content in the fields of social network analysis, recommendation system, bioinformatics system drug screening, etc.

[0066] In this embodiment, the initial knowledge graph construction requires the construction of triples. S=(E;R;F) is the set of triples of the knowledge graph, where E is the set of entity names, R is the set of relationship descriptions, and F is the set of facts. .here, and are the head entity and the tail entity of the three elements of the fact. is the entity type to which the entity belongs, that is, Class entity. Each entity and relationship description is a tag sequence, represented as ,in and They are and The length of the sequence in . Given a query pair ( ), the link prediction task aims to infer the relationship between missing facts , or given a query pair ( ), infer the tail entity in the missing fact .

[0067] In this embodiment, the entity type normalization process includes classifying different entity type expressions representing the same content into one category, and the relationship type normalization process includes classifying different relationship type expressions representing the same content into one category.

[0068] See also Figure 2As shown, it is a specific schematic diagram of the normalization process; in the figure, a is the initial knowledge graph before normalization, c is the normalized knowledge graph, and the nodes in the same ellipse in b are nodes that need to be merged. After the nodes that need to be merged are merged into the same node, the relationship between the nodes is normalized and described, and then c is obtained. It should be pointed out that arsenic is the chemical element arsenic, atorvastatin is atorvastatin, Isoproterenol is isoproterenol, DX600 peptide is an ACE2-specific inhibitor peptide, CDDP represents cisplatin, Cisplatin also represents cisplatin (an anti-tumor drug), diminazene aceturate is triazoline, DIZE is the abbreviation of diminazene aceturate, acetaminophen is acetaminophen, angiotensin converting enzyme 2 is angiotensin converting enzyme 2, and ACE2 is the abbreviation of angiotensin converting enzyme 2. In the figure, Cav-1 and Cisplatin, DIZE and diminazene aceturate, ACE2 and angiotensin converting enzyme 2 are merged into one and represented by Cisplatin, diminazene aceturate and ACE2 respectively, and the relationship types are classified into one for standardized description. Singnificantly downregulated means significantly downregulated, increased means increased, decreased activity means decreased activity, result in decreased expression means significantly decreased expression, remarkably increased the expression means significantly increased, increased expression means increased expression, decreased expression means decreased expression, and counteracted means offset.

[0069] Step S12: Grouping and processing several target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph to obtain a target number of group entity relationship samples; wherein all the target entity relationships in a group of the entity relationship samples correspond to the same two entity types; the entity relationship includes a head entity, a relationship type and a tail entity.

[0070] In this embodiment, several target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph are grouped and processed to obtain a target number group of entity relationship samples, including: dividing the target entity relationships into a training set, a validation set, and a test set, and grouping the training set, the validation set, and the test set respectively to obtain a target number group of entity relationship samples corresponding to the training set, as well as a first number group of other entity relationship samples corresponding to the validation set and a second number group of other entity relationship samples corresponding to the test set.

[0071] It should be noted that each group of entity relationship samples in the target number of groups of entity relationship samples includes partial contents of multiple target entity relationships.

[0072] In this embodiment, the several target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph are grouped and processed to obtain a target number group of entity relationship samples, including: determining the initial number of target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph, and selecting one of the initial number as a reference number according to a target rule; removing the initial number that is smaller than the reference number, and grouping the other initial numbers of the target entity relationships to obtain a target number group of entity relationship samples including the reference number of the target entity relationships.

[0073] It should be pointed out that the selected reference quantity can be the value closest to the preset quantity, or it can be selected by other means, which is not specifically limited here; in addition, when the target entity relationships of the other initial quantities are grouped, if the final remaining quantity after grouping is less than the reference quantity, the final remaining target entity relationship will be removed.

[0074] In a specific embodiment, the number of relationships contained in each relationship type is from small to large. , where the relationship type The number of relationships ,Right now < ……< , let the batch size be ,like ,exist Randomly select If , then Divided into batches, the size of the first m-1 batches is ,the remaining throw away, is processed in the same way, i and j represent entities.

[0075] Step S13: Evenly distribute the entity relationship samples of the target number group to several computing nodes through the graph neural network to obtain sample groups of computing nodes, and train the sample groups of computing nodes in parallel through the replica network to update the graph neural network parameters to obtain a link prediction model to realize knowledge graph link prediction; there is a replica network of the graph neural network in each computing node.

[0076] In this embodiment, balanced distribution is required. Specifically, it is necessary to ensure that the number of target entity relationships in different sample groups is the same, so that multiple nodes can remain balanced during the training process. Specifically, it can be determined that the number of target entity relationships in different entity relationship samples is the same, and the number of entity relationship samples in different sample groups is the same, thereby ensuring that the number of target entity relationships in different sample groups is the same. Of course, it can also include the situation where the number of target entity relationships in different entity relationship samples is different. In this case, it is necessary to focus on detecting the number of target entity relationships in each sample group during subsequent distribution.

[0077] It should be pointed out that in distributed training, coordination and synchronization between nodes are very important. When distributing the training load to different nodes, it is necessary to ensure that the overall workload assigned to each node is roughly balanced to avoid overloading or idling some nodes, thereby improving training efficiency and resource utilization.

[0078] See Figure 3 As shown in Figure 1, it is a schematic diagram of a grouping and distribution process (distributed training process). The two entity types are and In the figure, there are 9 types of relationships in total. The relationship type with the least number of relationships is too small, so it is ignored. The relationship type with the second smallest number of relationships is used as the reference number, and the grouping of other relationship types is completed based on the reference number. In the grouping process in the figure, when the number of the last group of target entity relationships of each relationship type is less than the reference number, it is removed and does not participate in the subsequent process, so there are 8 types left; there are 4 parallel nodes in the figure (Node1, Node2, Node3, Node4), and the contents of the 8 relationship types are evenly divided into 4 parallel nodes. The arrows between the four nodes indicate that there is information exchange between the four nodes. In addition, the training process is also a polling and iterative update of each node.

[0079] It should be pointed out that in parallel training, each node maintains a copy of the graph neural network model during the training process. This process ensures that each node has the same initial model. In each pass, gradient fusion is achieved by sharing and averaging gradients among all nodes. Specifically, the steps of independent gradient calculations on each node ensure that each node can participate in the training process and contribute to the calculation results. In this way, each node not only retains its own computing power, but also uses the information of other nodes to improve the overall training efficiency and accuracy. Ultimately, through this sharing and fusion mechanism, the model results on each node are the same. Because each node starts with the same copy, and through the gradient fusion operation, the weight updates on all nodes are consistent, thus ensuring the consistency and coordination of the model in the entire distributed system. The specific implementation process is as follows: The code parses the command line parameters through the argparse library, which include whether to use GPU, GPU device number, number of nodes (world_size), node ID (node_id) and local ranking (local_rank), which are all required for distributed training. ①Environment setup: Set the CUDA_VISIBLE_DEVICES environment variable according to the gpu_devices parameter to limit the number of GPUs visible to PyTorch. Set different distributed backends (gloo or nccl) depending on the system. ②Process group initialization: On each GPU, start multiple worker processes through the torch.multiprocessing.spawn function. Each process executes the worker function. In the worker function, the global rank (process ID) is calculated based on the local_rank (i.e. node ID) of the current process and the global node_id. Use the torch.distributed.init_process_group function to initialize the distributed process group, which allows communication between different processes. ③Model and data parallelism: Wrap the model through torch.nn.parallel.DistributedDataParallel to achieve data parallelism. In this way, each GPU processes a subset of the data and aggregates the gradients through the AllReduce operation. ④Training process: In the training loop, each process processes the batch of data assigned to it. The model forward propagates to calculate the predicted value, calculates the loss, and performs backpropagation to update the weights. Due to the use of DistributedDataParallel, gradients are automatically synchronized between GPUs. ⑤ Validation and model saving: At the end of each epoch, the code performs a validation process to evaluate the performance of the model. Based on the validation results, you can choose to save the model parameters of the current epoch, or save the best model when the validation indicators have improved.

[0080] It can be seen that the present application performs entity type normalization processing and relationship type normalization processing on the initial knowledge graph constructed based on the target content to obtain a normalized knowledge graph; groups several target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph to obtain a target number of groups of entity relationship samples; wherein, all the target entity relationships in a group of the entity relationship samples correspond to the same two entity types; the entity relationship includes a head entity, a relationship type and a tail entity; the target number of groups of the entity relationship samples are evenly distributed to a number of the computing nodes through the graph neural network to obtain a number of sample groups of computing nodes, and the number of sample groups of computing nodes are trained in parallel through the replica network to update the graph neural network parameters to obtain a link prediction model to realize knowledge graph link prediction; there is a replica network of the graph neural network in each of the computing nodes. It can be seen that the normalization of the initial knowledge graph in the present application avoids the situation where the subsequent prediction speed is reduced due to the non-standard entity types and relationship types, thereby improving efficiency; the grouping and distribution have been completed before training in the present application, and the knowledge graph link prediction is realized directly based on the sample group, so there is no need to transmit data between entities during the prediction process, thereby improving speed and prediction efficiency; the grouping and distribution have been completed before training in the present application, and the entity relationship samples in the target number group are evenly distributed to several of the computing nodes to obtain sample groups with the number of computing nodes, ensuring that the number of target entity relationships in different sample groups is the same, so that the load of each node is balanced, which is conducive to improving prediction efficiency; the present application processes each sample group in parallel, improves processing speed, and further improves prediction efficiency.

[0081] The present application embodiment discloses a specific knowledge graph link prediction method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Figure 4 As shown, specifically including:

[0082] Step S21: Determine an initial knowledge graph constructed based on the target content; determine several standardized entity types corresponding to the target content, and determine the standardized entity relationship between every two entities of every two entity types.

[0083] In a specific embodiment, the classification and standardization of Stanford NER (for names of people, companies, genes or proteins, etc.) and PubChem interface (for compounds, drugs, etc.) are integrated. Entities are divided into multiple categories according to type. .

[0084] Step S22: Classify several initial entities representing the same content in the initial knowledge graph into the same entity, and classify the classified target entity into the corresponding entity type.

[0085] In this embodiment, the full name and abbreviation of the same content represent the same content, the full name and abbreviation of the same content are classified into an entity corresponding to the content, and the entity type corresponding to the entity is determined.

[0086] Step S23: Classify the initial entity relationship corresponding to every two target entities between every two entity types into the normalized entity relationship to determine the target entity relationship between every two target entities.

[0087] In this embodiment, the initial entity relationship corresponding to every two target entities between every two entity types is classified into the normalized entity relationship to determine the target entity relationship between every two target entities, including: determining the initial entity relationship corresponding to every two target entities between every two entity types in the initial knowledge graph; determining the target entity relationship in the normalized entity relationship that is most similar to the initial entity relationship through a retrieval system, and classifying the initial entity relationship into the target entity relationship.

[0088] In this embodiment, after determining the target entity relationship in the normalized entity relationship that is most similar to the initial entity relationship through the retrieval system and classifying the initial entity relationship into the target entity relationship, it also includes: encoding the initial entity relationship using a semantic similarity model to obtain a first encoding function, and encoding other initial entity relationships to obtain a second encoding function; calculating the cosine similarity between the initial entity relationship and the other initial entity relationships based on the first encoding function and the second encoding function; and classifying the other initial entity relationships whose cosine similarity meets the similarity condition into the target entity relationship.

[0089] It should be pointed out that there may be retrieval errors if the retrieval system is used alone. Increasing the application of semantic similarity models can improve accuracy.

[0090] In a specific embodiment, for an entity type and entity types , { ∈ }, given a set of relations , then the entity type With entity type The relationship between Class. Input Relation ,Will The input sequence Constructed in its text form The connection with the two introduced tags "[ENT1] ([EN1])" and "[ENT2] ([EN2])", i.e. Considering that the pre-trained language model is very good at capturing the semantics of text, the pre-trained SBERT (semantic similarity model) is used for each relationship. Encode it and get its dense sentence representation, expressed as a function Then a retrieval system Will and , and returns the most similar relation ( ) as its normalized relation:

[0091] ;

[0092] in yes The normalized relationship group of is a hyperparameter. and ∈ of and Semantic Similarity The cosine similarity of its sentence representation is calculated as:

[0093] ;

[0094] for The input sequence of ; SBERT represents the semantic similarity model.

[0095] Finally, the body type and entity types The relationship type is normalized in within the range.

[0096] Step S24: Count the classification results to obtain a normalized knowledge graph.

[0097] In a specific embodiment, see Figure 5 As shown in the figure, it is a specific schematic diagram of the knowledge graph normalization process; for bioinformatics system drug screening, there is and Two entity types, The corresponding type is PubChem, which is the organic small molecule biological activity data, and is a database of chemical modules (compounds in this example). There are many different languages ​​that express the same content. In the figure, the three expressions can be classified as , the three expressions (including DIZE and diminazene aceturate) can all be classified as , both expressions can be classified as , the middle content is omitted, and the last three expressions can be classified as ,m represents The number of entity types in , for example, DIZE is the abbreviation of diminazene aceturate, which means the same thing. is the type corresponding to Stanford NER (gene in this embodiment), There are many different languages ​​that express the same content. In the figure, the three expressions can be classified as , both expressions (ACE2 and angiotensin converting enzyme 2) can be classified as , the three expressions can be classified as , the middle content is omitted, and the last three expressions can be classified as , n represents The number of entity types in the table, for example, ACE2 is the abbreviation of angiotensin converting enzyme 2, which means the same thing. In addition, the entity type normalization process is as follows: Assume that There are three entities: There are two entities: There are three entities: There are two entities: Includes three entities, the middle content is omitted, and the last There are three entities (e.g. Including diethylamide triazoline and two other compounds, Including and another gene), Z means that this embodiment includes Z entity types; finally, the relationship between entities in each two entity types is performed according to the normalized entity types, that is, to Finally, a new knowledge graph can be obtained.

[0098] See Figure 2 As shown, this is a schematic diagram of the normalized results. First, Figure 2 In a, it is not a normalized knowledge graph. The content in an ellipse in b represents the same content, so they need to be merged, and finally the graph in c is obtained.

[0099] It can be seen that the present application determines an initial knowledge graph constructed based on the target content; determines several standardized entity types corresponding to the target content, and determines the standardized entity relationship corresponding to each two entities between every two entity types; classifies several initial entities representing the same content in the initial knowledge graph as the same entity, and classifies the classified target entity into the corresponding entity type; classifies the initial entity relationship corresponding to each two target entities between every two entity types into the standardized entity relationship to determine the target entity relationship between every two target entities; and obtains a standardized knowledge graph by statistically analyzing the classification results. It can be seen that the present application specifically discloses a method for normalizing a knowledge graph, which can avoid the situation where the subsequent prediction speed is reduced due to the non-standardization of entity types and relationship types, thereby improving efficiency.

[0100] The present application embodiment discloses a specific knowledge graph link prediction method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Figure 6 As shown, specifically including:

[0101] Step S31: training the number of sample groups of the computing nodes in parallel through the replica network to obtain an initial prediction result, and performing gradient calculation on each of the computing nodes to obtain a target gradient corresponding to each of the computing nodes.

[0102] In this embodiment, the method of obtaining an initial prediction result by training the sample groups of the number of computing nodes in parallel through the replica network includes: determining a first entity relationship corresponding to a first entity type and a second entity relationship corresponding to a second entity type in the sample groups of the number of computing nodes for training through the replica network; obtaining a first primary embedding representation of the first entity type based on the first entity relationship, and obtaining a second primary embedding representation of the second entity type based on the second entity relationship; training based on the first primary embedding representation and the second primary embedding representation to obtain an initial prediction result corresponding to every two target entities between the first entity type and the second entity type; wherein the first entity relationship is an entity relationship between the first entity type and other entity types except the second entity type; and the second entity relationship is an entity relationship between the second entity type and other entity types except the first entity type.

[0103] In a specific embodiment, two entity types are specifically described. and To learn the relationship between the two types of entities, first learn them separately With The relationship between entities of other types outside the type, the relationship subgraph learns the primary embedding of nodes; first determine The corresponding division and The first relationship subgraph (corresponding to the first entity relationship) between the relationship is determined The corresponding division and The second relationship subgraph (corresponding to the second entity relationship) between the relationship between Entity-like node embeddings aggregate -SubGraph, -SubGraph, -SubGraph and -SubGraph and other subgraphs in the neighbor information, the second relationship subgraph assumes Node embeddings of entity-like nodes are aggregated -SubGraph, -SubGraph, -SubGraph and -Neighbor node information in SubGraph. Initialized using primary embedding and The node representations in the relational subgraph are further learned, and high-level embedding representations of the nodes are used for prediction.

[0104] Specifically, each individual node can be queried by multiplying the entity matrix by the one-hot vector. The corresponding node can be simplified and represented by the one-hot vector, denoted as ; The CCN process is divided into two steps (including preliminary embedding and advanced embedding), each of which is performed by a k-layer graph convolutional network. The encoding and updating process of the initial embedding information is carried out according to the following first equation:

[0105] ;

[0106] in, is aggregated from When the number of graph convolutional layers reaches a predefined depth When and Two types of entities are initially embedded.

[0107] in, belongs to the set of real vectors of dimension d. σ is a nonlinear activation function. Indicates a connection relationship of The set of adjacent nodes of Indicates a connection relationship of The set of adjacent nodes. Represents a relationship type of The learnable parameter matrix of . and is a normalization constant. Get each hidden layer and output node embedding ( , )’s hidden state , and embed them into the relational subgraph between the entities of interest. The advanced embedding is shown in the second equation below:

[0108] ;

[0109] same, ,and Indicates The number of neurons in the hidden layer. express - Interaction relationship type.

[0110] at last ,when and As multi-type subgraphs for learning and It should be noted that i and j represent and The specific entity in .

[0111] See also Figure 7 and Figure 8 As shown, Figure 7 and Figure 8 A schematic diagram of the initial prediction of the knowledge graph; Figure 7 It is a schematic diagram of the initial prediction of a part of the knowledge graph; Figure 8 is a schematic diagram of the initial prediction of another part of the knowledge graph; Figure 8 Steps Figure 7 The next step of the step; the schematic diagram of the initial prediction of the knowledge graph is also the schematic diagram of the node embedding process, including the above learning and The two node embedding processes are Figure 7 The first graph in the subgraph division is the first relationship subgraph, and the second graph is the second relationship subgraph. The initial node embedding is completed based on the first equation. The meaning of i and j is also specifically shown in the process of initial node embedding, which corresponds to Figure 4 Entity annotations in , ), which will not be introduced in detail here. Figure 8 The second equation is used to complete the advanced node embedding. It should be pointed out that Figure 8 middle, ( ) represents the relationship between the new nodes, Figure 7In the example, the initial knowledge graph and subgraph divisions are not clear, so the Fig. 9 and Fig.10 , Fig. 9 It is a schematic diagram of an initial knowledge graph; Fig.10 It is a schematic diagram of a seed diagram; Fig. 9 and Fig.10 The r in the above table represents the relationship between nodes.

[0112] Each sample group contains multiple training and prediction processes for two entity types, and all training and prediction processes in each sample group must be completed.

[0113] Step S32: performing gradient sharing among all the computing nodes, and calculating the average gradient to achieve gradient fusion among the computing nodes.

[0114] Step S33: The initial prediction results corresponding to the sample groups of the number of nodes are processed in parallel by the graph neural network based on the average gradient to obtain the final prediction results, so as to update the graph neural network parameters and obtain the link prediction model; wherein the final prediction results of all nodes are the same.

[0115] In this embodiment, after the training prediction process in each sample group is completely completed, the prediction results between different sample groups are shared so as to obtain the final prediction result by summing up all the prediction results.

[0116] In this embodiment, the bilinear tensor decomposition model RESCA based on DEDICOM uses matrix operations to represent the data interaction between entities and relationships, so that the potential information can be understood more deeply. The prediction results are obtained by relaxing some overly strict constraints to solve these problems. Node embedding learned by the encoder and The columns of are given weights. Represents the interaction type matrix. The calculation formula is as follows:

[0117] ;

[0118] It can be seen that the present application obtains the initial prediction result by training the sample groups of the number of computing nodes in parallel through the replica network, and performs gradient calculation on each computing node to obtain the target gradient corresponding to each computing node; performs gradient sharing between all the computing nodes, and calculates the average gradient to achieve gradient fusion between the computing nodes; and obtains the final prediction result by processing the initial prediction result corresponding to the sample groups of the number of nodes in parallel based on the average gradient through the graph neural network to update the graph neural network parameters and obtain the link prediction model; wherein the final prediction results of all nodes are the same. It can be seen that the present application discloses the specific process of completing prediction using graph neural networks.

[0119] Correspondingly, the present application embodiment also discloses a knowledge graph link prediction device, see Fig.11 As shown, the device comprises:

[0120] A normalization processing module 11 is used to perform entity type normalization processing and relationship type normalization processing on the initial knowledge graph constructed based on the target content to obtain a normalized knowledge graph;

[0121] The grouping processing module 12 is used to group a plurality of target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph to obtain a target number of entity relationship samples; wherein all the target entity relationships in a group of entity relationship samples correspond to the same two entity types; and the entity relationship includes a head entity, a relationship type, and a tail entity;

[0122] A parallel training module 13 is used to evenly distribute the entity relationship samples of the target number group to a number of the computing nodes through the graph neural network to obtain sample groups of the number of computing nodes, and to train the sample groups of the number of computing nodes in parallel through the replica network to update the graph neural network parameters and obtain a link prediction model to realize knowledge graph link prediction; there is a replica network of the graph neural network in each of the computing nodes.

[0123] Among them, the more specific working process of each of the above modules can refer to the corresponding content disclosed in the above embodiments, which will not be repeated here.

[0124] It can be seen that the present application performs entity type normalization processing and relationship type normalization processing on the initial knowledge graph constructed based on the target content to obtain a normalized knowledge graph; groups several target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph to obtain a target number of groups of entity relationship samples; wherein, all the target entity relationships in a group of the entity relationship samples correspond to the same two entity types; the entity relationship includes a head entity, a relationship type and a tail entity; the target number of groups of the entity relationship samples are evenly distributed to a number of the computing nodes through the graph neural network to obtain a number of sample groups of computing nodes, and the number of sample groups of computing nodes are trained in parallel through the replica network to update the graph neural network parameters to obtain a link prediction model to realize knowledge graph link prediction; there is a replica network of the graph neural network in each of the computing nodes. It can be seen that the normalization of the initial knowledge graph in the present application avoids the situation where the subsequent prediction speed is reduced due to the non-standard entity types and relationship types, thereby improving efficiency; the grouping and distribution have been completed before training in the present application, and the knowledge graph link prediction is realized directly based on the sample group, so there is no need to transmit data between entities during the prediction process, thereby improving speed and prediction efficiency; the grouping and distribution have been completed before training in the present application, and the entity relationship samples in the target number group are evenly distributed to several of the computing nodes to obtain sample groups with the number of computing nodes, ensuring that the number of target entity relationships in different sample groups is the same, so that the load of each node is balanced, which is conducive to improving prediction efficiency; the present application processes each sample group in parallel, improves processing speed, and further improves prediction efficiency.

[0125] Furthermore, an embodiment of the present application also provides an electronic device. Fig.12 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.

[0126] Fig.11 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a display screen 23, an input and output interface 24, a communication interface 25, a power supply 26, and a communication bus 27. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the knowledge graph link prediction method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0127] In this embodiment, the power supply 26 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 25 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 24 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0128] In addition, the memory 22, as a carrier for storing resources, may be a read-only memory, a random access memory, a disk or an optical disk, etc., and the resources stored thereon may include a computer program 221, and the storage method may be temporary storage or permanent storage. Among them, the computer program 221 may further include a computer program that can be used to complete the knowledge graph link prediction method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, in addition to a computer program that can be used to complete other specific tasks.

[0129] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned knowledge graph link prediction method is implemented.

[0130] The specific steps of the method can refer to the corresponding contents disclosed in the above embodiments, which will not be repeated here.

[0131] The various embodiments in this application are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0132] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0133] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0134] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0135] The above is a detailed introduction to a knowledge graph link prediction method, device, equipment, and storage medium provided by the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A knowledge graph link prediction method, characterized in that: include: Perform entity type normalization and relationship type normalization on the initial knowledge graph constructed based on the target content to obtain a normalized knowledge graph; A plurality of target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph are grouped to obtain a target number of entity relationship samples; wherein all the target entity relationships in a group of entity relationship samples correspond to the same two entity types; and an entity relationship includes a head entity, a relationship type, and a tail entity; The target number group of entity relationship samples are evenly distributed to a number of computing nodes through the graph neural network to obtain sample groups with the number of computing nodes. The sample groups with the number of computing nodes are trained in parallel through the replica network to update the sample groups with the number of computing nodes to obtain a link prediction model to realize knowledge graph link prediction; there is a replica network of the graph neural network in each computing node.

2. The knowledge graph link prediction method according to claim 1, characterized in that: The number of the target entity relations in different entity relation samples is the same, and the number of the entity relation samples in different sample groups is the same.

3. The knowledge graph link prediction method according to claim 2, characterized in that: The grouping of a plurality of target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph to obtain a target number of group entity relationship samples includes: Determine an initial number of target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph, and select one of the initial numbers as a reference number according to a target rule; The initial number that is smaller than the reference number is removed, and the other initial number of target entity relationships are grouped to obtain a target number group of entity relationship samples including the reference number of target entity relationships.

4. The knowledge graph link prediction method according to claim 1, characterized in that: The entity type normalization processing and relationship type normalization processing are performed on the initial knowledge graph constructed based on the target content to obtain a normalized knowledge graph, including: Determine the initial knowledge graph built based on the target content; Determine a number of standardized entity types corresponding to the target content, and determine a standardized entity relationship between every two entity types and every two entities corresponding to each other; Classifying several initial entities representing the same content in the initial knowledge graph as the same entity, and classifying the classified target entity into a corresponding entity type; Classifying the initial entity relationship corresponding to every two target entities between every two entity types into the normalized entity relationship to determine the target entity relationship between every two target entities; The statistical classification results are used to obtain a normalized knowledge graph.

5. The knowledge graph link prediction method according to claim 4, characterized in that: The step of classifying the initial entity relationship corresponding to each two target entities between each two entity types into the normalized entity relationship to determine the target entity relationship between each two target entities includes: Determine an initial entity relationship corresponding to every two target entities between every two entity types in the initial knowledge graph; A target entity relationship in the normalized entity relationship that is most similar to the initial entity relationship is determined through a retrieval system, and the initial entity relationship is classified into the target entity relationship.

6. The knowledge graph link prediction method according to claim 5, characterized in that: After determining the target entity relationship in the normalized entity relationship that is most similar to the initial entity relationship through the retrieval system and classifying the initial entity relationship into the target entity relationship, the method further includes: Using a semantic similarity model, the initial entity relationship is encoded to obtain a first encoding function, and other initial entity relationships are encoded to obtain a second encoding function; Calculate the cosine similarity between the initial entity relationship and the other initial entity relationships based on the first encoding function and the second encoding function; The other initial entity relations whose cosine similarities satisfy a similarity condition are classified into the target entity relation.

7. The knowledge graph link prediction method according to any one of claims 1 to 6, characterized in that: The method of training the number of sample groups of computing nodes in parallel through the replica network to update the graph neural network parameters and obtain a link prediction model includes: The number of sample groups of the computing nodes are trained in parallel through the replica network to obtain the initial prediction result, and the gradient calculation is performed on each of the computing nodes to obtain the target gradient corresponding to each of the computing nodes; Performing gradient sharing among all the computing nodes and calculating an average gradient to achieve gradient fusion among the computing nodes; The initial prediction results corresponding to the sample groups of the number of nodes are processed in parallel by the graph neural network based on the average gradient to obtain the final prediction results, so as to update the graph neural network parameters and obtain the link prediction model; wherein the final prediction results of all nodes are the same.

8. The knowledge graph link prediction method according to claim 7, characterized in that: The step of training the number of sample groups of computing nodes in parallel through the replica network to obtain the initial prediction result includes: Determine a first entity relationship corresponding to the first entity type and a second entity relationship corresponding to the second entity type in each sample group; Obtaining a first primary embedding representation of the first entity type based on the first entity relationship, and obtaining a second primary embedding representation of the second entity type based on the second entity relationship; Obtaining initial prediction results corresponding to every two target entities between the first entity type and the second entity type based on the first primary embedding representation and the second primary embedding representation; Performing gradient calculation on each of the computing nodes to obtain a target gradient corresponding to each of the computing nodes; The first entity relationship is an entity relationship between the first entity type and other entity types except the second entity type; the second entity relationship is an entity relationship between the second entity type and other entity types except the first entity type.

9. A knowledge graph link prediction device, characterized in that: include: A normalization processing module is used to perform entity type normalization processing and relationship type normalization processing on the initial knowledge graph constructed based on the target content to obtain a normalized knowledge graph; A grouping processing module is used to group a number of target entity relationships corresponding to various target entities between every two entity types in the normalized knowledge graph to obtain a target number of entity relationship samples; wherein all the target entity relationships in a group of entity relationship samples correspond to the same two entity types; and the entity relationship includes a head entity, a relationship type, and a tail entity; A parallel training module is used to evenly distribute the entity relationship samples of the target number group to several computing nodes through the graph neural network to obtain sample groups of computing nodes, and to train the sample groups of computing nodes in parallel through the replica network to update the graph neural network parameters and obtain a link prediction model to realize knowledge graph link prediction; there is a replica network of the graph neural network in each computing node.

10. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the knowledge graph link prediction method as described in any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: Used to store a computer program; wherein, when the computer program is executed by a processor, the knowledge graph link prediction method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Knowledge graph link prediction method and system based on conversion hypothesis and message passing

    CN114048328A

  • Knowledge graph induction link prediction method and prediction system

    CN117332093A

  • Knowledge graph link prediction method based on heuristic information and graph neural network

    CN118036726A

Cited By

  • Knowledge graph link prediction method and related equipment

    CN121094076A