Low-sample knowledge graph completion method based on multi-hop neighbor aggregation and relation association

By using multi-hop entity neighbor aggregation and orthogonal relationship potential vector generator methods in knowledge graph completion, the multi-hop neighbor and relationship association information is integrated, and the problem of insufficient entity representation generalization ability in the existing methods is solved, and a more accurate knowledge graph completion with few samples is achieved.

CN120196766APending Publication Date: 2025-06-24NORTHEASTERN UNIV CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510444862.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

The existing few-sample knowledge graph completion method relies on single-hop neighbor information, ignoring the rich information of multi-hop neighbors, resulting in insufficient generalization ability of entity representation, overfitting relationship representations, and difficulty in accurately completing no facts.

Method used

Using a method based on multi-hop neighbor aggregation and relational association, aggregation of multi-hop entity neighbor information through TransE model, graph neural network and multi-layer perceptron to generate an entity fusion representation. Then, the relationship association information is integrated with the orthogonal relationship latent vector generator and the multi-head attention mechanism to enhance the relationship representation.

Benefits of technology

By integrating multi-hop neighbor information and relationship correlation information, the generalization ability of entity and relationship representation is enhanced, and the accuracy and ability of knowledge graph completion of few-sample are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120196766A_ABST
    Figure CN120196766A_ABST
Patent Text Reader

Abstract

The invention provides a few-sample knowledge graph completion method based on multi-hop neighbor aggregation and relation association, and relates to the technical field of knowledge graph completion. The method comprises the following steps: firstly, giving a knowledge graph in the field of intelligent questions and answers, constructing a multi-hop entity neighbor aggregator, and aggregating information of multi-hop entity neighbors in the knowledge graph to obtain entity fusion representation of the knowledge graph; constructing an orthogonal relation potential vector generator, and obtaining an orthogonal relation potential vector represented by entity fusion of the knowledge graph; and finally, constructing a relation learner, integrating relation association information in the orthogonal relation potential vector into relation representation learning for storage by learning entity fusion representation and the orthogonal relation potential vector of the knowledge graph and utilizing a multi-head attention mechanism, and when a few-sample knowledge graph completion task is executed, performing completion according to the relation association information. According to the method, the relation representation with the context sensing capability and the enhanced relation representation are learned, and the capability of complementing the few-sample knowledge graph is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of knowledge graph completion, and particularly relates to a few-shot knowledge graph completion method based on multi-hop neighbor aggregation and relationship association. Background Art

[0002] Knowledge graphs provide a structured knowledge representation framework, constructed based on a heterogeneous graph, where each fact consists of a head entity, a relation, and a tail entity. However, in practical applications, due to the limitations of data source collection and the high cost of manual annotation, knowledge graphs are often incomplete. To address this issue, knowledge graph completion methods have been proposed, aiming to infer and complete missing information based on existing facts.

[0003] Early research on knowledge graph completion mainly focused on rule-based methods, which usually relied on sparse data and complex reasoning mechanisms. For example, the TransE model proposed by Bordes et al. pioneered the modeling of relations as translation operations between vectors and then used a scoring function to evaluate the quality of these translations. The DistMult model proposed by Yang et al. emphasized understanding the relationships between entities through symmetric pairwise interactions, modeled relations as diagonal matrices, and calculated scores using linear combinations to achieve knowledge graph completion. The RotatE model proposed by Sun et al. further modeled relations in the complex space to capture symmetric and anti-symmetric relations. Although existing knowledge graph completion methods have good effects, they still face great challenges in completing most relations that contain only a small number of facts. To solve this problem, few-shot knowledge graph completion methods infer and complete missing entities or relations in the knowledge graph through a small number of known facts. Existing few-shot knowledge graph completion methods enhance the relation representation by combining the neighbor information of the head entity (or tail entity), thereby enriching the support set of a small number of relations and alleviating the overfitting problem. The GMatching model proposed by Xiong et al. adopted a single-hop neighbor aggregation strategy, taking the average of the feature representations of one-hop neighbors of the head entity as the representation of the given entity. To further enhance the entity representation, the Hire model proposed by Wu et al. introduced a context layer to learn the fact representation by leveraging the context information of all one-hop neighbor entities connected to the head-tail entity pair.

[0004] Existing few-shot knowledge graph completion methods only rely on the single-hop neighbors of entities to enhance entity representations, ignoring the richer information from multi-hop neighbors. This limitation weakens the generalization ability of entity representations, leading to overfitting of relation representations and hindering the accurate completion of unseen facts. Therefore, how to effectively integrate the information of various neighbors and fully consider their importance remains an issue to be solved. In addition, during the process of relation representation learning, due to the data sparsity of few-shot relations, existing methods assume that relations are independent of each other, ignoring the associations between them, which results in poor performance in few-shot knowledge graph completion. This makes it particularly important to construct a unified distribution that can capture the potential correlations between different relations. Moreover, the long-tail distribution of relations causes the enhancement of entity representations related to low-frequency relations to be masked by entities related to high-frequency relations. At the same time, the learning of few-shot knowledge graph completion models is dominated by a few high-frequency relations, which makes it difficult to accurately predict tail relations. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide a few-shot knowledge graph completion method based on multi-hop neighbor aggregation and relation association for the deficiencies of the above-mentioned existing technologies.

[0006] To solve the above technical problems, the technical solutions adopted by the present invention are as follows:

[0007] The few-shot knowledge graph completion method based on multi-hop neighbor aggregation and relation association has the following specific process:

[0008] S1. Given a knowledge graph in the field of intelligent question answering, construct a multi-hop entity neighbor aggregator, and use the multi-hop entity neighbor aggregator to aggregate the information of multi-hop entity neighbors in the knowledge graph to obtain the entity fusion representation of the knowledge graph. The multi-hop entity neighbor aggregator successively includes a TransE model, a graph neural network, and a multi-layer perceptron;

[0009] S2. Construct an orthogonal relation latent vector generator, and use the orthogonal relation latent vector generator to obtain the orthogonal relation latent vector of the entity fusion representation of the knowledge graph obtained in S1. The orthogonal relation latent vector generator successively includes a relation distribution generator, a relation complex distribution generator, and an orthogonal relation latent vector generator;

[0010] S3. Construct a relation learner. The relation learner learns the entity fusion representation of the knowledge graph obtained in S1 and the orthogonal relation latent vector obtained in S2, and uses the multi-head attention mechanism to integrate the relation association information in the orthogonal relation latent vector into the relation representation learning for storage. When performing the few-shot knowledge graph completion task, perform completion according to the relation association information.

[0011] The specific process of S1 is as follows:

[0012] S11. Given a knowledge graph in the field of intelligent question answering, use the TransE model to learn and obtain the initial embedding representations of entities and relationships in the knowledge graph;

[0013] S12. In the graph neural network, based on the initial embedding representations of entities and relationships in the input knowledge graph, obtain all entity neighbor information in the knowledge graph, and use the attention mechanism to aggregate the multi-hop entity neighbor information in the knowledge graph from all entity neighbor information in the knowledge graph, and output the aggregated multi-hop entity neighbor information as the enhanced entity representation of the knowledge graph;

[0014] S13. In the multi-layer perceptron, fuse the enhanced entity representation of the knowledge graph output in S12, and output the entity fusion representation of the knowledge graph, where the entity fusion representation includes the fusion representations of each head and tail entity pair.

[0015] The scoring function f of the TransE model in S11 r (h, t) is

[0016]

[0017] Among them, and respectively represent the embeddings of the head entity h, the relationship r, and the tail entity t, and d is the embedding dimension.

[0018] The specific process of S12 is as follows:

[0019] First, input the initial embedding representations of entities and relationships in the knowledge graph into the graph neural network to obtain all entity neighbor information in the knowledge graph;

[0020] Then, use the attention mechanism to aggregate the multi-hop entity neighbor information in the knowledge graph from all entity neighbor information in the knowledge graph, as shown in the following formula:

[0021]

[0022] Among them, the initial embedding representations of entity v and entity u are respectively denoted as and The initial embedding representation of relationship r is denoted as The initial hidden state representation of relationship r is W r represents the learnable transformation matrix of relationship r, W l and respectively represent the weight matrix and bias vector of the l-th layer, N(r) represents the set of neighbor entities associated with relation r, N(v) represents the set of neighbor relations of entity v, the function ReLU(·) represents the ReLU activation function, and [·||·] represents the feature concatenation operation. At the l-th layer, the information embeddings stored in entity v and entity u are respectively represented as and L is the length of the multi-hop relation path;

[0023] is the attention weight vector, used to distinguish the importance of relations in N(v), and is specifically represented as follows:

[0024]

[0025] where, W is the weight matrix, represents a certain neighbor relation of entity v, and LeakyReLU(·) represents an activation function;

[0026] Finally, the aggregated multi-hop entity neighbor information output is the enhanced entity representation of the knowledge graph, and the enhanced entity representation includes enhanced head and tail entity pairs.

[0027] The specific process of S13 is as follows:

[0028] Input the enhanced head and tail entity pairs into a multi-layer perceptron MLP for fusion, and output the entity fusion representation of the corresponding knowledge graph The entity fusion representation includes the fusion representations of each head and tail entity pair, and is specifically represented as follows:

[0029]

[0030] where, is the embedded head entity of the j-th after enhancement, is the embedded tail entity of the j-th after enhancement, and k is the number of entities in the support set.

[0031] The specific process of S2 is as follows:

[0032] S21. In the relation distribution generator, use the multi-head attention mechanism to calculate the mean of the data distribution of each relation in the entity fusion representation of the knowledge graph output by S13, apply a mapping function to the mean to obtain the standard deviation of the data distribution of the relation, and use the mean and the standard deviation as the data distribution of the relation to obtain the data distributions of all relations;

[0033] S22. In the complex relationship distribution generator, calculate the average value of all relationships in the data distribution of all relationships obtained in S21 to obtain the average value of the complex relationship distribution. At the same time, apply a mapping function to the standard deviation of all relationships in the data distribution of all relationships obtained in S21 to obtain the standard deviation of the complex relationship distribution. Construct the complex relationship distribution based on the average value of the complex relationship distribution and the standard deviation of the complex relationship distribution;

[0034] S23. In the orthogonal relationship latent vector generator, sample relationship latent vectors from the complex relationship distribution constructed in S22, and apply the orthogonal triangular decomposition method to the relationship latent vectors to obtain orthogonal relationship latent vectors.

[0035] The specific process of S21 is as follows:

[0036] S211. Process the fused representations of each head-tail entity pair output by S13 through linear mapping to obtain a query matrix, a key matrix, and a value matrix;

[0037] S212. Use the multi-head attention mechanism to calculate the scores between each fused representation in the fused representations of each head-tail entity pair output by S13, and convert the scores into a probability matrix according to the query matrix, the key matrix, and the value matrix;

[0038] S213. Based on the probability matrix, integrate the fused representation of each head-tail entity pair with similar head-tail entity pairs to obtain the updated fused representation of each head-tail entity pair, that is, obtain the updated entity fused representation;

[0039] S214. Obtain the average value of the updated entity fused representation, and obtain the mean value of the data distribution of each relationship in the updated entity fused representation according to the average value;

[0040] S215. Apply a mapping function to the mean value of the data distribution to obtain the standard deviation of the data distribution of the corresponding relationship. Use the mean value of the data distribution and the standard deviation of the data distribution as the data distribution of the corresponding relationship to obtain the data distribution of all relationships.

[0041] The specific process of S3 is as follows:

[0042] S31. Perform linear mapping on the fused representations of each head-tail entity pair output by S13 and the orthogonal relationship latent vectors obtained in S23 to obtain a query matrix key matrix and value matrix

[0043] S32. According to the query matrix key matrix and value matrix Calculate the correlation matrix between the fused representations of each head and tail entity pair output by S13 and the orthogonal relation latent vectors obtained by S23 using the multi-head attention mechanism;

[0044] S33. Apply the correlation matrix to the orthogonal relation latent vectors related to the fused representations of the enhanced head and tail entity pairs to calculate the relation-correlation enhanced entity representations;

[0045] S34. Take the mean of the relation-correlation enhanced entity representations to obtain the context-aware relation representation;

[0046] S35. Obtain the enhanced entity representations by passing the knowledge graph support set given by S1 through a multi-layer perceptron, and obtain the enhanced relation representation by calculating the mean of the enhanced entity representations;

[0047] S36. Fuse the context-aware relation representation and the enhanced relation representation to obtain the relation representation.

[0048] The beneficial effects produced by adopting the above technical solutions are as follows:

[0049] The present invention aggregates multi-hop neighbor information by constructing a multi-hop entity neighbor aggregator. Specifically, first, use the TransE model to learn and obtain the initial embedding representations of entities and relations in the knowledge graph, and effectively aggregate the multi-hop neighbor information in the knowledge graph by using the multi-layer information propagation of the graph neural network according to the initial embedding representations of the entities and relations. Then, use a multi-layer perceptron to fuse the context information of entities from multi-hop relation paths, which can enhance the generalization ability of the learned entity representations to enhance the entity representations, thereby obtaining a more accurate enhanced relation representation, that is, obtaining the fused entity representation, overcoming the limitations of single-hop methods.

[0050] The present invention designs an orthogonal relation latent vector generator to obtain orthogonal relation latent vectors from complex relation distributions. Subsequently, according to the orthogonal relation latent vectors and the fused entity representations, use the multi-head attention mechanism to obtain the relation-correlation enhanced entity representations. Finally, fuse the relation-correlation enhanced entity representations and the enhanced relation representations to learn the context-aware relation representation and the enhanced relation representation. Furthermore, the ability of few-shot knowledge graph completion is enhanced. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 It is a schematic diagram of a few-shot knowledge graph completion method;

[0052] Figure 2 It is a flowchart of the few-shot knowledge graph completion method based on multi-hop neighbor aggregation and relation correlation provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0053] The specific implementation manners of the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. The following embodiments are used to illustrate the present invention, but are not used to limit the scope of the present invention.

[0054] As Figure 1 shown, in the few-shot knowledge graph completion task, the few-shot knowledge graph completion method learns the representations of each relationship through the given support set of few-shot relationships, and uses the learned relationship representations to predict the unseen facts in the query set. Suppose the few-shot relationship is "founder_of" -1 ", and its support set contains three facts: (Apple, founder_of -1 , Steve Jobs), (Tesla, founder_of -1 , Elon Musk), and (Microsoft, founder_of -1 , Bill Gates). In this case, the goal of the three-shot knowledge graph completion task for the relationship "founder_of" -1 is to learn the representation of the relationship based on these three facts in the support set and use this representation to predict the unseen facts in the query set, such as (Xiaomi, founder_of -1 ,?). As Figure 2 shown, the method of this embodiment is described as follows.

[0055] The few-shot knowledge graph completion method based on multi-hop neighbor aggregation and relationship association, the specific process is as follows:

[0056] S1. Given the knowledge graph support set in the field of intelligent question answering. At the same time, construct a multi-hop entity neighbor aggregator, which successively includes the TransE model, a graph neural network, and a multi-layer perceptron MLP. The multi-hop entity neighbor aggregator is a multi-hop neighbor entity aggregator based on a graph neural network. Use the multi-hop entity neighbor aggregator to aggregate the information of multi-hop entity neighbors in the knowledge graph within the knowledge graph support set to obtain the entity fusion representation of the knowledge graph. The specific process is as follows:

[0057] S11. Use the TransE model to learn and obtain the initial embedding representations of entities and relationships in the knowledge graph within the knowledge graph support set. The scoring function of the TransE model is where and respectively represent the embeddings of the head entity h, the relationship r, and the tail entity t, and d is the embedding dimension.

[0058] S12. Input the initial embedding representations of all entities and relationships obtained in S11 into the graph neural network. First, obtain all entity neighbor information corresponding to the knowledge graph support set, and use the attention mechanism to aggregate the multi-hop entity neighbor information in the corresponding knowledge graph from all entity neighbor information, and output the aggregated multi-hop entity neighbor information as the enhanced entity representation of the knowledge graph. The enhanced entity representation includes the representations of each head-tail entity pair. The attention mechanism is used to calculate the weights of relationships for the purpose of aggregating information. The specific process is as follows:

[0059]

[0060] Among them, the initial representations of entity v and entity u are respectively denoted as and The initial representation of relationship r is denoted as The initial hidden state of relationship r is represented as W r represents the learnable transformation matrix of relationship r, W l and respectively represent the weight matrix and bias vector of the l-th layer, N(r) represents the set of neighbor entities associated with relationship r, N(v) represents the set of neighbor relationships of entity v, the function ReLU(·) represents the ReLU activation function, and [·||·] represents the feature concatenation operation. At the l-th layer, the information of entity v and entity u themselves and their neighbor entities stored are respectively represented as and is the length of the multi-hop relationship path. In this embodiment, it is set as

[0061] is the attention weight vector used to distinguish the importance of relationships in N(v), and is specifically represented as follows:

[0062]

[0063] Among them, W is the weight matrix, represents a certain neighbor relationship of v, and LeakyReLU(·) represents an activation function.

[0064] S13. In the multi-layer perceptron MLP, fuse the enhanced entity representation of the knowledge graph output in S12, and output the entity fusion representation of the corresponding knowledge graph. The entity fusion representation

[0065]

[0066] S2. Construct an orthogonal relationship latent vector generator, which sequentially includes a relationship distribution generator, a relationship complexity distribution generator, and an orthogonal relationship latent vector generator. Use the orthogonal relationship latent vector generator to obtain the orthogonal relationship latent vector of the entity fusion representation of the knowledge graph obtained in S1. The specific process is as follows:

[0067] S21. In the relationship distribution generator, use the multi-head attention mechanism to calculate the data distribution mean of each relationship r in the entity fusion representation of the knowledge graph output in S13 in the entity fusion representation of the knowledge graph output in S13 i The specific operations are as follows:

[0068] Process the fusion representation of each head and tail entity pair output in S13 through linear mapping to obtain a query matrix a key matrix a value matrix Then use the multi-head attention mechanism to calculate the scores between each fusion representation in the fusion representation of the head and tail entity pairs, and convert these scores into a probability matrix according to the query matrix Q and the key matrix K Based on the probability matrix A, integrate the fusion representation of each head and tail entity pair with similar head and tail entity pairs to update the fusion representation of each head and tail entity pair, and obtain the updated entity fusion representation.

[0069] The above processing process can be expressed by the formula:

[0070] Attention(Q, K, V) = AV

[0071] By performing n different linear projections on the query, key, and value, the attention function can be calculated in parallel as follows:

[0072] MultiHead(Q, K, V) = [head1 || … || head n W O

[0073] i where head i = Attention(Q i , K i , V O ) k and are projection parameter matrices, and W O is the output weight matrix. In each parallel attention layer, d k = d / h, where d k represents the embedding dimension of the matrices Q, K, V. ​

[0074] Finally, take the mean of the updated entity fusion representation to obtain the mean of the data distribution of relationship r in the updated entity fusion representation i where Mean(·) represents the mean operator where Mean(·) represents the mean operator

[0075] By applying the mapping function f (·) to σ obtain the corresponding standard deviation which is expressed as follows

[0076]

[0077] where represents the Sigmoid activation function and W σ is the linear mapping weight matrix. Here, the parameters c1 and c2 are set to 0.1 and 0.9 respectively. For each relationship r i a corresponding independent data distribution is obtained

[0078] S22. In the relationship complex distribution generator, take the mean of all relationships in the data distributions of all relationships obtained in S21 to obtain the mean of the relationship complex distribution At the same time, apply the mapping function f (·) to the standard deviation of all relationships in the data distributions of all relationships obtained in S21 σ to obtain the standard deviation of the relationship complex distribution Construct the relationship complex distribution based on the mean of the relationship complex distribution and the standard deviation of the relationship complex distribution n l n l where n represents the number of relationship latent variables

[0079] This method helps to capture the interdependencies and potential commonalities between different relationships to effectively model the correlations between different relationships. The present invention constructs a unified relationship complex data distribution and samples orthogonal relationship latent vectors from this complex distribution to explicitly represent relationship correlation information

[0080] S23. In the orthogonal relationship latent vector generator, sample relationship latent vectors n l from the relationship complex distribution constructed in S22 to represent the multi-faceted relationship association information in the knowledge graph, that is where sample(·) represents the operation of sampling from the normal distribution function. In addition, apply the orthogonal triangular decomposition method to the sampled relationship latent vectors RL to obtain orthogonal relationship latent vectors Among them, n o is the number of orthogonal relationship latent vectors, so as to ensure that the selected multi-faceted relationship association information is orthogonal and does not interfere with each other. Here, n l is set to 100, and n o << n l . This method can effectively isolate and accurately capture the context-aware representations between different relationships.

[0081] S3. Construct a relationship learner. The relationship learner learns the entity fusion representation of the knowledge graph obtained in S1 and the orthogonal relationship latent vectors obtained in S2, and uses the multi-head attention mechanism to integrate the relationship association information in the orthogonal relationship latent vectors into the relationship representation learning for storage. When performing the few-shot knowledge graph completion task, it is completed according to the relationship association information. The specific process is as follows:

[0082] For the fusion representation of each head and tail entity pair output by S13 and the orthogonal relationship latent vector RL obtained in S23 O perform a linear mapping to obtain a query matrix key matrix and value matrix The calculation method is as follows:

[0083]

[0084] According to the matrix matrix and matrix Use the multi-head attention mechanism to calculate the association matrix C between the fusion representation of each head and tail entity pair output by S13 and the orthogonal relationship latent vector RL obtained in S23 O . The association matrix C can effectively identify the orthogonal relationship latent vector RL that is highly correlated with the fusion representation of each head and tail entity pair . O .

[0085]

[0086] Apply the association matrix C to the orthogonal relationship latent vector RL related to the fusion representation of each head and tail entity pair to calculate the relationship association enhanced entity representation O so as to capture the multi-faceted relationship association information related to the relationship r i . The specific operation is as follows:

[0087]

[0088] Among them, C iand are the orthogonal relation latent vectors RL of the i-th head respectively O of the association matrix and the value matrix.

[0089] The representations of the head entity and the tail entity in the support set are used to perform MLP to obtain the enhanced entity representation γ i , and the enhanced relation representation is obtained through the mean operation Specifically as follows:

[0090]

[0091] Among them, MLP l (·) represents the l-th layer multi-layer perceptron, is the representation output by the -th layer multi-layer perceptron.

[0092] In order to obtain a more accurate relation representation, the present invention performs a mean operation on the relation-associated enhanced entity representation to obtain a context-aware relation representation with relation-associated information. Then it is combined with the above-mentioned learned enhanced entity representation to obtain the relation representation The specific process is as follows:

[0093]

[0094] Among them, is the context-aware relation representation of the relation r i .

[0095] The present invention proposes a general framework that combines the enhanced relation representation with the context-aware relation representation to learn a more accurate relation representation.

[0096] The present invention adopts a training strategy consisting of two parts: on the one hand, the meta-relation representation is learned using the head and tail entity pairs in the support set; on the other hand, the model parameters are updated using the query set. In the process of relation representation learning, a scoring function is first constructed to evaluate the authenticity of the head and tail entity pairs under the relation r i . The predicted representation of the tail entity is defined as follows: Secondly, a ranking loss function is designed, and its goal is to make the predicted tail entity in the support set as close as possible to the positive sample (i.e., the tail entity t′ j ), while being far from the negative sample (i.e., the tail entity ), specifically as follows:

[0097]

[0098] Finally, calculate the gradient of the loss function to update the relation r i representation, as shown in the following formula:

[0099]

[0100] where ω represents the step size of gradient update. The ranking loss function is adopted in the query set to update the model parameters, that is:

[0101]

[0102] where the scoring functions for positive and negative triples are defined as follows:

[0103]

[0104] During the entire model training process, the optimization objective is to minimize the sum of query losses for all relation tasks, that is:

[0105]

[0106] For the performance verification of the few-shot knowledge graph completion method designed in the present invention, in this embodiment, given the known head entity and relation in the knowledge graph, the tail entity is predicted. The datasets used are FB15K-237 and the dataset Nell-One. The dataset FB15K-237 contains 231 relations, 14,541 entities, and 281,624 triples. The dataset Nell-One contains 358 relations, 68,545 entities, and 181,109 triples. The two datasets are divided into training set / validation set / test set in the ratio of 75 / 11 / 33. The evaluation metrics of MRR, Hits@10, Hits@5, and Hits@1 are selected and compared with the following methods: GMatching, MetaR, FSRL, FAAN, GANA, CIAN, HiRe. In Tables 1 and 2, the best results are shown in bold.

[0107] Table 1 Experimental results for 1-shot

[0108]

[0109] Here, 1-shot means that for each relation, there is only one training sample, which is the fact (h, r, t) composed of the head entity, relation, and tail entity.

[0110] Table 2 Experimental results for 5-shot

[0111]

[0112] Here, the 5 samples refer to the fact that each relationship has 5 training samples, which are composed of a head entity, a relationship, and a tail entity (h, r, t).

[0113] From the experimental results, it can be observed that in the few-shot knowledge graph completion task, the proposed method achieves the best results in both the 1-sample experiment and the 5-sample experiment, showing strong competitiveness compared with the baseline models. Especially in the 1-sample experiment on the FB15K-237 dataset, the model performance is significantly improved, where Hit@5 increases by 37.08% and Hit@1 increases by 52.61%. This result indicates that introducing multi-hop neighbor information in the process of enhancing the representation of head and tail entity pairs and combining relationship association information to optimize the relationship meta-representation can effectively improve the accuracy of the model.

[0114] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope defined by the claims of the present invention.

Claims

1. A few-sample knowledge graph completion method based on multi-hop neighbor aggregation and relationship association, characterized by: The following steps are involved: S1. Given a knowledge graph in the field of intelligent question answering, a multi-hop entity neighbor aggregator is constructed, and the multi-hop entity neighbor aggregator is used to aggregate the information of multi-hop entity neighbors in the knowledge graph to obtain an entity fusion representation of the knowledge graph. The multi-hop entity neighbor aggregator includes a TransE model, a graph neural network, and a multi-layer perceptron in sequence. S2. Construct an orthogonal relationship latent vector generator, and use the orthogonal relationship latent vector generator to obtain the orthogonal relationship latent vector of the entity fusion representation of the knowledge graph obtained in S1, wherein the orthogonal relationship latent vector generator includes a relationship distribution generator, a relationship complex distribution generator and an orthogonal relationship latent vector generator in sequence; S3. Construct a relational learner. The relational learner learns the entity fusion representation of the knowledge graph obtained in S1 and the orthogonal relationship latent vector obtained in S2, and uses a multi-head attention mechanism to integrate the relationship association information in the orthogonal relationship latent vector into the relationship representation learning and storage. When performing a few-sample knowledge graph completion task, the completion is performed based on the relationship association information.

2. The method for completing a few-sample knowledge graph based on multi-hop neighbor aggregation and relationship association according to claim 1, characterized in that: The specific process of S1 is as follows: S11. Given a knowledge graph in the field of intelligent question answering, use the TransE model to learn and obtain the initial embedding representation of entities and relationships in the knowledge graph; S12. In the graph neural network, all entity neighbor information in the knowledge graph is obtained according to the input initial embedding representation of entities and relationships in the knowledge graph, multi-hop entity neighbor information in the knowledge graph is aggregated from all entity neighbor information in the knowledge graph using an attention mechanism, and the aggregated multi-hop entity neighbor information is output as an enhanced entity representation of the knowledge graph; S13. In the multi-layer perceptron, the enhanced entity representation of the knowledge graph outputted by S12 is fused, and an entity fusion representation of the knowledge graph is outputted, wherein the entity fusion representation includes the fusion representation of each head and tail entity pair.

3. The method for completing a few-sample knowledge graph based on multi-hop neighbor aggregation and relationship association according to claim 2, characterized in that: The scoring function f of the TransE model in S11 r (h,t) is in, and They represent the embedding of head entity h, relation r and tail entity t respectively, and d is the embedding dimension.

4. The method for completing a few-sample knowledge graph based on multi-hop neighbor aggregation and relationship association according to claim 3 is characterized in that: The specific process of S12 is as follows: First, the initial embedding representations of entities and relationships in the knowledge graph are input into the graph neural network to obtain all entity neighbor information in the knowledge graph; Then, the attention mechanism is used to aggregate the multi-hop entity neighbor information in the knowledge graph from all entity neighbor information in the knowledge graph, as shown in the following formula: Among them, the initial embedding representations of entity v and entity u are recorded as and The initial embedding representation of relation r is denoted as The initial hidden state of relation r is expressed as W r Represents the learnable transformation matrix of relation r, W l and denote the weight matrix and bias vector of the lth layer respectively, N(r) denotes the set of neighbor entities associated with relation r, N(v) denotes the set of neighbor relations of entity v, the function ReLU(·) denotes the ReLU activation function, and [·||·] denotes the feature concatenation operation. At the lth layer, the information embedding stored in entity v and entity u is expressed as and L is the length of the multi-hop relationship path; is the attention weight vector, which is used to distinguish the importance of the relationship in N(v), and is specifically expressed as follows: Among them, W is the weight matrix, represents a neighbor relationship of entity v, and LeakyReLU(·) represents an activation function; Finally, the aggregated multi-hop entity neighbor information is output as an enhanced entity representation of the knowledge graph, and the enhanced entity representation includes enhanced head and tail entity pairs.

5. The method for completing a few-sample knowledge graph based on multi-hop neighbor aggregation and relationship association according to claim 4, characterized in that: The specific process of S13 is as follows: The enhanced head and tail entity pairs are input into the multi-layer perceptron MLP for fusion, and the entity fusion representation of the corresponding knowledge graph is output. The entity fusion representation includes the fusion representation of each head and tail entity pair, which is specifically represented as follows: in, To enhance the j-th head entity embedding, is the j-th tail entity embedding after enhancement, and k is the number of entities in the support set.

6. The method for completing a few-sample knowledge graph based on multi-hop neighbor aggregation and relationship association according to claim 5, characterized in that: The specific process of S2 is: S21, in the relationship distribution generator, using a multi-head attention mechanism to calculate the data distribution mean of each relationship in the entity fusion representation of the knowledge graph output by S13, applying a mapping function to the mean to obtain the data distribution standard deviation of the relationship, using the mean and the standard deviation as the data distribution of the relationship, and obtaining the data distribution of all relationships; S22. In the relational complex distribution generator, the means of all relations in the data distribution of all relations obtained in S21 are averaged to obtain the mean of the relational complex distribution. Meanwhile, a mapping function is applied to the standard deviations of all relations in the data distribution of all relations obtained in S21 to obtain the standard deviation of the relational complex distribution. The relational complex distribution is constructed according to the mean of the relational complex distribution and the standard deviation of the relational complex distribution. S23. In the orthogonal relationship latent vector generator, sample a relationship latent vector from the relationship complex distribution constructed in S22, apply an orthogonal triangular decomposition method to the relationship latent vector, and obtain an orthogonal relationship latent vector.

7. The method for completing a few-sample knowledge graph based on multi-hop neighbor aggregation and relationship association according to claim 6, characterized in that: The specific process of S21 is as follows: S211, processing the fusion representation of each head and tail entity pair output by S13 through linear mapping to obtain a query matrix, a key matrix and a value matrix; S212, using a multi-head attention mechanism to calculate the score between each fused representation in the fused representation of each head and tail entity pair output by S13, and converting the score into a probability matrix according to the query matrix, the key matrix and the value matrix; S213, based on the probability matrix, integrating the fusion representation of each head-tail entity pair with similar head-tail entity pairs to obtain an updated fusion representation of each head-tail entity pair, that is, obtaining an updated entity fusion representation; S214, obtaining the mean of the updated entity fusion representation, and obtaining the data distribution mean of each relationship in the updated entity fusion representation according to the mean; S215 , applying a mapping function to the data distribution mean to obtain a data distribution standard deviation of the corresponding relationship, taking the data distribution mean and the data distribution standard deviation as the data distribution of the corresponding relationship, and obtaining the data distribution of all relationships.

8. The method for completing a few-sample knowledge graph based on multi-hop neighbor aggregation and relationship association according to claim 7, characterized in that: The specific process of S3 is as follows: S31, linearly map the fusion representation of each head and tail entity pair output by S13 and the orthogonal relationship potential vector obtained by S23 to obtain the query matrix Key Matrix Sum Matrix S32, according to the query matrix Key Matrix Sum Matrix The multi-head attention mechanism is used to calculate the association matrix between the fusion representation of each head-tail entity pair output by S13 and the orthogonal relationship potential vector obtained by S23; S33, applying the association matrix to the orthogonal relationship potential vector associated with the enhanced fusion representation of the head-tail entity pair to calculate the relationship association enhanced entity representation; S34, taking the average of the relationship-related enhanced entity representations to obtain a context-aware relationship representation; S35, the knowledge graph support set given in S1 is used to obtain enhanced entity representation through a multi-layer perceptron, and the enhanced relationship representation is obtained by calculating the mean value of the enhanced entity representation; S36: Fusing the context-aware relationship representation and the enhanced relationship representation to obtain a relationship representation.