A small sample knowledge graph completion method based on embedding fusion and data enhancement

Through the small-sample knowledge graph completion method of bilateral fusion representation and data enhancement, the accuracy problem of the small-sample knowledge graph completion model when the support set data is scarce is solved. The support set is enhanced by using the background knowledge graph, which improves the performance of the model on the Nell-One and FB15k-237 datasets.

CN119537600BActive Publication Date: 2025-09-23DALIAN UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411332190.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2025-09-23
Estimated Expiration
2044-09-24

AI Technical Summary

Technical Problem

Existing small-sample knowledge graph completion models are not accurate when facing scarce support set data, and fail to fully utilize similar relationships in the background knowledge graph for reinforcement.

Method used

A triple encoder with bilateral fusion representation is used to generate entity representation, which is then combined with similar relations in the background knowledge graph for data enhancement. Tail entity prediction is then performed through a relation encoder and a ManifoldE decoder.

Benefits of technology

The accuracy of small sample completion is significantly improved on the Nell-One and FB15k-237 datasets. In particular, the performance is stable under low K values, the entity embedding is richer, and the relationship representation is more accurate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119537600B_ABST
    Figure CN119537600B_ABST
Patent Text Reader

Abstract

The present invention provides a small-sample knowledge graph completion method based on embedding fusion and data enhancement, which belongs to the field of knowledge graph completion. The present invention designs an attention multi-hop neighborhood modeler and a task-side entity modeler to establish the embedding of entities in the background knowledge graph and task relations. At the same time, a support set enhancement module is introduced to project the relations into a high-dimensional space, extract relevant relations from the background knowledge graph to supplement the support set, and control the quality of the extracted entities through a gating mechanism. Through a triple encoder architecture with bilateral fusion representation, the attention entity prototype and the entity task-side semantic information are integrated to generate an accurate embedding representation. Experimental results show that the present invention outperforms existing methods on multiple benchmark datasets, effectively improving the accuracy and efficiency of small-sample knowledge graph completion.
Need to check novelty before this filing date? Find Prior Art

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] A knowledge graph is a structured data storage format, consisting of a directed, heterogeneous graph of entities and their relationships. It typically consists of fact triplets in the form of (head entity, relationship, tail entity). Knowledge graphs, with their powerful semantic expression and information storage capabilities, are widely used in various fields, including knowledge discovery, dialogue systems, and semantic extraction. However, existing knowledge graphs are often incomplete, necessitating knowledge graph completion (KGC) to infer missing relationships or tail entities, thereby improving the application effectiveness 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 completion. 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 have a long-tail distribution, and the number of relation triplets for 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 from 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 neighboring node to enhance entity representation. For example, the model proposed by Xiong et al. in 2018 simply assigns weights to each neighboring node, while the FAAN model proposed by Sheng et al. in 2020 introduced the self-attention mechanism in Transformer and dynamically set the weights of neighboring 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 different forms of subgraph construction. 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 GMatching, FSRL, P-INT, etc.

[0005] Although the above models have made some progress in the problem of small-sample knowledge graph completion, they 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 in 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 response to the shortcomings of the above-mentioned existing technologies, the present invention proposes a small-sample knowledge graph completion method based on embedding fusion and data enhancement. It constructs two embeddings for entities from different angles, namely, a relational hierarchical embedding that reflects the overall embedding information and a head-tail entity semantic embedding that reflects the task information. Subsequently, the support set of the task is enhanced using the triplets in the similar relationships 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 triplet encoder with bilateral fusion representation for entity representation generation

[0009] A 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, entity representation is divided into two parts: attention entity prototype and 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 relationship information between the entity and its neighborhood is aggregated at multiple levels to generate an embedding 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 in a specific task relationship is obtained to generate a task-related embedding 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 a gating mechanism is used to control the quality of the enhanced triplets 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-range 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 on a 3D manifold sphere, expanding 2D vectors into 3D space to accommodate complex relationships in small sample sizes. Using the head entity and relationship embeddings, it scores candidate tail entities, finds the corresponding tail entity, and fills in missing triples in the query set.

[0016] Step 5: Model Optimization

[0017] The models of steps one to three are optimized by forming negative triples, 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 compared with the most advanced baseline methods. In particular, 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 tail entities. 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 with reference to the accompanying drawings and embodiments;

[0021] The flow chart of the present invention is as follows Figure 1 As shown in 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 triplet encoder with bilateral fusion representation for entity representation generation;

[0023] 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, we use the attention relationship hierarchical fusion mechanism to aggregate their information. Specifically, we consider entities with the same number of hops away from the given entity as entities in the same neighborhood layer, and then establish an aggregated relationship representation with attention for the neighbor relationship and neighbor entity representation to model the entity representation. 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, and “:” represents the concatenation operation. represents the neighborhood hybrid embedding of the l-1th layer for a given entity v, represents the neighbor relationship embedding of the l-1 layer, represents the entity embedding in the neighborhood of layer l-1, u i represents the entity that is l-1 away from the given entity v (i.e., the l-1th layer), Represents the background knowledge graph, N(l-1) represents the neighborhood knowledge graph with a distance of 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 relationships 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 calculated l-th layer for a given entity v, 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 is calculated 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 the TransE method. In this experiment, L = 2 is selected as the screening 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 Represents the head entity of a support triple in the support set of the task relationship, r represents the task relationship, t i represents 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, It represents the embedding of the head entity after the L-layer attention relationship level fusion mechanism, represents the embedding of the tail entity after the L-layer attention relation level fusion mechanism; is the prototype embedding of the triple.

[0036] Step 1.2: Task side solid modeling:

[0037] Unlike entity prototype modeling, which focuses on the global information of entities, task-side entity modeling places a given entity in the context of its matching entity to identify the relevant semantics between the head and tail entities, thereby obtaining a strongly task-relevant embedding representation. The specific process of task-side entity modeling is as follows:

[0038] Step 1.2.1: For the 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 backward relations 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; Is a neighbor entity Embedding of W n is a learnable weight matrix about the neighborhood, b nrepresents a learnable bias parameter with respect to the neighborhood. and After being concatenated, it passes through a feed-forward neural network to obtain an embedded 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 of 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 result of embedding 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 steps.

[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 Regarding 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 relationship; represents the embedding of the head entity neighborhood mapping of this support 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; 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 for 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. W 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 triple prototype embeddings, Represents a combination operation, where element-by-element 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 to generate relation representations.

[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 therein.

[0073]

[0074] Among them, g i This 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 to enhance the query task. These triples 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 task relationships after intermediate transformation, and The high-dimensional distribution of the relationships in the background knowledge graph after intermediate transformations is obtained. Subsequently, the most relevant triples 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: a Bi-LSTM is used as the generator of relation embeddings. It can consider long-range 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 triples 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 , Indicates 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 The hidden state after transformation is 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.

[0090] Step 4: Relational Decoder

[0091] 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 two-dimensional vector operations to a 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 spatial radius, and M represents the manifold function. TransE is used here as the manifold function 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 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 queries, q^- represents the score of negative queries, and γ is a boundary hyperparameter. The entire training process follows the multi-sampling meta-training procedure. By minimizing Φ, all models achieve 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 metrics, 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 (5-shot, 3-shot, 1-shot) 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 by: Here are the steps: Step 1: Design a triplet encoder with bilateral fusion representation for entity representation generation A 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, entity representation is divided into two parts: attention entity prototype and 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 relationship information of the entity and its neighborhood is aggregated at multiple levels to generate an embedding 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 in a specific task relationship is obtained to generate a task-related embedding 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 a bidirectional LSTM to generate relation embeddings, taking into account the long-distance dependencies between different triplets. It combines the enhanced triplets and generates the final relation representation by adaptively aggregating hidden states. Step 4: Design the ManifoldE decoder The ManifoldE decoder operates on a three-dimensional manifold sphere, expanding two-dimensional vectors to three-dimensional space to accommodate complex relationships in small sample sizes. It uses head entity and relationship embeddings to score candidate tail entities, find corresponding tail entities, and fill in missing triples in the query set. Step 5: Model Optimization The models of steps one to three are optimized by forming negative triples, and the optimized models are used to complete the small sample knowledge graph.

2. The small sample knowledge graph completion method based on embedding fusion and data enhancement according to claim 1 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, we use the attention relationship hierarchical fusion mechanism to aggregate their information. Specifically, we consider entities with the same number of hops away from the given entity as entities in the same neighborhood layer, and then establish an aggregated relationship representation with attention for the neighbor relationship and neighbor entity representation to model 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 hybrid embedding of the l-1th layer for a given entity v, represents the neighbor relationship embedding of the l-1 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. The neighborhood knowledge graph includes neighbor relationships and entities; represents the aggregation result of attention given to all neighbor entities and neighbor relationships 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 calculated l-th layer for a given entity v, 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 is calculated 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 a 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 Represents the head entity of a support triple in the support set of the task relationship, r represents the task relationship, t i represents 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, It represents the embedding of the head entity after the L-layer attention relationship level fusion mechanism, represents the embedding of the tail entity after the L-layer attention relation level fusion mechanism; is the prototype embedding of the triple; Step 1.2: Task side solid modeling: Unlike entity prototype modeling, which focuses on the global information of entities, task-side entity modeling places a given entity in its matching entity context to identify the relevant semantics between the head and tail entities, thereby obtaining a strongly task-relevant embedding representation. The specific process of task-side entity modeling is as follows: Step 1.2.1: For the 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 backward relations represents the head entity embedding of this support triple, represents the 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 Is a 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 embedded representation of the neighborhood; 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 of 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 result of embedding 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. 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 Regarding 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 relationship; Represents the embedding of the head entity neighborhood mapping of this support 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; is applied to The learnable matrix, is applied to The learnable matrix; 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 two modalities mentioned above, 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 to generate relation representations.

3. The method for completing a small sample knowledge graph based on embedding fusion and data enhancement according to claim 1, 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 relation 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 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 therein; 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 reinforcement 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 task relationships 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. The method for completing a small sample knowledge graph based on embedding fusion and data enhancement according to claim 1, 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 embeddings; 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; Then, 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; i The hidden state after conversion is 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. The method for completing a small sample knowledge graph based on embedding fusion and data enhancement according to claim 1, 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 two-dimensional vector operations to a 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-shot completion.

6. The method for completing a small sample knowledge graph based on embedding fusion and data enhancement according to claim 1, 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 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 task of completing a few samples 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 procedure; 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