A knowledge graph entity completion method combining entity categories and relationship representations

By combining entity categories and triple semantic relationships, the entity embedding features are updated and multi-head self-attention mechanism training is carried out, the problem of insufficient entity information in knowledge graph entity completion is solved, and the accuracy and representation ability of completion are improved.

CN119005320BActive Publication Date: 2025-02-28KUNMING UNIV OF SCI & TECH +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411470792.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-02-28
Estimated Expiration
2044-10-21

AI Technical Summary

Technical Problem

The prior art mainly focuses on the entity information in the triple in the knowledge graph entity completion, and fails to make full use of entity category information and the potential semantic relationships in the triple, resulting in insufficient completion accuracy.

Method used

A knowledge graph entity completion method for joint entity categories and relationship representations is proposed. By obtaining entity category data and triple data, calculating entity association strength, selecting the target category transfer matrix, updating entity embedding features, and using the multi-head self-attention mechanism for training to determine candidate entity labels.

Benefits of technology

By integrating entity categories and semantic relationships, we can enhance the representation ability of entity embedding features, improve the accuracy of knowledge graph entity completion, and better understand the characteristic properties of entities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119005320B_ABST
    Figure CN119005320B_ABST
Patent Text Reader

Abstract

The present application relates to the field of knowledge graph technology, and in particular to a knowledge graph entity completion method that combines entity categories and relationship representations. Through entity category transfer matrices and relationship combinations, entity categories and semantic relationships in triples are integrated into the embedded features of entities to enhance representation capabilities; in addition, by comprehensively considering the impact of entity categories and semantic relationships on knowledge graph entity completion, the model can better understand the characteristic attributes of entities, thereby improving the accuracy of knowledge graph entity completion. It aims to solve the problem of how to use entity category information and potential semantic relationships in triples to guide the completion of knowledge graph entities.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of knowledge graph technology, and in particular to a knowledge graph entity completion method that combines entity categories and relationship representations. Background Art

[0002] In recent years, knowledge graphs have been widely used in natural language processing, information retrieval, question-answering systems, recommendation systems and other fields, and have received widespread attention from academia and industry. Knowledge graphs are a semantic-based graph database that usually describes corresponding factual information in the form of a triple consisting of a head entity, a relationship, and a tail entity. They are represented and stored in a directed graph structure, where nodes consist of entities and edges consist of the corresponding relationships between a pair of entities.

[0003] In the early stage of knowledge graph construction, due to factors such as incomplete information extraction and dynamic changes in entity relationships, the constructed knowledge graph is prone to missing a large amount of entity information, resulting in incomplete knowledge graphs and limiting the application of knowledge graphs in downstream tasks. Therefore, the research on knowledge graph entity completion is of great significance to improving the integrity of knowledge graphs and extending the scope of application of knowledge graphs.

[0004] In the related technical solutions, the commonly used methods for studying knowledge graph entity completion currently focus on the entity information itself in the triples. However, in the process of conceiving and implementing this application, the inventors found that the entity category information and potential semantic relationship representation in the triples (such as the different roles represented by the head entity and the tail entity in the triples) can provide rich auxiliary information for entity completion, and can improve the accuracy of prediction even when the entity-related information is insufficient. Therefore, there is a need for a knowledge graph entity completion method that combines entity category and relationship representation, which uses entity category information and potential semantic relationships in triples to allow the knowledge graph model to learn richer entity embedding features, thereby guiding the completion of knowledge graph entities.

[0005] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0006] The main purpose of this application is to provide a knowledge graph entity completion method that combines entity categories and relationship representations, aiming to solve the problem of how to use entity category information and potential semantic relationships in triples to guide the completion of knowledge graph entities.

[0007] To achieve the above objectives, the present application provides a knowledge graph entity completion method that combines entity categories and relationship representations, the method comprising:

[0008] Obtain entity category data corresponding to the entity from the knowledge graph entity category data set, and obtain existing triple data from the knowledge graph triple data set to be completed, wherein the triple data includes a head entity, a relationship, and a tail entity;

[0009] Determine the occurrence frequency of the entity category data in the triple data, and determine the association strength of each entity in the triple data according to the occurrence frequency;

[0010] Based on the association strength, selecting a target head entity category transfer matrix associated with a head entity with the maximum association strength in the triple data, and a target tail entity category transfer matrix associated with a tail entity with the maximum association strength;

[0011] Updating the head entity embedding features in the triple data based on the target head entity category transfer matrix, and updating the tail entity embedding features in the triple data based on the target tail entity category transfer matrix;

[0012] Based on the updated entity embedding feature and the updated tail entity embedding feature, updating the triple data to obtain an updated triple embedding feature;

[0013] The updated triplet embedding feature is used as input to an encoding module built based on a multi-head self-attention mechanism for training, and the candidate entity label with the highest score in the encoding module is determined as the entity completion result of the knowledge graph.

[0014] Optionally, the step of selecting, based on the association strength, a target head entity category transfer matrix associated with a head entity with the maximum association strength in the triple data and a target tail entity category transfer matrix associated with a tail entity with the maximum association strength comprises:

[0015] Determine a category set corresponding to a head entity in the triple data and a category set corresponding to a relationship, and determine a category set corresponding to a tail entity in the triple data and a category set corresponding to a relationship;

[0016] The category set corresponding to the head entity and the head entity category set corresponding to the relationship form a first intersection, the entity category with the maximum association strength in the first intersection is selected as the target head entity, and the head entity category transfer matrix corresponding to the target head entity is used as the target head entity category transfer matrix; and

[0017] The category set corresponding to the tail entity and the tail entity category set corresponding to the relationship constitute a second intersection, the entity category with the maximum association strength in the second intersection is selected as the target tail entity, and the tail entity category transfer matrix corresponding to the target tail entity is used as the target tail entity category transfer matrix.

[0018] Optionally, if the maximum association strength in the first intersection or the second intersection is associated with multiple entity categories, any one of the multiple entity categories associated with the maximum association strength is randomly selected as the target entity category.

[0019] Optionally, the calculation expression of the updated triple embedding feature includes:

[0020]

[0021] Where X represents the updated triple embedding feature; represents the weight coefficient; Represents the updated embedding features of the head entity; represents the updated embedding feature of the tail entity; Represents relation embedding features.

[0022] Optionally, in the encoding module constructed based on the multi-head self-attention mechanism, the step of scoring the candidate entity tags includes:

[0023] Calculate a soft label corresponding to the candidate entity label;

[0024] Based on the soft label, a first cross entropy loss and a second cross entropy loss are calculated, wherein the first cross entropy loss is a loss value calculated based on the embedded features of the entity position to be predicted, and the second cross entropy loss is a loss value calculated based on the updated triplet embedded features;

[0025] A cross entropy loss is calculated according to the first cross entropy loss and the second cross entropy loss, and a hyperparameter in the encoding module is updated based on the cross entropy loss through back propagation.

[0026] Optionally, the calculation expression of the soft label is:

[0027]

[0028] in, represents the i-th soft label obtained after label smoothing; Represents the i-th candidate entity label among the candidate entities; represents the hyperparameter of label smoothing, and K represents the total number of entity labels.

[0029] Optionally, the calculation expressions of the first cross entropy loss and the second cross entropy loss are:

[0030]

[0031]

[0032] In the formula, Represents the loss value calculated based on the embedded features of the entity position to be predicted; represents the loss value calculated based on the updated triplet embedding feature, represents the i-th soft label obtained after label smoothing; K represents the total number of labels; It indicates that the model predicts the probability that the entity label is class i based on the embedded features of the entity position to be predicted; It represents the probability that the entity label is class i, predicted by the model based on the updated triple embedding features.

[0033] Optionally, the calculation expression of the cross entropy loss is:

[0034]

[0035] In the formula, Represents the loss value calculated based on the embedded features of the entity position to be predicted; represents the loss value calculated based on the updated triplet embedding feature, is a hyperparameter.

[0036] This application has at least the following beneficial effects:

[0037] 1. Through entity category transfer matrix and relationship combination, the semantic relationship between entity category and triple is integrated into the embedding feature of entity to enhance the representation ability;

[0038] 2. Comprehensively consider the impact of entity categories and semantic relationships on knowledge graph entity completion, so that the model can better understand the characteristic attributes of entities, thereby improving the accuracy of knowledge graph entity completion BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A schematic diagram of the architecture of the hardware operating environment of a computer system involved in an embodiment of the knowledge graph entity completion method for combining entity categories and relationship representations of the present application;

[0040] Figure 2 A flowchart of the first embodiment of the knowledge graph entity completion method combining entity categories and relationship representations of the present application;

[0041] Figure 3 A schematic diagram of the knowledge graph structure involved in the embodiments of the present application;

[0042] Figure 4 A flowchart of a second embodiment of the knowledge graph entity completion method combining entity categories and relationship representations of the present application;

[0043] Figure 5This is a schematic diagram of the encoding module architecture based on the multi-head self-attention mechanism involved in an embodiment of the present application.

[0044] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0045] In order to better understand the above technical solution, exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0046] As an implementation plan, Figure 1 This is a schematic diagram of the architecture of the hardware operating environment of the computer system involved in the embodiment of the present application.

[0047] like Figure 1 As shown, the computer system may include: a processor 1001, such as a CPU, a memory 1005, a user interface 1003, a network interface 1004, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0048] Those skilled in the art will understand that Figure 1 The computer system architecture shown in the figure does not constitute a limitation of the computer system, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0049] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a knowledge graph entity completion program for combining entity categories and relationship representations. Among them, the operating system is a program for managing and controlling the hardware and software resources of the computer system, and the knowledge graph entity completion program for combining entity categories and relationship representations and other software or programs are operated.

[0050] exist Figure 1 In the computer system shown, the user interface 1003 is mainly used to connect to the terminal and communicate data with the terminal; the network interface 1004 is mainly used for the background server and communicates data with the background server; the processor 1001 can be used to call the knowledge graph entity completion program of the joint entity category and relationship representation stored in the memory 1005.

[0051] In this embodiment, the computer system includes: a memory 1005, a processor 1001, and a knowledge graph entity completion program for combining entity categories and relationship representations stored in the memory and executable on the processor, wherein:

[0052] When the processor 1001 calls the knowledge graph entity completion program for combining entity categories and relationship representations stored in the memory 1005, the following operations are performed:

[0053] Obtain entity category data corresponding to the entity from the knowledge graph entity category data set, and obtain existing triple data from the knowledge graph triple data set to be completed, wherein the triple data includes a head entity, a relationship, and a tail entity;

[0054] Determine the occurrence frequency of the entity category data in the triple data, and determine the association strength of each entity in the triple data according to the occurrence frequency;

[0055] Based on the association strength, selecting a target head entity category transfer matrix associated with a head entity with the maximum association strength in the triple data, and a target tail entity category transfer matrix associated with a tail entity with the maximum association strength;

[0056] Updating the head entity embedding features in the triple data based on the target head entity category transfer matrix, and updating the tail entity embedding features in the triple data based on the target tail entity category transfer matrix;

[0057] Based on the updated entity embedding feature and the updated tail entity embedding feature, updating the triple data to obtain an updated triple embedding feature;

[0058] The updated triplet embedding feature is used as input to an encoding module built based on a multi-head self-attention mechanism for training, and the candidate entity label with the highest score in the encoding module is determined as the entity completion result of the knowledge graph.

[0059] When the processor 1001 calls the knowledge graph entity completion program for combining entity categories and relationship representations stored in the memory 1005, the following operations are performed:

[0060] Determine a category set corresponding to a head entity in the triple data and a category set corresponding to a relationship, and determine a category set corresponding to a tail entity in the triple data and a category set corresponding to a relationship;

[0061] The category set corresponding to the head entity and the head entity category set corresponding to the relationship form a first intersection, the entity category with the maximum association strength in the first intersection is selected as the target head entity, and the head entity category transfer matrix corresponding to the target head entity is used as the target head entity category transfer matrix; and

[0062] The category set corresponding to the tail entity and the tail entity category set corresponding to the relationship constitute a second intersection, the entity category with the maximum association strength in the second intersection is selected as the target tail entity, and the tail entity category transfer matrix corresponding to the target tail entity is used as the target tail entity category transfer matrix.

[0063] When the processor 1001 calls the knowledge graph entity completion program for combining entity categories and relationship representations stored in the memory 1005, the following operations are performed:

[0064] If the maximum association strength in the first intersection or the second intersection is associated with multiple entity categories, any one of the multiple entity categories associated with the maximum association strength is randomly selected as the target entity category.

[0065] When the processor 1001 calls the knowledge graph entity completion program for combining entity categories and relationship representations stored in the memory 1005, the following operations are performed:

[0066] Calculate a soft label corresponding to the candidate entity label;

[0067] Based on the soft label, a first cross entropy loss and a second cross entropy loss are calculated, wherein the first cross entropy loss is a loss value calculated based on the embedded features of the entity position to be predicted, and the second cross entropy loss is a loss value calculated based on the updated triplet embedded features;

[0068] A cross entropy loss is calculated according to the first cross entropy loss and the second cross entropy loss, and a hyperparameter in the encoding module is updated based on the cross entropy loss through back propagation.

[0069] Based on the hardware architecture of the computer system of the above-mentioned knowledge graph technology, an embodiment of the knowledge graph entity completion method of the present application that combines entity categories and relationship representations is proposed.

[0070] First embodiment

[0071] Reference Figure 2In a first embodiment, the method for completing knowledge graph entities by combining entity categories and relationship representations comprises the following steps:

[0072] Step S10, obtaining entity category data corresponding to the entity from the knowledge graph entity category data set, and obtaining existing triple data from the knowledge graph triple data set to be completed, wherein the triple data includes a head entity, a relationship, and a tail entity;

[0073] In this embodiment, two types of data are first obtained from two data sets respectively, namely, entity category data corresponding to the entity is obtained from the knowledge graph entity category data set, and existing triple data is obtained from the knowledge graph triple data set to be completed.

[0074] In the knowledge graph structure, nodes represent entities and edges represent the relationships between entities. The knowledge graph is defined as , where E represents the entity set and R represents the relationship set; the knowledge graph is composed of multiple triples, and the triples are represented as ,in and Respectively represent the head entity and the tail entity in the triple, Represents a relationship among triples.

[0075] For example, refer to Figure 3 The schematic diagram of the knowledge graph structure shown in the figure includes 6 entities , 3 types of relationships and 3 entity classes . Count the entity category data corresponding to each entity:

[0076]

[0077] in, represents the i-th entity, Representing Entities The corresponding entity category set, Represents different entity categories.

[0078] Step S20, determining the occurrence frequency of the entity category data in the triple data, and determining the association strength of each entity in the triple data according to the occurrence frequency;

[0079] In this embodiment, the occurrence frequency of entity category data in triple data is determined, and the association strength of each entity in the triple data is determined according to the occurrence frequency, wherein the association strength is positively correlated with the occurrence frequency.

[0080] Optionally, there may be a positive linear relationship between the association strength and the occurrence frequency.

[0081] Step S30, based on the association strength, selecting a target head entity category transfer matrix associated with the head entity with the maximum association strength in the triple data, and a target tail entity category transfer matrix associated with the tail entity with the maximum association strength;

[0082] Step S40, updating the head entity embedding feature in the triple based on the head entity category transfer matrix, and updating the tail entity embedding feature in the triple based on the tail entity category transfer matrix;

[0083] In this embodiment, a target head entity category transfer matrix associated with a head entity with the maximum association strength in triple data and a target tail entity category transfer matrix associated with a tail entity with the maximum association strength are selected.

[0084] In addition, if the maximum association strength in the first intersection or the second intersection is associated with multiple entity categories, any one of the multiple entity categories associated with the maximum association strength is randomly selected as the target entity category.

[0085] Optionally, step S30 may specifically include: determining a category set corresponding to the head entity in the triple data and a category set of the head entity corresponding to the relationship, and determining a category set corresponding to the tail entity in the triple data and a category set of the tail entity corresponding to the relationship; forming a first intersection with the category set corresponding to the head entity and the category set of the head entity corresponding to the relationship, selecting the entity category with the maximum association strength in the first intersection as the target head entity, and using the head entity category transfer matrix corresponding to the target head entity as the target head entity category transfer matrix; and forming a second intersection with the category set corresponding to the tail entity and the category set of the tail entity corresponding to the relationship, selecting the entity category with the maximum association strength in the second intersection as the target tail entity, and using the tail entity category transfer matrix corresponding to the target tail entity as the target tail entity category transfer matrix.

[0086] For example, let the target header entity be , the target tail entity is , which is expressed as follows:

[0087]

[0088]

[0089] In the formula, The function represents selecting the entity category with the maximum association strength from the input entity category. Indicates the category set corresponding to the head entity, Indicates the category set corresponding to the tail entity; and They represent the head entity category set corresponding to the relationship and the tail entity category set corresponding to the relationship respectively; represents the intersection operation of a set, is the first intersection, is the second intersection.

[0090] In this embodiment, each head entity is associated with a head entity category transfer matrix, and the head entity category transfer matrix corresponding to the target head entity is the target head entity category transfer matrix.

[0091] Further, when the target header entity is selected as , the target tail entity is Afterwards, the head entity embedding feature is updated through the entity category transfer matrix corresponding to the selected head entity category and the entity category transfer matrix corresponding to the tail entity category and tail entity embedding features :

[0092]

[0093]

[0094] in, and Represent the embedded features of the initialized head entity and tail entity respectively; Represents entity category t 2 The corresponding entity category transfer matrix.

[0095] Optionally, in a specific embodiment, and The dimension can be set to 1*256. The dimension can be set to 256*256, initialized as an identity matrix with the main diagonal elements being 1 and the remaining position elements being 0.

[0096] Step S50, updating the triple data based on the updated entity embedding feature and the updated tail entity embedding feature to obtain an updated triple embedding feature;

[0097] In this embodiment, after obtaining the target head entity category transfer matrix and the target tail entity category transfer matrix, the head entity and the tail entity in the triple are updated based on the obtained two transfer matrices.

[0098] Specifically and optionally, based on the formula parameters in the previous example, according to the core concept of the TransE model (full name: TranslatingEmbeddings for Modeling Multi-relational Data), that is, the head entity embedding plus the relation embedding should be close to the tail entity embedding, the triple is updated by the following formula to obtain the updated triple embedding feature:

[0099]

[0100] in represents the weight coefficient; X represents the updated triple embedding feature, X r1 Representing relationships r 1 corresponding relation embedding.

[0101] Optionally, in some specific embodiments, α may be 0.5.

[0102] Step S60, using the updated triple embedding feature as input to an encoding module constructed based on a multi-head self-attention mechanism for training, and determining the candidate entity label with the highest score in the encoding module as the entity completion result of the knowledge graph.

[0103] In this embodiment, the updated triple embedding features are used as input to an encoding module built based on a multi-head self-attention mechanism for training, and the candidate entity label with the highest score in the encoding module is determined as the entity completion result of the knowledge graph.

[0104] For example, the multi-head self-attention mechanism focuses on the positions of the head entity, relation, and tail entity in a triple, capturing the complex dependencies in the triple:

[0105]

[0106] Among them, the number of attention heads h=4; W o is the weight matrix to be learned; H For the long side; H i is the output matrix of a single attention head, representing the self-attention scores at each position of the triplet:

[0107]

[0108] Where X is the input triplet embedding feature; d_k represents the embedding dimension of each attention head, , embedding dimension d=256, number of attention heads h=4; W Q , WK , W V is the parameter to be learned, embedding dimension , is the activation function.

[0109] In the technical solution provided in this embodiment, the entity category and the semantic relationship in the triple are integrated into the embedded features of the entity through the entity category transfer matrix and relationship combination to enhance the representation capability; the influence of the entity category and semantic relationship on the knowledge graph entity completion is comprehensively considered, so that the model can better understand the characteristic attributes of the entity, thereby improving the accuracy of the knowledge graph entity completion.

[0110] Second embodiment

[0111] Reference Figure 4 Based on the first embodiment, in this embodiment, in step S60, in the encoding module constructed based on the multi-head self-attention mechanism, the scoring step of the candidate entity label includes:

[0112] Step S61, calculating the soft label corresponding to the candidate entity label;

[0113] Step S621, based on the soft label, calculating a first cross entropy loss and a second cross entropy loss, wherein the first cross entropy loss is a loss value calculated based on the embedded features of the entity position to be predicted, and the second cross entropy loss is a loss value calculated based on the updated triplet embedded features;

[0114] Step S622: Calculate a cross entropy loss according to the first cross entropy loss and the second cross entropy loss, and update the hyper parameters in the encoding module based on the cross entropy loss by back propagation.

[0115] In this embodiment, refer to Figure 5 The schematic diagram of the encoding module architecture based on the multi-head self-attention mechanism is shown. The encoding module includes multi-head self-attention, feedforward neural network, residual connection and layer normalization operation. After 6 encoding layers, when the encoding module scores the candidate entity labels, when the triple containing missing entities passes through the encoding module to score the candidate entities, multiple potential correct candidate answers in the entity are shielded, and the soft label corresponding to the entity label is calculated.

[0116] Furthermore, the calculation expression of the soft label is:

[0117]

[0118] in, represents the i-th soft label obtained after label smoothing; Represents the i-th candidate entity label among the candidate entities; represents the hyperparameter of label smoothing, and K represents the total number of entity labels.

[0119] Optionally, .

[0120] Furthermore, the calculation expressions of the first cross entropy loss and the second cross entropy loss are:

[0121]

[0122]

[0123] In the formula, Represents the loss value calculated based on the embedded features of the entity position to be predicted; represents the loss value calculated based on the updated triplet embedding feature, represents the i-th soft label obtained after label smoothing; K represents the total number of labels; It indicates that the model predicts the probability that the entity label is class i based on the embedded features of the entity position to be predicted; It represents the probability that the entity label is class i, predicted by the model based on the updated triple embedding features.

[0124] Furthermore, the calculation expression of the cross entropy loss is:

[0125]

[0126] In the formula, Represents the loss value calculated based on the embedded features of the entity position to be predicted; represents the loss value calculated based on the updated triplet embedding feature, is a hyperparameter.

[0127] Optionally, .

[0128] Third embodiment

[0129] This embodiment verifies the effect based on the methods in the first and second embodiments.

[0130] 1. Experimental data

[0131] YAGO26K-906 is a knowledge graph dataset built on YAGO3 (Yet Another Great Ontology). YAGO3 is a widely used large-scale knowledge graph that integrates data from multiple sources such as Wikipedia, WordNet, and GeoNames, and contains rich entity, type, and relationship information. The instance layer of YAGO26K-906 contains 26,078 entities and relationships between 34 types of entities. These entities include names of people, places, and organizations, while relationships describe various connections between entities, such as "born in", "located in", etc. YAGO26K-906 also provides 9,962 entity category data, providing clear type annotations for entities.

[0132] 2. Experimental Setup

[0133] The experiment was implemented using the Pytorch framework. The embedding feature dimension size of entities and relations was 256, the number of encoding layers was 6, the number of multi-head attention heads was 4, and the AdamW optimizer was used for optimization. The learning rate was set to 0.0005, the output layer activation function used GELU, and the total number of training epochs was 400. MRR (Mean Reciprocal Ranking, the inverse of the ranking) was used. (top-1 recommendation) and (top-10 recommendations) are used as evaluation indicators and are calculated using the following formulas:

[0134]

[0135]

[0136]

[0137] Where S represents the set of triples in the knowledge graph to be predicted; |S| represents the number of triple sets; represents the predicted ranking of entity completion for the i-th triple; Represents an indicator function. If the condition is true, the function value is 1, otherwise it is 0; MRR, and It is the result of the evaluation index. The larger the value is, the better the prediction effect of the model is.

[0138] 3. Experimental results

[0139] Through the above steps, the YAGO26K-906 dataset is experimentally tested, and the experimental results are shown in Table 1.

[0140] Table 1 Comparison of experimental results of this application on the YAGO26K-906 dataset

[0141]

[0142] It can be seen from Table 1 that the knowledge graph entity completion effect of the present application is higher than that of the comparison model in all three indicators, which indicates that combining entity category information and semantic relationships in entity embedding features can enhance representation capabilities, enable the model to better understand entities and contexts, and effectively improve the knowledge graph entity completion performance.

[0143] In addition, it can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in a computer system to implement the process steps of the embodiment of the above method.

[0144] Therefore, the present application also provides a computer-readable storage medium, which stores a knowledge graph entity completion program that combines entity categories and relationship representations. When the knowledge graph entity completion program that combines entity categories and relationship representations is executed by a processor, it implements the various steps of the knowledge graph entity completion method that combines entity categories and relationship representations as described in the above embodiment.

[0145] The computer-readable storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which are computer-readable storage media that can store program codes.

[0146] It should be noted that since the storage medium provided in the embodiment of the present application is the storage medium used to implement the method of the embodiment of the present application, based on the method introduced in the embodiment of the present application, the person skilled in the art can understand the specific structure and deformation of the storage medium, so it is not repeated here. All storage media used in the method of the embodiment of the present application belong to the scope of protection of this application.

[0147] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0148] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0149] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0150] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0151] It should be noted that in the claims, any reference signs placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claim. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The present application may be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.

[0152] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0153] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A knowledge graph entity completion method combining entity categories and relationship representations, characterized in that: The method comprises the following steps: Obtain entity category data corresponding to the entity from the knowledge graph entity category data set, and obtain existing triple data from the knowledge graph triple data set to be completed, wherein the triple data includes a head entity, a relationship, and a tail entity; Determine the occurrence frequency of the entity category data in the triple data, and determine the association strength of each entity in the triple data according to the occurrence frequency; Based on the association strength, selecting a target head entity category transfer matrix associated with a head entity with the maximum association strength in the triple data, and a target tail entity category transfer matrix associated with a tail entity with the maximum association strength; Updating the head entity embedding features in the triple data based on the target head entity category transfer matrix, and updating the tail entity embedding features in the triple data based on the target tail entity category transfer matrix; Based on the updated head entity embedding feature and the updated tail entity embedding feature, updating the triple data to obtain an updated triple embedding feature; The updated triplet embedding feature is used as input to an encoding module built based on a multi-head self-attention mechanism for training, and the candidate entity label with the highest score in the encoding module is determined as the entity completion result of the knowledge graph; The step of selecting, based on the association strength, a target head entity category transfer matrix associated with a head entity having the maximum association strength in the triple data and a target tail entity category transfer matrix associated with a tail entity having the maximum association strength comprises: Determine a category set corresponding to a head entity in the triple data and a category set corresponding to a relationship, and determine a category set corresponding to a tail entity in the triple data and a category set corresponding to a relationship; The category set corresponding to the head entity and the head entity category set corresponding to the relationship form a first intersection, the entity category with the maximum association strength in the first intersection is selected as the target head entity, and the head entity category transfer matrix corresponding to the target head entity is used as the target head entity category transfer matrix; and The category set corresponding to the tail entity and the tail entity category set corresponding to the relationship constitute a second intersection, the entity category with the maximum association strength in the second intersection is selected as the target tail entity, and the tail entity category transfer matrix corresponding to the target tail entity is used as the target tail entity category transfer matrix; The calculation expression of the updated triple embedding feature includes: ; Where X represents the updated triple embedding feature; represents the weight coefficient; Represents the updated embedding features of the head entity; represents the updated embedding feature of the tail entity; Represents relation embedding features.

2. The method according to claim 1, characterized in that If the maximum association strength in the first intersection or the second intersection is associated with multiple entity categories, any one of the multiple entity categories associated with the maximum association strength is randomly selected as the target entity category.

3. The method according to claim 1, characterized in that In the encoding module constructed based on the multi-head self-attention mechanism, the scoring step of the candidate entity label includes: Calculate a soft label corresponding to the candidate entity label; Based on the soft label, a first cross entropy loss and a second cross entropy loss are calculated, wherein the first cross entropy loss is a loss value calculated based on the embedded features of the entity position to be predicted, and the second cross entropy loss is a loss value calculated based on the updated triplet embedded features; A cross entropy loss is calculated according to the first cross entropy loss and the second cross entropy loss, and a hyperparameter in the encoding module is updated based on the cross entropy loss through back propagation.

4. The method according to claim 3, characterized in that The calculation expression of the soft label is: ; in, represents the i-th soft label obtained after label smoothing; Represents the i-th candidate entity label among the candidate entities; represents the hyperparameter of label smoothing, and K represents the total number of entity labels.

5. The method according to claim 3, characterized in that The calculation expressions of the first cross entropy loss and the second cross entropy loss are: ; ; In the formula, Represents the loss value calculated based on the embedded features of the entity position to be predicted; represents the loss value calculated based on the updated triplet embedding feature, represents the i-th soft label obtained after label smoothing; K represents the total number of labels; It indicates that the model predicts the probability that the entity label is class i based on the embedded features of the entity position to be predicted; It represents the probability that the entity label is class i, predicted by the model based on the updated triple embedding features.

6. The method according to claim 3, characterized in that The calculation expression of the cross entropy loss is: ; In the formula, Represents the loss value calculated based on the embedded features of the entity position to be predicted; represents the loss value calculated based on the updated triplet embedding feature, is a hyperparameter.

Citation Information

Patent Citations

  • Internet food entity alignment method and system based on graph neural network

    CN113342809A

  • Multimodal knowledge representation method fusing entity image information and entity category information

    CN113486190A