A Method for Completing a Character Relationship Knowledge Graph Based on Feature Enhancement
By combining additional description information, path information and convolutional neural network, the proposed character relationship knowledge graph completion method based on feature enhancement solves the problem of failing to effectively utilize graph semantic information and relationship structure information in the existing technology, and achieves a higher quality knowledge graph completion effect.
Patent Information
- Application Number
- CN202211095419.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-05
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2042-09-05
AI Technical Summary
The existing technology fails to effectively utilize the map semantic information and relational structure information in knowledge graph completion, resulting in poor completion effect and difficult to meet actual use needs.
By combining additional description information, path information and convolutional neural networks, a character relationship knowledge graph completion method is proposed based on feature enhancement, and a number of convolutional neural networks are used to mine deep-level map information to enhance feature expression and prediction performance.
It improves the prediction effect of knowledge graph completion, overcomes the limitation of prediction results caused by insufficient feature expression, and enhances the prediction performance of potential relationships between characters.
Smart Images

Figure CN116258139B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field related to knowledge graphs, and specifically provides a method for completing a knowledge graph of character relationships based on feature enhancement. Background Art
[0002] A knowledge graph is essentially a structured database, which represents a collection of descriptions of the interrelationships between entities (objects, events, concepts, etc.). By means of relationships, data is placed in context, and the form of expression is a triple: (head entity, relationship, tail entity); a character relationship graph is a knowledge graph constructed with "character" entities and the social relationships between characters as the core. A reliable and content-rich character relationship graph can clearly display character information and the relevance between characters, and can also provide more reliable and detailed knowledge when applied to intelligent search, intelligent question answering, and personalized recommendation. However, due to the diversity and complexity of character relationships, the knowledge graph established only relying on public information has sparse data and lacks key information. Therefore, completing the missing information in the knowledge graph is of great significance for constructing a large-scale character relationship knowledge graph and its downstream tasks. At present, the research on representation reasoning for knowledge graph completion is divided into three categories: the first category is the knowledge representation model that embeds the model into a low-dimensional space, such as TransE and RotatE; the second category is the semantic enhancement model that incorporates additional information, such as DKRL; the third category is the neural network model that uses deep learning technology to reason path information or knowledge subgraphs, such as ConvE and R-GCN. Although these three types of methods can solve the knowledge graph link prediction problem to a certain extent, due to the inherent defects of these three types of methods, the actual completion effect is not good and it is difficult to meet the actual usage requirements.
[0003] For the knowledge representation model, by embedding the entities and relationships in the knowledge graph into a low-dimensional space and constructing a scoring function, the rationality score of the triple is calculated; this type of method is the basic research direction to explore a reasonable knowledge representation method, but the quality of the effect depends on the scalability of the space and the modeling formula, and rarely pays attention to the characteristics of the data itself.
[0004] For the semantic enhancement model, by incorporating additional information to enrich the information representation of the knowledge graph, the most representative model is DKRL. In addition to the elements of the triple itself, the model also models the relevant descriptions of the entity. Although the model effect is improved, in actual applications, due to the inaccurate or too long description statements, the operation method of extracting the semantic information of the description statements has instability.
[0005] For neural network inference models, such models are generally divided into models based on convolutional neural networks and models based on graph neural networks; models based on convolutional neural networks first reshape the input entity and relation vectors into two-dimensional tensors, regarded as a "picture" and perform two-dimensional convolution operations, and then obtain the rationality score of the triple through vector flattening operation and scoring function; models based on graph neural networks first extract the structural subgraphs of the head entity and the tail entity in the triple, and then update the vectors of the entity nodes in the form of GNN (graph neural network) information transmission; such methods have limited interpretability, and GNN is prone to problems such as overfitting and averaging. Summary of the Invention
[0006] The object of the present invention is to provide a knowledge graph completion method based on semantic feature enhancement for the technical defects existing in the above-mentioned prior art; it aims to solve the problem that the existing model methods based on convolutional neural networks do not consider rich graph semantic information, are limited by the information features of the triple itself, and at the same time solve the defect that the DKRL model cannot effectively extract descriptive text features; finally, by combining additional description information, path information with convolutional neural networks, a higher-quality knowledge graph completion method is realized, and then the completion of the character relationship knowledge graph is realized, providing support for downstream tasks such as constructing large-scale character relationship knowledge graphs and intelligent search, intelligent question answering, and personalized recommendation.
[0007] To achieve the above object, the technical solution adopted by the present invention is as follows:
[0008] A method for completing a character relationship knowledge graph based on feature enhancement, comprising the following steps:
[0009] Step 1. Obtain an existing publicly available character relationship knowledge graph, where any triple is (head entity, relation, tail entity), and fill the candidate entities for the triples with incomplete head entities or tail entities to obtain a number of predicted triples;
[0010] Step 2. Obtain the entity descriptions of the head entity and the tail entity of the predicted triple, and the relationship set composed of all directed relationship paths within three steps of the head and tail entity pairs, and the relationship set includes: one-hop path, two-hop path and three-hop path;
[0011] Step 3. Vectorize the head entity description, tail entity description and relationship set of the predicted triple to obtain a head entity description vector matrix, a tail entity description vector matrix and a relationship vector matrix; the specific process of vectorization is: obtain the corresponding word vectors and relationship vectors by querying the entity embedding matrix and the relationship embedding matrix, and then perform vector splicing to obtain the matrix;
[0012] Step 4. Use the head entity description vector matrix, the tail entity description vector matrix, and the relationship vector matrix as inputs, and output the prediction probability by the prediction model based on feature enhancement;
[0013] Step 5. Use the prediction triple with the highest prediction probability as the prediction result and supplement it into the knowledge graph of the person relationship.
[0014] Furthermore, in Step 2,
[0015] The head entity description is represented as: D h ={Word h1 , Word h2 ,..., Word hn},
[0016] The tail entity description is represented as: D t ={Word t1 , Word t2 ,..., Word tn},
[0017] where n represents the length of the word sequence, Word hn represents the nth word in the head entity description, and Word tn represents the nth word in the tail entity description;
[0018] The relationship set is represented as: P = {p1, p2,..., p m}, where m represents the number of paths, and p m represents the mth directed relationship path.
[0019] Even further, in Step 3, the head entity description vector matrix is: D h =[Word h1 ; Word h2 ;...; Word hn , its size is: k×n, k represents the embedding dimension, and Word hn represents the word vector of Word hn , and [;] represents vector concatenation;
[0020] The tail entity description vector matrix is: D t =[Word t1 ; Word t2 ;...; Word tn , its size is: k×n, and Word tn represents the word vector of Word tn ;
[0021] The relationship vector is: P = {p1; p2;...; p m}, pm Denote p m 's relational vector.
[0022] Furthermore, in step 4, the prediction model based on feature enhancement is:
[0023] Use the first convolutional layer with a convolutional kernel of 3×3 to perform a convolutional operation on the head entity description vector matrix D h to obtain a feature map, then perform a vector flattening operation on the feature map, and finally obtain the head entity description feature vector w h :
[0024] w h = f(vec(D h *Ω h )W h )
[0025] where f represents the activation function, vec(·) represents the vector flattening operation, * represents the convolutional operation, Ω h represents the convolutional kernel of the first convolutional layer, and W h represents the parameter matrix of the first fully connected layer;
[0026] Use the second convolutional layer with a convolutional kernel of 3×3 to perform a convolutional operation on the tail entity description vector matrix D t to obtain a feature map, then perform a vector flattening operation on the feature map, and finally obtain the tail entity description feature vector w t :
[0027] w t = f(vec(D t *Ω t )W t )
[0028] where Ω t represents the convolutional kernel of the second convolutional layer, and W t represents the parameter matrix of the second fully connected layer;
[0029] Use the third convolutional layer with a convolutional kernel size of 3×1 to perform a convolutional operation on the relational vector of any one-hop path to obtain a feature map, then obtain a feature vector through the third fully connected layer, and finally take the average of the feature vectors of all one-hop paths to obtain a feature vector
[0030]
[0031] where N1 represents the number of one-hop paths, p 1,i represents the feature vector of the i-th one-hop path, represents the convolutional kernel of the third convolutional layer, represents the parameter matrix of the third fully connected layer;
[0032] The fourth convolutional layer with a convolutional kernel size of 3×2 performs a convolutional operation on the relationship vector of any two-hop path to obtain a feature map, then performs a vector flattening operation on the feature map, then obtains a feature vector through the fourth fully connected layer, and finally takes the average of the feature vectors of all two-hop paths to obtain a feature vector
[0033]
[0034] Among them, N2 represents the number of two-hop paths, p 2,i represents the feature vector of the i-th two-hop path, represents the convolutional kernel of the fourth convolutional layer, represents the parameter matrix of the fourth fully connected layer;
[0035] The fifth convolutional layer with a convolutional kernel size of 3×3 performs a convolutional operation on the relationship vector of any three-hop path to obtain a feature map, then performs a vector flattening operation on the feature map, then obtains a feature vector through the fifth fully connected layer, and finally takes the average of the feature vectors of all three-hop paths to obtain a feature vector
[0036]
[0037] Among them, N3 represents the number of three-hop paths, p 3,i represents the feature vector of the i-th three-hop path, represents the convolutional kernel of the fifth convolutional layer, represents the parameter matrix of the fifth fully connected layer;
[0038] The feature vectors Feature vectors Feature vectors are feature-fused to obtain the relationship feature vector w p :
[0039]
[0040] Then, the head entity description feature vector w h , the tail entity description feature vector w t , the relationship feature vector w p are concatenated with the head entity eigenfeature h, the tail entity eigenfeature t, and the relationship eigenfeature r to obtain an enhanced feature matrix. Then, the sixth convolutional layer with a convolutional kernel of 3×3 performs a convolutional operation on the enhanced feature matrix to obtain a feature map, then performs a vector flattening operation on the feature map, and finally obtains the final feature vector w through the sixth fully connected layer:
[0041] w = f(vec([w h ; h; wt ; t; w p ; r]*Ω f )W f )
[0042] where, Ω f represents the convolution kernel of the sixth convolutional layer, and W f represents the parameter matrix of the sixth fully connected layer;
[0043] Finally, an inner product operation is performed on the final feature vector w and the metric vector c to obtain the logical score score:
[0044]
[0045] Then, it passes through the activation function sigmoid as the predicted probability.
[0046] Furthermore, the prediction model based on feature enhancement is trained offline. The training set is as follows: Obtain the existing public knowledge graph of human relationships, use the triples in it as positive example samples, and then replace the head entity or tail entity in the positive example samples through random or Bernoulli distribution to form negative example samples. The positive example samples are set with a probability label of 1, and the negative example samples are set with a probability label of 0;
[0047] Based on the above training set, set the loss function and complete the training using the Adam optimization algorithm. The loss function is:
[0048]
[0049] where, N is the normalization coefficient, representing the number of samples in a training batch, and T i represents the probability label of the i-th sample, and S i is the predicted probability of the i-th sample.
[0050] Based on the above technical solutions, the beneficial effects of the present invention are as follows:
[0051] Based on the semantic features and path features attached to the knowledge graph, the present invention provides a convolutional neural network model based on feature enhancement for the link prediction task; by using multiple convolutional neural networks to mine deep graph information, it makes up for the deficiency that the existing methods cannot effectively utilize entity description information and relationship structure information, overcomes the defect that the prediction result is limited due to insufficient feature expression, and thus improves the prediction effect; through the convolution fusion operation of direct features and indirect features, the present invention further improves the prediction performance of potential relationships between people. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 It is a schematic flow chart of the method for completing the knowledge graph of human relationships based on feature enhancement of the present invention.
[0053] Figure 2 Schematic diagram of the overall structure of the prediction model based on feature enhancement of the present invention.
[0054] Figure 3 Schematic diagram of the path feature extraction process of the present invention. Detailed implementation manners
[0055] To make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below in conjunction with embodiments and the accompanying drawings.
[0056] This embodiment provides a method for completing a knowledge graph of character relationships based on feature enhancement, including the following steps:
[0057] Step 1. Obtain an existing publicly available knowledge graph of character relationships, where any triple is (head entity, relationship, tail entity), and fill candidate entities for triples with incomplete head entities or tail entities to obtain a number of predicted triples;
[0058] Step 2. Obtain the entity descriptions of the head entity and the tail entity of the predicted triples, as well as the relationship set composed of all directed relationship paths within three steps of the head-tail entity pair. The relationship set includes: one-hop paths, two-hop paths and three-hop paths; specifically:
[0059] The head entity description is expressed as: D h ={Word h1 , Word h2 ,..., Word hn},
[0060] The tail entity description is expressed as: D t ={Word t1 , Word t2 ,..., Word tn},
[0061] where n represents the preset word sequence length. If the original length is longer than n, the tail is truncated; if it is less than n, redundant characters are filled; Word hn represents the nth word in the head entity description, and Word tn represents the nth word in the tail entity description;
[0062] The relationship set is expressed as: P = {p1, p2,..., p m}, where m represents the number of paths, and p mRepresents the m-th directed relation path; in the present invention, the path information does not include entities, mainly for the following considerations: 1) Most knowledge graphs are multi-relational knowledge graphs, and relations can better represent path features. 2) The number of entities is much larger than the number of relations, so entity features are more complex, and noise is easily introduced when extracting features, affecting the accuracy of path information. 3) Relation paths can encode composite information, that is, the relation path r1→r2→r3 can deduce the existence of the relation path r1→r3;
[0063] Step 3. Vectorize the head entity description, tail entity description, and relation set of the predicted triple to obtain a head entity description vector matrix, a tail entity description vector matrix, and a relation vector matrix; specifically: The specific process of vectorization is: obtain the corresponding word vectors and relation vectors by querying the entity embedding matrix and the relation embedding matrix, and then perform vector concatenation to obtain a matrix;
[0064] The head entity description vector matrix is: D h =[Word h1 ; Word h2 ;...; Word hn , and its size is: k×n, where k represents the embedding dimension, and Word hn represents the word vector of Word hn , and [;] represents vector concatenation;
[0065] The tail entity description vector matrix is: D t =[Word t1 ; Word t2 ;...; Word tn , and its size is: k×n, and Word tn represents the word vector of Word tn ;
[0066] The relation vector is: P = {p1; p2;...; p m}, and p m represents the relation vector of p m ;
[0067] Step 4. Take the head entity description vector matrix, the tail entity description vector matrix, and the relation vector matrix as inputs, and output the prediction probability by the prediction model based on feature enhancement; specifically, the prediction model based on feature enhancement is:
[0068] Use the first convolutional layer with a convolutional kernel of 3×3 to perform a convolutional operation on the head entity description vector matrix D h to obtain a feature map, then perform a vector flattening operation on the feature map, and finally obtain the head entity description feature vector w h :
[0069] wh = f(vec(D h * Ω h ))W h )
[0070] where f represents the activation function, vec(·) represents the vector flattening operation, * represents the convolution operation, and Ω h represents the convolution kernel of the first convolutional layer, and W h represents the parameter matrix of the first fully connected layer;
[0071] The second convolutional layer with a 3×3 convolution kernel is used to perform a convolution operation on the tail entity description vector matrix D t to obtain a feature map, then perform a vector flattening operation on the feature map, and finally obtain the tail entity description relationship feature vector w t :
[0072] w t = f(vec(D t * Ω t ))W t )
[0073] where Ω t represents the convolution kernel of the second convolutional layer, and W t represents the parameter matrix of the second fully connected layer;
[0074] The third convolutional layer with a 3×1 convolution kernel is used to perform a convolution operation on the relationship vector (size k×1) of any one-hop path to obtain a feature map, then obtain a feature vector (dimension k) through the third fully connected layer, and finally take the average of the feature vectors of all one-hop paths to obtain a feature vector
[0075]
[0076] where N1 represents the number of one-hop paths, and p 1,i represents the feature vector of the i-th one-hop path, represents the convolution kernel of the third convolutional layer, represents the parameter matrix of the third fully connected layer;
[0077] The fourth convolutional layer with a 3×2 convolution kernel is used to perform a convolution operation on the relationship vector (size k×2) of any two-hop path to obtain a feature map, then perform a vector flattening operation on the feature map to obtain an intermediate feature vector with dimension 2k, then obtain a feature vector (dimension k) through the fourth fully connected layer, and finally take the average of the feature vectors of all two-hop paths to obtain a feature vector
[0078]
[0079] Among them, N2 represents the number of two-hop paths, and p 2,i represents the feature vector of the i-th two-hop path, represents the convolution kernel of the fourth convolutional layer, represents the parameter matrix of the fourth fully connected layer;
[0080] A fifth convolutional layer with a convolution kernel size of 3×3 is used to perform a convolution operation on the relationship vector (size k×3) of any three-hop path to obtain a feature map, then a vector flattening operation is performed on the feature map to obtain an intermediate feature vector with a dimension of 3k, and then a feature vector (dimension k) is obtained through the fifth fully connected layer. Finally, the feature vectors of all three-hop paths are averaged to obtain a feature vector
[0081]
[0082] Among them, N3 represents the number of three-hop paths, and p 3,i represents the feature vector of the i-th three-hop path, represents the convolution kernel of the fifth convolutional layer, represents the parameter matrix of the fifth fully connected layer;
[0083] The feature vectors Feature vector Feature vector are subjected to feature fusion to obtain a relationship feature vector w p :
[0084]
[0085] The present invention realizes unified modeling for paths with different hop numbers through the above process, and obtains a feature vector based on the relationship matrix, as Figure 3 shown;
[0086] Then, the eigenfeatures of the triple are introduced: the head entity eigenfeature h, the relationship eigenfeature r, and the tail entity eigenfeature t to strengthen the semantic information of the graph itself, that is: the feature vector w h , w t , w p are concatenated with the eigenfeatures h, t, and r to obtain a strengthened feature matrix, and then a sixth convolutional layer with a convolution kernel of 3×3 is used to perform a convolution operation on the strengthened feature matrix to obtain a feature map, and then a vector flattening operation is performed on the feature map. Finally, the final feature vector w is obtained through the sixth fully connected layer:
[0087] w = f(vec([w h ; h; w t ; t; w p ; r]*Ω f )W f )
[0088] Among them, Ω f represents the convolution kernel of the sixth convolutional layer, and W f represents the parameter matrix of the sixth fully connected layer;
[0089] Finally, an inner product operation is performed on the final feature vector w and the metric vector c to obtain the logical score score:
[0090]
[0091] Then, it passes through the activation function sigmoid as the predicted probability. The greater the predicted probability, the greater the possibility that the triple is true; as Figure 2 shown;
[0092] The above prediction model based on feature enhancement is trained offline. The training set is: obtaining the existing public knowledge graph of person relationships. The knowledge graph is a set of factual triples, all of which are positive example samples. Therefore, the head entity or tail entity in the positive example samples is replaced by random or Bernoulli distribution to form negative example samples that do not exist in the knowledge graph. The positive example samples are set with a probability label of 1, and the negative example samples are set with a probability label of 0; the loss function uses the binary cross-entropy loss function as:
[0093]
[0094] where N is the normalization coefficient, representing the number of samples in a training batch, and T i represents the probability label of the i-th sample, and S i is the predicted probability of the i-th sample;
[0095] The Adam optimization algorithm is used for training. The training parameters are: the batch size is 256, the total number of training rounds is set to 1000 rounds, and verification is performed every 100 rounds. Evaluation is performed on the validation set. When the loss function value of this round is higher than that of the previous round for more than three times, the model training is terminated early;
[0096] Step 5. Use the predicted triple with the highest predicted probability as the prediction result and supplement it into the knowledge graph of person relationships.
[0097] It should be noted that in the present invention, the entity embedding matrix and the relationship embedding matrix are trained along with the training process of the prediction model based on feature enhancement. The initialization methods of both are random initialization; therefore, the parameters to be trained in the present invention are: the entity embedding matrix, the relationship embedding matrix, the convolution kernel parameters of each convolutional layer, the parameters of each fully connected layer, and the metric vector (the initialization method is random initialization).
[0098] Compared with other existing models, the present invention incorporates features in more dimensions, including entity semantic information and structural information (relationship paths). Moreover, the path encoding unit does not use Long Short-Term Memory (LSTM) units, but a convolutional neural network with more powerful feature extraction capabilities. Additionally, the feature fusion of the present invention is more direct and complete, further mining the deep features of the knowledge graph, enabling the present invention to achieve a higher accuracy rate in the link prediction task.
[0099] As described above, the above is only the specific implementation manner of the present invention. Any feature disclosed in this specification, unless specifically stated, can be replaced by other equivalent or alternative features with similar purposes; all the features disclosed, or all the steps in any method or process, except for mutually exclusive features and / or steps, can be combined in any manner.
Claims
1. A method for completing a knowledge graph of character relationships based on feature enhancement, comprising the following steps: Step 1. Obtain an existing open-source knowledge graph of character relationships. Any triple is (head entity, relationship, tail entity). Fill candidate entities for triples with incomplete head entities or tail entities to obtain a number of predicted triples; Step 2. Obtain the entity descriptions of the head entity and the tail entity of the predicted triples, as well as the relationship set composed of all directed relationship paths within three steps of the head and tail entity pairs. The relationship set includes: one-hop paths, two-hop paths, and three-hop paths; Step 3. Vectorize the head entity description, tail entity description, and relationship set of the predicted triples to obtain a head entity description vector matrix, a tail entity description vector matrix, and a relationship vector matrix. The specific process of vectorization is: obtain the corresponding word vectors and relationship vectors by querying the entity embedding matrix and the relationship embedding matrix, and then perform vector splicing to obtain a matrix; Step 4. Take the head entity description vector matrix, the tail entity description vector matrix, and the relationship vector matrix as inputs, and output the prediction probability by a prediction model based on feature enhancement. The prediction model based on feature enhancement is: Use the first convolutional layer with a convolution kernel of 3×3 to perform a convolution operation on the head entity description vector matrix D h to obtain a feature map, then perform a vector flattening operation on the feature map, and finally obtain the head entity description feature vector w through the first fully connected layer h : w h = f(vec(D h *Ω h )W h ) where f represents the activation function, vec(·) represents the vector flattening operation, * represents the convolution operation, and Ω h represents the convolution kernel of the first convolutional layer, and W h represents the parameter matrix of the first fully connected layer; The second convolutional layer with a convolutional kernel of 3×3 is used to perform a convolution operation on the tail entity description vector matrix D t to obtain a feature map, then perform a vector flattening operation on the feature map, and finally obtain the tail entity description feature vector w through the second fully connected layer t : w t = f(vec(D t *Ω t )W t ) Among them, Ω t represents the convolution kernel of the second convolutional layer, and W t represents the parameter matrix of the second fully connected layer; The relationship vector of any one-hop path is subjected to a convolution operation using a third convolutional layer with a convolution kernel size of 3×1 to obtain a feature map, and then a feature vector is obtained through a third fully connected layer. Finally, the average of the feature vectors of all one-hop paths is taken to obtain a feature vector Among them, N1 represents the number of one-hop paths, and p 1,i represents the feature vector of the i-th one-hop path, represents the convolution kernel of the third convolutional layer, represents the parameter matrix of the third fully connected layer; The relationship vectors of any two-hop path are subjected to a convolution operation by a fourth convolutional layer with a convolution kernel size of 3×2 to obtain a feature map, then a vector flattening operation is performed on the feature map, and then a feature vector is obtained through a fourth fully connected layer. Finally, the average of the feature vectors of all two-hop paths is taken to obtain a feature vector Among them, N2 represents the number of two-hop paths, and p 2,i represents the feature vector of the i-th two-hop path, represents the convolution kernel of the fourth convolutional layer, represents the parameter matrix of the fourth fully connected layer; The fifth convolutional layer with a convolutional kernel size of 3×3 performs a convolution operation on the relationship vector of any three-hop path to obtain a feature map, then performs a vector flattening operation on the feature map, and then obtains a feature vector through the fifth fully connected layer. Finally, the average of the feature vectors of all three-hop paths is taken to obtain a feature vector Among them, N3 represents the number of three-hop paths, and p 3,i represents the feature vector of the i-th three-hop path, represents the convolution kernel of the fifth convolutional layer, represents the parameter matrix of the fifth fully connected layer; The feature vectors Feature vector Feature vector are subjected to feature fusion to obtain the relational feature vector w p : Then, concatenate the head entity description feature vector w h , the tail entity description feature vector w t , the relation feature vector w p with the head entity eigen feature h, the tail entity eigen feature t, and the relation eigen feature r to obtain an enhanced feature matrix. Then, perform a convolution operation on the enhanced feature matrix using the sixth convolutional layer with a convolution kernel of 3×3 to obtain a feature map. Next, perform a vector flattening operation on the feature map. Finally, obtain the final feature vector w through the sixth fully connected layer: w = f(vec([w h ; h; w t ; t; w p ; r]*Ω f )W f ) Among them, Ω f represents the convolution kernel of the sixth convolutional layer, and W f represents the parameter matrix of the sixth fully connected layer; Finally, perform an inner product operation on the final feature vector w and the metric vector c to obtain the logical score score: Then pass through the activation function sigmoid as the prediction probability; Step 5. Take the predicted triple with the highest prediction probability as the prediction result and supplement it into the knowledge graph of character relationships.
2. The method for completing a knowledge graph of character relationships based on feature enhancement according to claim 1, wherein In Step 2, The head entity description is represented as: D h = {Word h1 , Word h2 ,..., Word hn}, The tail entity description is represented as: D t = {Word t1 , Word t2 ,..., Word tn}, Among them, n represents the length of the word sequence, and Word hn represents the nth word in the head entity description, and Word tn represents the nth word in the tail entity description; The relationship set is represented as: P = {p1, p2,..., p m}, where m represents the number of paths, and p m represents the m-th directed relationship path.
3. The method for completing a knowledge graph of character relationships based on feature enhancement according to claim 2, wherein In step 3, the head entity description vector matrix is: D h = [Word h1 ; Word h2 ;...; Word hn , with a size of: k×n, where k represents the embedding dimension, and Word hn represents Word hn 's word vector, [; represents vector splicing; The tail entity description vector matrix is: D t = [Word t1 ; Word t2 ;...; Word tn , whose size is: k×n, Word tn represents the Word tn word vector; The relationship vectors are: P = {p1; p2;...; p m}, where p m represents the relationship vector of p m .
4. The method for completing a knowledge graph of character relationships based on feature enhancement according to claim 1, wherein The prediction model based on feature enhancement is trained offline. The training set is: obtain an existing public knowledge graph of character relationships, use the triples therein as positive example samples, and then replace the head entity or tail entity in the positive example samples through random or Bernoulli distribution to form negative example samples. Set the probability label of the positive example samples to 1 and the probability label of the negative example samples to 0; Based on the above training set, set the loss function and complete the training using the Adam optimization algorithm. The loss function is: where N is the normalization coefficient, representing the number of samples in a training batch, and T i represents the probability label of the i-th sample, and S i is the predicted probability of the i-th sample.
Citation Information
Patent Citations
Knowledge graph completion method based on entity description and relationship path
CN111026875A
Aquatic medicine knowledge graph completion method, hybrid convolution model and training method and device thereof
CN114860955A