Method for completing knowledge graph based on potential neighbor perception
By constructing a global knowledge graph based on latent neighbor perception and extracting implicit association features, this method solves the problems of noisy learning and insufficient single triples caused by multi-layer graph convolutional networks, and achieves efficient knowledge graph completion and improved accuracy.
Patent Information
- Application Number
- CN202511254379.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-04
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2045-09-04
AI Technical Summary
In existing knowledge graph completion methods, the superposition of multi-layer graph convolutional networks easily learns a large amount of useless noise knowledge, making it difficult to combine remote entity features to optimize the embedding representation of entities and relationships, resulting in low training efficiency and poor model performance. At the same time, considering only a single triple makes it difficult to capture the complex semantic relationships between entities, reducing the accuracy and generalization ability of completion.
By acquiring existing knowledge graphs, determining the neighborhood similarity between entities, constructing a global knowledge graph, extracting implicit association features, generating embedding vectors for entities and relations, and combining entity, relation, and contextual information to determine the score of the completion triples, knowledge graph completion is performed, avoiding overfitting of multi-layer graph convolutional networks, and optimizing the embedding representation of entities and relations using latent neighbor perception.
It effectively reduces the waste of computing resources, improves the accuracy and generalization ability of knowledge graph completion, ensures the consistency and rationality of information between the completed triples and the original knowledge graph, and optimizes the use of computing resources.
Smart Images

Figure CN120806099B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present disclosure relate to the technical field of knowledge graph completion, and in particular to a knowledge graph completion method based on latent neighbor perception. BACKGROUND
[0002] As a highly structured and semantically rich knowledge representation form, knowledge graphs have been widely applied in academic and industrial fields, covering a variety of intelligent applications such as link prediction, intelligent question answering, recommendation systems, information retrieval, and natural language processing. However, the facts in the real world are usually complex and dynamically changing, which makes the existing knowledge graphs often incomplete in practical applications. At present, when completing the knowledge graph, the commonly used methods are: embedding-based methods and graph structure information-based methods. The embedding-based method embeds entities and relationships into a low-dimensional vector space, and determines the score of the triple through specific mathematical logic or complex neural network layers to evaluate the rationality of the triple. The graph structure information-based method uses an encoder-decoder architecture, the encoder uses the graph structure information to optimize and update the embedding of entities and relationships, and the decoder is based on the traditional embedding method to infer and predict the incomplete knowledge graph based on the reinforced embedding, thereby completing the knowledge graph completion task.
[0003] However, when the above methods are used to complete the knowledge graph, the following technical problems often exist:
[0004] First, the multi-layer graph convolution network is easy to learn a large amount of useless noise knowledge, and it is difficult to combine remote entity features to optimize the embedding representation of entities and relationships, thereby affecting the training efficiency and the performance of the model, and further causing waste of computing resources;
[0005] Second, the embedding-based method usually only considers a single triple, and it is difficult to fully capture the complex semantic association between entities, and the direction and distribution characteristics of the entity adjacency relationship are not fully utilized, thereby reducing the accuracy and generalization ability of the knowledge graph completion.
[0006] The above information disclosed in this BACKGROUND section is only for the purpose of enhancing the understanding of the background of the present disclosure and, therefore, can include information that does not form the prior art known to those of ordinary skill in the art in the country. SUMMARY
[0007] The summary of the present disclosure is intended to introduce the concepts in a simplified form, which will be described in detail in the following detailed description. The summary of the present disclosure is not intended to identify key or essential features of the claimed technology, nor is it intended to be used to limit the scope of the claimed technology.
[0008] Some embodiments of the present disclosure propose a knowledge graph completion method based on potential neighbor awareness to solve one or more of the technical problems mentioned in the background section.
[0009] In a first aspect, some embodiments of the present disclosure provide a knowledge graph completion method based on potential neighbor awareness, which comprises: obtaining an existing knowledge graph from a database, wherein the existing knowledge graph comprises an entity set, a relation set and a triple set, a triple is an ordered group composed of a head entity, a relation and a tail entity, the head entity and the tail entity belong to the entity set, and the relation belongs to the relation set; determining the neighborhood similarity between each two entities in the entity set to obtain an entity neighborhood similarity set; determining a knowledge graph global graph corresponding to the existing knowledge graph according to the entity neighborhood similarity set; extracting implicit association features from the knowledge graph global graph to obtain an entity embedding vector set and a relation embedding vector set; determining the score of each completed triple in the completed triple set according to the entity embedding vector set and the relation embedding vector set, to obtain a completed triple score set, wherein a completed triple is a triple composed of an entity in the entity set and a relation in the relation set, and the completed triple is not included in the triple set; completing the existing knowledge graph according to the completed triple corresponding to each completed triple score in the completed triple score set that satisfies a preset condition to obtain an updated knowledge graph, and replacing the existing knowledge graph in the database with the updated knowledge graph.
[0010] In a second aspect, some embodiments of the present disclosure provide a potential neighbor-aware knowledge graph completion device, the device comprising: an acquisition unit configured to acquire an existing knowledge graph from a database, wherein the existing knowledge graph comprises an entity set, a relation set and a triple set, the triple is an ordered group composed of a head entity, a relation and a tail entity, the head entity and the tail entity belong to the entity set, and the relation belongs to the relation set; a first determination unit configured to determine the neighborhood similarity between each two entities in the entity set to obtain an entity neighborhood similarity set; a second determination unit configured to determine a knowledge graph global graph corresponding to the existing knowledge graph according to the entity neighborhood similarity set; an implicit association feature extraction unit configured to perform implicit association feature extraction on the knowledge graph global graph to obtain an entity embedding vector set and a relation embedding vector set; a third determination unit configured to determine the score of each completed triple in a completed triple set according to the entity embedding vector set and the relation embedding vector set, to obtain a completed triple score set, wherein the completed triple is a triple composed of an entity in the entity set and a relation in the relation set, and the completed triple is not included in the triple set; and a completion unit configured to complete the existing knowledge graph according to the completed triple corresponding to each completed triple score in the completed triple score set that satisfies a preset condition to obtain an updated knowledge graph, and replace the existing knowledge graph in the database with the updated knowledge graph.
[0011] In a third aspect, some embodiments of the present disclosure provide an electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon, when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the implementations of the first aspect.
[0012] In a fourth aspect, some embodiments of the present disclosure provide a computer readable medium having a computer program stored thereon, wherein the program is executed by a processor to implement the method described in any of the implementations of the first aspect.
[0013] The above various embodiments of the present disclosure have the following beneficial effects: by using the knowledge graph completion method based on potential neighbor awareness of some embodiments of the present disclosure, the waste of computing resources can be avoided. Specifically, the reason for the waste of computing resources is that the multi-layer graph convolution network superposition is easy to learn a large amount of useless noise knowledge, and it is difficult to combine the remote entity features to optimize the embedding representation of entities and relationships, thereby affecting the training efficiency and the performance of the model. Based on this, the knowledge graph completion method based on potential neighbor awareness of some embodiments of the present disclosure first acquires an existing knowledge graph from a database. The existing knowledge graph includes an entity set, a relationship set and a triple set. The triple is an ordered group composed of a head entity, a relationship and a tail entity. The head entity and the tail entity belong to the entity set, and the relationship belongs to the relationship set. Second, the neighborhood similarity between each two entities in the entity set is determined to obtain an entity neighborhood similarity set. In this way, the neighborhood features of the entities can be determined according to the neighborhood of the entities, and it is determined whether two non-directly connected entities have similar neighborhood features, thereby helping to discover remote entities in the knowledge graph that are similar in neighborhood features. Then, according to the entity neighborhood similarity set, a knowledge graph global graph corresponding to the existing knowledge graph is determined. By constructing the knowledge graph global graph, the complex relationships between multiple entities can be described. Then, the knowledge graph global graph is subjected to implicit association feature extraction to obtain an entity embedding vector set and a relationship embedding vector set. By extracting features from the global graph constructed in the previous step, the entity embedding is updated to complete the entity embedding reinforcement, which can avoid overfitting of the multi-layer graph convolution network and reduce the influence of noise on the performance of the model. Then, according to the entity embedding vector set and the relationship embedding vector set, the score of each completed triple in the completed triple set is determined to obtain a completed triple score set. The completed triple is a triple composed of an entity in the entity set and a relationship in the relationship set, and the completed triple is not included in the triple set. The score of the completed triple is determined by combining entity, relationship and context information, which can effectively learn the semantic association between entities and help to further improve the quality of the completion result, ensuring the consistency and rationality of the final completed triple with the information in the original knowledge graph. Finally, according to the completed triple corresponding to each completed triple score in the completed triple score set that satisfies a preset condition, the existing knowledge graph is completed to obtain an updated knowledge graph, and the updated knowledge graph is used to replace the existing knowledge graph in the database. By using the completed triple score set to fill in the blanks in the knowledge graph, the graph is more complete, and at the same time, the noise interference is reduced and the use of computing resources is optimized. BRIEF DESCRIPTION OF DRAWINGS
[0014] The above-described and other features, advantages, and aspects of the embodiments of the present disclosure will become more apparent as various embodiments of the present disclosure are described in conjunction with the following detailed description, which, taken in conjunction with the drawings, can illustrate certain embodiments of the disclosure. Throughout the drawings, like reference numbers can designate like elements. It should be understood that the drawings are schematic and elements and features can not be necessarily drawn to scale.
[0015] Figure 1 is a flowchart of some embodiments of the potential neighbor-aware knowledge graph completion method according to the present disclosure;
[0016] Figure 2 is a visual flowchart of some embodiments of the potential neighbor-aware knowledge graph completion method according to the present disclosure;
[0017] Figure 3 is a type induction-based similarity generation diagram of some embodiments of the potential neighbor-aware knowledge graph completion method according to the present disclosure;
[0018] Figure 4 is a relation direction subgraph-based similarity generation diagram of some embodiments of the potential neighbor-aware knowledge graph completion method according to the present disclosure;
[0019] Figure 5 is a tensor compression diagram of some embodiments of the potential neighbor-aware knowledge graph completion method according to the present disclosure;
[0020] Figure 6 is a hypergraph and its corresponding adjacency matrix diagram of some embodiments of the potential neighbor-aware knowledge graph completion method according to the present disclosure;
[0021] Figure 7 is a structural diagram of some embodiments of the potential neighbor-aware knowledge graph completion apparatus according to the present disclosure;
[0022] Figure 8 is a structural diagram of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION
[0023] Embodiments of the present disclosure will be described more fully hereinafter with reference to the accompanying drawings. While several embodiments of the present disclosure can be implemented in various forms, the present disclosure should not be construed as being limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and fully convey the scope of the present disclosure to those skilled in the art. It should be understood that the drawings and embodiments are only for illustrative purposes and should not be construed as limiting the scope of the present disclosure.
[0024] In addition, it needs to be noted that only parts related to the present application are shown in the drawings for the convenience of description. The embodiments in the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0025] It should be noted that the concepts of "first", "second", etc. mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0026] It should be noted that the modification of "one" or "multiple" mentioned in the present disclosure is illustrative and not restrictive, and those skilled in the art should understand that unless the context clearly indicates otherwise, it should be understood as "one or more".
[0027] The names of the messages or information exchanged between the plurality of devices in the embodiments of the present disclosure are only for illustrative purposes, and are not used to limit the scope of the messages or information.
[0028] The present disclosure will be described in detail below with reference to the drawings and in conjunction with embodiments.
[0029] Figure 1 Flow 100 of some embodiments of the knowledge graph completion method based on potential neighbor perception according to the present disclosure is shown. The knowledge graph completion method based on potential neighbor perception includes the following steps:
[0030] Step 101, obtaining an existing knowledge graph from a database.
[0031] In some embodiments, the execution subject of the knowledge graph completion method based on potential neighbor perception can obtain an existing knowledge graph from a database. The above-mentioned database can be a database deployed by a local device, or a cloud database. The above-mentioned existing knowledge graph contains an entity set, a relationship set and a triple set. Each triple in the above-mentioned triple set is an ordered group composed of a head entity, a relationship and a tail entity. A triple can be used to describe a fact. The above-mentioned head entity and tail entity belong to the above-mentioned entity set, and the above-mentioned relationship belongs to the above-mentioned relationship set. An entity refers to a thing in the real world, such as a person, a place name, a concept, etc., and a relationship is used to represent a certain connection between different entities. For example, the triple corresponding to the fact "the Earth is located in the solar system" is: {"Earth", "is located in", "solar system"}. Among them, "Earth" is the head entity, "solar system" is the tail entity, and "is located in" is the relationship between the two entities.
[0032] Each entity in the entity set corresponds to an initial semantic feature. Each relationship in the relationship set corresponds to an initial relationship feature. The initial semantic feature and the initial relationship feature can be generated by performing semantic embedding on each entity in the entity set and each relationship in the relationship set through a preset semantic embedding algorithm, to obtain an initial semantic feature set and an initial relationship feature set.
[0033] As an example, the semantic embedding algorithm can include, but is not limited to, at least one of the following: a BERT (Bidirectional Encoder Representations from Transformers) algorithm, an ELMo (Embeddings from Language Models) algorithm, and the like.
[0034] In practice, the existing knowledge graph has a missing triple situation, and therefore needs to be completed. A visualization flowchart of the completion is shown in FIG. 1. Figure 2 The first subgraph on the left in the figure represents the existing knowledge graph. The second subgraph represents remote entities with implicit associations in different colors. The third subgraph represents different hyper-edges established in different color blocks. The fourth subgraph represents the process of updating the knowledge graph with arrows of different colors.
[0035] In step 102, the neighborhood similarity between each two entities in the entity set is determined to obtain a neighborhood similarity set.
[0036] In some embodiments, the execution subject can determine the neighborhood similarity between each two entities in the entity set to obtain a neighborhood similarity set.
[0037] In some optional implementations of some embodiments, the execution subject determines the neighborhood similarity between each two entities in the entity set to obtain a neighborhood similarity set, which can include the following steps:
[0038] First, neighborhood entity feature extraction is performed on each entity in the entity set to generate a neighborhood entity feature vector, to obtain a neighborhood entity feature vector set. First, the neighbor entities and neighbor relationships directly connected to the entity can be determined as the neighborhood of the entity. Specifically, for each entity in the entity set, the relationship and entity in each triple containing the current entity in the triple set can be determined as the neighbor relationship and neighbor entity of the current entity, to obtain a neighbor entity set and a neighbor relationship set of the current entity. Second, neighborhood entity feature extraction can be performed on the entity to generate a neighborhood entity feature vector through the following formula. .
[0039] wherein, represents the entity The feature vector of the neighboring entities. This represents the activation function. Representing entities The set of neighboring entities, Representing entities The neighboring entities. This represents the learnable parameter matrix used for feature extraction of neighboring entities. Representing neighboring entities The initial semantic features. The above. It is not used to limit an entity to its neighboring entities.
[0040] The second step involves extracting neighborhood relationship features for each entity in the aforementioned entity set to generate a relationship feature vector, resulting in a set of relationship feature vectors. This can be achieved using the following formula to extract neighborhood relationship features from entities and generate the relationship feature vectors.
[0041] .
[0042] in, Representing entities The relational feature vector. Representing entities The set of neighbor relationships. Representing entities Neighborly relations This represents the learnable parameter matrix used for neighborhood relation feature extraction. Indicating neighborly relations The initial relational characteristics.
[0043] The third step is to determine the initial semantic features of each entity in the aforementioned entity set, thus obtaining the initial semantic feature set of entities. Specifically, the initial semantic features corresponding to each entity in the aforementioned entity set can be determined as the initial semantic features of the entities, resulting in the initial semantic feature set of entities.
[0044] Fourth, based on the aforementioned neighborhood entity feature vector set, relation feature vector set, and initial semantic feature set of entities, determine the entity neighborhood similarity between each entity in the entity set and the remaining entities, thus obtaining the entity neighborhood similarity set. The entity neighborhood similarity between any two entities in the entity set can be determined using the following formula.
[0045] .
[0046] in, Representing entities and entity Type-based inductive similarity between entity neighborhoods This indicates a similarity generation method based on type induction. denotes a cosine similarity function. , and denotes a sensitivity coefficient for controlling the proportion of similarity corresponding to the neighborhood entity feature vector, the relationship feature vector, and the entity initial semantic feature, which is a learnable parameter.
[0047] In practice, the above first to fourth steps can be referred to as a type induction-based similarity generation method, a schematic diagram of which is shown in Figure 3 . The white nodes in the figure represent entities u . The green nodes represent the neighbor nodes of the entity u . The blue lines directly connected to the white nodes represent the neighbor relationships of the entity . The green and blue columnar contents in the figure represent the neighborhood entity features and relationship features, respectively. u In some other optional implementations of some embodiments, the above step of determining the neighborhood similarity between each two entities in the entity set by the execution subject can further include the following steps:
[0048] First, relationship attribute features of each entity in the entity set are extracted to generate in-edge relationship attribute features and out-edge relationship attribute features, and in-edge relationship attribute feature sets and out-edge relationship attribute feature sets are obtained. The in-edge relationship attribute features and the out-edge relationship attribute features can be used as the adjacency relationship attribute features of the entity together to represent the directionality and distribution characteristics of the entity adjacency relationship.
[0049] Optionally, for each entity in the entity set, the following relationship attribute feature extraction steps can be performed to generate in-edge relationship attribute features and out-edge relationship attribute features, and in-edge relationship attribute feature sets and out-edge relationship attribute feature sets are obtained:
[0050] Optionally, for each entity in the entity set, the following relationship attribute feature extraction steps can be performed to generate in-edge relationship attribute features and out-edge relationship attribute features, and in-edge relationship attribute feature sets and out-edge relationship attribute feature sets are obtained:
[0051] First sub-step, the head entity and the relationship in each triple whose tail entity is the entity in the triple set are determined as the in-edge group, and the in-edge group set is obtained. The in-edge group set is also referred to as the in-edge subgraph of the entity, as shown in the in-edge subgraph in Figure 4 . The in-edge subgraph can be represented as: .
[0052] wherein, denotes the in-edge subgraph of the entity . represents the in-edge adjacency relationship. denotes the in-edge group of the entity . denotes the head entity , and the relationship and tail entities triples. denotes the set of above triples.
[0053] Second sub-step, determine the head entity, the relation and the tail entity in each triple of the set of above triples as the out-edge group, and obtain the set of out-edge groups. The set of out-edge groups is also called the out-edge subgraph of the entity, as shown in the out-edge subgraph of the entity in Figure 4 . The out-edge subgraph can be represented as: .
[0054] wherein, denotes the out-edge subgraph of the entity , which represents the adjacent relationship as the out-edge. denotes the out-edge group of the entity . denotes the triple composed of the head entity , the relation and the tail entity .
[0055] Third sub-step, determine the in-edge direction perception vector and the out-edge direction perception vector corresponding to the entity. The in-edge direction perception vector and the out-edge direction perception vector corresponding to the entity can be determined by the following formula.
[0056] .
[0057] wherein, denotes the in-edge direction perception vector or the out-edge direction perception vector of the entity. represents different directions of the entity adjacent relationship, represents the relation as the in-edge, represents the relation as the out-edge. When dir is i, denotes the in-edge direction perception vector. When dir is o, denotes the out-edge direction perception vector. denotes the preset adjacent direction perception vector. The element value of the adjacent direction perception vector can be set randomly. denotes the Hadamard product. denotes the learnable parameter matrix for determining the direction perception vector. denotes the bias parameter vector for determining the direction perception vector.
[0058] A fourth sub-step, determining the in-edge relationship distribution perception vector and the out-edge relationship distribution perception vector of the entity according to the in-edge group set and the out-edge group set. Wherein, firstly, the existing knowledge graph can be regarded as a three-dimensional binary tensor, the dimension of which is AxBxA. Here, A represents the number of entities in the entity set contained in the existing knowledge graph, and B represents the number of relationships in the relationship set. The basic unit of the tensor represents whether a triple is a fact. For example, T hrt =1 represents that there is a relationship r between the head entity h and the tail entity t, and the relationship direction is from h to t. Secondly, the tensor can be compressed by the following formula to obtain the in-edge matrix and the out-edge matrix.
[0059] .
[0060] Wherein, represents the in-edge matrix. represents the out-edge matrix. and represent a three-dimensional binary tensor with a dimension of AxBxA. , .
[0061] In practice, the relationship distribution features around each entity can be obtained by compressing the tensor. When the adjacency relationship of the entity is in-edge, the tensor is compressed in the x-axis direction to obtain the in-edge matrix. When the adjacency relationship of the entity is out-edge, the tensor is compressed in the z-axis direction to obtain the out-edge matrix, as shown in the tensor compression diagram. Figure 5 .
[0062] Then, the in-edge matrix and the out-edge matrix can be normalized by the following formula to obtain the normalized in-edge matrix and the normalized out-edge matrix.
[0063] .
[0064] Wherein, represents the normalized in-edge matrix or the normalized out-edge matrix. When dir is i, the v-th row of represents the in-edge relationship distribution perception vector of entity v as the tail entity; when dir is o, the v-th row of represents the out-edge relationship distribution perception vector of entity v as the head entity, denoted as .
[0065] In the fifth sub-step, the in-edge relationship attribute feature and the out-edge relationship attribute feature corresponding to the entity are determined according to the above-mentioned in-edge direction perception vector, the above-mentioned out-edge direction perception vector, the above-mentioned in-edge relationship distribution perception vector, and the above-mentioned out-edge relationship distribution perception vector. The in-edge relationship attribute feature and the out-edge relationship attribute feature corresponding to the entity can be determined by the following formula.
[0066] .
[0067] wherein, represents the in-edge relationship attribute feature or the out-edge relationship attribute feature of the entity . represents a fusion weight parameter vector, wherein each element ranges between (0, 1). is a learnable parameter matrix for determining the relationship attribute feature, and the dimension of the relationship distribution perception vector can be transformed into d dimensions. is a bias parameter vector for determining the relationship attribute feature.
[0068] The first sub-step to the fifth sub-step and the related content thereof are an invention point of an embodiment of the present disclosure, and solve the second technical problem that the accuracy and generalization ability of the knowledge graph completion are reduced. The factors that cause the above-mentioned technical problem are usually as follows: the embedding-based method usually only considers a single triple, and it is difficult to fully capture the complex semantic association between entities, and the direction and distribution characteristics of the entity adjacency relationship are not fully utilized. If the above-mentioned factors are solved, the accuracy and generalization ability of the knowledge graph completion can be improved. In order to achieve this effect, first, the knowledge graph is modeled as a graph, and according to the directionality of the entity adjacency relationship, the local graph is divided into an in-edge subgraph and an out-edge subgraph. Secondly, according to the in-edge subgraph and the out-edge subgraph, the adjacency relationship attribute feature of the entity is determined. The adjacency relationship attribute feature of the entity can be used to represent the directionality and distribution characteristics of the entity adjacency relationship. The directionality of the relationship helps to distinguish different semantic spaces corresponding to different positions of the entity in the triple, and the distribution characteristics of the relationship help the model to learn the attributes and categories of the entity. The adjacency relationship attribute feature of the entity plays a role in reinforcing the embedding in the entity neighborhood feature extraction, utilizes richer local structure information of the entity in the entity aggregation, expands the information source in the entity aggregation, enhances the entity representation, and thus can better capture the local structure information of the entity. Therefore, by extracting the directionality and distribution characteristics of the entity adjacency relationship, the accuracy and generalization ability of the knowledge graph completion can be effectively improved.
[0069] In the second step, for each entity in the above-mentioned entity set, the following neighborhood feature extraction step is performed to generate the entity neighborhood feature, and the entity neighborhood feature set is obtained:
[0070] The first sub-step is to perform subgraph feature extraction on each neighbor entity corresponding to the above entity to generate neighbor in-edge subgraph features and neighbor out-edge subgraph features, to obtain a neighbor in-edge subgraph feature set and a neighbor out-edge subgraph feature set. The neighbor entity can be subjected to subgraph feature extraction to generate neighbor in-edge subgraph features and neighbor out-edge subgraph features by the following formula.
[0071] .
[0072] wherein, denotes the neighbor in-edge subgraph features or the neighbor out-edge subgraph features of the neighbor entity . is a fusion operator of vectors, for fusing three d dimensional vectors into one d dimensional vector. denotes the initial relationship features of the relationship corresponding to the entity and the neighbor entity .
[0073] The second sub-step is to determine the entity neighborhood features according to the above neighbor in-edge subgraph feature set, the above neighbor out-edge subgraph feature set, the in-edge relationship attribute features and the out-edge relationship attribute features corresponding to the above entity. The entity neighborhood features can be determined by the following formula.
[0074] .
[0075] wherein, denotes the entity neighborhood features of the entity . denotes the in-edge subgraph or the out-edge subgraph of the entity , and denotes an ordered group composed of neighbor entities and relationships contained in the in-edge subgraph or the out-edge subgraph. denotes a learnable parameter matrix used for determining the entity neighborhood features. denotes the in-edge relationship attribute features or the out-edge relationship attribute features of the entity .
[0076] The third step is to determine the entity neighborhood similarity between each entity in the above entity set and the remaining entities according to the above entity neighborhood feature set, to obtain an entity neighborhood similarity set. The entity neighborhood similarity between any two entities in the above entity set can be determined by the following formula.
[0077] .
[0078] wherein, denotes the entity neighborhood similarity between the entity and the entity .entity neighborhood similarity based on relation-oriented sub-graph. representative similarity generation mode based on relation-oriented sub-graph.
[0079] In practice, the above first to third steps can be referred to as a similarity generation mode based on a relation-oriented sub-graph, a schematic diagram of which is shown in Figure 4 As the similarity generation mode based on type induction uses neighborhood entity features and relationship features separately when constructing neighborhood features, the similarity generation mode based on relation-oriented sub-graph introduces relationship attribute features to strengthen the embedding representation of entities, which better describes the neighborhood features of entities. Comparative experiments show that in knowledge graph completion, the similarity generation mode based on relation-oriented sub-graph has a higher MRR (Mean Reciprocal Rank) than the similarity generation mode based on type induction.
[0080] Step 103, determining a knowledge graph global graph corresponding to the existing knowledge graph according to the entity neighborhood similarity set.
[0081] In some embodiments, the above execution subject can determine the knowledge graph global graph corresponding to the existing knowledge graph according to the above entity neighborhood similarity set.
[0082] In practice, in a knowledge graph, implicit associations can exist between multiple entities, and ordinary graph structures are difficult to model global graphs. In order to better capture this structural characteristic, a hypergraph (HyperGraph) can be used to model the knowledge graph global graph. The global graph can be represented by an undirected hypergraph , , and represent nodes, hyperedges and node feature sets respectively. The above hypergraph can be represented as an adjacency matrix . The basic unit of the above adjacency matrix is defined as follows: .
[0083] wherein, represents a node. represents a hyperedge. represents that the node v belongs to the hyperedge e. A schematic diagram of the above hypergraph and its corresponding adjacency matrix is shown in Figure 6 .
[0084] In some optional implementations of some embodiments, the execution subject determines the knowledge graph global graph corresponding to the existing knowledge graph according to the entity neighborhood similarity set, which can include the following steps:
[0085] In a first step, for each entity in the entity set, the following steps are performed to obtain a remote hyperedge set:
[0086] In a first sub-step, each entity neighborhood similarity in the entity neighborhood similarity set corresponding to the entity is determined as a target entity neighborhood similarity to obtain a target entity neighborhood similarity set. The target entity similarity set is a set of entity neighborhood similarities between the entity and each of the remaining entities in the entity set.
[0087] In a second sub-step, a preset number of each target entity neighborhood similarity with the highest value in the target entity neighborhood similarity set is determined as a target optimal neighborhood similarity to obtain a target optimal neighborhood similarity set. The preset number is a learnable hyperparameter.
[0088] In practice, through hyperparameter validation experiments on the preset number, the best performance of the knowledge graph completion is achieved when the preset number is 3.
[0089] In a third sub-step, each target optimal neighborhood similarity in the target optimal neighborhood similarity set is determined as a remote neighbor entity of the entity to obtain a remote neighbor entity set.
[0090] In practice, through the above steps, the entity with the most similar neighborhood to the entity can be selected as the remote neighbor entity of the entity.
[0091] In a fourth sub-step, the entity and each remote neighbor entity in the remote neighbor entity set are connected to obtain a remote hyperedge. The connection between the entity and each remote neighbor entity in the remote neighbor entity set can be achieved by an adjacency matrix. Specifically, the remote hyperedge can be determined as a newly added column in the adjacency matrix, with all initial element values being 0. Then, the element values corresponding to the serial numbers of the entity and each remote neighbor entity are set to 1.
[0092] In a second step, the number of occurrences of each entity in the entity set in each remote neighbor entity set is determined as an entity hyperedge attribution frequency value to obtain an entity hyperedge attribution frequency value set. The entity hyperedge attribution frequency value represents the frequency of the occurrence of an entity in the remote hyperedge, i.e., the number of remote hyperedges to which the entity belongs.
[0093] In a third step, the sum of the target optimal neighborhood similarities corresponding to each entity in the entity set in each target optimal neighborhood similarity set is determined as an entity relative similarity to obtain an entity relative similarity set. The entity relative similarity represents the sum of the entity neighborhood similarities between an entity and other entities when the entity is divided into the remote neighbor entities of the other entities.
[0094] Fourthly, a ratio between each entity relative similarity value in the entity relative similarity value set and each entity hyperedge attribution frequency value in the entity hyperedge attribution frequency value set is determined as an entity hyperedge relative similarity value, and an entity hyperedge relative similarity value set is obtained.
[0095] Fifthly, a knowledge graph global graph is determined according to the remote hyperedge set and the entity hyperedge relative similarity value set. The knowledge graph global graph corresponds to a knowledge graph adjacency matrix, which can be determined according to the remote hyperedge set and the entity hyperedge relative similarity value set. The basic component unit of the knowledge graph adjacency matrix corresponding to the knowledge graph global graph is as follows: As shown in the following formula: .
[0096] In practice, represents an element value of the i-th row and the e-th column of the knowledge graph adjacency matrix. i represents an entity in the entity set, and e represents a remote hyperedge in the remote hyperedge set represents that the entity i belongs to the remote hyperedge e. represents an entity hyperedge relative similarity value.
[0097] Step 104, implicit association feature extraction is performed on the knowledge graph global graph to obtain an entity embedding vector set and a relation embedding vector set.
[0098] In some embodiments, the execution subject can perform implicit association feature extraction on the knowledge graph global graph to obtain an entity embedding vector set and a relation embedding vector set.
[0099] In some optional implementations of some embodiments, the execution subject performs implicit association feature extraction on the knowledge graph global graph to obtain an entity embedding vector set and a relation embedding vector set, which can include the following steps:
[0100] Firstly, hypergraph convolution feature extraction is performed on the initial semantic features of each entity in the entity set to generate entity embedding vectors, and an entity embedding vector set is obtained. The hypergraph convolution feature extraction can be performed on the initial semantic features of each entity in the entity set to generate entity embedding vectors by a preset hypergraph convolution network, and an entity embedding vector set is obtained. The process of performing hypergraph convolution feature extraction on the entity to generate the entity embedding vector can be represented by the following formula: .
[0101] wherein k represents the number of stacked layers of the graph convolution network. represents the entity embedding feature of entity u at the k+1 layer. represents the entity embedding feature of entity v at the k layer. Entity v is a remote neighbor entity of entity u. is a learnable parameter matrix for hypergraph convolution feature extraction. and is an element in the above knowledge graph adjacency matrix. represents the initial semantic feature of entity v.
[0102] In practice, the above k is a learnable hyperparameter. Through hyperparameter validation experiments on k, the best performance of knowledge graph completion is achieved when k is 1, indicating that the superposition of multi-layer convolution leads to overfitting of entity and relationship embedding learning, affecting the performance of the model.
[0103] As an example, the hypergraph convolution network can include, but is not limited to, at least one of the following: HGNN+ (General Hypergraph Neural Networks), Hyper-SAGNN (self-attention based graph neural network for hypergraphs), etc.
[0104] Secondly, the initial relationship feature of each relationship in the above relationship set is subjected to multi-layer linear transformation to generate a relationship embedding vector, obtaining a relationship embedding vector set. Wherein, the initial embedding feature of the relationship can be subjected to multi-layer linear transformation to generate a relationship embedding vector by the following formula.
[0105] .
[0106] wherein, represents the relationship embedding feature of the k+1th layer. represents the relationship embedding feature of the kth layer. represents the initial relationship feature of the relationship .
[0107] In practice, both the entity embedding vector and the relationship embedding vector can be a d-dimensional vector. Wherein, d is a learnable hyperparameter. The embedding dimension d will directly affect the expression ability of entity semantics and structural features, thereby affecting the performance of knowledge graph completion. Too low embedding dimension may not be able to capture complex information, while too high embedding dimension may lead to overfitting or high storage and calculation cost. Therefore, a balanced decision needs to be made between performance and parameter dimension. Through hyperparameter validation experiments, the embedding dimension is selected from the range of {50, 100, 150, 200, 250, 300}, and the final experimental results show that when d is 200, the performance of knowledge graph completion is best.
[0108] Step 105, according to the entity embedding vector set and the relationship embedding vector set, determine the score of each completed triple in the completed triple set, obtaining a completed triple score set.
[0109] In some embodiments, the execution subject can determine scores of each of the completed triplets in the completed triplet set according to the entity embedding vector set and the relation embedding vector set, to obtain a completed triplet score set. The completed triplet is a triplet composed of an entity in the entity set and a relation in the relation set, and the completed triplet is not included in the triplet set.
[0110] Specifically, the triplet corresponding to the remote neighbor entity of the entity can be determined as the implicit triplet of the entity, to obtain an implicit triplet set. Then, the remote neighbor entity in each of the implicit triplet set can be replaced by the entity to obtain a replacement triplet set. Finally, each of the replacement triplets in the replacement triplet set that is not the same as each of the triplets in the triplet set is determined as the completed triplet to obtain the completed triplet set. Here, all possible completed triplets can also be enumerated, and the set composed of the completed triplets that do not exist in the triplet set is determined as the completed triplet set.
[0111] In some optional implementations of some embodiments, the execution subject can determine scores of each of the completed triplets in the completed triplet set according to the entity embedding vector set and the relation embedding vector set, to obtain a completed triplet score set, which can include the following steps:
[0112] For each of the completed triplets in the completed triplet set, the following steps are performed to generate a completed triplet score, to obtain a completed triplet score set:
[0113] In a first sub-step, the entity embedding vector and the relation embedding vector corresponding to the head entity and the relation in the completed triplet are converted into a two-dimensional matrix to obtain a head entity two-dimensional matrix and a relation two-dimensional matrix.
[0114] In a second sub-step, the entity embedding vector corresponding to the tail entity in the completed triplet is determined as a tail entity embedding vector.
[0115] In a third sub-step, the head entity two-dimensional matrix and the relation two-dimensional matrix are spliced to obtain a fusion two-dimensional matrix.
[0116] In a fourth sub-step, the completed triplet score is determined according to the fusion two-dimensional matrix and the tail entity embedding vector. The completed triplet score can be determined according to the fusion two-dimensional matrix and the tail entity embedding vector through a preset neural network model. The neural network model can be a ConvE model. The score function of the ConvE model includes two parts: a convolution layer and a fully connected layer. The two layers of networks jointly act to determine the score of the completed triplet, and the process is as follows: .
[0117] wherein, denotes the score of the completed triple composed of head entity h, relation r, and tail entity t. denotes the embedding vector of entity is converted into a two-dimensional embedding matrix , denotes the embedding vector of relation is converted into a two-dimensional embedding matrix. denotes the connection operation of two embedding matrices, representing the association information between the head entity and the relation. The embedding matrix is generated by a convolution kernel to generate a feature map tensor . C represents the number of channels, which is the number of feature maps with dimension m x n. denotes a nonlinear activation function, and the feature matrix after convolution is processed by to obtain a higher-dimensional feature representation. vec denotes a vectorization operation that converts into . Then is multiplied by a learnable parameter matrix , the dimension is converted into the embedding dimension d, and a fixed-length vector representation is obtained. The product of the result of the nonlinear activation of the vector representation by the activation function and the above-mentioned tail entity embedding vector determines the score of the completed triple, which is used to evaluate the rationality of the triple.
[0118] Optionally, the above execution subject can determine the score of the completed triple corresponding to the existing knowledge graph through the knowledge graph completion model. The above knowledge graph completion model can be used to perform the above steps 101 to 105 on the existing knowledge graph. The above knowledge graph completion model can be obtained by training in the following way:
[0119] First, obtain a sample data set and an initial knowledge graph completion model. The above sample data set contains an entity sample set, a relation sample set, and a triple sample set. Each triple in the above triple sample set corresponds to a true label. The above initial knowledge graph completion model can perform the above steps 101 to 105.
[0120] Secondly, the entity sample set and the relation sample set are taken as inputs of the initial knowledge graph completion model, the triple sample set and the real labels are taken as expected outputs of the initial knowledge graph completion model, and the initial knowledge graph completion model is trained to obtain the knowledge graph completion model. The initial knowledge graph completion model can be updated in a back propagation parameter manner by minimizing a binary cross entropy (BCE) loss function. The elements of each learnable parameter matrix, each bias parameter vector, each parameter vector, and each fusion operator can be determined by training. The loss function is shown in the following formula: .
[0121] wherein, represents a loss value between a predicted triple score value and a real value. N represents the number of entities. represents a real label of a triple sample corresponding to the i-th completed triple. represents a probability that the completed triple is a real fact, represents a probability of the i-th completed triple.
[0122] In step 106, the existing knowledge graph is completed according to the completed triple corresponding to each completed triple score in the completed triple score set that meets the preset condition, and an updated knowledge graph is obtained. The existing knowledge graph in the database is replaced by the updated knowledge graph.
[0123] In some embodiments, the execution subject can complete the existing knowledge graph according to the completed triple corresponding to each completed triple score in the completed triple score set that meets the preset condition, and obtain an updated knowledge graph. The existing knowledge graph in the database is replaced by the updated knowledge graph. First, each completed triple corresponding to a completed triple score in the completed triple score set that is higher than a preset threshold value can be determined as a to-be-completed triple to obtain a to-be-completed triple set. Secondly, each to-be-completed triple in the to-be-completed triple set is updated to the triple set to obtain an updated triple set. Finally, the corresponding updated knowledge graph is determined according to the entity set, the relation set, and the updated triple set.
[0124] Optionally, the execution subject can further perform the following steps:
[0125] In the first step, the user's question content is obtained. The question content includes question text or question voice. When the question content is question voice, the question voice can be converted into question voice text by voice-to-text technology.
[0126] Secondly, the semantic extraction is performed on the question content to obtain a question entity and a question relationship. The semantic extraction can be performed on the question content by using the semantic embedding algorithm to obtain the question entity and the question relationship. The question entity and the question relationship are included in the question content.
[0127] Thirdly, the knowledge correlation is performed on the question entity and the question relationship according to the updated knowledge graph to obtain an answer entity, and the answer entity is displayed. The updated triple set in the updated knowledge graph can be used to determine an updated triple composed of the question entity and the question relationship. Then, the entity in the updated triple except the question entity is determined as the answer entity. Finally, the answer entity is transmitted to a display device for display. The answer entity can also be converted into an answer voice, and the answer voice is played through a voice player.
[0128] The above various embodiments of the present disclosure have the following beneficial effects: by using the knowledge graph completion method based on potential neighbor awareness of some embodiments of the present disclosure, the waste of computing resources can be avoided. Specifically, the reason for the waste of computing resources is that the multi-layer graph convolution network superposition is easy to learn a large amount of useless noise knowledge, and it is difficult to combine the remote entity features to optimize the embedding representation of entities and relationships, thereby affecting the training efficiency and the performance of the model. Based on this, the knowledge graph completion method based on potential neighbor awareness of some embodiments of the present disclosure first acquires an existing knowledge graph from a database. The existing knowledge graph includes an entity set, a relationship set and a triple set. The triple is an ordered group composed of a head entity, a relationship and a tail entity. The head entity and the tail entity belong to the entity set, and the relationship belongs to the relationship set. Second, the neighborhood similarity between each two entities in the entity set is determined to obtain an entity neighborhood similarity set. In this way, the neighborhood features of the entities can be determined according to the neighborhood of the entities, and it is determined whether two non-directly connected entities have similar neighborhood features, thereby helping to discover remote entities in the knowledge graph that are similar in neighborhood features. Then, according to the entity neighborhood similarity set, a knowledge graph global graph corresponding to the existing knowledge graph is determined. By constructing the knowledge graph global graph, the complex relationships between multiple entities can be described. Then, the knowledge graph global graph is subjected to implicit association feature extraction to obtain an entity embedding vector set and a relationship embedding vector set. By extracting features from the global graph constructed in the previous step, the entity embedding is updated to complete the entity embedding reinforcement, which can avoid overfitting of the multi-layer graph convolution network and reduce the influence of noise on the performance of the model. Then, according to the entity embedding vector set and the relationship embedding vector set, the score of each completed triple in the completed triple set is determined to obtain a completed triple score set. The completed triple is a triple composed of an entity in the entity set and a relationship in the relationship set, and the completed triple is not included in the triple set. The score of the completed triple is determined by combining entity, relationship and context information, which can effectively learn the semantic association between entities and help to further improve the quality of the completion result, ensuring the consistency and rationality of the final completed triple with the information in the original knowledge graph. Finally, according to the completed triple corresponding to each completed triple score in the completed triple score set that satisfies a preset condition, the existing knowledge graph is completed to obtain an updated knowledge graph, and the updated knowledge graph is used to replace the existing knowledge graph in the database. By using the completed triple score set to fill in the blanks in the knowledge graph, the graph is more complete, and at the same time, the noise interference is reduced and the use of computing resources is optimized.
[0129] Further reference is made to Figure 7As an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a knowledge graph completion apparatus based on potential neighbor awareness. These apparatus embodiments correspond to those method embodiments shown in Figure 1 The apparatus can be specifically applied in various electronic devices.
[0130] As shown in Figure 7 , the knowledge graph completion apparatus 700 based on potential neighbor awareness of some embodiments includes an acquisition unit 701, a first determination unit 702, a second determination unit 703, an implicit association feature extraction unit 704, a third determination unit 705, and a completion unit 706. The acquisition unit 701 is configured to acquire an existing knowledge graph from a database, wherein the existing knowledge graph contains a set of entities, a set of relations, and a set of triples. A triple is an ordered group composed of a head entity, a relation, and a tail entity. The head entity and the tail entity belong to the set of entities, and the relation belongs to the set of relations. The first determination unit 702 is configured to determine the neighborhood similarity between each two entities in the set of entities to obtain a set of entity neighborhood similarities. The second determination unit 703 is configured to determine a knowledge graph global graph corresponding to the existing knowledge graph according to the set of entity neighborhood similarities. The implicit association feature extraction unit 704 is configured to perform implicit association feature extraction on the knowledge graph global graph to obtain a set of entity embedding vectors and a set of relation embedding vectors. The third determination unit 705 is configured to determine the score of each completed triple in the set of completed triples according to the set of entity embedding vectors and the set of relation embedding vectors to obtain a set of completed triple scores, wherein a completed triple is a triple composed of an entity in the set of entities and a relation in the set of relations, and the completed triple is not contained in the set of triples. The completion unit 706 is configured to complete the existing knowledge graph according to the completed triple corresponding to each completed triple score in the set of completed triple scores that satisfies a preset condition to obtain an updated knowledge graph, and replace the existing knowledge graph in the database with the updated knowledge graph.
[0131] It can be understood that the units described in the apparatus 700 correspond to the respective steps in the method described with reference to Figure 1 . Therefore, the operations, features, and beneficial effects described above for the method also apply to the apparatus 700 and the units contained therein, which will not be described here again.
[0132] Reference is made below to Figure 8 , which shows a structural schematic diagram of an electronic device (e.g., a computing device) 800 suitable for implementing some embodiments of the present disclosure. Figure 8 The electronic device shown is merely an example and should not impose any limitation on the functions and use range of the embodiments of the present disclosure.
[0133] like Figure 8 As shown, the electronic device 800 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory 802 or a program loaded from a storage device 808 into a random access memory 803. The random access memory 803 also stores various programs and data required for the operation of the electronic device 800. The processing unit 801, the read-only memory 802, and the random access memory 803 are interconnected via a bus 804. An input / output interface 805 is also connected to the bus 804.
[0134] Typically, the following devices can be connected to I / O interface 805: input devices 806 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 807 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 808 including, for example, magnetic tapes, hard disks, etc.; and communication devices 809. Communication device 809 allows electronic device 800 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 8 An electronic device 800 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively. Figure 8 Each box shown can represent a device or multiple devices as needed.
[0135] In particular, according to some embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, some embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 809, or installed from a storage device 808, or installed from a read-only memory 802. When the computer program is executed by the processing device 801, it performs the functions defined above in the methods of some embodiments of this disclosure.
[0136] Note that the computer readable medium in some embodiments of the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination thereof. The computer readable storage medium can be, for example but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any suitable combination of the foregoing. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the present disclosure, the computer readable storage medium can be any tangible medium that contains or stores a program used by an instruction execution system, apparatus or device, or that can be used by or in connection with an instruction execution system, apparatus or device. In some embodiments of the present disclosure, the computer readable signal medium can include a computer readable program code propagated on or through a carrier wave, in baseband or as part of a carrier wave. Such propagated signals can take a variety of forms, including but not limited to electro-magnetic signals, optical signals or any suitable combination thereof. The computer readable signal medium can also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate or transport a program for use by or in connection with an instruction execution system, apparatus or device. Program code embodied on a computer readable medium can be transmitted using any appropriate medium, including but not limited to wireless, wire line, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0137] In some embodiments, the client, server, or both can communicate using any current known or future developed network protocol, such as HTTP (Hyper Text Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet, and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any current known or future developed networks.
[0138] The computer readable medium can be included in the electronic device; or can exist independently of the electronic device. The computer readable medium carries one or more programs, when executed by the electronic device, cause the electronic device to: obtain an existing knowledge graph from a database, where the existing knowledge graph includes a set of entities, a set of relations, and a set of triples, the triple is an ordered group composed of a head entity, a relation, and a tail entity, the head entity and the tail entity belong to the set of entities, and the relation belongs to the set of relations; determine neighborhood similarity between each two entities in the set of entities to obtain a set of entity neighborhood similarities; determine a knowledge graph global graph corresponding to the existing knowledge graph according to the set of entity neighborhood similarities; perform implicit association feature extraction on the knowledge graph global graph to obtain a set of entity embedding vectors and a set of relation embedding vectors; determine a score of each completed triple in a set of completed triples according to the set of entity embedding vectors and the set of relation embedding vectors, to obtain a set of completed triple scores, where the completed triple is a triple composed of an entity in the set of entities and a relation in the set of relations, and the completed triple is not included in the set of triples; and complete the existing knowledge graph according to each completed triple corresponding to a completed triple score that satisfies a preset condition in the set of completed triple scores to obtain an updated knowledge graph, and replace the existing knowledge graph in the database with the updated knowledge graph.
[0139] Computer program code for carrying out operations of some embodiments of the disclosure can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0140] The computer program product of the first aspect can include a computer readable storage medium. The computer readable storage medium can include instructions. The instructions can include one or both of: instructions for causing a computer to implement a method as described above; and instructions for causing a computer to operate based on a system as described above. The computer readable storage medium can include one or more of: a magnetic disk; a magnetic disk drive; a magnetic tape; a magneto-optical drive; a solid state drive; a semiconductor drive; a flash drive; an optical drive; a holographic drive; a holographic medium; a memory stick; a floppy disk; a flexible disk; a hard disk; a hard disk drive; a holographic storage medium; a RAM drive; a ROM drive; a flash drive; an optical drive; a holographic drive; a magnetic drive; a removable memory port; a bay adapter; a memory PC card slot; a PC card socket; and a disk cartridge comprising a computer readable storage medium.
[0141] The units described in some embodiments of the present disclosure can be implemented by means of software, or by hardware. The described units can also be implemented by means of a processor, for example, a processor can be described as comprising an obtaining unit, a first determining unit, a second determining unit, an implicit association feature extraction unit, a third determining unit, a supplementing unit. In some cases, the names of the units do not constitute a limitation on the units themselves, for example, the supplementing unit can also be described as a unit that supplements an existing knowledge graph.
[0142] The functions described above can be performed, at least in part, by one or more hardware logic components. For example, and without limitation, example types of hardware logic components that can be used include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SOCs), complex programmable logic devices (CPLDs), etc.
[0143] The above description is merely exemplary of some of the most preferred embodiments of the present disclosure and of the application of the principles thereof. It is to be understood that, within the scope of the protection sought by the following claims, the present disclosure can be carried out by other embodiments that do not depart from the spirit and essence of the application. For example, the features described above can be combined with other features disclosed in the embodiments of the present disclosure (but not limited to) having similar functions to form other technical solutions.
Claims
1. A method for knowledge graph completion based on potential neighbor awareness, comprising: obtaining an existing knowledge graph from a database, wherein the existing knowledge graph comprises an entity set, a relation set and a triple set, a triple is an ordered group composed of a head entity, a relation and a tail entity, the head entity and the tail entity belong to the entity set, and the relation belongs to the relation set; determining neighborhood similarity between each two entities in the entity set to obtain an entity neighborhood similarity set, comprising: extracting relation attribute features of each entity in the entity set to generate in-edge relation attribute features and out-edge relation attribute features, obtaining an in-edge relation attribute feature set and an out-edge relation attribute feature set, comprising: determining the head entity and the relation in each triple in the triple set whose tail entity is the entity as an in-edge group to obtain an in-edge group set, the in-edge group set is also called an in-edge subgraph of the entity, and the in-edge subgraph is represented as: , wherein, an in-edge subgraph of an entity , represents an adjacency relation as an in-edge, an in-edge group of an entity , a head entity , a relation , and a tail entity form a triple, denotes a set of triples; determining the tail entity and the relation in each triple in the triple set whose head entity is the entity as an out-edge group to obtain an out-edge group set, the out-edge group set is also called an out-edge subgraph of the entity, and the out-edge subgraph is represented as: , wherein, an out-edge subgraph of an entity , represents an adjacency relation as an out-edge, an out-edge group of an entity , a head entity , a relation , and a tail entity form a triple; determining the in-edge direction awareness vector and the out-edge direction awareness vector corresponding to the entity by the following formula, , wherein, denotes an in-edge directional perception vector or an out-edge directional perception vector of the entity, denotes different directions of the entity adjacency relation, denotes that the relation is an in-edge, denotes that the relation is an out-edge, when dir is i, denotes an in-edge directional perception vector, when dir is o, denotes an out-edge directional perception vector, denotes a preset adjacency directional perception vector, an element value of the adjacency directional perception vector being randomly set, denotes a Hadamard product, denotes a learnable parameter matrix for determining the directional perception vector, denotes a bias parameter vector for determining the directional perception vector; According to the in-edge group set and the out-edge group set, an in-edge relationship distribution perception vector and an out-edge relationship distribution perception vector of the entity are determined, wherein the existing knowledge graph is regarded as a three-dimensional binary tensor with dimensions of AxBxA; the tensor is compressed by the following formula to obtain an in-edge matrix and an out-edge matrix: , wherein, represents the in-edge matrix, represents the out-edge matrix, and represents a three-dimensional binary tensor with dimensions of AxBxA, , ; the in-edge matrix and the out-edge matrix are normalized by the following formula to obtain a normalized in-edge matrix and a normalized out-edge matrix: , wherein, represents the normalized in-edge matrix or the normalized out-edge matrix, when dir is i, the vth row of represents an in-edge relationship distribution perception vector of entity v as a tail entity; when dir is o, the vth row of represents an out-edge relationship distribution perception vector of entity v as a head entity, denoted as ; determining the in-edge relation attribute features and the out-edge relation attribute features corresponding to the entity according to the in-edge direction awareness vector, the out-edge direction awareness vector, the in-edge relation distribution awareness vector and the out-edge relation distribution awareness vector by the following formula: , in, Representing entities The inbound edge relationship attribute features or outbound edge relationship attribute features. This represents the fusion weight parameter vector, where each element ranges from (0,1). To create a learnable parameter matrix for determining relation attribute features, the dimension of the relation distribution perception vector is transformed to d dimensions. This is the offset parameter vector used to determine the characteristics of relational attributes; for each entity in the entity set, performing the following neighborhood feature extraction steps to generate entity neighborhood features to obtain an entity neighborhood feature set: extracting subgraph features of each neighbor entity corresponding to the entity to generate neighbor in-edge subgraph features and neighbor out-edge subgraph features to obtain a neighbor in-edge subgraph feature set and a neighbor out-edge subgraph feature set; determining entity neighborhood features according to the neighbor in-edge subgraph feature set, the neighbor out-edge subgraph feature set, the in-edge relation attribute features and the out-edge relation attribute features corresponding to the entity; determining entity neighborhood similarity between each entity in the entity set and the remaining entities according to the entity neighborhood feature set to obtain an entity neighborhood similarity set; determining a knowledge graph global graph corresponding to the existing knowledge graph according to the entity neighborhood similarity set; extracting implicit association features from the knowledge graph global graph to obtain an entity embedding vector set and a relation embedding vector set; determining scores of each completed triple in a completed triple set according to the entity embedding vector set and the relation embedding vector set, wherein a completed triple is a triple composed of an entity in the entity set and a relation in the relation set, and a completed triple is not included in the triple set; completing the existing knowledge graph according to the completed triple corresponding to each completed triple score in the completed triple score set that meets a preset condition to obtain an updated knowledge graph, and replacing the existing knowledge graph in the database with the updated knowledge graph. Obtaining a question content of a user, wherein the question content contains question text or question voice; Performing semantic extraction on the question content to obtain question entities and question relationships; According to the updated knowledge graph, performing knowledge association on the question entities and the question relationships to obtain answer entities, and displaying the answer entities.
2. The method of claim 1, wherein, The determining of the neighborhood similarity between each two entities in the entity set to obtain an entity neighborhood similarity set comprises: Performing neighborhood entity feature extraction on each entity in the entity set to generate a neighborhood entity feature vector to obtain a neighborhood entity feature vector set; Performing neighborhood relationship feature extraction on each entity in the entity set to generate a relationship feature vector to obtain a relationship feature vector set; Determining the initial semantic feature of each entity in the entity set to obtain an initial semantic feature set of the entity; According to the neighborhood entity feature vector set, the relationship feature vector set and the initial semantic feature set of the entity, the entity neighborhood similarity between each entity in the entity set and the remaining entities is determined to obtain an entity neighborhood similarity set.
3. The method of claim 1, wherein, The determining of the knowledge graph global graph corresponding to the existing knowledge graph according to the entity neighborhood similarity set comprises: For each entity in the entity set, the following steps are performed to obtain a remote hyperedge set: Each entity neighborhood similarity corresponding to the entity in the entity neighborhood similarity set is determined as a target entity neighborhood similarity to obtain a target entity neighborhood similarity set; A preset number of each target entity neighborhood similarity with the highest value in the target entity neighborhood similarity set is determined as a target optimal neighborhood similarity to obtain a target optimal neighborhood similarity set; Each target optimal neighborhood similarity in the target optimal neighborhood similarity set is determined as a remote neighbor entity of the entity to obtain a remote neighbor entity set; The entity and each remote neighbor entity in the remote neighbor entity set are connected to obtain a remote hyperedge; The occurrence frequency of each entity in the entity set in each remote neighbor entity set is determined as an entity hyperedge attribution frequency value to obtain an entity hyperedge attribution frequency value set; The sum of the target optimal neighborhood similarity corresponding to each entity in the entity set in each target optimal neighborhood similarity set is determined as an entity relative similarity to obtain an entity relative similarity set; The ratio between each entity relative similarity in the entity relative similarity set and each entity hyperedge attribution frequency value in the entity hyperedge attribution frequency value set is determined as an entity hyperedge relative similarity value to obtain an entity hyperedge relative similarity value set; The knowledge graph global graph is determined according to the remote hyperedge set and the entity hyperedge relative similarity value set.
4. The method of claim 1, wherein, The implicit association feature extraction on the knowledge graph global graph to obtain an entity embedding vector set and a relationship embedding vector set comprises: Performing hypergraph convolution feature extraction on the initial semantic feature of each entity in the entity set to generate an entity embedding vector to obtain an entity embedding vector set; Performing multi-layer linear transformation on the initial relationship feature of each relationship in the relationship set to generate a relationship embedding vector to obtain a relationship embedding vector set.
5. The method of claim 1, wherein, The score of each completed triple in the completed triple set is determined according to the entity embedding vector set and the relation embedding vector set, and a completed triple score set is obtained, including: For each completed triple in the completed triple set, the following steps are performed to generate a completed triple score, and a completed triple score set is obtained: The entity embedding vector and the relation embedding vector corresponding to the head entity and the relation in the completed triple are converted into a two-dimensional matrix to obtain a head entity two-dimensional matrix and a relation two-dimensional matrix; The entity embedding vector corresponding to the tail entity in the completed triple is determined as the tail entity embedding vector; The head entity two-dimensional matrix and the relation two-dimensional matrix are spliced to obtain a fusion two-dimensional matrix; The completed triple score is determined according to the fusion two-dimensional matrix and the tail entity embedding vector.
6. A knowledge graph completion device based on latent neighbor awareness, comprising: An acquisition unit configured to acquire an existing knowledge graph from a database, wherein the existing knowledge graph contains an entity set, a relation set and a triple set, the triple is an ordered group composed of a head entity, a relation and a tail entity, the head entity and the tail entity belong to the entity set, and the relation belongs to the relation set; A first determination unit configured to determine the neighborhood similarity between each two entities in the entity set to obtain an entity neighborhood similarity set, including: Performing relation attribute feature extraction on each entity in the entity set to generate in-edge relation attribute features and out-edge relation attribute features to obtain an in-edge relation attribute feature set and an out-edge relation attribute feature set, including: Determine the head entity and the relation in each triple in the triple set as the in-edge group when the tail entity is the entity to obtain an in-edge group set, the in-edge group set is also called the in-edge subgraph of the entity, and the in-edge subgraph is represented as: , wherein, an in-edge subgraph of an entity , represents an in-edge relationship, an in-edge group of an entity , a head entity , a relationship , and a tail entity grouping, a set of triples; Determine the tail entity and the relation in each triple in the triple set as the out-edge group when the head entity is the entity to obtain an out-edge group set, the out-edge group set is also called the out-edge subgraph of the entity, and the out-edge subgraph is represented as: , wherein, an out-edge subgraph of an entity represents an adjacency relation as an out-edge, an out-edge group of an entity a head entity , a relation and a tail entity form a triple; Determine the in-edge direction awareness vector and the out-edge direction awareness vector corresponding to the entity by the following formula, , wherein, represents an in-edge direction perception vector or an out-edge direction perception vector of the entity, represents different directions of the entity adjacency relationship, represents that the relationship is an in-edge, represents that the relationship is an out-edge, when dir is i, represents an in-edge direction perception vector, when dir is o, represents an out-edge direction perception vector, represents a preset adjacency direction perception vector, an element value of the adjacency direction perception vector being randomly set, represents a Hadamard product, represents a learnable parameter matrix for determining a direction perception vector, represents a bias parameter vector for determining a direction perception vector; According to the in-edge group set and the out-edge group set, an in-edge relationship distribution perception vector and an out-edge relationship distribution perception vector of the entity are determined, wherein the existing knowledge graph is regarded as a three-dimensional binary tensor with dimensions of AxBxA; the tensor is compressed by the following formula to obtain an in-edge matrix and an out-edge matrix: , wherein, represents the in-edge matrix, represents the out-edge matrix, and represents a three-dimensional binary tensor with dimensions of AxBxA, , ; the in-edge matrix and the out-edge matrix are normalized by the following formula to obtain a normalized in-edge matrix and a normalized out-edge matrix: , wherein, represents the normalized in-edge matrix or the normalized out-edge matrix, when dir is i, the vth row of represents an in-edge relationship distribution perception vector of entity v as a tail entity; when dir is o, the vth row of represents an out-edge relationship distribution perception vector of entity v as a head entity, denoted as ; Determine the in-edge relation attribute features and the out-edge relation attribute features corresponding to the entity according to the in-edge direction awareness vector, the out-edge direction awareness vector, the in-edge relation distribution awareness vector and the out-edge relation distribution awareness vector by the following formula: , wherein, represents an in-edge relation attribute feature or an out-edge relation attribute feature of an entity , represents a fusion weight parameter vector, wherein each element ranges between (0, 1), is a learnable parameter matrix for determining the relation attribute feature, transforming the dimension of the relation distribution-aware vector into d dimensions, is an offset parameter vector for determining the relation attribute feature; For each entity in the entity set, perform the following neighborhood feature extraction steps to generate entity neighborhood features to obtain an entity neighborhood feature set: Perform subgraph feature extraction on each neighbor entity corresponding to the entity to generate neighbor in-edge subgraph features and neighbor out-edge subgraph features to obtain a neighbor in-edge subgraph feature set and a neighbor out-edge subgraph feature set; Determine the entity neighborhood features according to the neighbor in-edge subgraph feature set, the neighbor out-edge subgraph feature set, the in-edge relation attribute features and the out-edge relation attribute features corresponding to the entity; Determine the entity neighborhood similarity between each entity in the entity set and the remaining entities according to the entity neighborhood feature set to obtain an entity neighborhood similarity set; a second determining unit, configured to determine a knowledge graph global graph corresponding to the existing knowledge graph according to the entity neighborhood similarity set; an implicit association feature extraction unit, configured to perform implicit association feature extraction on the knowledge graph global graph to obtain an entity embedding vector set and a relation embedding vector set; a third determining unit, configured to determine a score of each completed triple in a completed triple set according to the entity embedding vector set and the relation embedding vector set, to obtain a completed triple score set, wherein the completed triple is a triple composed of an entity in the entity set and a relation in the relation set, and the completed triple is not contained in the triple set; a completing unit, configured to complete the existing knowledge graph according to a completed triple corresponding to each completed triple score in the completed triple score set satisfying a preset condition, to obtain an updated knowledge graph, and replace the existing knowledge graph in the database with the updated knowledge graph; a question content obtaining unit, configured to obtain question content of a user, wherein the question content contains question text or question voice; a semantic extraction unit, configured to perform semantic extraction on the question content to obtain a question entity and a question relation; a knowledge association unit, configured to perform knowledge association on the question entity and the question relation according to the updated knowledge graph to obtain an answer entity, and display the answer entity. 7.An electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon; when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1-5.
8. A computer readable medium having stored thereon a computer program, wherein, The program is executed by the processor to implement the method of any one of claims 1-5.
Citation Information
Patent Citations
Multi-view knowledge graph inference method and system based on hypergraph convolution and graph convolution, and storage medium
CN118396093A