Small sample knowledge graph completion method based on embedding fusion and data enhancement
By introducing a triple encoder and data enhancement technology with two-sided fusion representation in knowledge graph completion, the problem of data scarcity in small sample knowledge graph completion is solved, and higher model performance and accuracy are achieved.
Patent Information
- Application Number
- CN202411332190.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-09-24
AI Technical Summary
Existing knowledge graph completion methods perform poorly in the face of scarce support set data, especially in small samples, and lack effective methods to improve model accuracy and performance.
A small sample knowledge graph completion method based on embedded fusion and data augmentation is proposed. The entity representation is generated through a triple encoder with a two-sided fusion representation, and data augmentation is carried out through similar relationships in the background knowledge graph to improve the overall performance of the model.
The experiments on the Nell-One and FB15k-237 datasets significantly improved the performance of small sample completion, especially with low K values, the model performed better than the existing state-of-the-art baseline methods.
Smart Images

Figure CN119537600A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of knowledge graph completion, and in particular relates to a small sample knowledge graph completion method based on embedding fusion and data enhancement. Background Art
[0002] Knowledge graph is a structured data storage format, a directed heterogeneous graph consisting of entities and their relationships. It is usually composed of fact triples in the form of (head entity, relationship, tail entity). Knowledge graphs are widely used in many fields, including knowledge discovery, dialogue systems, semantic extraction, etc., due to their powerful semantic expression ability and information storage function. However, existing knowledge graphs are often incomplete, so knowledge graph completion (KGC) is needed to infer missing relationships or tail entities, thereby improving the application effect of knowledge graphs.
[0003] In recent years, methods based on knowledge graph embedding (KGE) have been widely used in knowledge graph completion problems, such as TransE, TransH, TransR, ComplE, etc., and have achieved good performance. These embedding-based methods generally project entities and relations into a low-dimensional vector space, and then calculate the positional relationship between entities to complete the knowledge graph. Most embedding-based knowledge graph completion systems usually require a large number of training triples to learn the representation of specific relations. However, in real knowledge graphs, relations often present a long-tail distribution, and the number of relation triplets of the same relation is very limited. For example, in the NELL and Wikidate datasets, more than 20% of the relations have less than 10 support triples. Traditional knowledge graph completion methods are greatly limited in solving these problems. Therefore, the few-shot knowledge graph completion model came into being, aiming to solve the problem that traditional knowledge graph completion methods perform poorly when faced with scarce support set data.
[0004] The general goal of the few-shot knowledge graph completion task is to learn the representation of a relation r given its K supporting entity pairs and predict the tail entity t in the query triple (h, r, ?). Some methods are based on the KGE idea and have achieved good results by assigning fixed weights to each neighbor node to enhance the entity representation. For example, the model proposed by Xiong et al. in 2018 simply assigns weights to each neighbor node, while the FAAN model by Sheng et al. in 2020 introduces the self-attention mechanism in Transformer and dynamically sets the weights of neighbor nodes on this basis. Subsequent studies have mostly referred to the methods of the FAAN model and enriched the information carried by entity embeddings through subgraph construction in different forms. There are also some methods that regard the query set of few-shot relations as a meta-learning task and focus on how to improve the adaptability of the model on different meta-learning tasks, such as Meta-KGR and MetaR, which emphasize the role of relation-specific meta-information in knowledge graph completion. In addition, some models believe that entities with the same relationship should have similar relationship paths, and use relationship path matching methods to complete small sample knowledge graphs, such as GMacking, FSRL, P-INT, etc.
[0005] Although the above models have made some progress in the problem of small-sample knowledge graph completion, these models still have some limitations: (1) In the process of constructing subgraph embeddings for entities, they generally use a single method to model entities, without considering that in different tasks, the neighborhood relationships of entities should reflect different levels of information. (2) They do not fully utilize the relationships in the background knowledge graph. A major difficulty in completing relationships with small samples is that the number of support sets is too small, and the generated query relationships do not have sufficient information support, resulting in low accuracy of small-sample completion. Although there are no relationships in the background knowledge graph that are the same as the task relationships, triplets with similar relationships can supplement the small-sample completion task to a certain extent. Summary of the invention
[0006] In view of the shortcomings of the above-mentioned prior art, the present invention proposes a small sample knowledge graph completion method based on embedding fusion and data enhancement. It constructs two embeddings from different angles for entities, namely, a relational hierarchical embedding that reflects the overall embedded information and a head and tail entity semantic embedding that reflects the task information. Then, the support set of the task is enhanced by using the triplets in the similar relations in the background knowledge graph, thereby improving the overall performance of the model.
[0007] To achieve the above objectives, this application proposes a small sample knowledge graph completion method based on embedding fusion and data enhancement, including:
[0008] Step 1: Design a triple encoder with bilateral fusion representation for entity representation generation
[0009] The triple encoder architecture with bilateral fusion representation is used for entity representation generation. The triple encoder architecture with bilateral fusion representation consists of two parts: an attention entity prototype modeler and a task-side entity modeler. Therefore, the entity representation is divided into two parts, the attention entity prototype and the task-side entity modeling. The attention entity prototype captures the global information of the entity through multi-hop neighborhood modeling. Using a relational graph neural network, the relational information of the entity and its neighborhood is aggregated at multiple levels to generate an embedded representation that can reflect the global characteristics of the entity. Task-side entity modeling focuses on the performance of the entity in a specific task. Through linear transformation and bilinear dot product, the semantic information of the head and tail entities under a specific task relationship is obtained to generate a task-related embedded representation.
[0010] Step 2: Support set enhancement
[0011] By extracting relation triplets similar to task relations from the background knowledge graph, the quantity and quality of the support set are expanded. The similarity between task relations and background relations is calculated using cosine similarity, and the quality of enhanced triplets is controlled through a gating mechanism to ensure that they contribute positively to the representation of task relations.
[0012] Step 3: Design a relational encoder
[0013] The relation encoder uses a bidirectional LSTM (Bi-LSTM) to generate relation embeddings, taking into account the long-distance dependencies between different triplets. Combined with the enhanced triplets, the final relation representation is generated by adaptively aggregating hidden states.
[0014] Step 4: Design the ManifoldE decoder
[0015] The ManifoldE decoder operates in a three-dimensional manifold sphere, expanding the two-dimensional vector to three-dimensional space to adapt to complex relationships in small sample conditions. Through the embedding of head entities and relations, the candidate tail entities are scored, the corresponding tail entities are found, and the missing triples in the query set are filled.
[0016] Step 5: Model Optimization
[0017] The models of steps one to three are optimized by forming negative triplets, and the optimized models are used to complete the small sample knowledge graph.
[0018] Beneficial effects of the present invention: The method proposed in the present invention was experimented on two datasets, Nell-One and FB15k-237. In the K-shot small sample completion scenario, the present method has significant improvements over the existing most advanced baseline methods, especially when the K value is low, the decline in various indicators of the present method is not obvious. Due to the use of multiple embedding aggregation methods, the entity embedding produced by the present method is richer, and similar entities in the background knowledge graph are used as reinforcement of the relationship representation, which is more accurate than the relationship representation of ordinary methods. The introduction of the ManifoldE method makes the relationship decoder more tolerant of the operation of the tail entity. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 Flowchart of a small-sample knowledge graph completion method based on embedding fusion and data augmentation. DETAILED DESCRIPTION
[0020] The present invention will be further described below in conjunction with the accompanying drawings and embodiments;
[0021] The flow chart of the present invention is as follows Figure 1 A small sample knowledge graph completion method based on embedding fusion and data enhancement specifically includes the following steps:
[0022] Step 1: Design a triple encoder with bilateral fusion representation for entity representation generation;
[0023] The entity representation is divided into two parts, attention entity prototype and task-side entity modeling.
[0024] Step 1.1: Modeling the Attention Entity Prototype
[0025] For a given entity v and its neighborhood N, the attention relationship hierarchical fusion mechanism is used to aggregate their information. Specifically, entities with the same number of hops away from the given entity are regarded as entities in the same layer of neighborhood, and then an aggregate relationship representation with attention is established for the neighbor relationship and neighbor entity representation, and then the entity representation is modeled. The specific formula for attention relationship hierarchical fusion is as follows:
[0026]
[0027] in, represents the neighborhood embedding centered on entity v at the l-1th layer, “:” represents the concatenation operation, represents the neighborhood mixed embedding of the l-1th layer for a given entity v, represents the neighbor relationship embedding of the l-1th layer, represents the entity embedding in the neighborhood of layer l-1, u i represents the entity that is l-1 (i.e., the l-1th layer) away from the given entity v. represents the background knowledge graph, N(l-1) represents the neighborhood knowledge graph with a distance l-1 from the given entity v, and the neighborhood knowledge graph includes neighbor relationships and entities. represents the aggregation result of attention given to all neighbor entities and neighbor relations in the l-1 layer, Represents a function for calculating the relation r i The learnable weight matrix, represents the neighborhood mixed embedding of the given entity v at the lth layer after calculation, and ReLU(·) represents the activation function. Here, and represents the learnable weight matrix of layer l, b l represents the learnable bias term of layer l, attention a ri The calculation method is as follows:
[0028]
[0029] Among them, W is a learnable weight matrix, and the activation function is LeakyReLU.
[0030] The hierarchical message passing of graph neural networks represents the exploration of implicit relationships between multi-hop entities. Here, we set L layers to be stacked, that is, the neighbor entities within the range of L hops from the given entity and the corresponding neighbor relationships are embedded in the given entity representation. The specific formula is as follows:
[0031]
[0032] Among them, LayerMessagePass(·) represents the attention relationship hierarchical fusion mechanism mentioned above. It is the knowledge embedding pre-trained by TransE method. In this experiment, L=2 is selected as the way to filter the path.
[0033] After generating entity representations, each triple in the support set can be represented as the concatenation of its head and tail entity representations, expressed as:
[0034]
[0035] Among them, h i The head entity of a supporting triple in the support set of the task relationship, r represents the task relationship, t i The tail entity of a supporting triple in the support set of the task relationship, C r represents the support set of a knowledge graph completion task about relation r, represents the embedding of the head entity after L layers of attention relationship hierarchical fusion mechanism, It represents the embedding of the tail entity after L layers of attention relation level fusion mechanism; is the prototype embedding of this triple.
[0036] Step 1.2: Task side entity modeling:
[0037] Entity prototype modeling focuses on the global information of the entity, while task-side entity modeling is different from entity prototype modeling. In task-side entity modeling, a given entity is placed in its matching entity environment to identify the relevant semantics between the head and tail entities, so as to obtain a strong task-related embedding representation. The specific process of task-side entity modeling is as follows:
[0038] Step 1.2.1: For a given knowledge graph completion task about r, the support set C r , for one of the supporting triples (h i ,r,t i ), first preliminarily calculate the relationship representation:
[0039]
[0040] Among them, BiLinear represents a bilinear layer, and the calculation result is divided into two to obtain the representation of the forward relationship. and the backward relationship represents the head entity embedding of this support triple, Represents tail entity embedding.
[0041] Step 1.2.2: For the head entity h i For example, the head entity h i The local neighborhood information of is expressed as:
[0042]
[0043] Represents the head entity h i A neighbor relationship; Head entity h i Calculate the embedding of a neighborhood information of the head entity
[0044]
[0045] in, It's a neighbor relationship Embedding Neighbor entity Embedding of W n is the learnable weight matrix about the neighborhood, b nrepresents a learnable bias parameter with respect to the neighborhood. and After being concatenated, they pass through a feed-forward neural network to get an embedding representation of the neighborhood.
[0046] Then a series of linear transformations are used to transform the required information into different matrices. The specific formula is as follows:
[0047]
[0048] in, The forward relation representing the bilinear transformation represents the result after deformation by the learnable matrix; Represents the result of the tail entity embedding of this support set after being deformed by the learnable matrix; Represents the result of embedding a neighbor relationship in the neighborhood of the head entity of this support set after passing through the learnable matrix; W represents the embedding result of a neighborhood information in the neighborhood of the head entity of this support set after passing through the learnable matrix. R ,W T ,W K and W N These are all learnable matrices. Through these linear transformations, embeddings of various shapes are organized into matrices that can be calculated for the next step.
[0049] The correlation between the neighbor relationship and the task relationship is then calculated by bilinear dot product, and the correlation scores of all neighbor entities are normalized using the softmax function as follows:
[0050]
[0051] Represents the neighbor relationship r in the neighborhood of the head entity j The weight coefficient of task relationship r; Represents the relationship r in the neighborhood of the head entity j About the tail entity t i The weight coefficient of . and is a trainable weight vector used to learn the interaction between relations. Finally, all neighbor relations are aggregated through the attention mechanism to obtain the representation of the task relations in the neighborhood and the entities at the tail of the neighborhood.
[0052]
[0053]
[0054] in, Represents the embedding of the head entity neighborhood mapping of this support triple on the task relation; represents the embedding of the head entity neighborhood mapping of this supporting triple on the tail entity. Finally, and Pre-trained embeddings with head entities Combined, generate the task-side embedding of the entity:
[0055]
[0056] in, Is applied to The learnable matrix of Is applied to The learnable matrix, Is applied to The learnable matrix. Represents the task-side embedding of the head entity and its domain.
[0057] Step 1.2.3: Use the same method as step 1.2.2 to process the tail entities to obtain their task-side representations. Then, concatenate the head entity and the tail entity to form the task-side embedding of the triple:
[0058]
[0059] Step 1.3: Entity Fusion Modeling Embedding
[0060] After obtaining the embeddings of the above two modalities, an adaptive embedding fusion mechanism is used to perform bidirectional embedding on each entity.
[0061]
[0062] in, represents the adaptive weights applied to the triplet task-side embedding, represents the adaptive weight applied to the triple prototype embedding, s i is a bidirectional triplet fusion embedding. task represents the learnable matrix used to calculate the adaptive weights of the triplet task-side embedding, W prototype represents the learnable matrix used to compute the adaptive weights of triplet prototype embeddings, represents a combination operation, where element-wise multiplication is used, and exp(·) represents a nonlinear transformation operation.
[0063] Through an adaptive embedding fusion mechanism, information from different aspects of triples is combined together to generate relation representation.
[0064] Step 2: Design support set enhancement components
[0065] This is a support set enhancement module based on task relationship similarity. For a given knowledge graph completion task, based on the idea provided by TransE, the pre-trained embedding of the head entity minus the pre-trained embedding of the tail entity is used as the preliminary relationship representation.
[0066] e r =e t -e h
[0067] Among them, e h and e t represents the pre-trained embeddings that support the head and tail entities in the triple, e r Indicates a preliminary relationship representation.
[0068] In order to make r This can express more information. r This embedding is considered to follow a Gaussian distribution z0~N(μ(e r ),σ(e r )), where μ(e r ) and σ(e r ) is defined as follows:
[0069] x = ReLU(MLP(e r )),
[0070] μ(e r )=MLP(x),
[0071] σ(e r )=0.1+0.9*Sigmoid(MLP(e r ))
[0072] This distribution is then expanded through a regularization flow to form a more complex high-dimensional distribution, aiming to deeply explore the information contained in it.
[0073]
[0074] Among them, g i It can be any bijective transformation function. The purpose of the bijective transformation function is to use some intermediate transformations to make the distribution of relational expressions follow a more complex high-dimensional distribution, thereby enhancing the information content. After obtaining the high-dimensional distribution, some triples similar to the task relationship are extracted from the background knowledge graph as an enhancement of the query task, which are called "enhanced triples".
[0075]
[0076] Here, cosine similarity is used to calculate the similarity between the enhancement relationship and the task relationship. trepresents the high-dimensional distribution of the task relationship after intermediate transformation, and The high-dimensional distribution of the relationship in the background knowledge graph after the intermediate transformation is obtained. Subsequently, the triples most relevant to the task relationship are retrieved from the background knowledge graph through similarity, and these triples are added to the support set of the task relationship to achieve the purpose of enhancing the support set.
[0077] Step 3: Relational Encoder
[0078] Since the relationship of the enhanced triples is not completely consistent with the task relationship, before entering the relation encoder module, the enhanced triples need to pass through a gating unit to control their participation in the final generated relation expression. The specific process is as follows:
[0079]
[0080] in, represents the result of the enhanced triple after the entity representation generation step 1, S bkg Indicated by The enhanced triple set composed of b g represents the learnable bias parameter.
[0081] According to the gating parameters, the final state of the enhanced triple in the relational expression is calculated as follows:
[0082]
[0083] The relation encoder is responsible for generating representations of few-shot relations: Bi-LSTM is used as the generator of relation embedding. It is able to consider long-distance dependencies between different triplets in the same support set and is widely used to summarize triplets in the support set. The specific calculation method is as follows:
[0084]
[0085] in, represents the result obtained after the entity representation generation step of the enhanced triple extracted from the background knowledge graph, and s i Represents the result obtained after the original support triples go through the entity representation generation step. i , Represents the result after Bi-LSTM long distance encoding.
[0086] Then, adaptive aggregation of hidden states is used to obtain the final relational representation. The expression is as follows:
[0087] o i =tanh(W o s , 1+b),
[0088]
[0089] Among them, b represents the learnable bias parameter, and the relationship represents e , r Will be used to predict new facts in the query set. i It is the hidden state after conversion that captures the core features of the relationship and provides a basis for the next step of attention weight calculation. K represents the size of the support set. i is the attention weight used to calculate the relation vector.
[0090] Step 4: Relational Decoder
[0091] The decoder scores the candidate tail entities based on the head entity and relation embedding, aiming to find the corresponding tail entity to fill the gap in the query set triple (h, r, ?). ManifoldE extends the two-dimensional vector operation to the three-dimensional manifold sphere, expanding the acceptable error range of the model. The specific formula is as follows:
[0092]
[0093] Among them, D r is the manifold parameter related to the space radius, and M represents the manifold function. TransE is used as the manifold function here to handle complex relationships in few-shot completion.
[0094] Step 5: Optimize
[0095] For the training task set R train Select the relation r from the set and randomly select K triples from it as the support set S of the relation. r , and randomly select some entity pairs to form the query set Q r At the same time, the model creates some negative triples consisting of random tail entities for each triple in the query set. These incorrectly matched negative triples constitute the negative query set - Q r The few-shot completion task is to score these triplets using the decoder and ensure that the query set Q r The similarity score obtained by the positive query in is higher than that of the negative query in the negative query set -Q_r. The specific formula is as follows:
[0096]
[0097] Here, q^+ represents the score of positive query, q^- represents the score of negative query, and γ is a boundary hyperparameter. The whole training process follows the multi-sampling meta-training process. By minimizing Φ, the whole model achieves the best performance.
[0098] Table 1
[0099]
[0100] The method of the present invention has conducted a large number of experiments based on two real-world datasets, NELL-One and FB15k-237. In the K-shot recommendation scenario, two widely used evaluation indicators, Hits@K and MRR, are used to evaluate the recommended set. The recommendation results based on the two datasets are shown in Table 1. From the experimental results, it can be seen that the present method is significantly better than all baseline models. Specifically, taking MRR as an example, compared with the best baseline model NP-FKGC, the performance improvement of SHAO of the present invention on NELL-one (5shot, 3shot, 1shot) is 11.3% / 7.7% / 4.8% respectively, and on FB15K-237 it is 2.3% / 7.6% / 6.3%.
Claims
1. A small sample knowledge graph completion method based on embedding fusion and data enhancement, characterized in that: Here are the steps: Step 1: Design a triple encoder with bilateral fusion representation for entity representation generation The triple encoder architecture of bilateral fusion representation is used for entity representation generation. The triple encoder architecture of bilateral fusion representation consists of two parts: attention entity prototype modeler and task-side entity modeler. Therefore, entity representation is divided into two parts, attention entity prototype and task-side entity modeling. Attention entity prototype captures the global information of entity through multi-hop neighborhood modeling. Using relational hierarchical graph neural network, the relational information of entity and its neighborhood is aggregated at multiple levels to generate an embedded representation that can reflect the global characteristics of entity. Task-side entity modeling focuses on the performance of entity in specific tasks. Through linear transformation and bilinear dot product, the semantic information of head and tail entities in specific task relationship is obtained to generate task-related embedded representation. Step 2: Support set enhancement By extracting relation triplets similar to task relations from the background knowledge graph, the quantity and quality of the support set are expanded; the similarity between task relations and background relations is calculated using cosine similarity, and the quality of enhanced triplets is controlled through a gating mechanism to ensure that they contribute positively to the representation of task relations; Step 3: Design a relational encoder The relation encoder uses bidirectional LSTM to generate relation embeddings, taking into account the long-distance dependencies between different triplets. It combines enhanced triplets and generates the final relation representation by adaptively aggregating hidden states. Step 4: Design the ManifoldE decoder The ManifoldE decoder operates in a three-dimensional manifold sphere, expanding the two-dimensional vector to three-dimensional space to adapt to complex relationships in small sample conditions. It scores candidate tail entities through head entity and relationship embedding, finds the corresponding tail entity, and fills in the missing triples in the query set. Step 5: Model Optimization The models of steps one to three are optimized by forming negative triplets, and the optimized models are used to complete the small sample knowledge graph.
2. According to claim 1, a small sample knowledge graph completion method based on embedding fusion and data enhancement is characterized in that: Step 1 specifically includes: Step 1.1: Modeling the Attention Entity Prototype For a given entity v and its neighborhood N, the attention relationship hierarchical fusion mechanism is used to aggregate their information. Specifically, entities with the same number of hops away from the given entity are regarded as entities in the same layer of neighborhood, and then an aggregate relationship representation with attention is established for the neighbor relationship and neighbor entity representation, thereby modeling the entity representation. The specific formula for attention relationship hierarchical fusion is as follows: in, represents the neighborhood embedding centered on entity v at the l-1th layer, ":" represents the concatenation operation, represents the neighborhood mixed embedding of the l-1th layer for a given entity v, represents the neighbor relationship embedding of the l-1th layer, represents the entity embedding in the neighborhood of layer l-1, u i represents an entity that is l-1 layers away from a given entity v. represents the background knowledge graph, N(l-1) represents the neighborhood knowledge graph with a distance l-1 from the given entity v, and the neighborhood knowledge graph includes neighbor relationships and entities; represents the aggregation result of attention given to all neighbor entities and neighbor relations in the l-1 layer, Represents a function for calculating the relation r i The learnable weight matrix, represents the neighborhood mixed embedding of the given entity v at the lth layer after calculation, and ReLU(·) represents the activation function. Here, and represents the learnable weight matrix of layer l, b l represents the learnable bias term of layer l, attention a ri The calculation method is as follows: Among them, W is a learnable weight matrix, and the activation function is LeakyReLU; Set the stacking layer to L, and embed the neighbor entities within the range of L hops from the given entity and the corresponding neighbor relationships into the given entity representation. The specific formula is as follows: Among them, LauerMessagePass(·) represents the attention relationship hierarchical fusion mechanism mentioned above, It is the knowledge embedding pre-trained by the TransE method; After generating entity representations, each triple in the support set can be represented as the concatenation of its head and tail entity representations, expressed as: Among them, h i The head entity of a supporting triple in the support set of the task relationship, r represents the task relationship, t i The tail entity of a supporting triple in the support set of the task relationship, C r represents the support set of a knowledge graph completion task about relation r, represents the embedding of the head entity after L layers of attention relationship hierarchical fusion mechanism, It represents the embedding of the tail entity after L layers of attention relation level fusion mechanism; is the prototype embedding of this triple; Step 1.2: Task side entity modeling: In entity prototype modeling, the global information of the entity is focused on. Task-side entity modeling is different from entity prototype modeling. In task-side entity modeling, a given entity is placed in its matching entity environment to identify the relevant semantics between the head and tail entities, so as to obtain a strong task-related embedding representation. The specific process of task-side entity modeling is as follows: Step 1.2.1: For a given knowledge graph completion task about r, the support set C r , for one of the supporting triples (h i ,r,t i ), first preliminarily calculate the relationship representation: Among them, BiLinear represents a bilinear layer, and the calculation result is divided into two to obtain the representation of the forward relationship. and the backward relationship represents the head entity embedding of this support triple, represents tail entity embedding; Step 1.2.2: For the head entity h i For example, the head entity h i The local neighborhood information of is expressed as: Represents the head entity h i A neighbor relationship; Head entity h i A neighbor entity of the head entity; calculate the embedding of a neighborhood information of the head entity in, It's a neighbor relationship Embedding Neighbor entity Embedding of W n is the learnable weight matrix about the neighborhood, b n represents the learnable bias parameter about the neighborhood; and After being concatenated, it passes through a feed-forward neural network to obtain an embedding representation of a neighbor; Then a series of linear transformations are used to transform the required information into different matrices. The specific formula is as follows: in, The forward relation representing the bilinear transformation represents the result after deformation by the learnable matrix; Represents the result of the tail entity embedding of this support set after being deformed by the learnable matrix; Represents the result of embedding a neighbor relationship in the neighborhood of the head entity of this support set after passing through the learnable matrix; represents the embedding result of a neighborhood information in the neighborhood of the head entity of this support set after passing through the learnable matrix; W R ,W T ,W K and W N These are all learnable matrices. Through these linear transformations, embeddings of various shapes are organized into matrices that can be calculated for the next step. The correlation between the neighbor relationship and the task relationship is then calculated by bilinear dot product, and the correlation scores of all neighbor entities are normalized using the softmax function as follows: Represents the neighbor relationship r in the neighborhood of the head entity j The weight coefficient of task relationship r; Represents the relationship r in the neighborhood of the head entity j About the tail entity t i The weight coefficient of and is a trainable weight vector used to learn the interaction between relations; finally, all neighbor relations are aggregated through the attention mechanism to obtain the representation of the task relations in the neighborhood and the entities at the tail of the neighborhood; in, Represents the embedding of the head entity neighborhood mapping of this support triple on the task relation; represents the embedding of the head entity neighborhood mapping of this supporting triple on the tail entity; finally, and Pre-trained embeddings with head entities Combined, generate the task-side embedding of the entity: in, Is applied to The learnable matrix of Is applied to The learnable matrix, Is applied to The learnable matrix of represents the task-side embedding of the head entity and its domain; Step 1.2.3: Use the same method as step 1.2.2 to process the tail entities to obtain their task-side representations; then, concatenate the head entity and the tail entity to form the task-side embedding of the triple: Step 1.3: Entity Fusion Modeling Embedding After obtaining the embeddings of the above two modalities, an adaptive embedding fusion mechanism is used to perform bidirectional embedding on each entity; in, represents the adaptive weights applied to the triplet task-side embedding, represents the adaptive weight applied to the triple prototype embedding, s i is a bidirectional triplet fusion embedding; W task represents the learnable matrix used to calculate the adaptive weights of the triplet task-side embedding, W prototype represents a learnable matrix for computing the adaptive weights of triple prototype embeddings, ⊕ represents a combination operation, where element-wise multiplication is used, and exp(·) represents a nonlinear transformation operation; Through an adaptive embedding fusion mechanism, information from different aspects of triples is combined together to generate relation representation.
3. According to claim 1, a small sample knowledge graph completion method based on embedding fusion and data enhancement is characterized in that: Step 2 specifically includes: For a given knowledge graph completion task, based on the idea provided by TransE, the pre-trained embedding of the head entity minus the pre-trained embedding of the tail entity is used as the preliminary relationship representation; And r =and t -And h Among them, e h and e t represents the pre-trained embeddings that support the head and tail entities in the triple, e r Indicates a preliminary relationship representation; In order to make r This can express more information. r This embedding is considered to follow a Gaussian distribution z0~N(μ(e r ),σ(e r )), where μ(e r ) and σ(e r ) is defined as follows: x=ReLU(MLP(e r )), μ(e r )=MLP(x), σ(e r )=0.1+0.9*Sigmoid(MLP(e r )) This distribution is then expanded through a regularization flow to form a more complex high-dimensional distribution, aiming to deeply explore the information contained in it; Among them, g i It can be any bijective transformation function. The purpose of the bijective transformation function is to use some intermediate transformations to make the distribution of relational expressions follow a more complex high-dimensional distribution, thereby enhancing the information content. After obtaining the high-dimensional distribution, some triples similar to the task relationship are extracted from the background knowledge graph as an enhancement of the query task, which are called "enhanced triples". Here, cosine similarity is used to calculate the similarity between the enhancement relationship and the task relationship; t represents the high-dimensional distribution of the task relationship after intermediate transformation, and The high-dimensional distribution obtained after the intermediate transformation of the relationship in the background knowledge graph is represented; then, the triples most relevant to the task relationship are retrieved from the background knowledge graph through similarity, and these triples are added to the support set of the task relationship to achieve the purpose of enhancing the support set.
4. According to claim 1, a small sample knowledge graph completion method based on embedding fusion and data enhancement is characterized in that: Step three specifically includes: Since the relationship of the enhanced triples is not completely consistent with the task relationship, before entering the relation encoder module, the enhanced triples need to pass through a gating unit to control their participation in the final generated relation expression; the specific process is as follows: in, represents the result of the enhanced triple after the entity representation generation step 1, S bkg Indicated by The enhanced triple set composed of b g represents the learnable bias parameter; According to the gating parameters, the final state of the enhanced triple in the relational expression is calculated as follows: The relation encoder is responsible for generating representations of few-shot relations: Bi-LSTM is used as the generator of relation embedding; it is able to consider long-distance dependencies between different triplets in the same support set and is widely used to summarize triplets in the support set; the specific calculation method is as follows: in, represents the result obtained after the entity representation generation step of the enhanced triple extracted from the background knowledge graph, and s i represents the result obtained after the original support triples go through the entity representation generation step; s' i Represents the result after Bi-LSTM long distance encoding; Next, adaptive aggregation of hidden states is used to obtain the final relational representation; the expression is as follows: o i =tanh(W o s'1+b), Where b represents the learnable bias parameter and the relationship represents e' r Will be used to predict new facts in the query set; o i It is the converted hidden state used to capture the core features of the relationship and provide a basis for the next step of attention weight calculation. K represents the size of the support set; β i is the attention weight used to calculate the relation vector.
5. According to claim 1, a small sample knowledge graph completion method based on embedding fusion and data enhancement is characterized in that: Step 4 specifically includes: The decoder scores candidate tail entities based on the head entity and relation embeddings, aiming to find the corresponding tail entity to fill the gap in the query set triple (h, r, ?); ManifoldE extends the two-dimensional vector operation to the three-dimensional manifold sphere, expanding the acceptable error range of the model; the specific formula is as follows: Among them, D r It is the manifold parameter related to the space radius, and M represents the manifold function. TransE is used as the manifold function here to handle complex relationships in few-sample completion.
6. According to claim 1, a small sample knowledge graph completion method based on embedding fusion and data enhancement is characterized in that: Step 5 specifically includes: for the training task set R train Select the relation r from the set and randomly select K triples from it as the support set S of the relation. r , and randomly select some entity pairs to form the query set Q r ; At the same time, the model creates some negative triples consisting of random tail entities for each triple in the query set; these incorrectly matched negative triples constitute the negative query set -Q r ; The few-shot completion task is to score these triplets using the decoder and ensure that the query set Q r The similarity score obtained by the positive query in is higher than that of the negative query in the negative query set -Q_r; the specific formula is as follows: Here, q^+ represents the score of positive queries, q^- represents the score of negative queries, and γ is a boundary hyperparameter; the entire training process follows the multi-sampling meta-training process; by minimizing Φ, the entire model achieves the best performance.
Citation Information
Patent Citations
Majority domain space fusion knowledge graph embedding method, system, equipment and medium
CN115795050A
Information retrieval optimization method and system based on small sample knowledge graph completion
CN116955650A
Cited By
Knowledge graph knowledge expansion method
CN119917701A
A method for expanding knowledge in a knowledge graph
CN119917701B