Knowledge graph completion method and device, electronic equipment and storage medium
By performing information interaction, fusion, and translation transformation on the head and tail entities in the knowledge graph, proxy entities are generated, which solves the problem of low judgment accuracy caused by insufficient interaction between head and tail entities in the existing technology and improves the accuracy of knowledge graph completion.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HEBEI XUNFEI ARTIFICIAL INTELLIGENCE RES INST
- Filing Date
- 2022-08-18
- Publication Date
- 2026-06-19
AI Technical Summary
The lack of head-to-tail entity interactions in existing knowledge graph embedding models leads to low accuracy in determining fact triples, which affects the accuracy of knowledge graph completion.
By integrating information between the head and tail entities in the triplet to be predicted, proxy head and tail entities are generated. The probability of the triplet being true is determined by calculating the relationship between the head and tail entities and performing translation transformation. If the probability reaches a preset threshold, knowledge graph completion is performed.
It improves the accuracy of fact triple determination and knowledge graph completion, and realizes more efficient reasoning and adaptation capabilities after the interaction of head and tail entity information.
Smart Images

Figure CN115455193B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of natural language processing technology, and in particular to a knowledge graph completion method, apparatus, electronic device, and storage medium. Background Technology
[0002] In knowledge graphs, a fact is typically represented as a triple, i.e., "(head entity, relation, tail entity)". Knowledge graph completion usually utilizes a knowledge graph embedding model. By transforming the actual head entity and relation in the triple, a transformed tail entity is obtained. The knowledge graph embedding model determines whether the triple is valid based on the distance between the transformed tail entity and the actual tail entity, thus enabling the use of valid triples for knowledge graph completion.
[0003] However, the lack of head-to-tail entity interactions in existing knowledge graph embedding models leads to low accuracy in determining fact triples, affecting the accuracy of knowledge graph completion. Summary of the Invention
[0004] Based on the defects and shortcomings of the existing technology, this application proposes a knowledge graph completion method, device, electronic device and storage medium, which can realize information interaction between head and tail entities in knowledge graph embedding, and improve the accuracy of fact triple determination and knowledge graph completion.
[0005] The first aspect of this application provides a knowledge graph completion method, including:
[0006] Information interaction and fusion are performed on the head entity and tail entity in the triplet to be predicted to obtain the proxy head entity corresponding to the head entity and the proxy tail entity corresponding to the tail entity.
[0007] The probability of the predicted triple being true is determined by calculating the difference between the entity obtained by translating the surrogate head entity according to the head-tail entity relationship in the predicted triple and the surrogate tail entity.
[0008] If the probability of the predicted triplet being true reaches a preset threshold, the predicted triplet is used to complete the knowledge graph.
[0009] Optionally, information interaction and fusion are performed on the head entity and tail entity in the triple to be predicted to obtain the proxy head entity corresponding to the head entity and the proxy tail entity corresponding to the tail entity, including:
[0010] Based on the head entity and tail entity in the triplet to be predicted, auxiliary vectors for the head entity and the tail entity are generated respectively.
[0011] The auxiliary vectors of the head entity and the tail entity are interactively fused to obtain the proxy head entity corresponding to the head entity, and the auxiliary vectors of the tail entity and the head entity are interactively fused to obtain the proxy tail entity corresponding to the tail entity.
[0012] The auxiliary vector of the head entity contains information about the head entity, and the auxiliary vector of the tail entity contains information about the tail entity.
[0013] Optionally, the auxiliary vectors of the head entity and the tail entity are interactively fused to obtain the proxy head entity corresponding to the head entity, and the auxiliary vectors of the tail entity and the head entity are interactively fused to obtain the proxy tail entity corresponding to the tail entity, including:
[0014] The head entity is projected and transformed based on the auxiliary vector of the tail entity to obtain the proxy head entity corresponding to the head entity; and the tail entity is projected and transformed based on the auxiliary vector of the head entity to obtain the proxy tail entity corresponding to the tail entity.
[0015] Optionally, the probability of the predicted triple being true is determined by calculating the difference between the entity obtained by translating the surrogate head entity according to the head-tail entity relationship in the predicted triple and the surrogate tail entity, including:
[0016] Based on the head and tail entity relationship in the triplet to be predicted, the proxy head entity is translated to obtain the entity translation vector.
[0017] Calculate the distance between the entity translation vector and the proxy tail entity;
[0018] The probability of the predicted triplet being true is calculated based on the distance between the entity translation vector and the surrogate tail entity.
[0019] Optionally, the triples to be predicted are obtained through the following processing:
[0020] The entities in the knowledge graph and the entity relationships between them are randomly combined into triples. The triples that do not exist in the knowledge graph are used as triples to be predicted.
[0021] Optionally, information interaction and fusion are performed on the head entity and tail entity in the triplet to be predicted to obtain the proxy head entity corresponding to the head entity and the proxy tail entity corresponding to the tail entity. Furthermore, the probability of the triplet to be predicted being true is determined by calculating the difference between the entity obtained by translating the proxy head entity according to the head-tail entity relationship in the triplet to be predicted and the proxy tail entity. This includes:
[0022] The triple to be predicted is input into a pre-trained knowledge graph embedding model, which performs information interaction and fusion on the head entity and tail entity in the triple to be predicted, to obtain the proxy head entity corresponding to the head entity and the proxy tail entity corresponding to the tail entity. The probability of the triple to be predicted being true is determined by calculating the difference between the entity obtained by translating the proxy head entity according to the head and tail entity relationship in the triple to be predicted and the proxy tail entity.
[0023] Optionally, the training process of the knowledge graph embedding model includes:
[0024] The sample triples from the sample dataset are input into a neural network model, which then performs the following processing: For the sample head entity, sample head-tail entity relationship, and sample tail entity in the sample triples, as well as the auxiliary vectors of the sample head entity and sample tail entity, the vector parameters are randomly initialized; the auxiliary vectors of the sample head entity and the sample tail entity are interactively fused to obtain the sample proxy head entity corresponding to the sample head entity; and the auxiliary vectors of the sample tail entity and the sample head entity are interactively fused to obtain the sample proxy tail entity corresponding to the sample tail entity; the sample distance between the entity obtained by translating the sample proxy head entity according to the sample head-tail entity relationship and the sample proxy tail entity is calculated.
[0025] By utilizing the sample distance and the loss function in the neural network model, and aiming to minimize the sample distance and the loss function, the parameters of the neural network model are optimized to obtain a knowledge graph embedding model.
[0026] Specifically, when optimizing the parameters of the neural network model, the vector parameter update step size between the sample head entity and the auxiliary vector of the sample head entity is consistent and the vector parameters are not shared, and the vector parameter update step size between the sample tail entity and the auxiliary vector of the sample tail entity is consistent and the vector parameters are not shared.
[0027] Optionally, the auxiliary vectors of the sample head entity and the sample tail entity are interactively fused to obtain the sample proxy head entity corresponding to the sample head entity, and the auxiliary vectors of the sample tail entity and the sample head entity are interactively fused to obtain the sample proxy tail entity corresponding to the sample tail entity, including:
[0028] The sample head entity is projected and transformed based on the auxiliary vector of the sample tail entity to obtain the sample proxy head entity corresponding to the sample head entity; and the sample tail entity is projected and transformed based on the auxiliary vector of the sample head entity to obtain the sample proxy tail entity corresponding to the sample tail entity.
[0029] Optionally, the sample dataset is obtained through the following processing:
[0030] Based on the entities in the knowledge graph and the entity relationships between them, at least one set of sample triples is constructed, and the constructed sample triples form a sample dataset.
[0031] A second aspect of this application provides a knowledge graph completion device, comprising:
[0032] The entity interaction fusion module is used to perform information interaction and fusion between the head entity and the tail entity in the triplet to be predicted, so as to obtain the proxy head entity corresponding to the head entity and the proxy tail entity corresponding to the tail entity.
[0033] The triplet prediction module is used to determine the probability that the triplet to be predicted is true by calculating the difference between the entity obtained by translating the proxy head entity according to the head and tail entity relationship in the triplet to be predicted and the proxy tail entity.
[0034] The knowledge graph completion module is used to complete the knowledge graph using the triplet to be predicted if the probability of the triplet to be predicted being true reaches a preset threshold.
[0035] A third aspect of this application provides an electronic device, including: a memory and a processor;
[0036] The memory is connected to the processor and is used to store programs.
[0037] The processor is used to implement the knowledge graph completion method described above by running the program in the memory.
[0038] A fourth aspect of this application provides a storage medium storing a computer program, which, when executed by a processor, implements the aforementioned knowledge graph completion method.
[0039] The knowledge graph completion method proposed in this application involves information interaction and fusion between the head entity and the tail entity in the triplet to be predicted, resulting in a proxy head entity corresponding to the head entity and a proxy tail entity corresponding to the tail entity. The probability of the triplet being predicted is determined by calculating the difference between the entity obtained by translating the proxy head entity according to the head-tail entity relationship in the triplet and the proxy tail entity. If the probability of the triplet being predicted reaches a preset threshold, the knowledge graph is completed using the triplet. By adopting the technical solution of this application, information interaction and fusion between the head and tail entities in the triplet can be achieved. Using the proxy head and proxy tail entities obtained after entity information interaction can determine whether the triplet is valid, thereby improving the accuracy of fact triplet determination and the accuracy of knowledge graph completion. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of this application 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 this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0041] Figure 1 This is a flowchart illustrating a knowledge graph completion method provided in an embodiment of this application.
[0042] Figure 2 This is a schematic diagram of the processing flow for the interaction and fusion of head entity and tail entity information provided in an embodiment of this application.
[0043] Figure 3 This is a schematic diagram of the processing flow for determining the probability of a triplet to be predicted, provided in an embodiment of this application.
[0044] Figure 4 This is a schematic diagram of the triple transformation after the interaction and fusion of head and tail entity information provided in an embodiment of this application.
[0045] Figure 5 This is a schematic diagram of the training process of the knowledge graph embedding model provided in the embodiments of this application;
[0046] Figure 6 This is a schematic diagram of the structure of a knowledge graph completion device provided in an embodiment of this application;
[0047] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0048] The technical solutions of this application are applicable to knowledge graph completion scenarios. By employing the technical solutions of this application, information interaction between head and tail entities can be achieved, improving the accuracy of fact triple determination and the accuracy of knowledge graph completion.
[0049] In knowledge graphs, a fact is typically represented as a triple, i.e., "(head entity, head-tail entity relation, tail entity)". If a triple is true, meaning the head entity can be transformed into the tail entity through the head-tail entity relation, then the triple is a fact triple. For example, in the triple (City A1, Located in, Country B1), "City A1" is the head entity, "Located in" is the head-tail entity relation, and "Country B1" is the tail entity. If City A1 is indeed located in Country B1, meaning the statement "City A1 is located in Country B1" is true, then the triple is a fact triple.
[0050] A triple can be denoted as "(h, r, t)", where h represents the head entity, r represents the head-tail entity relationship, and t represents the tail entity. In existing technologies, knowledge graph embedding techniques based on vector transformations are typically used to determine whether a triple is a potentially true fact triple. First, h, r, and t in the triple are represented as vectors. Then, the head entity h is transformed according to the head-tail entity relationship r to obtain the predicted tail entity t'. Next, the scoring function and the distance (e.g., Euclidean distance) between the predicted tail entity t' and the tail entity t in the triple are used to determine whether the triple is a potentially true fact triple. After confirming that the triple is a true fact triple using knowledge graph embedding techniques based on vector transformations, it can be used for knowledge graph completion. However, existing knowledge graph embedding technologies typically employ TransE, TransH, RotatE, PairRE, OTE, etc. When transforming the head entity, there is no interaction between the head and tail entities, resulting in insufficient information fusion between them. Consequently, the knowledge graph embedding technology (i.e., the knowledge graph embedding model) does not learn and utilize the hidden information in the dataset sufficiently and comprehensively, leading to low accuracy in determining fact triples and affecting the accuracy of knowledge graph completion.
[0051] In view of the shortcomings of the existing technology and the lack of head-tail entity interaction in reality, which leads to low accuracy in the determination of fact triples and affects the accuracy of knowledge graph completion, the inventors of this application propose a knowledge graph completion method after research and experimentation. This method can realize the information interaction and fusion of head and tail entities in triples, thereby improving the accuracy of fact triple determination and the accuracy of knowledge graph completion.
[0052] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0053] This application proposes a knowledge graph completion method, see [link to relevant documentation]. Figure 1 As shown, the method includes:
[0054] S101. Perform information interaction and fusion on the head entity and tail entity in the triplet to be predicted to obtain the proxy head entity corresponding to the head entity and the proxy tail entity corresponding to the tail entity.
[0055] Specifically, in this embodiment, after obtaining the triple to be predicted, information interaction and fusion are performed on the head entity and tail entity in the triple to be predicted. That is, some information of the tail entity is fused into the head entity, and the head entity that has fused the tail entity information is used as the proxy head entity corresponding to the head entity in the triple to be predicted. Some information of the head entity is fused into the tail entity, and the tail entity that has fused the head entity information is used as the proxy tail entity corresponding to the tail entity in the triple to be predicted.
[0056] The proxy head entity obtained through the above information interaction and fusion process only incorporates a portion of the semantic information of the tail entity, but it still possesses the same semantics as the head entity. Essentially, the proxy head entity is just a different representation of the head entity. Similarly, the proxy tail entity obtained through the above information interaction and fusion process only incorporates a portion of the semantic information of the head entity, but it still possesses the same semantics as the tail entity. Essentially, the proxy tail entity is just a different representation of the tail entity.
[0057] The proxy head entity and proxy tail entity realize the information interaction and fusion between the head entity and the tail entity. By utilizing the proxy head entity and proxy tail entity that realize the information interaction and fusion between the head and tail entities, the reasoning and adaptation capabilities of the knowledge graph are higher, and the accuracy of judging whether the triple to be predicted is a fact triple is higher.
[0058] Furthermore, this embodiment can employ a pre-trained knowledge graph embedding model. Using several sample triples, the neural network model is trained to perform information interaction and fusion between the head and tail entities of the triples, predicting the probability of the triples being true. The model with the highest training accuracy is then used as the knowledge graph embedding model. After the pre-trained knowledge graph embedding model performs information interaction and fusion between the head and tail entities in the triples to be predicted, proxy head entities corresponding to the head entities and proxy tail entities corresponding to the tail entities are generated.
[0059] Furthermore, the triples to be predicted in this embodiment are obtained through the following processing:
[0060] The entities in the knowledge graph and the entity relationships between them are randomly combined into triples. The triples that do not exist in the knowledge graph are used as the triples to be predicted.
[0061] Specifically, a knowledge graph is a relational network that connects all different types of information. It consists of nodes and edges. Each node represents an "entity" existing in the real world, and each edge represents a "relationship" between entities. Based on the entities and their relationships in the knowledge graph, several triples can be identified. These triples are all present in the knowledge graph. However, if the relationships between entities in the knowledge graph are not fully represented, then it is necessary to predict the triples that are not yet represented in the knowledge graph to determine if they are valid. If they are valid, the knowledge graph is completed based on these valid triples. Therefore, this embodiment requires randomly combining entities and their relationships in the knowledge graph into triples, and using the resulting triples that are not present in the knowledge graph as the triples to be predicted.
[0062] Furthermore, to improve the comprehensiveness of the knowledge graph, this embodiment can also acquire knowledge text related to the knowledge graph (e.g., the relevant domains, entity relationships, etc.). This knowledge text also contains entities and the relationships between them. This embodiment can randomly combine entities and their relationships from the knowledge text and the knowledge graph into triples, and use the resulting triples that are not present in the knowledge graph as the triples to be predicted. By predicting whether the triples to be predicted are true, and using the true triples to complete the knowledge graph, the number of entities in the knowledge graph can be increased, expanding its scope and making it more comprehensive.
[0063] S102. By calculating the difference between the entity obtained by translating the surrogate head entity according to the head and tail entity relationship in the triplet to be predicted and the surrogate tail entity, the probability of the triplet to be predicted being true is determined.
[0064] Specifically, this embodiment requires transforming the surrogate head entity according to the head-tail entity relationship in the triplet to be predicted to obtain the predicted tail entity. Then, the difference between the predicted tail entity and the surrogate tail entity is calculated, and the probability of the triplet to be predicted being true is determined based on the difference between the predicted tail entity and the surrogate tail entity. A larger difference between the predicted tail entity and the surrogate tail entity indicates a lower probability of the triplet to be predicted being true, while a smaller difference indicates a higher probability of the triplet to be predicted being true.
[0065] Furthermore, this embodiment can employ a pre-trained knowledge graph embedding model. The trained knowledge graph embedding model is used to perform a translation transformation on the proxy head entity according to the head and tail entity relationship in the triple to be predicted, and the difference between the translated entity and the proxy tail entity is calculated. Based on this difference, the probability of the triple to be predicted being true is determined and output.
[0066] S103. If the probability of the triplet to be predicted being true reaches a preset threshold, then the knowledge graph is completed using the triplet to be predicted.
[0067] Specifically, in this embodiment, a preset threshold is set to determine whether a triple is true. After determining the probability of the triple to be predicted being true, the probability is compared with the preset threshold. If the probability of the triple to be predicted being true reaches the preset threshold, it means that the triple to be predicted is true and belongs to a fact triple. At this time, the triple to be predicted needs to be used to complete the knowledge graph, that is, to mark the head entity, tail entity, and head-tail entity relationship in the knowledge graph. If the probability of the triple to be predicted is not true, it means that the triple to be predicted is not true and does not belong to a fact triple. At this time, the triple to be predicted needs to be discarded.
[0068] As described above, the knowledge graph completion method proposed in this application involves information interaction and fusion between the head entity and the tail entity in the triplet to be predicted, resulting in a proxy head entity corresponding to the head entity and a proxy tail entity corresponding to the tail entity. The method calculates the difference between the entity obtained by translating the proxy head entity according to the head-tail entity relationship in the triplet to be predicted and the proxy tail entity, determining the probability of the triplet being true. If the probability of the triplet being true reaches a preset threshold, the knowledge graph is completed using the triplet. By adopting the technical solution of this embodiment, information interaction and fusion between the head entity and the tail entity in the triplet can be achieved. Using the proxy head entity and proxy tail entity after entity information interaction to determine whether the triplet is true can improve the accuracy of fact triplet determination and the accuracy of knowledge graph completion.
[0069] As an optional implementation, see [link to implementation details]. Figure 2 As shown, another embodiment of this application discloses that step S101 above, which involves information interaction and fusion of the head entity and tail entity in the triplet to be predicted, to obtain the proxy head entity corresponding to the head entity and the proxy tail entity corresponding to the tail entity, includes:
[0070] S201. Based on the head entity and tail entity in the triplet to be predicted, generate the auxiliary vectors for the head entity and the tail entity, respectively.
[0071] Specifically, in this embodiment, the head entity, head-tail entity relationship, and tail entity in the triple to be predicted can be represented as vectors, i.e., three vectors h, r, and t representing the head entity, head-tail entity relationship, and tail entity in the triple to be predicted, respectively. Here, h represents the head entity vector, r represents the relationship vector of the head-tail entity relationship, and t represents the tail entity vector. This embodiment also needs to design auxiliary vectors based on the head entity vector and the tail entity vector, i.e., the auxiliary vector h_t of the head entity corresponding to the head entity vector h. a And the auxiliary vector t of the tail entity corresponding to the tail entity vector t. a Among them, the auxiliary vector h of the head entity a It contains partial information from the head entity, that is, partial information from the head entity vector h; and the auxiliary vector t of the tail entity. a It contains some information from the tail entity, that is, it contains some information from the tail entity vector t.
[0072] Furthermore, this embodiment can generate auxiliary vectors for the head entity and the tail entity by pre-training a knowledge graph embedding model. During training, the knowledge graph embedding model continuously optimizes the vector parameters of the head entity vector, relation vector, tail entity vector, auxiliary vectors of the head entity, and auxiliary vectors of the tail entity to ensure the accuracy of the generated auxiliary vectors of the head and tail entities. This embodiment can generate the auxiliary vector h of the head entity corresponding to the head entity in the triplet to be predicted based on the vector parameters in the trained knowledge graph embedding model. a And, the auxiliary vector t of the tail entity corresponding to the tail entity. a .
[0073] S202. Interact and fuse the auxiliary vectors of the head entity and the tail entity to obtain the proxy head entity corresponding to the head entity, and interact and fuse the auxiliary vectors of the tail entity and the head entity to obtain the proxy tail entity corresponding to the tail entity.
[0074] To achieve information fusion between the head entity and the tail entity, it is necessary to interact and fuse the head entity with the auxiliary vector of the tail entity, which contains some information about the tail entity. That is, to fuse the head entity vector h with the auxiliary vector t of the tail entity. a Interactive fusion is performed to obtain the proxy head entity corresponding to the head entity; the tail entity is interactively fused with the auxiliary vector of the head entity containing partial information of the head entity, that is, the tail entity vector t is fused with the auxiliary vector h of the head entity. a Interactive fusion is performed to obtain the proxy tail entity corresponding to the tail entity.
[0075] Specifically, the interactive fusion of the auxiliary vectors of the head entity and the tail entity, and the interactive fusion of the auxiliary vectors of the tail entity and the head entity, can be achieved using projection transformation. That is, the interactive fusion between the auxiliary vectors of the head entity and the tail entity can be based on the auxiliary vector t of the tail entity. a Perform a projection transformation on the head entity vector h to obtain the proxy head entity corresponding to the head entity. The interaction and fusion between the auxiliary vectors of the tail entity and the head entity can be achieved by projecting the tail entity vector t onto the auxiliary vector ha of the head entity, thereby obtaining the surrogate tail entity corresponding to the tail entity.
[0076] Furthermore, this embodiment can employ a pre-trained knowledge graph embedding model to generate auxiliary vectors for the head entity and the tail entity. The head entity vector is then projected onto the tail entity vector to obtain the proxy head entity. Similarly, the tail entity vector is projected onto the tail entity vector to obtain the proxy tail entity.
[0077] As an optional implementation, see [link to implementation details]. Figure 3 As shown, another embodiment of this application discloses that step S102 above, which determines the probability of the triplet being predicted by calculating the difference between the entity obtained by translating the surrogate head entity according to the head-tail entity relationship in the triplet to be predicted and the surrogate tail entity, includes:
[0078] S301. Based on the head and tail entity relationship in the triplet to be predicted, perform a translation transformation on the proxy head entity to obtain the entity translation vector.
[0079] Specifically, after obtaining the surrogate head entity incorporating the tail entity information and the surrogate tail entity incorporating the head entity information, this embodiment needs to perform a translation transformation on the surrogate head entity according to the head-tail entity relationship in the triplet to be predicted, thereby obtaining the predicted tail entity. The vector corresponding to the predicted tail entity is the entity translation vector. Performing a translation transformation on the surrogate head entity according to the head-tail entity relationship is equivalent to transforming the vector corresponding to the surrogate head entity... Adding the relation vector corresponding to the head and tail entity relation r, the entity translation vector is:
[0080] In this embodiment, the L2-norm of the entity vector is subject to the following restrictions: See Figure 4 As shown, the head entity vector h is passed through the auxiliary vector t of the tail entity, which contains information about the tail entity. a Mapping from the unit circle to the inside of the circle yields the vector of the proxy head entity. Simultaneously, the tail entity vector t is passed through the auxiliary vector h of the head entity, which contains information about the head entity. a Mapping from the unit circle to the inside of the circle yields the vector of the proxy tail entity. Then, the vector of the proxy head entity is obtained by using the relation vector r corresponding to the head and tail entity relationship. A translation transformation is performed, which takes into account the interaction information between the head and tail entities and integrates the information of the two entities with the relationship. The transformation is not only based on the relationship vector r corresponding to the head and tail entity relationship, but also simultaneously based on the head and tail entities, thus avoiding strong constraints on the relationship vector r and improving the accuracy of fact triple determination.
[0081] S302. Calculate the distance between the entity translation vector and the surrogate tail entity.
[0082] Specifically, in this embodiment, both the predicted tail entity and the proxy tail entity obtained by translating the proxy head entity according to the head-tail entity relationship are represented in vector form. Therefore, the difference between the predicted tail entity and the proxy tail entity obtained by translating the proxy head entity according to the head-tail entity relationship can be represented by calculating the distance between the vectors. That is, the greater the distance between the entity translation vector corresponding to the predicted tail entity and the vector corresponding to the proxy tail entity, the greater the difference between the predicted tail entity and the proxy tail entity. The smaller the distance between the entity translation vector corresponding to the predicted tail entity and the vector corresponding to the proxy tail entity, the smaller the difference between the predicted tail entity and the proxy tail entity.
[0083] Calculate the entity translation vector Vector corresponding to the proxy tail entity The distance between them can be calculated using the Euclidean distance method, and the calculated distance is expressed as: See Figure 4 As shown, Figure 4 middle and Both represent the distance between the predicted tail entity and the proxy tail entity after the proxy head entity is translated according to the head-tail entity relationship.
[0084] S303. Calculate the probability of the predicted triplet being true based on the distance between the entity translation vector and the surrogate tail entity.
[0085] Specifically, in this embodiment, the difference between the predicted tail entity and the proxy tail entity can be represented by the distance between the entity translation vector corresponding to the predicted tail entity obtained after translating the proxy head entity according to the head-tail entity relationship and the proxy tail entity. Therefore, this embodiment can calculate and determine the probability of the predicted triple being true based on the distance between the entity translation vector and the proxy tail entity. That is, the greater the distance between the entity translation vector corresponding to the predicted tail entity obtained after translating the proxy head entity according to the head-tail entity relationship and the proxy tail entity, the lower the probability of the predicted triple being true; conversely, the smaller the distance between the entity translation vector and the proxy tail entity, the higher the probability of the predicted triple being true.
[0086] Furthermore, this embodiment can employ a pre-trained knowledge graph embedding model. The trained model performs a translation transformation on the proxy head entity based on the head-tail entity relationship in the triplet to be predicted. Then, based on the distance between the entity translation vector corresponding to the predicted tail entity obtained after the translation transformation according to the head-tail entity relationship and the proxy tail entity, the probability of the triplet to be predicted is calculated and output. The knowledge graph embedding model can use an activation function to calculate the probability of the triplet to be predicted, i.e.,
[0087] As an optional implementation, see [link to implementation details]. Figure 5 As shown in another embodiment of this application, the training process of a knowledge graph embedding model includes:
[0088] S501. Input the sample triples in the sample dataset into the neural network model so that the neural network model can calculate the sample distance between the sample surrogate head entity corresponding to the sample head entity and the sample surrogate tail entity corresponding to the sample tail entity.
[0089] Specifically, in this embodiment, when training the knowledge graph embedding model, the sample triples from the sample dataset are input into the pre-built neural network model so that the neural network model performs the following processing:
[0090] First, the vector parameters are randomly initialized for the sample head entity, the sample head-tail entity relationship, and the sample tail entity in the sample triplet, as well as the auxiliary vectors of the sample head entity and the sample tail entity.
[0091] A sample triple contains a head entity, a head-tail entity relationship, and a tail entity. These are represented as three vectors: h0 for the head entity, r0 for the head-tail entity relationship, and t0 for the tail entity. After receiving the input sample triple, the neural network model needs to generate an auxiliary vector h containing partial information about the head entity h0.a0 and the auxiliary vector t of the sample tail entity containing partial information of the sample tail entity t0 a0 And for the sample head entity h0, the sample head and tail entity relationship r0, the sample tail entity t0, and the auxiliary vector h of the sample head entity. a0 and the auxiliary vector t of the sample tail entity a0 Perform random initialization of the vector parameters. These parameters include the sample head entity h0, the sample head-tail entity relationship r0, the sample tail entity t0, and the auxiliary vector h of the sample head entity. a0 and the auxiliary vector t of the sample tail entity a0 All vectors have the same dimension, and the vector parameters include weights and biases in the neural network model. For example, in y = Wx + b, suppose x is the number in the vector before passing through the network in the neural network model, y is the number in the final vector after the network calculation, and W and b are the vector parameters, which refer to the weight and bias in the neural network model, respectively.
[0092] Second, the auxiliary vectors of the sample head entity and the sample tail entity are interactively fused to obtain the sample proxy head entity corresponding to the sample head entity, and the auxiliary vectors of the sample tail entity and the sample head entity are interactively fused to obtain the sample proxy tail entity corresponding to the sample tail entity.
[0093] The neural network model considers the sample head entity h0, the sample head-tail entity relationship r0, the sample tail entity t0, and the auxiliary vector h of the sample head entity. a0 and the auxiliary vector t of the sample tail entity a0 After randomly initializing the vector parameters, the auxiliary vectors t of the sample head entity h0 and the sample tail entity after random initialization need to be... a0 Interactive fusion is performed to incorporate partial information from the sample tail entity into the sample head entity h0, resulting in the sample proxy head entity corresponding to sample head entity h0. This is achieved by randomly initializing the vector parameters of the sample tail entity t0 and the auxiliary vector h of the sample head entity. a0 Interactive fusion is performed to incorporate partial information from the sample head entity into the sample tail entity t0, resulting in the sample proxy tail entity corresponding to sample tail entity t0. This interactive fusion can be implemented using a projection transformation, i.e., based on the auxiliary vector t of the sample tail entity... a0 Perform a projection transformation on the sample header entity h0 to obtain the sample proxy header entity corresponding to the sample header entity h0. And, based on the auxiliary vector h of the sample head entity a0 Perform a projection transformation on the sample tail entity t0 to obtain the sample surrogate tail entity corresponding to sample tail entity t0.
[0094] Third, calculate the sample distance between the entity obtained by translating the sample surrogate head entity according to the relationship between the sample head and tail entities and the sample surrogate tail entity.
[0095] The neural network model performs head and tail entity interaction fusion on the input sample triples, resulting in a sample proxy head entity that incorporates partial information from the sample tail entities into the sample head entity. Perform a translation transformation based on the head-to-tail entity relationship r0 in the sample triplet. Then, calculate the tail entity of the sample proxy. The sample distance between them, i.e.
[0096] Furthermore, in this embodiment, the sample dataset for training the neural network model is obtained through the following processing:
[0097] Based on the entities in the knowledge graph and the entity relationships between them, construct at least one set of sample triples, and then use the constructed sample triples to form a sample dataset.
[0098] A knowledge graph contains several entities and the entity relationships between them. In this embodiment, at least one set of sample triples can be constructed based on the entities marked in the knowledge graph and the entity relationships between them. The sample dataset is composed of the constructed sample triples.
[0099] S502. Using the sample distance and the loss function in the neural network model, with the goal of minimizing the sample distance and the loss function, the parameters of the neural network model are optimized to obtain the knowledge graph embedding model.
[0100] Specifically, the sample triples contain the fact triples in the knowledge graph. If the sample triples are fact triples, then ideally, the sample proxy head entity can be transformed by translating according to the relationship between the sample head and tail entities to obtain the sample proxy tail entity. Therefore, the smaller the sample distance between the sample proxy head entity after translating according to the relationship between the sample head and tail entities and the sample proxy tail entity, the more accurate the neural network model is.
[0101] When training the neural network model, the entity is obtained by translating the sample proxy head entity h0 according to the sample head-tail entity relationship r0. With sample agent tail entity To perform fitting, i.e. The parameters of the neural network model are optimized with the goal of minimizing the sample distance. These parameters include vector parameters and parameters of each network layer. This embodiment also uses a loss function incorporating negative sampling to optimize the neural network model parameters, simultaneously aiming to minimize both the sample distance and the loss function. During parameter optimization, the sample head entity h0 and its auxiliary vector h are considered. a0 The vector parameters between them are updated synchronously, with the update gradient and update step size being consistent, and the vector parameters between them are not shared; the sample tail entity t0 and the auxiliary vector t of the sample tail entity are updated synchronously. a0 The vector parameters between them are updated synchronously, the update gradient and update step size of the vector parameters are consistent, and the vector parameters between them are not shared.
[0102] When the sample distance and loss function determined by the neural network model meet the preset requirements, the neural network model is considered to have completed training, and the final parameter-optimized neural network model is used as the knowledge graph embedding model. If the sample distance and loss function determined by the neural network model do not meet the preset requirements, the neural network model continues to be iteratively trained using sample triples in the sample dataset. In this embodiment, the loss function corresponding to the neural network model is:
[0103]
[0104] Where, h″ i The sample header entity representing negative sampling, t″ i This represents the tail entity of the negatively sampled sample, γ represents the pre-set hyperparameter, and d r (h0, t0) represents the distance between the head entity h0 and the tail entity t0 of the sample under the head-tail entity relationship r. r (h″ i ,t″ i ) represents the sample head entity h″ of the negative sample under the sample head-tail entity relation r. i Sample tail entity t″ of negative samples i The distance between them, where n represents the total number of negative samples, and 1 / k represents the proportion of the i-th negative sample among all negative samples.
[0105] Corresponding to the knowledge graph completion method described above, this application also proposes a knowledge graph completion device, see [link to relevant documentation]. Figure 6 As shown, the device includes:
[0106] The entity interaction fusion module 100 is used to perform information interaction fusion between the head entity and the tail entity in the triplet to be predicted, so as to obtain the proxy head entity corresponding to the head entity and the proxy tail entity corresponding to the tail entity.
[0107] The triplet prediction module 110 is used to determine the probability of the triplet being true by calculating the difference between the entity obtained by translating the proxy head entity according to the head and tail entity relationship in the triplet to be predicted and the proxy tail entity.
[0108] The knowledge graph completion module 120 is used to complete the knowledge graph using the triplet to be predicted if the probability of the triplet to be predicted is true reaches a preset threshold.
[0109] The knowledge graph completion device proposed in this application utilizes an entity interaction fusion module 100 to perform information interaction fusion between the head entity and the tail entity in the triplet to be predicted, obtaining a proxy head entity corresponding to the head entity and a proxy tail entity corresponding to the tail entity. A triplet prediction module 110 calculates the difference between the entity obtained by translating the proxy head entity according to the head-tail entity relationship in the triplet to be predicted and the proxy tail entity, determining the probability of the triplet being true. If the probability of the triplet being true reaches a preset threshold, the knowledge graph completion module 120 completes the knowledge graph using the triplet. By adopting the technical solution of this embodiment, information interaction fusion between the head entity and the tail entity in the triplet can be achieved. Using the proxy head entity and proxy tail entity after entity information interaction to determine whether the triplet is true can improve the accuracy of fact triplet determination and the accuracy of knowledge graph completion.
[0110] As an optional implementation, another embodiment of this application also discloses that the entity interaction fusion module 100 is specifically used for:
[0111] Based on the head entity and tail entity in the triplet to be predicted, generate auxiliary vectors for the head entity and tail entity respectively.
[0112] The auxiliary vectors of the head entity and the tail entity are interactively fused to obtain the proxy head entity corresponding to the head entity, and the auxiliary vectors of the tail entity and the head entity are interactively fused to obtain the proxy tail entity corresponding to the tail entity.
[0113] The auxiliary vector of the head entity contains information about the head entity, and the auxiliary vector of the tail entity contains information about the tail entity.
[0114] As an optional implementation, another embodiment of this application also discloses that the entity interaction fusion module 100 interacts and fuses the auxiliary vectors of the head entity and the tail entity to obtain the proxy head entity corresponding to the head entity, and interacts and fuses the auxiliary vectors of the tail entity and the head entity to obtain the proxy tail entity corresponding to the tail entity, including:
[0115] The head entity is projected onto the auxiliary vector of the tail entity to obtain the proxy head entity corresponding to the head entity, and the tail entity is projected onto the auxiliary vector of the head entity to obtain the proxy tail entity corresponding to the tail entity.
[0116] As an optional implementation, another embodiment of this application also discloses that the triplet prediction module 110 is specifically used for:
[0117] Based on the head and tail entity relationship in the triplet to be predicted, the proxy head entity is translated to obtain the entity translation vector.
[0118] Calculate the distance between the entity translation vector and the surrogate tail entity;
[0119] The probability of the predicted triple is calculated based on the distance between the entity translation vector and the surrogate tail entity.
[0120] As an optional implementation, another embodiment of this application also discloses that the knowledge graph completion device of this embodiment further includes: a triplet determination module, used to randomly combine triplets of entities in the knowledge graph and entity relationships between entities, and to take triplets that do not exist in the knowledge graph as triplets to be predicted.
[0121] As an optional implementation, another embodiment of this application also discloses that the entity interaction fusion module 100 and the triple prediction module 110 are specifically used for:
[0122] The triple to be predicted is input into a pre-trained knowledge graph embedding model, which then performs information interaction and fusion between the head entity and the tail entity in the triple to be predicted, to obtain the proxy head entity corresponding to the head entity and the proxy tail entity corresponding to the tail entity. The probability of the triple to be predicted is determined by calculating the difference between the entity obtained by translating the proxy head entity according to the head and tail entity relationship in the triple to be predicted and the proxy tail entity.
[0123] As an optional implementation, another embodiment of this application also discloses that the knowledge graph completion device of this embodiment further includes: a model training module.
[0124] The model training module is specifically used for:
[0125] The sample triples from the sample dataset are input into the neural network model, which then performs the following processing: For the sample head entity, the sample head-tail entity relationship, and the sample tail entity in the sample triples, as well as the auxiliary vectors of the sample head entity and the sample tail entity, the vector parameters are randomly initialized; the auxiliary vectors of the sample head entity and the sample tail entity are interactively fused to obtain the sample surrogate head entity corresponding to the sample head entity, and the auxiliary vectors of the sample tail entity and the sample head entity are interactively fused to obtain the sample surrogate tail entity corresponding to the sample tail entity; the sample distance between the entity obtained by translating the sample surrogate head entity according to the sample head-tail entity relationship and the sample surrogate tail entity is calculated.
[0126] By utilizing sample distance and the loss function in the neural network model, with the goal of minimizing sample distance and the loss function, the parameters of the neural network model are optimized to obtain a knowledge graph embedding model.
[0127] Specifically, when optimizing the parameters of the neural network model, the vector parameter update step size between the sample head entity and the auxiliary vector of the sample head entity is consistent and the vector parameters are not shared, and the vector parameter update step size between the sample tail entity and the auxiliary vector of the sample tail entity is consistent and the vector parameters are not shared.
[0128] As an optional implementation, another embodiment of this application also discloses that the model training module interactively fuses the auxiliary vectors of the sample head entity and the sample tail entity to obtain the sample proxy head entity corresponding to the sample head entity, and interactively fuses the auxiliary vectors of the sample tail entity and the sample head entity to obtain the sample proxy tail entity corresponding to the sample tail entity, including:
[0129] The sample head entity is transformed by projection based on the auxiliary vector of the sample tail entity to obtain the sample proxy head entity corresponding to the sample head entity. The sample tail entity is transformed by projection based on the auxiliary vector of the sample head entity to obtain the sample proxy tail entity corresponding to the sample tail entity.
[0130] As an optional implementation, another embodiment of this application also discloses a model training module, which is further used to construct at least one set of sample triples based on entities in the knowledge graph and the entity relationships between entities, and to form a sample dataset from the constructed sample triples.
[0131] The knowledge graph completion device provided in this embodiment belongs to the same application concept as the knowledge graph completion method provided in the above embodiments of this application. It can execute the knowledge graph completion method provided in any of the above embodiments of this application and has the corresponding functional modules and beneficial effects of executing the knowledge graph completion method. Technical details not described in detail in this embodiment can be found in the specific processing content of the knowledge graph completion method provided in the above embodiments of this application, and will not be repeated here.
[0132] Another embodiment of this application discloses an electronic device, see [link to relevant documentation] Figure 7 As shown, the device includes:
[0133] Memory 200 and processor 210:
[0134] The memory 200 is connected to the processor 210 and is used to store programs;
[0135] The processor 210 is configured to implement the knowledge graph completion method disclosed in any of the above embodiments by running the program stored in the memory 200.
[0136] Specifically, the aforementioned electronic device may also include: a bus, a communication interface 220, an input device 230, and an output device 240.
[0137] The processor 210, memory 200, communication interface 220, input device 230, and output device 240 are interconnected via a bus. Among them:
[0138] A bus can include a pathway for transmitting information between various components of a computer system.
[0139] The processor 210 can be a general-purpose processor, such as a general-purpose central processing unit (CPU), a microprocessor, etc., or an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the program of the present invention. It can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0140] Processor 210 may include a main processor, as well as a baseband chip, modem, etc.
[0141] The memory 200 stores a program that executes the technical solution of this invention, and may also store an operating system and other key business functions. Specifically, the program may include program code, which includes computer operation instructions. More specifically, the memory 200 may include read-only memory (ROM), other types of static storage devices capable of storing static information and instructions, random access memory (RAM), other types of dynamic storage devices capable of storing information and instructions, disk storage, flash memory, etc.
[0142] Input device 230 may include a device for receiving user input data and information, such as a keyboard, mouse, camera, scanner, light pen, voice input device, touch screen, pedometer, or gravity sensor.
[0143] Output device 240 may include devices that allow information to be output to a user, such as a display screen, printer, speaker, etc.
[0144] The communication interface 220 may include a device that uses any transceiver to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Network (WLAN), etc.
[0145] The processor 2102 executes the program stored in the memory 200 and calls other devices, which can be used to implement the various steps of the knowledge graph completion method provided in the embodiments of this application.
[0146] Another embodiment of this application provides a storage medium storing a computer program, which, when executed by a processor, implements the various steps of the knowledge graph completion method provided in any of the above embodiments.
[0147] For the foregoing method embodiments, in order to simplify the description, they are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0148] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For apparatus embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0149] The steps in the methods of the various embodiments of this application can be adjusted, combined, or deleted according to actual needs.
[0150] The modules and sub-modules in the various embodiments of the present application's devices and terminals can be merged, divided, and deleted according to actual needs.
[0151] It should be understood that the disclosed terminals, devices, and methods can be implemented in other ways, given the several embodiments provided in this application. For example, the terminal embodiments described above are merely illustrative. For instance, the division of modules or sub-modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple sub-modules or modules may be combined or integrated into another module, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or modules, and may be electrical, mechanical, or other forms.
[0152] The modules or submodules described as separate components may or may not be physically separate. The components that constitute a module or submodule may or may not be physical modules or submodules; that is, they may be located in one place or distributed across multiple network modules or submodules. Some or all of the modules or submodules can be selected to achieve the purpose of this embodiment's solution, depending on actual needs.
[0153] Furthermore, the functional modules or sub-modules in the various embodiments of this application can be integrated into one processing module, or each module or sub-module can exist physically separately, or two or more modules or sub-modules can be integrated into one module. The integrated modules or sub-modules described above can be implemented in hardware or in the form of software functional modules or sub-modules.
[0154] 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.
[0155] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software unit executed by a processor, or a combination of both. The software unit 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.
[0156] 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.
[0157] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A knowledge graph completion method, characterized in that, include: A pre-trained knowledge graph embedding model generates auxiliary vectors for the head and tail entities in the triplet to be predicted, respectively. The auxiliary vector for the head entity contains information about the head entity, and the auxiliary vector for the tail entity contains information about the tail entity. The triplet to be predicted is obtained by randomly combining entities and their relationships within the knowledge graph. The knowledge graph is a relational network formed by connecting different types of information. It includes nodes and edges, where nodes represent entities existing in the real world, and edges represent relationships between entities. The head entity, tail entity, and entity relationships in the triplet to be predicted are extracted from knowledge text related to the knowledge graph. The auxiliary vectors of the head entity and the tail entity are interactively fused through the knowledge graph embedding model to obtain the proxy head entity corresponding to the head entity, and the auxiliary vectors of the tail entity and the head entity are interactively fused to obtain the proxy tail entity corresponding to the tail entity. The probability of the triplet being predicted being true is determined by calculating the difference between the entity obtained by translating the proxy head entity according to the head and tail entity relationship in the triplet to be predicted and the proxy tail entity. If the probability of the predicted triplet being true reaches a preset threshold, the predicted triplet is used to complete the knowledge graph.
2. The method of claim 1, wherein, The process involves interactively fusing the auxiliary vectors of the head entity and the tail entity to obtain a proxy head entity corresponding to the head entity, and interactively fusing the auxiliary vectors of the tail entity and the head entity to obtain a proxy tail entity corresponding to the tail entity, including: The head entity is projected and transformed based on the auxiliary vector of the tail entity to obtain the proxy head entity corresponding to the head entity; and the tail entity is projected and transformed based on the auxiliary vector of the head entity to obtain the proxy tail entity corresponding to the tail entity.
3. The method according to claim 1, characterized in that, The probability of the predicted triple being true is determined by calculating the difference between the entity obtained by translating the surrogate head entity according to the head-tail entity relationship in the predicted triple and the surrogate tail entity, including: Based on the head and tail entity relationship in the triplet to be predicted, the proxy head entity is translated to obtain the entity translation vector. Calculate the distance between the entity translation vector and the proxy tail entity; The probability of the predicted triplet being true is calculated based on the distance between the entity translation vector and the surrogate tail entity.
4. The method of claim 1, wherein, The triplet to be predicted is obtained through the following processing: The entities in the knowledge graph and the entity relationships between them are randomly combined into triples. The triples that do not exist in the knowledge graph are used as triples to be predicted.
5. The method of claim 1, wherein, Based on the head and tail entities in the triplet to be predicted, a pre-trained knowledge graph embedding model generates auxiliary vectors for the head entity and the tail entity, respectively. The knowledge graph embedding model then interacts and fuses the auxiliary vectors of the head and tail entities to obtain a proxy head entity. Similarly, the knowledge graph embedding model interacts and fuses the auxiliary vectors of the tail entity to obtain a proxy tail entity. The probability of the triplet to be predicted being true is determined by calculating the difference between the entity obtained by translating the proxy head entity according to the head-tail entity relationship in the triplet to be predicted and the proxy tail entity. This includes: The triplet to be predicted is input into a pre-trained knowledge graph embedding model. The knowledge graph embedding model generates auxiliary vectors for the head entity and the tail entity respectively based on the head entity and tail entity in the triplet to be predicted. The auxiliary vectors of the head entity and the tail entity are interactively fused to obtain the surrogate head entity corresponding to the head entity. The auxiliary vectors of the tail entity and the head entity are interactively fused to obtain the surrogate tail entity corresponding to the tail entity. Finally, the probability of the triplet to be predicted being true is determined by calculating the difference between the entity obtained by translating the surrogate head entity according to the head-tail entity relationship in the triplet to be predicted and the surrogate tail entity.
6. The method of claim 5, wherein, The training process of the knowledge graph embedding model includes: The sample triples from the sample dataset are input into a neural network model, which then performs the following processing: For the sample head entity, sample head-tail entity relationship, and sample tail entity in the sample triples, as well as the auxiliary vectors of the sample head entity and sample tail entity, the vector parameters are randomly initialized; the auxiliary vectors of the sample head entity and the sample tail entity are interactively fused to obtain the sample proxy head entity corresponding to the sample head entity; and the auxiliary vectors of the sample tail entity and the sample head entity are interactively fused to obtain the sample proxy tail entity corresponding to the sample tail entity; the sample distance between the entity obtained by translating the sample proxy head entity according to the sample head-tail entity relationship and the sample proxy tail entity is calculated. By utilizing the sample distance and the loss function in the neural network model, with the goal of minimizing the sample distance and the loss function, the parameters of the neural network model are optimized to obtain a knowledge graph embedding model; Specifically, when optimizing the parameters of the neural network model, the vector parameter update step size between the sample head entity and the auxiliary vector of the sample head entity is consistent and the vector parameters are not shared, and the vector parameter update step size between the sample tail entity and the auxiliary vector of the sample tail entity is consistent and the vector parameters are not shared.
7. The method of claim 6, wherein, The process involves interactively fusing the auxiliary vectors of the sample head entity and the sample tail entity to obtain the sample proxy head entity corresponding to the sample head entity, and interactively fusing the auxiliary vectors of the sample tail entity and the sample head entity to obtain the sample proxy tail entity corresponding to the sample tail entity, including: The sample head entity is projected and transformed based on the auxiliary vector of the sample tail entity to obtain the sample proxy head entity corresponding to the sample head entity; and the sample tail entity is projected and transformed based on the auxiliary vector of the sample head entity to obtain the sample proxy tail entity corresponding to the sample tail entity.
8. The method of claim 6, wherein, The sample dataset was obtained through the following processing: Based on the entities in the knowledge graph and the entity relationships between them, at least one set of sample triples is constructed, and the constructed sample triples form a sample dataset.
9. A knowledge graph completion apparatus, characterized in that, include: The entity interaction fusion module is used to generate auxiliary vectors for the head entity and the tail entity respectively based on the head entity and tail entity in the triplet to be predicted using a pre-trained knowledge graph embedding model. The auxiliary vectors of the head entity and tail entity contain information about the head entity and tail entity, respectively. The triplet to be predicted is obtained by randomly combining entities and entity relationships in the knowledge graph. The knowledge graph is a relational network formed by connecting different types of information. The knowledge graph includes nodes and edges, where nodes represent entities existing in the real world and edges represent relationships between entities. The head entity, tail entity, and entity relationships in the triplet to be predicted are extracted from knowledge text related to the knowledge graph. The knowledge graph embedding model interacts and fuses the auxiliary vectors of the head entity and tail entity to obtain a proxy head entity corresponding to the head entity, and interacts and fuses the auxiliary vectors of the tail entity and head entity to obtain a proxy tail entity corresponding to the tail entity. The triplet prediction module is used to determine the probability that the triplet to be predicted is true by calculating the difference between the entity obtained by translating the proxy head entity according to the head and tail entity relationship in the triplet to be predicted and the proxy tail entity. The knowledge graph completion module is used to complete the knowledge graph using the triplet to be predicted if the probability of the triplet to be predicted being true reaches a preset threshold.
10. An electronic device, comprising: include: Memory and processor; The memory is connected to the processor and is used to store programs; The processor is configured to implement the knowledge graph completion method as described in any one of claims 1 to 8 by running the program in the memory.
11. A storage medium, characterized by The storage medium stores a computer program, which, when executed by a processor, implements the knowledge graph completion method as described in any one of claims 1 to 8.