A knowledge graph link prediction method, device, equipment and medium

By normalizing the entity and relation types of the knowledge graph and training the replica network in parallel, the problem of low efficiency in large-scale knowledge graph link prediction is solved, and efficient knowledge graph link prediction is achieved.

CN119669484BActive Publication Date: 2025-11-04NAT UNIV OF DEFENSE TECH
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing technologies suffer from inefficiency in predicting links in large-scale knowledge graphs, especially in distributed computing environments. The increased communication volume and unbalanced workload due to the dependencies in the graph structure lead to reduced prediction efficiency.

Method used

By standardizing the initial knowledge graph by entity type and relation type, grouping and evenly distributing entity relation samples to computing nodes, and using graph neural networks to train replica networks in parallel, knowledge graph link prediction is achieved.

Benefits of technology

It improves the efficiency of knowledge graph link prediction, avoids the slowdown in prediction speed caused by non-standard entity and relation types, ensures balanced node load, and improves processing speed and prediction efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119669484B_ABST
    Figure CN119669484B_ABST
Patent Text Reader

Abstract

The application discloses a knowledge graph link prediction method and device, equipment and medium, and relates to the technical field of knowledge graph link prediction. The method comprises the following steps: performing entity type normalization processing and relation type normalization processing on an initial knowledge graph to obtain a normalized knowledge graph; performing grouping processing on a plurality of target entity relations corresponding to each two entity types in the normalized knowledge graph to obtain a plurality of target quantity group entity relation samples; all target entity relations in a group of entity relation samples correspond to two entity types; an entity relation comprises a head entity, a relation type and a tail entity; the target quantity group entity relation samples are evenly distributed to a plurality of computing nodes by a graph neural network to obtain a plurality of sample groups, the sample groups are trained in parallel by a replica network to update graph neural network parameters, a link prediction model is obtained, and knowledge graph link prediction is realized; and a replica network of the graph neural network exists in each computing node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of knowledge graph link prediction technology, and in particular to a knowledge graph link prediction method, apparatus, device and medium. Background Technology

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

[0003] Currently, large-scale knowledge graphs extract fact triples from literature using text mining and database integration methods. These triples take the form of (head entity, relation, tail entity), such as (compound, enhanced expression, gene). Knowledge graphs are now widely used in various fields, supporting the tracing of knowledge principles and the discovery of new knowledge. Unlike manually compiled knowledge graphs, automatically / semi-automatically generated knowledge graphs are extremely sparse and incomplete.

[0004] Graph Neural Networks (CNNs) are graph-based deep learning models that have been widely applied in many fields, including social network analysis, recommender systems, and drug screening in bioinformatics systems. CNNs can effectively learn and utilize the complex relationships between nodes in knowledge graphs, thereby achieving efficient information propagation and feature learning. However, extending GNNs to handle large-scale graph data still faces some challenges, such as the large number of nodes and the complexity of the graph structure. To overcome these challenges, distributed computing provides abundant computational resources and has become a promising solution for training large-scale GNNs. However, achieving efficient distributed GNN training still faces some technical challenges. One key issue is that the dependencies in the graph structure increase the challenge of communication volume; information exchange between entities may involve a large amount of data transmission, leading to reduced prediction efficiency. In addition, due to the special nature of graph data, the workload may be uneven, with some entities potentially bearing more computational tasks, thus reducing overall training efficiency.

[0005] In summary, improving the efficiency of knowledge graph link prediction is an urgent problem to be solved. Summary of the Invention

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

[0007] Firstly, this application discloses a knowledge graph link prediction method, including:

[0008] The initial knowledge graph constructed based on the target content is subjected to entity type normalization and relation type normalization to obtain a normalized knowledge graph;

[0009] The normalized knowledge graph is grouped into several target entity relationships corresponding to various target entities between each pair of entity types to obtain a target number of entity relationship samples; wherein, all target entity relationships in a group of entity relationship samples correspond to the same two entity types; the entity relationship includes head entity, relationship type and tail entity;

[0010] The target number of entity relationship samples are evenly distributed to several computing nodes through the graph neural network to obtain a number of computing node sample groups. The number of computing node sample groups are trained in parallel through the replica network to update the graph neural network parameters and obtain a link prediction model to achieve knowledge graph link prediction. Each computing node has a replica network of the graph neural network.

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

[0012] Specifically, the process of grouping various target entity relationships corresponding to each pair of entity types in the normalized knowledge graph to obtain a target number of entity relationship samples includes:

[0013] Determine the initial number of target entity relationships between each pair of entity types in the normalized knowledge graph, and select one of the initial numbers as a reference number according to the target rules.

[0014] Remove the initial number that is less than the reference number, and group the other initial number of target entity relationships to obtain a target number group that includes the reference number of target entity relationships as entity relationship samples.

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

[0016] Determine the initial knowledge graph to be constructed based on the target content;

[0017] Determine several normalized entity types corresponding to the target content, and determine the normalized entity relationship between each pair of entity types.

[0018] Several initial entities representing the same content in the initial knowledge graph are classified into the same entity, and the classified target entity is classified into the corresponding entity type;

[0019] The initial entity relationships between every two target entities and every two entity types are categorized into the normalized entity relationships to determine the target entity relationships between every two target entities.

[0020] The statistical classification results yielded a standardized knowledge graph.

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

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

[0023] The retrieval system identifies the target entity relationship that is most similar to the initial entity relationship among the normalized entity relationships, and classifies the initial entity relationship into the target entity relationship.

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

[0025] The initial entity relationships are encoded using a semantic similarity model 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 relationships whose cosine similarity satisfies the similarity condition are classified into the target entity relationship.

[0028] The step 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 the link prediction model includes:

[0029] The number of sample groups of computing nodes are trained in parallel by the replica network to obtain the initial prediction result, and the gradient is calculated for each computing node to obtain the target gradient corresponding to each computing node.

[0030] Gradient sharing is performed among all the computing nodes, and the average gradient is calculated to achieve gradient fusion among the computing nodes;

[0031] The graph neural network processes the initial prediction results corresponding to the number of sample groups of nodes in parallel based on the average gradient to obtain the final prediction results, thereby updating the graph neural network parameters and obtaining a linked prediction model; wherein the final prediction results of all nodes are the same.

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

[0033] The replica network is used to determine the first entity relationship corresponding to the first entity type and the second entity relationship corresponding to the second entity type in the number of sample groups of the number of computing nodes trained.

[0034] Based on the first entity relationship, a first primary embedding representation of the first entity type is obtained; based on the second entity relationship, a second primary embedding representation of the second entity type is obtained.

[0035] Based on the first primary embedding representation and the second primary embedding representation, the initial prediction results corresponding to every two target entities between the first entity type and the second entity type are obtained through training;

[0036] Wherein, the first entity relationship is the entity relationship between the first entity type and other entity types excluding the second entity type; the second entity relationship is the entity relationship between the second entity type and other entity types excluding the first entity type.

[0037] Secondly, this application discloses a knowledge graph link prediction device, comprising:

[0038] The normalization module is used to perform entity type normalization and relation type normalization on the initial knowledge graph built based on the target content to obtain a normalized knowledge graph;

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

[0040] The parallel training module is used to distribute the target number of entity relationship samples evenly to several computing nodes through the graph neural network to obtain a number of computing node sample groups. The number of computing node sample groups 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. Each computing node has a replica network of the graph neural network.

[0041] Thirdly, this application discloses an electronic device, including:

[0042] Memory, used to store computer programs;

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

[0044] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned knowledge graph link prediction method.

[0045] As can be seen, this application performs entity type normalization and relation type normalization on the initial knowledge graph constructed based on the target content to obtain a normalized knowledge graph; it groups several target entity relations corresponding to various target entities between each two entity types in the normalized knowledge graph to obtain a target number of entity relation samples; wherein, all target entity relations in a group of entity relation samples correspond to the same two entity types; the entity relations include head entity, relation type, and tail entity; the target number of entity relation samples are evenly distributed to several computing nodes through the graph neural network to obtain a number of computing node sample groups, and the number of computing node sample groups 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; each computing node has a replica network of the graph neural network. Therefore, this application standardizes the initial knowledge graph to avoid the reduction in subsequent prediction speed caused by non-standard entity and relation types, thus improving efficiency. Before training, this application completes grouping and distribution, and directly performs knowledge graph link prediction based on sample groups, eliminating the need for data transmission between entities during prediction, thereby improving speed and prediction efficiency. Before training, this application completes grouping and distribution, evenly distributing the target number of entity relation samples to several computing nodes to obtain a number of computing node sample groups, ensuring that the number of target entity relations in different sample groups is the same, resulting in balanced load on each node and improving prediction efficiency. This application processes each sample group in parallel, increasing processing speed and further improving prediction efficiency. Attached Figure Description

[0046] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0047] Figure 1 This is a flowchart of a knowledge graph link prediction method disclosed in this application;

[0048] Figure 2 This is a schematic diagram of a specific standardized process disclosed in this application;

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

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

[0051] Figure 5 This is a schematic diagram of a specific knowledge graph standardization process disclosed in this application;

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

[0053] Figure 7 This is a schematic diagram illustrating the initial prediction of a portion of a knowledge graph disclosed in this application.

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

[0055] Figure 9 This is a schematic diagram of an initial knowledge graph disclosed in this application;

[0056] Figure 10 This is a schematic diagram of a sub-diagram disclosed in this application;

[0057] Figure 11 This is a schematic diagram of the structure of a knowledge graph link prediction device disclosed in this application;

[0058] Figure 12 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation

[0059] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0060] Currently, large-scale knowledge graphs extract fact triples from literature using text mining and database integration methods. These triples take the form of (head entity, relation, tail entity), such as (compound, enhanced expression, gene). Knowledge graphs are now widely used in various fields, supporting the tracing of knowledge principles and the discovery of new knowledge. 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 applied in many fields, including social network analysis, recommender systems, and drug screening in bioinformatics systems. GNNs can effectively learn and utilize the complex relationships between nodes in a knowledge graph, thereby achieving efficient information propagation and feature learning. However, extending GNNs to handle large-scale graph data still faces challenges, such as the large number of nodes and the complexity of the graph structure. To overcome these challenges, distributed computing provides abundant computational resources and has become a promising solution for training large-scale GNNs. However, achieving efficient distributed GNN training still faces some technical challenges. One key issue is that the dependencies in the graph structure increase the challenge of communication volume; information exchange between entities may involve a large amount of data transmission, leading to reduced prediction efficiency. Furthermore, due to the special nature of graph data, the workload may be uneven, with some entities potentially bearing more computational tasks, thus reducing overall training efficiency.

[0062] Therefore, this application proposes a knowledge graph link prediction scheme that can improve the efficiency of knowledge graph link prediction.

[0063] This application discloses a knowledge graph link prediction method. See also Figure 1 As shown, the method includes:

[0064] Step S11: Perform entity type normalization and relation 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 can be content from fields such as social network analysis, recommendation systems, and drug screening in bioinformatics systems.

[0066] In this embodiment, the initial knowledge graph construction requires the construction of triples, S=(E;R;F), which is the set of triples constituting the knowledge graph, where E is the set of entity names, R is the set of relation descriptions, and F is the set of facts. .here, and These are the head entity and tail entity in the three elements of fact. Let them be... The entity type to which the entity belongs, i.e., the total number of entities in the knowledge graph. Class entities. Each entity and relation description It is a labeled sequence, represented as ,in and They are and The sequence length in the query pair. Link prediction tasks aim to infer relationships in missing facts. , or given a query pair ( ), to infer tail entities in missing facts .

[0067] In this embodiment, the entity type normalization process includes grouping different entity type representations of the same content into one category, and the relation type normalization process includes grouping different relation type representations of the same content into one category.

[0068] See Figure 2The diagram illustrates a specific standardization process. In the diagram, a represents the initial knowledge graph before standardization, c represents the standardized knowledge graph, and nodes within the same ellipse in b are nodes that need to be merged. After merging these nodes into a single node, the relationships between the nodes are standardized, resulting in c. It should be noted 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 diminazene, DIZE is an abbreviation for diminazene aceturate, acetaminophen is acetaminophen, angiotensin-converting enzyme 2 is angiotensin-converting enzyme 2, and ACE2 is an abbreviation for angiotensin-converting enzyme 2. The figure combines Cav-1 and Cisplatin, DIZE and diminazene aceturate, and ACE2 and angiotensin converting enzyme 2 into one, denoted as Cisplatin, diminazene aceturate, and ACE2 respectively. The relationship types are also categorized and normalized. "Singletonically downregulated" indicates significant downregulation, "increased" indicates increased activity, "decreased activity" indicates decreased activity, "result in decreased expression" indicates significantly decreased expression, "remarkably increased the expression" indicates a significant increase, "increased expression" indicates enhanced expression, "decreased expression" indicates decreased expression, and "counteracted" indicates offsetting.

[0069] Step S12: Group the various target entity relationships between each pair of entity types in the normalized knowledge graph to obtain a target number of entity relationship samples; wherein, all target entity relationships in a group of entity relationship samples correspond to the same two entity types; entity relationships include head entity, relationship type and tail entity.

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

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

[0072] In this embodiment, the step of grouping several target entity relationships corresponding to various target entities between each two entity types in the normalized knowledge graph to obtain a target number of entity relationship samples includes: determining the initial number of target entity relationships corresponding to various target entities between each two entity types in the normalized knowledge graph, and selecting one of the initial numbers as a reference number according to the target rules; removing the initial number smaller than the reference number, and grouping the other initial numbers of target entity relationships to obtain a target number of entity relationship samples including the reference number of target entity relationships.

[0073] It should be noted that the selected reference number can be a value that is closest to the preset number, or it can be selected in other ways, without being specifically limited here; in addition, when the target entity relationships of other initial numbers are grouped, if the number remaining after grouping is less than the reference number, the remaining target entity relationships will be removed.

[0074] In one specific embodiment, the numbers of relations contained in each relation type are arranged from smallest to largest as follows: , where the relation type Number of relations ,Right now < ... Let the batch size be... ,like ,exist Randomly selected If one relationship is established, other relationships are discarded, and so on. If Then Divided into There are m-1 batches, with the first m-1 batches having a size of m-1. ,the remaining throw away, The processing method is the same, where i and j represent entities.

[0075] Step S13: The target number of entity relationship samples are evenly distributed to several computing nodes through the graph neural network to obtain a number of computing node sample groups. The number of computing node sample groups 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. Each computing node has a replica network of the graph neural network.

[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, thereby maintaining balance among multiple nodes during training. 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, thus ensuring that the number of target entity relationships in different sample groups is the same. Of course, it can also include the case 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 is important to note that coordination and synchronization between nodes are crucial in distributed training. When distributing the training load across different nodes, it is necessary to ensure that the overall workload allocated to each node is roughly balanced to avoid some nodes being overloaded or idle, thereby improving training efficiency and resource utilization.

[0078] See details Figure 3 The diagram shown illustrates a grouping and distribution process (distributed training process), with two entity types. and In the diagram, there are a total of 9 relation types. The relation type with the fewest relations is too few to be counted and is therefore ignored. The relation type with the second fewest relations is used as the reference number, and the other relation types are grouped based on the reference number. During the grouping process, if the number of target entity relations in the last group of each relation type is less than the reference number, it is removed and does not participate in the subsequent process. Therefore, there are 8 types remaining. There are 4 parallel nodes (Node1, Node2, Node3, Node4) in the diagram. The content of the 8 relation types is evenly distributed among the 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's important to note 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. Gradient fusion is achieved in each pass by sharing and averaging gradients across all nodes. Specifically, the step of each node independently calculating gradients ensures that each node can participate in the training process and contribute to the computational results. In this way, each node not only retains its own computational power but also leverages information from other nodes, thereby improving overall training efficiency and accuracy. Ultimately, through this sharing and fusion mechanism, the model results on each node are identical. Because each node starts with the same copy, and through gradient fusion, the weight updates on all nodes are consistent, ensuring the consistency and collaboration of the model throughout the distributed system. The specific implementation process is as follows: The code parses command-line arguments using the argparse library. These arguments include whether to use a GPU, the GPU device number, the number of nodes (world_size), the node ID (node_id), and the local rank (local_rank), all of which are necessary 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. Configure different distributed backends (gloo or nccl) depending on the system. ② Process Group Initialization: On each GPU, launch multiple worker processes using the torch.multiprocessing.spawn function. Each process executes a worker function. Within the worker function, the global rank (process ID) is calculated based on the current process's local_rank (i.e., node ID) and the global node_id. The distributed process group is initialized using the torch.distributed.init_process_group function, allowing communication between different processes. ③ Model and Data Parallelism: Wrap the model with torch.nn.parallel.DistributedDataParallel to achieve data parallelism. This way, each GPU processes a subset of the data and aggregates gradients through the AllReduce operation. ④ Training Process: During the training loop, each process processes its assigned batch of data. The model performs forward propagation to compute predictions, calculates the loss, and performs backpropagation to update the weights. Because DistributedDataParallel is used, gradients are automatically synchronized across GPUs. ⑤ Validation and Model Saving: At the end of each epoch, the code performs a validation process to evaluate the model's performance. Based on the validation results, you can choose to save the model parameters for the current epoch, or save the best model when validation metrics improve.

[0080] As can be seen, this application performs entity type normalization and relation type normalization on the initial knowledge graph constructed based on the target content to obtain a normalized knowledge graph; it groups several target entity relations corresponding to various target entities between each two entity types in the normalized knowledge graph to obtain a target number of entity relation samples; wherein, all target entity relations in a group of entity relation samples correspond to the same two entity types; the entity relations include head entity, relation type, and tail entity; the target number of entity relation samples are evenly distributed to several computing nodes through the graph neural network to obtain a number of computing node sample groups, and the number of computing node sample groups 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; each computing node has a replica network of the graph neural network. Therefore, this application standardizes the initial knowledge graph to avoid the reduction in subsequent prediction speed caused by non-standard entity and relation types, thus improving efficiency. Before training, this application completes grouping and distribution, and directly performs knowledge graph link prediction based on sample groups, eliminating the need for data transmission between entities during prediction, thereby improving speed and prediction efficiency. Before training, this application completes grouping and distribution, evenly distributing the target number of entity relation samples to several computing nodes to obtain a number of computing node sample groups, ensuring that the number of target entity relations in different sample groups is the same, resulting in balanced load on each node and improving prediction efficiency. This application processes each sample group in parallel, increasing processing speed and further improving prediction efficiency.

[0081] This application discloses a specific method for predicting knowledge graph links. Compared to the previous embodiment, this embodiment further explains and optimizes the technical solution. See also... Figure 4 As shown, it specifically includes:

[0082] Step S21: Determine the initial knowledge graph constructed based on the target content; determine several normalized entity types corresponding to the target content, and determine the normalized entity relationship between each pair of entity types.

[0083] In one specific embodiment, Stanford NER (for personal names, company names, gene names, or protein names, etc.) and PubChem interface (for compounds, drugs, etc.) are integrated for classification and standardization. Entities are categorized into multiple types. .

[0084] Step S22: Classify several initial entities representing the same content in the initial knowledge graph into the same entity, and classify the target entity after classification 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 the entity corresponding to that content, and the entity type corresponding to that entity is determined.

[0086] Step S23: Classify the initial entity relationships between each pair of target entities for each of the two entity types into the normalized entity relationships to determine the target entity relationships between each pair of target entities.

[0087] In this embodiment, classifying the initial entity relationship between each pair of target entities and each pair of entity types into the normalized entity relationship to determine the target entity relationship between each pair of target entities includes: determining the initial entity relationship between each pair of target entities and each pair of entity types in the initial knowledge graph; determining the target entity relationship most similar to the initial entity relationship in the normalized 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 most similar to the initial entity relationship among the normalized entity relationships through the retrieval system and classifying the initial entity relationship into the target entity relationship, the method further 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 satisfies the similarity condition into the target entity relationship.

[0089] It should be noted that relying solely on the retrieval system may result in retrieval errors; therefore, the application of semantic similarity models can improve accuracy.

[0090] In one specific embodiment, for entity type and entity type , { ∈ Given a set of relations , then entity type With entity type Relationship Class. Input Relationship ,Will input sequence Construct its text form The connection with the two introduced markers "[ENT1] ([EN1])" and "[ENT2] ([EN2])" is... Given that pre-trained language models excel at capturing text semantics, a pre-trained SBERT (semantic similarity model) is used for each relation. Encoding is performed to obtain its dense sentence representation, which is represented as a function. Then a retrieval system Will and Match all other relations in the list and return the most similar relation. As its normalization relation:

[0091] ;

[0092] in yes Normalized relation set, It is a hyperparameter. and ∈ of and semantic similarity The cosine similarity is calculated for its sentence representation:

[0093] ;

[0094] for The input sequence; SBERT stands for semantic similarity model.

[0095] Ultimately, body type and entity type Relationship type normalization in Within the range.

[0096] Step S24: Statistical classification results yield a standardized knowledge graph.

[0097] In one specific embodiment, see Figure 5 The diagram shown illustrates a specific knowledge graph standardization process; regarding drug screening in bioinformatics systems, there are... and Two entity types, This corresponds to the PubChem type. PubChem stands for Organic Small Molecule Bioactivity Data, which is a database of chemical modules (compounds in this example). The same content is expressed in many different languages. In the image, the three expressions can all be categorized as follows: All three expressions (including DIZE and diminazene aceturate) can be categorized as Both expressions can be categorized as The middle part is omitted, and the last three expressions can all be classified as: m represents The number of entity types in the middle, for example, DIZE is an abbreviation for diminazene aceturate, meaning the same thing. This corresponds to the type of Stanford NER (gene in this example). The same content is expressed in many different languages. In the image, the three expressions can all be categorized as follows: Both expressions (ACE2 and angiotensin converting enzyme 2) can be categorized as All three expressions can be categorized as The middle part is omitted, and the last three expressions can all be classified as: n represents The number of entity types, for example, ACE2 is an abbreviation for angiotensin-converting enzyme 2, indicating the same content. Furthermore, the entity type normalization process is as follows: Assume, Includes three entities, Includes two entities, Includes three entities, Includes two entities, Includes three types of entities, omitted intermediate content, and the final... Includes three types of entities (e.g., Including diacetamide triazine and two other compounds, Including one other gene), Z indicates that this embodiment includes Z entity types; finally, the relationship between entities in each pair of entity types is determined based on the normalized entity types, i.e., as shown in the figure. to The content will eventually lead to a new knowledge graph.

[0098] See details Figure 2 The image shown is a schematic diagram of a normalized result. First... Figure 2 In graph a, which is not a normalized knowledge graph, and in graph b, the content within an ellipse represents the same content, so they need to be merged to finally obtain the graph in graph c.

[0099] As can be seen, this application determines an initial knowledge graph constructed based on the target content; identifies several standardized entity types corresponding to the target content, and determines the standardized entity relationships between each pair of entity types; categorizes several initial entities representing the same content in the initial knowledge graph into the same entity, and then categorizes the categorized target entities into their corresponding entity types; categorizes the initial entity relationships between each pair of target entities into the standardized entity relationships to determine the target entity relationships between each pair of target entities; and statistically analyzes the categorization results to obtain a standardized knowledge graph. Therefore, this application specifically discloses a method for knowledge graph standardization, which can avoid the situation where non-standard entity types and relationship types reduce the subsequent prediction speed, thus improving efficiency.

[0100] This application discloses a specific method for predicting knowledge graph links. Compared to the previous embodiment, this embodiment further explains and optimizes the technical solution. See also... Figure 6 As shown, it specifically includes:

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

[0102] In this embodiment, the step of obtaining the initial prediction result by training the number of computing nodes in parallel with the replica network to obtain a number of sample groups includes: determining, through the replica network, a first entity relationship corresponding to a first entity type and a second entity relationship corresponding to a second entity type in the number of sample groups trained on the number of computing nodes; 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 the initial prediction result for 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; wherein, the first entity relationship is the entity relationship between the first entity type and other entity types excluding the second entity type; and the second entity relationship is the entity relationship between the second entity type and other entity types excluding the first entity type.

[0103] In one specific embodiment, the description focuses on two entity types, specifically addressing... and To learn about the two types of entity relationships, we will first learn them separately. With and Relationships between entities of other types besides the main type; the primary embedding of nodes in the relation subgraph is learned; first, determine... Corresponding division and The first relation subgraph (corresponding to the first entity relation) is determined. Corresponding division and The second relation subgraph (corresponding to the second entity relation) of the relationship between them is assumed in the first relation subgraph. The node embedding of the entity class aggregates -SubGraph、 -SubGraph、 -SubGraph and Neighbor information in the subgraph, such as the subgraph of the subgraph, and the assumption in the second relation subgraph. The node embedding of entity classes is aggregated. -SubGraph、 -SubGraph、 -SubGraph and Neighbor node information in the SubGraph. Initialization using primary embeddings. and The nodes in the relational subgraph are represented, and further high-level embedding representations of the nodes are learned for prediction.

[0104] Specifically, each individual node can be queried by multiplying the entity matrix by a one-hot vector. The corresponding node can be simplified and represented using a one-hot vector, denoted as . CCN processing consists of two steps (initial embedding and high-level embedding), each executed by a k-layer graph convolutional network. The encoding and updating of the initial embedding information is performed according to the following first equation:

[0105] ;

[0106] in, It is aggregation from its The information of the neighboring nodes of the node. When the number of graph convolutional layers reaches a predefined depth. At that time, and Initial embedding of two types of entities.

[0107] in, It belongs to a set of real vectors of dimension d. σ is a non-linear activation function. Indicates a connection relationship of The set of adjacent nodes, Indicates a connection relationship of The set of adjacent nodes. Represents a relation of type The learnable parameter matrix. and It is a normalization constant. Obtain the embedding of each hidden layer and output node ( , The hidden state of ) They are then embedded into the relationship subgraph of the entities of interest. The high-level embedding is specifically illustrated in the following second equation:

[0108] ;

[0109] same, ,and Indicates the first The number of neurons in the hidden layer. express - Types of interaction relationships.

[0110] at last ,when and Used as a multi-type subgraph for learning and The high-level node embedding. It should be noted that i and j represent... and The specific entities in it.

[0111] See Figure 7 and Figure 8 As shown, Figure 7 and Figure 8 A schematic diagram illustrating the initial prediction of a knowledge graph; Figure 7 This is a schematic diagram of the initial prediction of a portion of a knowledge graph. Figure 8 This is a schematic diagram illustrating the initial prediction of another part of a knowledge graph; among which, Figure 8 The steps are as follows Figure 7 The next step in the process; the initial prediction diagram of the knowledge graph, also known as the node embedding process diagram, includes the learning described above. and The two node embedding processes, Figure 7 The first graph in the neutron graph partitioning is the first relation subgraph, the second graph is the second relation subgraph, and the initial node embedding is subsequently completed based on the first equation. The process of initial node embedding also specifically shows the meanings of i and j, which correspond to... Figure 4 Entity annotations in (e.g.) , (This will not be discussed in detail here.) Finally Figure 8 The second equation is used to complete the high-level node embedding. It should be noted that... Figure 8 middle, ( ) represents the relationship between new nodes. Figure 7In the original text, the initial knowledge graph and its subgraphs were not clearly defined, therefore additional steps were taken. Figure 9 and Figure 10 , Figure 9 This is a schematic diagram of an initial knowledge graph; Figure 10 This is a schematic diagram of a sub-diagram; Figure 9 and Figure 10 In this context, 'r' 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 must be completed for each sample group.

[0113] Step S32: Perform gradient sharing among all the computing nodes and calculate the average gradient to achieve gradient fusion among the computing nodes.

[0114] Step S33: The graph neural network processes the initial prediction results corresponding to the number of sample groups of nodes in parallel based on the average gradient to obtain the final prediction results, thereby updating the graph neural network parameters and obtaining the linked prediction model; wherein the final prediction results of all nodes are the same.

[0115] In this embodiment, after the training and prediction process is completed in each sample group, the prediction results are shared between different sample groups so that all prediction results are summed to obtain the final prediction result.

[0116] In this embodiment, the DEDICOM-based bilinear tensor decomposition model RESCA utilizes matrix operations to represent data interactions between entities and relations, thereby enabling a deeper understanding of underlying information. Predictive results are obtained by relaxing some overly strict constraints. The encoder learns node embeddings. and The columns are assigned weights. This represents the interaction type matrix. The calculation formula is shown below:

[0117] ;

[0118] As can be seen, this application obtains an initial prediction result by training the number of sample groups of computing nodes in parallel through the replica network, and calculates the gradient for each computing node to obtain the target gradient corresponding to each computing node; gradient sharing is performed among all computing nodes, and the average gradient is calculated to achieve gradient fusion among the computing nodes; the initial prediction result corresponding to the number of sample groups of nodes is processed in parallel by a graph neural network based on the average gradient to obtain the final prediction result, so as to update the graph neural network parameters and obtain a linked prediction model; wherein, the final prediction result of all nodes is the same. Therefore, this application discloses the specific process of using a graph neural network to complete prediction.

[0119] Accordingly, embodiments of this application also disclose a knowledge graph link prediction device, see [link to relevant documentation]. Figure 11 As shown, the device includes:

[0120] The normalization processing module 11 is used to perform entity type normalization and relation type normalization 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 several target entity relationships corresponding to various target entities between each two entity types in the normalized knowledge graph to obtain a target number of entity relationship samples; wherein, all target entity relationships in a group of entity relationship samples correspond to the same two entity types; the entity relationship includes head entity, relationship type and tail entity;

[0122] The parallel training module 13 is used to distribute the target number of entity relationship samples evenly to several computing nodes through the graph neural network to obtain a number of computing node sample groups, and to train the number of computing node sample groups 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; each computing node has a replica network of the graph neural network.

[0123] The more specific working process of each of the above modules can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.

[0124] As can be seen, this application performs entity type normalization and relation type normalization on the initial knowledge graph constructed based on the target content to obtain a normalized knowledge graph; it groups several target entity relations corresponding to various target entities between each two entity types in the normalized knowledge graph to obtain a target number of entity relation samples; wherein, all target entity relations in a group of entity relation samples correspond to the same two entity types; the entity relations include head entity, relation type, and tail entity; the target number of entity relation samples are evenly distributed to several computing nodes through the graph neural network to obtain a number of computing node sample groups, and the number of computing node sample groups 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; each computing node has a replica network of the graph neural network. Therefore, this application standardizes the initial knowledge graph to avoid the reduction in subsequent prediction speed caused by non-standard entity and relation types, thus improving efficiency. Before training, this application completes grouping and distribution, and directly performs knowledge graph link prediction based on sample groups, eliminating the need for data transmission between entities during prediction, thereby improving speed and prediction efficiency. Before training, this application completes grouping and distribution, evenly distributing the target number of entity relation samples to several computing nodes to obtain a number of computing node sample groups, ensuring that the number of target entity relations in different sample groups is the same, resulting in balanced load on each node and improving prediction efficiency. This application processes each sample group in parallel, increasing processing speed and further improving prediction efficiency.

[0125] Furthermore, embodiments of this application also provide an electronic device. Figure 12 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.

[0126] Figure 11 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a display screen 23, an input / output interface 24, a communication interface 25, a power supply 26, and a communication bus 27. The memory 22 stores 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 foregoing embodiments. Alternatively, 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 operating 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 external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 24 is used to acquire 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] Furthermore, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk, or optical disk, etc. The resources stored thereon may include computer programs 221, and the storage method may be temporary storage or permanent storage. The computer programs 221 may include, in addition to computer programs capable of performing the knowledge graph link prediction method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, computer programs capable of performing other specific tasks.

[0129] Furthermore, embodiments of this application also disclose a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned knowledge graph link prediction method.

[0130] The specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.

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

[0132] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0133] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0134] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0135] The above provides a detailed description of a knowledge graph link prediction method, apparatus, device, and storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A knowledge graph link prediction method, characterized in that, include: The initial knowledge graph constructed based on the target content is subjected to entity type normalization and relation type normalization to obtain a normalized knowledge graph; The normalized knowledge graph is grouped into several target entity relationships corresponding to various target entities between each pair of entity types to obtain a target number of entity relationship samples; wherein, all target entity relationships in a group of entity relationship samples correspond to the same two entity types; the entity relationship includes head entity, relationship type and tail entity; The target number of entity relationship samples are evenly distributed to several computing nodes using a graph neural network to obtain a number of sample groups for each computing node. The number of sample groups for each computing node is then trained in parallel using a replica network to update the number of sample groups for each computing node, thereby obtaining a link prediction model to achieve knowledge graph link prediction. Each computing node contains a replica network of the graph neural network. The step of training the number of computing nodes and sample groups in parallel through a replica network to update the graph neural network parameters and obtain a link prediction model includes: The number of sample groups of computing nodes are trained in parallel by the replica network to obtain the initial prediction result, and the gradient is calculated for each computing node to obtain the target gradient corresponding to each computing node. Gradient sharing is performed among all the computing nodes, and the average gradient is calculated to achieve gradient fusion among the computing nodes; The graph neural network processes the initial prediction results corresponding to the number of sample groups of nodes in parallel based on the average gradient to obtain the final prediction results, thereby updating the graph neural network parameters and obtaining a linked prediction model; wherein the final prediction results of all nodes are the same.

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

3. The knowledge graph link prediction method according to claim 2, characterized in that, The process of grouping various target entity relationships corresponding to each pair of entity types in the normalized knowledge graph to obtain a target number of entity relationship samples includes: Determine the initial number of target entity relationships between each pair of entity types in the normalized knowledge graph, and select one of the initial numbers as a reference number according to the target rules. Remove the initial number that is less than the reference number, and group the other initial number of target entity relationships to obtain a target number group that includes the reference number of target entity relationships as entity relationship samples.

4. The knowledge graph link prediction method according to claim 1, characterized in that, The process of performing entity type normalization and relation type normalization on the initial knowledge graph constructed based on the target content to obtain a normalized knowledge graph includes: Determine the initial knowledge graph to be constructed based on the target content; Determine several normalized entity types corresponding to the target content, and determine the normalized entity relationship between each pair of entity types. Several initial entities representing the same content in the initial knowledge graph are classified into the same entity, and the classified target entity is classified into the corresponding entity type; The initial entity relationship between each pair of target entities is classified into the normalized entity relationship to determine the target entity relationship between each pair of target entities. The statistical classification results yielded a standardized knowledge graph.

5. The knowledge graph link prediction method according to claim 4, characterized in that, The step of classifying the initial entity relationships corresponding to every two target entities between every two entity types into the normalized entity relationships, in order to determine the target entity relationships between every two target entities, includes: Determine the initial entity relationship between every two target entities and every two entity types in the initial knowledge graph; The retrieval system identifies the target entity relationship that is most similar to the initial entity relationship among the normalized entity relationships, and classifies the initial entity relationship 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 most similar to the initial entity relationship among the normalized entity relationships through the retrieval system, and classifying the initial entity relationship into the target entity relationship, the process further includes: The initial entity relationships are encoded using a semantic similarity model 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 relationships whose cosine similarity satisfies the similarity condition are classified into the target entity relationship.

7. The knowledge graph link prediction method according to claim 1, characterized in that, The process of obtaining the initial prediction result by training the number of computing nodes and sample groups in parallel through the replica network includes: Determine the first entity relation corresponding to the first entity type and the second entity relation corresponding to the second entity type in each sample group; Based on the first entity relationship, a first primary embedding representation of the first entity type is obtained; based on the second entity relationship, a second primary embedding representation of the second entity type is obtained. Based on the first primary embedding representation and the second primary embedding representation, the initial prediction results corresponding to every two target entities between the first entity type and the second entity type are obtained through training; Gradient calculation is performed on each computing node to obtain the target gradient corresponding to each computing node; Wherein, the first entity relationship is the entity relationship between the first entity type and other entity types excluding the second entity type; the second entity relationship is the entity relationship between the second entity type and other entity types excluding the first entity type.

8. A knowledge graph link prediction device, characterized in that, include: The normalization module is used to perform entity type normalization and relation type normalization on the initial knowledge graph built based on the target content to obtain a normalized knowledge graph; The grouping processing module is used to group several target entity relationships corresponding to various target entities between each pair of entity types in the normalized knowledge graph to obtain a target number of entity relationship samples; wherein, all target entity relationships in a group of entity relationship samples correspond to the same two entity types; the entity relationship includes head entity, relationship type and tail entity; The parallel training module is used to distribute the target number of entity relationship samples evenly to several computing nodes through a graph neural network to obtain a number of sample groups for each computing node. The number of sample groups for each computing node is trained in parallel through a replica network to update the parameters of the graph neural network and obtain a link prediction model to achieve knowledge graph link prediction. Each computing node has a replica network of the graph neural network. Specifically, the parallel training module is used to train the number of sample groups of computing nodes in parallel through the replica network to obtain the initial prediction result, and to perform gradient calculation on each computing node to obtain the target gradient corresponding to each computing node. Gradient sharing is performed among all the computing nodes, and the average gradient is calculated to achieve gradient fusion among the computing nodes; The graph neural network processes the initial prediction results corresponding to the number of sample groups of nodes in parallel based on the average gradient to obtain the final prediction results, thereby updating the graph neural network parameters and obtaining a linked prediction model; wherein the final prediction results of all nodes are the same.

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

10. A computer-readable storage medium, characterized in that, Used to store a computer program; wherein, when the computer program is executed by a processor, it implements the knowledge graph link prediction method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

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

    CN114048328A

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

    CN118036726A