A small sample knowledge reasoning method based on decoupled learning strategy
By adopting a decoupled learning strategy in small sample knowledge inference, the comprehensive inference characteristics in the knowledge graph are extracted, and the optimal candidate entity is determined through a progressive learning factor, the problem of poor inference of small sample knowledge in the existing technology is solved, and the problem of poor inference in small sample knowledge inference in existing technology is improved. Inference accuracy and feature extraction capability.
Patent Information
- Application Number
- CN202111032526.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-03
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2041-09-03
AI Technical Summary
When the existing small sample knowledge inference technology faces small sample relational data, the model performance is not ideal, and the method based on the meta-learning framework divides the connection between different relational data under the same knowledge graph, and loses the knowledge graph itself. Extraction of small sample inference features.
Using a small sample knowledge inference method based on a decoupled learning strategy, the entity embedding vector and relation embedding vector are obtained through data preprocessing, comprehensive inference features, including embedding features and small sample features, and the establishment probability of candidate entities is calculated through the inference scorer. , and finally determine the best candidate entity through a progressive learning factor.
The accuracy of small samples inference is improved, and the connection between different relational data in the knowledge graph is avoided, and comprehensive inference information is provided for the inference score function.
Smart Images

Figure CN114792134B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing, and in particular to a small sample knowledge reasoning method based on a decoupling learning strategy. Background Art
[0002] Knowledge reasoning is a technology for discovering new knowledge based on existing knowledge graphs[1][2]. Since Google proposed the concept of knowledge graphs, researchers have proposed many knowledge reasoning technologies for knowledge graphs[2-4] to achieve the goals of completing missing information, identifying erroneous content, and deriving new knowledge, providing strong support for downstream construction of recommendation systems or knowledge question-answering systems. However, these knowledge reasoning technologies rely on a large amount of data to train reasoning models[5]. When faced with small sample relationship data that is common in real knowledge graphs, the model's performance is not ideal[6]. Therefore, developing knowledge reasoning models or technologies suitable for small samples has important research and application value[7-9].
[0003] At present, most small-sample knowledge reasoning technologies are based on the design of reasoning models based on the meta-learning framework. Small-sample knowledge reasoning technologies based on the meta-learning framework use different relational data grouping training methods to discover reasoning capabilities that can be transferred to small-sample relational data, thereby improving the model's learning effect on small-sample reasoning. For example, the GMatching model introduces metric learning under the meta-learning framework and successfully transfers the reasoning capabilities on sample-rich relational data to small-sample relational data[7]; the Meta-KGR model integrates the Multihop reasoning method into the meta-learning framework and realizes the model's small-sample reasoning capabilities[8]; the CogKR model organically combines the meta-learning framework with the human brain cognitive theory model to enhance the model's reasoning capabilities on small-sample relational data[9]. Although these small-sample reasoning models designed based on the meta-learning framework can learn a universal reasoning capability that can be transferred to small-sample relational data, the practice of grouping different relational data for training breaks the connection between different relational data under the same knowledge graph and loses the extraction of small-sample reasoning features contained in the knowledge graph itself.
[0004] [1] Ma Zhonggui, Ni Runyu, Yu Kaihang. The latest progress, key technologies and challenges of knowledge graph.
[0005] [2]Yang B, Yih WT, He X, et al. Embedding Entities and Relations for Learning and Inference in Knowledge Bases[J]. 2014.
[0006] [3] Cui Yuanning, Li Jing, Chen Yan, Lu Zhengjia. TransPath: A knowledge reasoning method based on deep transfer reinforcement learning[J]. Microcomputer Systems: 1-8.2021.
[0007] [4]Trouillon T,Welbl J,Riedel S,et al.Complex Embeddings for SimpleLink Prediction.JMLR.org,2016.
[0008] [5]Qin P, Wang
[0009] [6]Cai L,Wang W Y.KBGAN:Adversarial Learning for Knowledge GraphEmbeddings[C].Proceedings of the 2018Conference of the North American Chapter of the Association for Computational Linguistics:Human Language Technologies,Volume 1(Long Papers).2018.
[0010] [7]W Xiong,Mo Y,S Chang,et al.One-Shot Relational Learning forKnowledge Graphs[J].2018.
[0011] [8]Lv X, Gu Y, Han X, et al.Adapting Meta Knowledge Graph Information for Multi-Hop Reasoning over Few-Shot Relations[C].2019.
[0012] [9]Du Z, Zhou C, Ding M, et al. Cognitive Knowledge Graph Reasoning for One-shot Relational Learning[J]. 2019. Summary of the invention
[0013] The purpose of the present invention is to propose a small sample knowledge reasoning method based on a decoupled learning strategy.
[0014] The technical solution to achieve the purpose of the present invention is: a small sample knowledge reasoning method based on a decoupled learning strategy, comprising the following steps:
[0015] Step 1: Data preprocessing
[0016] Preprocess the collected knowledge graph data to obtain entity embedding vectors and relationship embedding vectors;
[0017] Step 2: Train a small sample knowledge reasoning model
[0018] The small sample knowledge reasoning model is trained to realize comprehensive reasoning feature extraction, candidate entity establishment probability calculation and best candidate entity prediction, wherein the comprehensive reasoning feature extraction extracts the comprehensive reasoning features of the head entity based on the embedding vector of the head entity and the relationship embedding vector, including the embedded features and the small sample features; the candidate entity establishment probability calculation inputs the embedded features and the small sample features of the head entity into the reasoning scorer to calculate the probability of the candidate entity being established under the embedded features and the small sample features; the best candidate entity prediction combines the progressive learning factor and the probability of the candidate entity being established under the embedded features and the small sample features to calculate the comprehensive probability of the candidate entity reasoning being established, and determines the candidate entity with the highest comprehensive probability value as the final reasoning result;
[0019] Step 3: Data Reasoning
[0020] Obtain the entity embedding vector and relationship embedding vector of the data to be inferred, and combine them with the trained small sample knowledge reasoning model to obtain the best completion entity.
[0021] Furthermore, in step 1, the specific method of data preprocessing is:
[0022] All entities and relationships that appear in the knowledge graph are marked with ID numbers, and the ID number of each entity is different from that of other entities, and the ID number of each relationship is different from that of other relationships, so as to achieve symbolization of entities and relationships;
[0023] Each entity and relationship is randomly mapped into the d-dimensional space, that is, a randomly initialized encoding vector is assigned to each entity and relationship, and the encoding vector is associated with the corresponding entity and relationship ID number, so that the entity and relationship are converted into computer-processable encoding information, that is, the entity embedding vector and the relationship embedding vector are obtained.
[0024] Furthermore, in step 2, the specific method of comprehensive reasoning feature extraction is:
[0025] 1) Extracting embedded features
[0026] The embedding features of the data to be inferred are extracted through the embedding feature extraction layer. The formula for embedding feature extraction is as follows:
[0027]
[0028] Where W∈R d×d×d is a third-order parameter matrix determined by training, with a dimension of 3 and dimensions d, v c ∈R d is the embedded feature extracted by the embedded feature extraction layer, It is the head entity h The corresponding vector encoding is, The vector encoding representing the relationship, ×1 represents the vector product operator along the first dimension of the third-order parameter matrix W, and ×2 represents the vector product operator along the second dimension of the third-order parameter matrix W;
[0029] 2) Extract small sample features
[0030] Before extracting small sample features, it is necessary to calculate the head entity e in the entity relationship triple h The adjacent entity code n h , and the head entity e in the support triple h’ The adjacent entity code n h' , where the supporting triples refer to the triples whose relations are the same as those in the entity relation triples to be calculated. The supporting triples are randomly selected from the set of triples with the same relations as those in the entity relation triples to be calculated. The head entity e in the entity relation triples is calculated. h The adjacent entity code n h The formula is as follows:
[0031]
[0032] Among them, N e Represents a set of entity relationship triples, n h ∈R d Represents the head entity e in the entity relationship triple h The adjacent entity encoding, σ represents the activation function, |Ne | represents the head entity e in the entity relationship triple h The number of adjacent entities, W c ∈R d ×2d and b c ∈R d are the parameters that need to be learned during model training. and Respectively represent the head entity e in the entity relationship triple h The adjacent entity e k The corresponding vector encoding and the head entity e in the entity relationship triple h The adjacency relationship r k The corresponding vector encoding;
[0033] Calculate the head entity e in the support triple h' The adjacent entity code n h' The formula is the same as formula (3), but it is necessary to replace the head entity e in the supporting triple h' Adjacent entity vector encoding and adjacency vector encoding Replace the adjacent entities e in formula (3) respectively k The corresponding vector encoding and adjacency relation r k The corresponding vector encoding
[0034] Then, the small sample features of the data to be inferred are obtained through the small sample feature extraction layer. The calculation formula for small sample feature extraction is as follows:
[0035]
[0036] Among them, v o ∈R d Represents small sample features, W'∈R d×d×d is the third-order parameter matrix determined by training, n h ∈R d Represents the head entity e h The adjacent entity code, n h' ∈R d Represents the head entity e h' The adjacent entity code of Representative relationship r The vector encoding of , ×1 represents the vector product operator along the first dimension of the third-order parameter matrix W', and ×2 represents the vector product operator along the second dimension of the third-order parameter matrix W'.
[0037] Furthermore, in step 2, the specific method for calculating the probability of candidate entity establishment is:
[0038] According to the embedding features and small sample features of the head entity, the inference scorer calculates the probability value of the candidate entity under the embedding features and small sample features respectively. The score function calculation formula in the inference scorer is as follows:
[0039]
[0040] in, is the score function, v is the embedding feature or small sample feature, Represents the candidate tail entity e t The vector encoding of the head entity and the small sample features are substituted into formula (5) to calculate the probability p of the candidate tail entity being established. c and p o .
[0041] Furthermore, in step 2, the specific method for predicting the best candidate entity is:
[0042] Constructing the progressive learning factor is as follows:
[0043]
[0044] In the formula, ε is the learning factor, T is the current number of training times, and T max Maximum number of training runs.
[0045] Calculate the comprehensive probability that the candidate entity reasoning is valid. The formula is as follows:
[0046] p=ε×p c +(1-ε)×p o (7)
[0047] In the formula, p represents the comprehensive probability value of the candidate entity being finally established, p c is the probability of candidate entity establishment under embedded feature extraction, p o It is the probability of candidate entity establishment under small sample feature extraction, and the candidate entity with the highest comprehensive probability value is the final reasoning result.
[0048] A small sample knowledge reasoning system based on a decoupling learning strategy implements small sample knowledge reasoning based on a decoupling learning strategy based on the small sample knowledge reasoning method based on a decoupling learning strategy.
[0049] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the small sample knowledge reasoning based on the decoupling learning strategy is implemented based on the small sample knowledge reasoning method based on the decoupling learning strategy.
[0050] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements small sample knowledge reasoning based on a decoupling learning strategy based on the small sample knowledge reasoning method based on a decoupling learning strategy.
[0051] Compared with the prior art, the present invention has the following significant advantages: it extracts embedded features from the overall data of the knowledge graph and extracts small sample features from a single relationship sample, thus avoiding severing the connection between different relationship data under the same knowledge graph, providing comprehensive reasoning information for the reasoning score function, and improving the reasoning accuracy of small samples. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 Flowchart of the method for small sample knowledge reasoning based on decoupled learning strategy.
[0053] Figure 2 This is the system architecture diagram for small sample knowledge reasoning based on decoupled learning strategy. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0055] like Figure 1-2 As shown, the present invention provides a small sample knowledge reasoning method based on a decoupled learning strategy, comprising the following steps:
[0056] Step 1: Preprocess the collected knowledge graph data
[0057] Preprocess the collected knowledge graph data to vectorize the entity and relationship data, which is convenient for further processing in subsequent steps and for computer data reading and processing.
[0058] First, all entities and relationships that appear in the knowledge graph are marked with ID numbers, and the ID number of each entity is different from that of other entities, and the ID number of each relationship is different from that of other relationships, so as to symbolize entities and relationships and facilitate further processing in subsequent steps.
[0059] Next, each entity and relationship is randomly mapped into the d-dimensional space, that is, a randomly initialized encoding vector is assigned to each entity and relationship, and the encoding vector is associated with the corresponding entity relationship ID number, so that the entity relationship is converted into computer-processable encoding information.
[0060] Then, traverse and record the adjacent entities and their relationships corresponding to each entity. The set of adjacent entities and their relationships corresponding to any entity is defined as follows:
[0061] N e ={(e k ,r k )|(e k ,r k ,e)∈G} (1)
[0062] Among them, N e represents the set of entities e, e k and r k They represent the adjacent entities and relationships corresponding to entity e respectively, and G represents the set of all entity relationship triplets in the knowledge graph.
[0063] Finally, an entity relationship triplet with the same relationship is randomly extracted from the knowledge graph for each data to be inferred as the support triplet corresponding to each data to be inferred.
[0064] Step 2: Extract comprehensive reasoning features of the data to be inferred
[0065] The comprehensive reasoning feature consists of two parts: the embedded feature extraction layer obtains the embedded features of the data to be reasoned, and the small sample feature extraction layer obtains the small sample features of the data to be reasoned, such as Figure 2 The extracted comprehensive reasoning features will be used in the reasoning scorer to calculate the probability that the candidate entity is established under the embedded features and small sample features.
[0066] 1) Extract embedding features of the data to be inferred
[0067] Extracting embedded features of the data to be inferred is to fully explore the reasoning feature information contained in the knowledge graph as a whole, with the purpose of preserving the connection between different relational data under the same knowledge graph.
[0068] Here, the embedding features of the data to be inferred are extracted through the embedding feature extraction layer. The formula for embedding feature extraction is as follows:
[0069]
[0070] Where W∈R d×d×d is a third-order parameter matrix determined by training, with a dimension of 3 and dimensions d, v c ∈R d is the embedded feature extracted by the embedded feature extraction layer, It is the head entity h The corresponding vector encoding is, The vector encoding representing the relationship, ×1 represents the vector product operator along the first dimension of the third-order parameter matrix W, and ×2 represents the vector product operator along the second dimension of the third-order parameter matrix W.
[0071] 2) Extract features of small samples of data to be inferred
[0072] Extracting small sample features of entity relationship triples is to combine the data to be inferred with the relationship data with corresponding scarce samples when specific relationship samples are scarce, explore the connection between them, and extract the reasoning feature information reflected in this connection.
[0073] Before extracting the features of the small sample of data to be inferred, it is necessary to calculate the head entity e h The adjacent entity encoding and the head entity e in the support triple h’ According to the adjacent entities and their relationships corresponding to each entity in the adjacent entity step 1, calculate the head entity e in the entity relationship triple h The corresponding adjacent entity code n h , the calculation formula is as follows:
[0074]
[0075] Among them, N e Represents a set of entity relationship triples, n h ∈R d Represents the head entity e in the entity relationship triple h The adjacent entity encoding, σ represents the activation function, |N e | represents the head entity e in the entity relationship triple h The number of adjacent entities, W c ∈R d ×2d and b c ∈R d are the parameters that need to be learned during model training. and Respectively represent the head entity e in the entity relationship triple h The adjacent entity e k The corresponding vector encoding and the head entity e in the entity relationship triple h The adjacency relationship r k The corresponding vector encoding.
[0076] Calculate the head entity e in the support triple h' The adjacent entity code n h' The formula is the same as formula (3), but it is necessary to replace the head entity e in the supporting triple h' Adjacent entity vector encoding and adjacency vector encoding Replace the adjacent entities e in formula (3) respectively k The corresponding vector encoding and adjacency relation r k The corresponding vector encoding
[0077] Calculate the adjacent entity code n of the head entity h and supports the adjacent entity encoding of the head entity in the triple h' After that, the small sample features of the data to be inferred are obtained through the small sample feature extraction layer. The calculation formula for small sample feature extraction is as follows:
[0078]
[0079] Among them, v o ∈R d Represents small sample features, W'∈R d×d×d is the third-order parameter matrix determined by training, n h ∈R d Represents the head entity e h The adjacent entity code, n h' ∈R d Represents the head entity e h' The adjacent entity code of Representative relationship r The vector encoding of , ×1 represents the vector product operator along the first dimension of the third-order parameter matrix W', and ×2 represents the vector product operator along the second dimension of the third-order parameter matrix W'.
[0080] Step 3: Calculate the probability of candidate entities being true based on the inference scorer
[0081] According to the embedded features and small sample features obtained in step 2, the inference scorer can calculate the probability values of the candidate entity under the embedded features and small sample features respectively. The obtained probability values will be used as the basis for judging the best candidate entity in step 4. In the process of calculating the candidate entity based on the inference scorer, the score function calculation in the inference scorer is as follows:
[0082]
[0083] in, is the score function, v is the embedded feature or small sample feature in step 2, Represents the candidate tail entity e t The embedding feature and the small sample feature are substituted into formula (5) to calculate the probability p of the candidate tail entity being established. c and p o .
[0084] Step 4: Progressively Learned Best Candidate Entity Prediction
[0085] Considering that the accuracy of the probability value of the candidate entity in step 3 is related to the quality of the embedded feature extraction and the small sample feature extraction, and the small sample feature extraction is affected by the quality of the embedded feature extraction, a progressive learning factor is designed here, as shown in formula (6), which gradually adjusts the center of gravity of the model training process by adjusting the weight to ensure that the model is effectively trained.
[0086] In the calculation of the final probability of the candidate entity being established by combining the progressive learning factor, through formula (6), the model will go through three stages: 1) focusing on learning the ability to extract embedded features; 2) focusing on learning the ability to extract embedded features and the ability to extract small sample features at the same time; 3) focusing on learning the ability to extract small sample features. The progressive learning factor is as follows:
[0087]
[0088] In the formula, ε is the learning factor, T is the current number of training times, and T max Maximum number of training runs.
[0089] The probability of the candidate entity being finally established is calculated as shown in formula (7). The entity t with the highest probability of establishment among the candidate entities is selected as the reasoning result of the tail entity of the data to be inferred (h, r), and the completed data (h, r, t) is obtained. The probability of the candidate entity being finally established is as follows:
[0090] p=ε×p c +(1-ε)×p o (7)
[0091] In the formula, p represents the probability value of the candidate entity being finally established, ε is the progressive learning factor, and p c is the probability of candidate entity establishment under embedded feature extraction, p o It is the probability of candidate entity establishment under small sample feature extraction.
[0092] Step 5: Train the optimal small sample knowledge reasoning model
[0093] The entity relationship triples in the training set are input into step 1 for preprocessing, and then input into step 2 in batches for comprehensive feature extraction. The obtained features are input into step 3 and combined with the candidate entity vector encoding to calculate the probability of each candidate entity being established. The obtained probability is then calculated together with the learning factor to obtain the probability that each candidate entity is the best completion entity. The cross entropy loss function is used on the training set to measure the gap between the model prediction result and the true value of the training set, and the parameters in the neural network are updated by back propagation with the help of the stochastic gradient descent optimizer. At the end of each round of training, the MRR value is calculated and the model is retained. After multiple rounds of training, the model with the largest MRR value is selected as the optimal model.
[0094] Example
[0095] In order to verify the effectiveness of the solution of the present invention, the following simulation experiment is conducted: This embodiment is based on the trained optimal small sample knowledge reasoning model and uses the test corpus in the test set to carry out knowledge reasoning.
[0096] Step 1: Preprocess the collected knowledge graph data
[0097] Step 1.1: Select a test sample (gnats, animal such as invertebrate) from the test set.
[0098] Step 1.2: According to the entity and relationship ID numbers, find the ID numbers of the test sample entities and relationships. The entity gnats corresponds to ID 0, and the relationship animalsuchasinvertebrate corresponds to ID 0. The test sample can be simplified to (0,0).
[0099] Step 1.3: According to the ID number, find the 200-dimensional entity and relationship embedding vectors corresponding to gnats and animalsuchasinvertebrate in the model v r ∈R 200 .
[0100] Step 1.4: Traverse and record the adjacent entities and their relationships corresponding to the head entity gants, and obtain the corresponding adjacent entity and its relationship set N e .
[0101] Step 1.5: Take the entity relationship triples (insects, animalsuchasinvertebrate, caterpillars) with the same relationship as the test sample from the training set as the support triples. After finding the corresponding entity ID number, the support triples can be simplified to (2,1,3). At the same time, find the corresponding 200-dimensional entity insects embedding vector according to the ID number And traverse and record the adjacent entities and their relationships corresponding to the head entity insects, and obtain the corresponding adjacent entity and its relationship set N e' .
[0102] Step 2: Extract comprehensive reasoning features of the data to be inferred
[0103] Step 2.1: Replace the and v r As the input of the embedding feature extraction layer, the embedding features of the data to be inferred are extracted through the embedding feature extraction layer. and v rSubstituting into formula (2), we get the embedded feature v c ∈R 200 .
[0104] Step 2.2: According to the adjacent entities and their relationship set N of the head entity gnats in the test sample in step 1.4 e , according to formula (3), we can calculate its adjacent vector code n h ∈R 200 .
[0105] Step 2.3: Based on the adjacent entities and their relationship set N of the head entity insects in the supporting triple in step 1.5 e' , according to formula (3), we can calculate its adjacent vector code n h' ∈R 200 .
[0106] Step 2.4: Replace the n in steps 2.2 and 2.3 h and n h' , and v in step 1.3 r As the input of the small sample feature extraction layer, the small sample features are extracted through the small sample feature extraction layer, that is, n h 、n h' and v r Substituting into formula (4), we get the small sample feature v o ∈R 200 .
[0107] Step 3: Calculate the probability of candidate entities being true based on the inference scorer
[0108] Step 3.1: Embedding feature v in step 2.1 c The vector encoding corresponding to the candidate entity As the input of the inference scorer, v c and Substituting into formula (5), we can calculate the probability p that the candidate entity is the best completion entity under the embedded feature: c .
[0109] Step 3.2: Substitute the small sample feature v in step 2.4 o The vector encoding corresponding to the candidate entity As the input of the inference scorer, v o and Substituting into formula (5), we can calculate the probability p that the candidate entity is the best completion entity under the small sample feature: c .
[0110] Step 4: Progressively Learned Best Candidate Entity Prediction
[0111] Step 4.1: Determine the specific value of the incremental learning factor ε. Since this is a test phase, the incremental learning factor value is 0.5.
[0112] Step 4.2: According to the gradual learning factor ε, the probability p in step 3.1 c and the probability p in step 3.2 c , substitute it into formula (7) and calculate the probability value p that the final candidate entity is the best completion entity.
[0113] Step 4.3: Sort all candidate entities according to the probability value of the best completion entity, and take the one with the largest probability value as the best completion entity.
[0114] The best completion entity obtained by reasoning in this embodiment is bugs, that is, after reasoning for the test sample (gnats, animalsuchasinvertebrate), the completion result obtained is (gnats, animalsuchasinvertebrate, bugs).
[0115] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0116] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A small sample knowledge reasoning method based on a decoupled learning strategy, characterized in that: The steps include: Step 1: Data preprocessing Preprocess the collected knowledge graph data to obtain entity embedding vectors and relationship embedding vectors; Step 2: Train a small sample knowledge reasoning model Training a small sample knowledge reasoning model to realize comprehensive reasoning feature extraction, candidate entity establishment probability calculation and best candidate entity prediction, wherein the comprehensive reasoning feature extraction extracts the comprehensive reasoning features of the head entity based on the embedding vector of the head entity and the relationship embedding vector, including the embedding features and the small sample features; The probability calculation of candidate entity validity inputs the embedded features and small sample features of the head entity into the inference scorer to calculate the probability of the candidate entity being valid under the embedded features and small sample features; the best candidate entity prediction combines the progressive learning factor and the probability of the candidate entity being valid under the embedded features and small sample features to calculate the comprehensive probability of the candidate entity being valid, and determines the candidate entity with the highest comprehensive probability value as the final inference result; Step 3: Data Reasoning Obtain the entity embedding vector and relationship embedding vector of the data to be inferred, and combine them with the trained small sample knowledge reasoning model to obtain the best completion entity; In step 1, the specific method of data preprocessing is: All entities and relationships that appear in the knowledge graph are marked with ID numbers, and the ID number of each entity is different from that of other entities, and the ID number of each relationship is different from that of other relationships, so as to achieve symbolization of entities and relationships; Randomly map each entity and relationship into a d-dimensional space, that is, assign a randomly initialized encoding vector to each entity and relationship, and associate the encoding vector with the corresponding entity and relationship ID number, so that the entity and relationship are converted into computer-processable encoding information, that is, the entity embedding vector and the relationship embedding vector are obtained; The entities are gnats, insects, bugs, caterpillars, and the entity relationship is animalsuchasinvertebrate; In step 2, the specific method of comprehensive reasoning feature extraction is: 1) Extracting embedded features The embedding features of the data to be inferred are extracted through the embedding feature extraction layer. The formula for embedding feature extraction is as follows: Where W∈R d×d×d is a third-order parameter matrix determined by training, with a dimension of 3 and dimensions d, v c ∈R d is the embedded feature extracted by the embedded feature extraction layer, It is the head entity h The corresponding vector encoding is, The vector encoding representing the relationship, ×1 represents the vector product operator along the first dimension of the third-order parameter matrix W, and ×2 represents the vector product operator along the second dimension of the third-order parameter matrix W; 2) Extract small sample features Before extracting small sample features, it is necessary to calculate the head entity e in the entity relationship triple h The adjacent entity code n h , and the head entity e in the support triple h’ The adjacent entity code n h' , where the supporting triples refer to the triples whose relations are the same as those in the entity relation triples to be calculated. The supporting triples are randomly selected from the set of triples with the same relations as those in the entity relation triples to be calculated. The head entity e in the entity relation triples is calculated. h The adjacent entity code n h The formula is as follows: Among them, N e Represents a set of entity relationship triples, n h ∈R d Represents the head entity e in the entity relationship triple h The adjacent entity encoding, σ represents the activation function, |N e | represents the head entity e in the entity relationship triple h The number of adjacent entities, W c ∈R d×2d and b c ∈R d are the parameters that need to be learned during model training. and Respectively represent the head entity e in the entity relationship triple h The adjacent entity e k The corresponding vector encoding and the head entity e in the entity relationship triple h The adjacency relationship r k The corresponding vector encoding; Calculate the head entity e in the support triple h' The adjacent entity code n h' The formula is the same as formula (3), but it is necessary to replace the head entity e in the supporting triple h' Adjacent entity vector encoding and adjacency vector encoding Replace the adjacent entities e in formula (3) respectively k The corresponding vector encoding and adjacency relation r k The corresponding vector encoding Then, the small sample features of the data to be inferred are obtained through the small sample feature extraction layer. The calculation formula for small sample feature extraction is as follows: Among them, v o ∈R d Represents small sample features, W'∈R d×d×d is the third-order parameter matrix determined by training, n h ∈R d Represents the head entity e h The adjacent entity code, n h' ∈R d Represents the head entity e h' The adjacent entity code of Representative relationship r The vector encoding of , ×1 represents the vector product operator along the first dimension of the third-order parameter matrix W', and ×2 represents the vector product operator along the second dimension of the third-order parameter matrix W'; In step 2, the specific method for calculating the probability of candidate entity establishment is: According to the embedding features and small sample features of the head entity, the inference scorer calculates the probability value of the candidate entity under the embedding features and small sample features respectively. The score function calculation formula in the inference scorer is as follows: in, is the score function, v is the embedding feature or small sample feature, Represents the candidate tail entity e t The vector encoding of the head entity and the small sample features are substituted into formula (5) to calculate the probability p of the candidate tail entity being established. c and p o ; In step 2, the specific method for predicting the best candidate entity is: Constructing the progressive learning factor is as follows: In the formula, ε is the learning factor, T is the current number of training times, and T max Maximum number of training sessions; Calculate the comprehensive probability that the candidate entity reasoning is valid. The formula is as follows: p=ε×p c +(1-e)×p o (7) In the formula, p represents the comprehensive probability value of the candidate entity being finally established, p c is the probability of candidate entity establishment under embedded feature extraction, p o It is the probability of candidate entity establishment under small sample feature extraction, and the candidate entity with the highest comprehensive probability value is the final reasoning result.
2. A small sample knowledge reasoning system based on a decoupled learning strategy, characterized in that: Based on the small sample knowledge reasoning method based on the decoupling learning strategy described in claim 1, small sample knowledge reasoning based on the decoupling learning strategy is implemented.
3. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements small sample knowledge reasoning based on a decoupling learning strategy based on the small sample knowledge reasoning method based on a decoupling learning strategy as described in claim 1.
4. A computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the small sample knowledge reasoning method based on the decoupling learning strategy according to claim 1 is used to implement small sample knowledge reasoning based on the decoupling learning strategy.
Citation Information
Patent Citations
Knowledge graph construction method based on adaptive few-sample relation extraction
CN113254675A
Internet appliance system and method
US20060200253A1