A Knowledge Graph Reasoning Method Based on Deep Semantic Feature Extraction
The deep semantic features of knowledge graph triplets are extracted through deep convolutional networks and fully connected networks, and the problem of insufficient semantic information acquisition of triplets in the existing technology is solved, which significantly improves the effect of knowledge graph reasoning.
Patent Information
- Application Number
- CN202311052463.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-21
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2043-08-21
AI Technical Summary
Existing knowledge graph inference technology is difficult to effectively obtain triple semantic information, resulting in poor feature extraction effect, which in turn affects the knowledge graph inference effect.
The knowledge graph inference method based on deep semantic feature extraction is adopted. By training the knowledge graph inference model, the deep semantic features of the triple are extracted, the confidence score is calculated, and the knowledge graph inference is carried out by training the knowledge graph inference model, using deep convolution networks and fully connected networks.
By extracting richer triple semantic information, the effectiveness of knowledge graph reasoning is improved, and the completeness and reasoning accuracy of knowledge graphs are improved.
Smart Images

Figure CN117093724B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of knowledge graphs, and particularly relates to a knowledge graph reasoning method based on deep semantic feature extraction. Background Art
[0002] A knowledge graph is a data set stored in the form of triples (h, r, t), and its representation form is, for example, (China, capital, Beijing), and it has been widely applied to intelligent fields such as text question answering and social recommendation. Knowledge graph reasoning refers to, on the basis of the existing triple set, fully exploring the potential relationships between entities, adding new fact triples to the knowledge graph to complete the reasoning of the graph, so as to achieve the effect of improving the completeness of the knowledge graph.
[0003] The existing knowledge graph reasoning technologies are mainly based on representation learning methods. In the training stage, such methods will learn the embedding feature representations of entities and relationships in the knowledge graph one by one. When all the triple entities in the test set exist in the training set, only based on the embedding features obtained by training, the scores of candidate possible triples are calculated through a scoring function, and the candidate triples with higher scores are sorted according to the scoring results, and the candidate triples with higher scores are the graph reasoning results. Among them, the extraction of triple semantic features becomes an important step in graph reasoning.
[0004] In order to utilize the overall semantic features of triples, the existing methods input the triple embedding vector as a three-column matrix as a whole into the convolutional layer, but the interaction between entities and relationships is less, and only limited semantic features can be obtained. Moreover, most shallow network models also limit the extraction of triple semantic features, so the graph reasoning effect still needs to be improved. Summary of the Invention
[0005] The technical problem to be solved by the present invention is: to propose a knowledge graph reasoning method based on deep semantic feature extraction to solve the problems of insufficient acquisition of triple semantic information and poor feature extraction effect in the existing knowledge graph, resulting in poor knowledge graph reasoning effect.
[0006] The technical solution adopted by the present invention to solve the above technical problems is:
[0007] A knowledge graph reasoning method based on deep semantic feature extraction, characterized by including the following steps:
[0008] A. Training a knowledge graph reasoning model:
[0009] A1. Initializing the triples of the knowledge graph to be reasoned, and obtaining the vectors of the head entities, the vectors of the tail entities, and the vectors of the relationships in each triple;
[0010] A2. For each triple, concatenate and reshape the vectors of its head entity and tail entity to obtain the embedding matrix of the entity pair; split and reshape the vector of its relation to obtain a set of convolution kernels; respectively use each convolution kernel to extract features from the embedding matrix of the entity pair to obtain the corresponding feature maps; then, concatenate the feature maps to obtain the semantic feature vector of this triple;
[0011] A3. Use a deep convolutional network to extract features from the semantic feature vectors of each triple to obtain the deep semantic feature vectors of each triple, and then input them into a fully connected network to obtain the confidence scores of the corresponding triples;
[0012] A4. Calculate the loss value according to the confidence scores of each triple;
[0013] A5. Aim to minimize the loss, and train by the stochastic gradient descent method, iterate steps A2 - A4 until reaching the set number of iterations or the model converges, to obtain the trained knowledge graph reasoning model;
[0014] B. Perform the knowledge graph reasoning task:
[0015] Input the incomplete triple to be reasoned, where the incomplete triple is a triple containing incomplete elements, and the incomplete elements are head entity or tail entity or relation; according to the incomplete elements in the incomplete triple, extract the corresponding elements from the knowledge graph to be reasoned, and respectively combine the extracted elements with the incomplete triple to construct a set of candidate triples;
[0016] Use the trained knowledge graph reasoning model to calculate the confidence scores of all candidate triples, and take the candidate triple with the highest confidence score as the reasoning result for the incomplete triple.
[0017] Further, in step A1, use the pre - trained TransE model to initialize the triples of the knowledge graph to be reasoned, and obtain the vectors of the head entity, tail entity and relation in each triple, specifically including:
[0018] A11. Construct a positive sample set S, and the triples in the positive sample set S are represented as (h, r, t), and construct a negative sample set S by randomly replacing the head entity or tail entity in the positive sample set S ′ , and the triples in the negative sample set S ′ are represented as (h ′ , r, t ′ ); randomly sample the head entity, tail entity and relation in each triple in the positive sample set S and the negative sample set S ′ to obtain their initial vectors;
[0019] A12. Use the following loss function LTransE , by minimizing the loss, iterative updates are performed using the gradient descent method to obtain the vectors of the head entity, the vectors of the tail entity, and the vectors of the relationships in each triple:
[0020]
[0021] Among them, γ is a distance hyperparameter greater than 0 used to distinguish positive sample triples and negative sample triples, + represents the positive value function, and d(·) represents the Euclidean distance.
[0022] Furthermore, in step A2, for each triple, the vectors of its head entity and the vectors of its tail entity are concatenated and reshaped to obtain the embedding matrix of the entity pair, specifically including:
[0023] First, the vectors of the input head entity and the vectors of the tail entity are concatenated to obtain a concatenated vector with a dimension of 2*K, where K is the vector dimension of the head entity and the tail entity;
[0024] Then, the concatenated vector is reshaped through a two-dimensional transformation to obtain an embedding matrix of the entity pair with a dimension of M*N, and M*N = 2*K is satisfied.
[0025] Furthermore, in step A2, for each triple, the vectors of its relationship are split and reshaped to obtain a set of convolution kernels, specifically including:
[0026] First, the vectors of the input relationship are split into I groups of vectors, and A = I*P*Q is satisfied, where A is the vector dimension of the relationship, I is the number of splits, and P*Q is the dimension of the two-dimensional convolution kernel;
[0027] Then, each vector obtained by splitting is reshaped through a two-dimensional transformation to obtain I convolution kernels with a dimension of P*Q. Furthermore, in step A2, according to the following formula, the semantic feature vectors of the triples are concatenated:
[0028] V = concat(g([h;t]*Ω i ))
[0029] where V represents the semantic feature vector of the triple, [h;t] represents the embedding matrix of the entity pair, * represents the convolution operation, Ω i represents the i-th convolution kernel, g() represents the feature map obtained by convolving the embedding matrix of the entity pair with the convolution kernel, and concat() represents the operation of connecting each feature map.
[0030] Furthermore, in step A3, the deep convolutional neural network includes a first convolutional block and a second convolutional block;
[0031] The first convolutional block includes a first convolutional layer, a first activation layer, and a second convolutional layer connected in sequence; the second convolutional block includes a pooling layer, a second activation layer, a third convolutional layer, a third activation layer, and a fourth convolutional layer connected in sequence;
[0032] Among them, the first convolutional layer takes the semantic feature vector of the triple as the input, and the input of the first convolutional layer and the output of the second convolutional layer are connected through a residual connection as the input of the pooling layer; and the input of the pooling layer and the output of the fourth convolutional layer are connected through a residual connection as the output of the deep convolutional neural network, that is, the deep semantic feature vector.
[0033] Furthermore, the first convolutional layer, the second convolutional layer, the third convolutional layer, and the fourth convolutional layer all adopt equal-length convolutions.
[0034] Furthermore, in step A3, using a fully connected network, the confidence score of the triple is calculated in the following manner:
[0035] f(h,Q,t)=V c ·W
[0036] Among them, V c represents the deep semantic feature vector extracted by the deep convolutional neural network, and W is a learnable weight parameter.
[0037] Furthermore, in step A4, the loss function used to calculate the loss value is:
[0038]
[0039]
[0040] Among them, f(h,r,t) represents the confidence score of the triple, represents L2 regularization, and λ represents the coefficient of the regularization term.
[0041] Furthermore, in step B, according to the missing element in the incomplete triple, the corresponding element is extracted from the knowledge graph to be inferred, specifically including:
[0042] If the missing element is a relation, all relations are extracted from the knowledge graph to be inferred;
[0043] If the missing element is the tail entity, all tail entities are extracted from the knowledge graph to be inferred;
[0044] If the missing element is the head entity, all head entities are extracted from the knowledge graph to be inferred.
[0045] The beneficial effects of the present invention are:
[0046] In the solution of the present invention, when extracting the embedding matrix features of the entity pairs of triples, adaptive convolution is adopted, and multiple groups of vectors obtained by splitting and reshaping according to the corresponding relation vectors of the entity pairs are used as convolution kernels, which not only reduces the number of parameters of the convolution kernels, but also further enriches the interaction between entities and relations, so that more comprehensive overall semantic information of the triples can be extracted. Moreover, in order to overcome the expression limitation of the shallow network model, the present invention obtains the deep semantic features of the triples in the same dimension through a deep convolution network, so as to further mine more comprehensive semantic features, making the confidence score of the triples more accurate. Therefore, the present invention can improve the effect of knowledge graph reasoning. Description of the Drawings
[0047] Figure 1 It is a flowchart of the knowledge graph reasoning method based on deep semantic feature extraction in an embodiment of the present invention;
[0048] Figure 2 It is a schematic diagram of extracting the overall semantic features of triples through adaptive convolution in an embodiment of the present invention;
[0049] Figure 3 It is a schematic diagram of the deep convolution network layer in an embodiment of the present invention. Detailed Embodiments
[0050] The present invention aims to propose a knowledge graph reasoning method based on deep semantic feature extraction to solve the problems of insufficient acquisition of triple semantic information and poor feature extraction effect in existing knowledge graphs, resulting in poor knowledge graph reasoning effect. In the training process of the knowledge graph reasoning model of the present invention, first, the triples of the knowledge graph to be reasoned are initialized to obtain the head, tail entity vectors and relation vectors in each triple. Then, adaptive convolution related to the relation is used to obtain the feature interaction information between the entity and the relation in the triple, and a feature vector representing the overall semantics of the triple is obtained. Next, based on the feature vector of the overall semantics of the triple, its corresponding deep semantic features are extracted through a deep convolution network, and the confidence score of the triple is obtained through a fully connected network. Then, the loss value is calculated according to the confidence scores of each triple, and with the goal of minimizing the loss, the stochastic gradient descent method is used for iterative training to obtain a trained knowledge graph reasoning model. When performing a specific reasoning task, according to the missing elements in the input incomplete triple, all corresponding elements are extracted from the knowledge graph to be reasoned, and candidate triples are respectively formed with the incomplete triple. The confidence scores of all candidate triples are calculated using the trained knowledge graph reasoning model, and the candidate triple with the highest confidence score is used as the reasoning result for the incomplete triple.
[0051] Embodiment:
[0052] The knowledge graph reasoning method based on deep semantic feature extraction provided by this embodiment includes two major parts: training a knowledge graph reasoning model and using the trained knowledge graph reasoning model to perform reasoning tasks. Among them, the process of training the knowledge graph reasoning model is as follows Figure 1 shown, and it includes the following implementation steps:
[0053] S1. Initialize the triples of the knowledge graph
[0054] Since the triples of the knowledge graph are usually represented in text and cannot be directly input, they need to be initialized into vector representations for convenient subsequent calculation and processing. In an exemplary implementation means, the TransE model can be used to initialize the embedding representations of all triples in the knowledge graph. The specific process is as follows:
[0055] S11. Construct positive and negative sample sets
[0056] Construct a positive sample set S, and the triples in the positive sample set S are represented as (h, r, t);
[0057] By randomly replacing the head entity or the tail entity in the positive sample set S, construct a negative sample set S ′ , that is, the triples in the negative sample set S ′ are (h ′ , r, t) or (h, r, t ′ ). For the convenience of subsequent description, the triples in the negative sample set S ′ are uniformly represented as (h ′ , r, t ′ ).
[0058] S12. Random sampling
[0059] According to the general practice, from the multinomial distribution, randomly sample for each entity and relationship vector in the triple from the interval, where k represents the embedding dimension of the entity and relationship vectors.
[0060] Through random sampling, obtain the initial vectors of the head entity, tail entity, and relationship in each triple in the positive sample set S and the negative sample set S ′ .
[0061] S13. Based on the assumption of h + r = t, adopt the following loss function L TransE , by minimizing the loss and using the gradient descent method for iterative update, obtain the vectors of the head entity, tail entity, and relationship in each triple:
[0062]
[0063] Among them, γ is a distance hyperparameter greater than 0 used to distinguish positive sample triples from negative sample triples. + represents the positive value function, and d(·) represents the Euclidean distance.
[0064] S2. Extract the triple semantic feature vector based on entity-relationship interaction information
[0065] In this step, the adaptive convolution related to the relationship is used to obtain the feature interaction information between entities and relationships in the triple, and a feature vector representing the overall semantics of the triple is obtained. The specific implementation process is as follows:
[0066] S21. Concatenate and reshape the head entity vector and the tail entity vector
[0067] For each triple, the vectors of its head entity and tail entity are concatenated and reshaped to obtain an embedding matrix of the entity pair, which specifically includes:
[0068] First, the vectors of the input head entity and tail entity are concatenated to obtain a concatenated vector with a dimension of 2*K, where K is the vector dimension of the head entity and the tail entity;
[0069] Then, the concatenated vector is reshaped through a two-dimensional transformation to obtain an embedding matrix of the entity pair with a dimension of M*N, and M*N = 2*K is satisfied.
[0070] For example: Suppose the head entity vector is represented as (x1,..., x9), and the tail entity vector is represented as (y1,..., y9). After concatenating the head and tail, we get (x1,..., x9, y1,..., y9), a total of 18 elements; then, through two-dimensional transformation and reshaping, the elements are arranged in a two-dimensional matrix in the order from top to bottom and from left to right, and a 6*3 two-dimensional matrix can be obtained.
[0071] S22. Split and reshape the relationship vector
[0072] In this step, for each triple, the vector of its relationship is split and reshaped to obtain a set of convolution kernels, which specifically includes:
[0073] First, the vector of the input relationship is split into I groups of vectors, and A = I*P*Q is satisfied, where A is the vector dimension of the relationship, I is the number of splits, and P*Q is the dimension of the two-dimensional convolution kernel;
[0074] Then, each vector obtained by splitting is reshaped through a two-dimensional transformation to obtain I convolution kernels with a dimension of P*Q.
[0075] The number of convolutional kernels can be determined according to actual needs. The more convolutional kernels there are, the more sufficient the extraction of entity-relationship interaction information will be, but the greater the time cost. Therefore, considering comprehensively, generally splitting the relationship vector to form two convolutional kernels is sufficient. For example: Suppose the vector of the relationship is (a1, a2, a3, a4, a5, a6, a7, a8). First, it is divided into two groups, namely (a1, a2, a3, a4) and (a5, a6, a7, a8). Then, each group is respectively subjected to a two-dimensional transformation, and the elements are arranged in a two-dimensional matrix in the order from top to bottom and from left to right. Then, 2 convolutional kernels of size 2*2 can be obtained.
[0076] Since the convolutional kernels are reshaped from the relationship vector splitting, they are closely related to the relationship. Then, using the convolutional kernels to extract features from the entity pair embedding matrix can obtain richer semantic features.
[0077] S23. Extract the overall semantics of the triple using the convolutional kernels
[0078] In this step, each convolutional kernel is respectively used to extract features from the embedding matrix of the entity pair to obtain the corresponding feature maps. Then, the feature maps are concatenated to obtain the semantic feature vector of the triple. It can be expressed as:
[0079] V = concat(g([h;t]*Ω i ))
[0080] where V represents the semantic feature vector of the triple, [h;t] represents the embedding matrix of the entity pair, * represents the convolution operation, Ω i represents the i-th convolutional kernel, g() represents the feature map obtained by convolving the embedding matrix of the entity pair with the convolutional kernel, and concat() represents the operation of concatenating the feature maps.
[0081] For the process of obtaining the relationship-related adaptive convolutional kernels and extracting the overall semantic features of the triple, refer to Figure 2 .
[0082] S3. According to the semantic feature vector of the triple, use a deep convolutional neural network to extract the deep semantic features of the triple
[0083] In this step, based on the semantic feature vector of the triple obtained in step S2, it is input into a deep convolutional network, and the deep semantic feature vector of the triple is obtained through the method of convolution-pooling-convolution.
[0084] In the design of the deep convolutional network, in order to avoid too many network layers and too many parameters, in an exemplary implementation, the deep convolutional neural network includes a first convolutional block and a second convolutional block;
[0085] The first convolutional block includes a first convolutional layer, a first activation layer, and a second convolutional layer connected in sequence; the second convolutional block includes a pooling layer, a second activation layer, a third convolutional layer, a third activation layer, and a fourth convolutional layer connected in sequence;
[0086] Among them, the first convolutional layer takes the semantic feature vector of the triple as the input, and the input of the first convolutional layer and the output of the second convolutional layer are connected through a residual connection as the input of the pooling layer; and the input of the pooling layer and the output of the fourth convolutional layer are connected through a residual connection as the output of the deep convolutional neural network, that is, the deep semantic feature vector.
[0087] The deep convolutional network uses two convolutional modules to improve the richness of the feature vector, and its structure is as Figure 3 shown. Specifically, the first convolutional module contains two convolutional layers, an activation layer, and a residual connection. This part can be expressed by the formula f(x)+x, and the latter term represents the residual connection of the input feature vector x. By introducing the residual connection, the vanishing gradient and gradient explosion are prevented.
[0088] The second convolutional module contains a pooling layer, two convolutional layers, two activation layers, and a residual connection. This part can be expressed by the formula g(x)*Ω + b, where g(x) represents the activation function ReLU, b represents the bias, and Ω represents the convolutional kernel. Similarly, by introducing the residual connection, the vanishing gradient and gradient explosion are prevented.
[0089] In addition, as a preference, the first convolutional layer, the second convolutional layer, the third convolutional layer, and the fourth convolutional layer all adopt equal-length convolutions, so that the length of the vector obtained after convolution is the same as the input, thus avoiding the dimension matching problem caused by the residual connection.
[0090] S4. Calculate the confidence score according to the triple deep semantic feature
[0091] In this step, the vector V of the deep semantic feature obtained in step S3 c is input into the fully connected network, and thus the confidence score of the triple is calculated. The formula is as follows:
[0092] f(h, Q, t) = V c ·W
[0093] where W is a learnable weight parameter.
[0094] S5. Calculate the loss function
[0095] In this step, the loss is calculated according to the confidence scores of each triple. The loss function used to calculate the loss value is as follows:
[0096]
[0097]
[0098] Among them, represents L2 regularization, and λ represents the coefficient of the regularization term.
[0099] S6. Iteratively train with the goal of minimizing the loss
[0100] With the goal of minimizing the loss L, and train by iteratively performing steps S2 - S5 using the stochastic gradient descent method, so that the scores of negative sample triples calculated by the model are much smaller than the scores of positive sample triples, thereby enabling the model to have the ability to distinguish between positive and negative samples. When the preset number of training rounds is reached or the model converges, a trained knowledge graph reasoning model is obtained.
[0101] After completing the model training through the above process, the model can be used for actual knowledge graph reasoning tasks. Specifically: Input the incomplete triple to be reasoned, where the incomplete triple is a triple containing incomplete elements, and the incomplete elements are head entities or tail entities or relationships; according to the incomplete elements in the incomplete triple, extract the corresponding elements from the knowledge graph to be reasoned, and respectively combine the extracted elements with the incomplete triple to construct a set of candidate triples;
[0102] Use the trained knowledge graph reasoning model to calculate the confidence scores of all candidate triples, and take the candidate triple with the highest confidence score as the reasoning result for the incomplete triple.
[0103] And according to the incomplete elements in the incomplete triple, extracting the corresponding elements from the knowledge graph to be reasoned specifically includes:
[0104] If the incomplete element is a relationship, extract all relationships from the knowledge graph to be reasoned;
[0105] If the incomplete element is a tail entity, extract all tail entities from the knowledge graph to be reasoned;
[0106] If the incomplete element is a head entity, extract all head entities from the knowledge graph to be reasoned.
[0107] For example, for the incomplete triple (a,?, b) to be reasoned, where the incomplete element is a relationship, that is, to predict the possible relationship between entity a and entity b. By extracting all candidate relationships r from the knowledge graph, each candidate relationship r is combined with entity a and entity b to form candidate triples, use the knowledge graph reasoning model to calculate the confidence scores of all candidate triples, and sort the scores, and take the relationship in the candidate triple with the highest score as the reasoning result.
[0108] Similarly, the reasoning for the incomplete triple (?, r, b) or the incomplete triple (a, r,?) can also be achieved.
[0109] Finally, it should be noted that the above embodiments are only preferred embodiments and are not intended to limit the present invention. It should be pointed out that for those of ordinary skill in the art, without departing from the spirit and scope of the present invention as defined by the claims, several modifications, equivalent substitutions, improvements, etc. should all be included within the protection scope of the present invention.
Claims
1. A knowledge graph reasoning method based on deep semantic feature extraction, characterized in that It includes the following steps: A. Training a knowledge graph reasoning model: A1. Initializing the triples of the knowledge graph to be reasoned, and obtaining the vectors of the head entities, the vectors of the tail entities, and the vectors of the relationships in each triple; A2. For each triple, concatenating and reshaping the vectors of its head entity and tail entity to obtain an embedding matrix of the entity pair; Splitting and reshaping the vector of its relationship to obtain a set of convolutional kernels; respectively using each convolutional kernel to extract features from the embedding matrix of the entity pair to obtain corresponding feature maps; then, concatenating the feature maps to obtain the semantic feature vector of this triple; A3. Using a deep convolutional network to extract features from the semantic feature vectors of each triple to obtain the deep semantic feature vectors of each triple, and then inputting them into a fully connected network to obtain the confidence scores of the corresponding triples; A4. Calculating the loss value according to the confidence scores of each triple; A5. Taking minimizing the loss as the goal, and training by the stochastic gradient descent method, iterating steps A2 - A4 until the set number of iterations is reached or the model converges, to obtain the trained knowledge graph reasoning model; B. Performing a knowledge graph reasoning task: Inputting the incomplete triple to be reasoned, where the incomplete triple is a triple containing incomplete elements, and the incomplete elements are head entities or tail entities or relationships; according to the incomplete elements in the incomplete triple, extracting the corresponding elements from the knowledge graph to be reasoned, and respectively combining the extracted elements with the incomplete triple to construct a set of candidate triples; Using the trained knowledge graph reasoning model to calculate the confidence scores of all candidate triples, and taking the candidate triple with the highest confidence score as the reasoning result for the incomplete triple.
2. The method for knowledge graph reasoning based on deep semantic feature extraction according to claim 1, wherein in step A1, using a pre - trained TransE model to initialize the triples of the knowledge graph to be reasoned, and obtaining the vectors of the head entities, the vectors of the tail entities, and the vectors of the relationships in each triple, specifically including: A11. Construct a positive sample set S. The triples in the positive sample set S are represented as (h, r, t), and construct a negative sample set S by randomly replacing the head entity or the tail entity in the positive sample set S. ′ , the negative sample set S ′ The triples in are represented as (h ′ , r, t ′ ); Randomly sample the head entity, tail entity, and relationship in each triple in the positive sample set S and the negative sample set S ′ respectively to obtain their initial vectors. A12. The following loss function L is adopted TransE , and by minimizing the loss and using the gradient descent method for iterative update, the vectors of the head entity, the vectors of the tail entity, and the vectors of the relationships in each triple are obtained: Among them, γ is a distance hyperparameter greater than 0 used to distinguish positive sample triplets and negative sample triplets. + represents the positive value function, and d(·) represents the Euclidean distance.
3. The method for knowledge graph reasoning based on deep semantic feature extraction according to claim 1, wherein in step A2, for each triple, concatenating and reshaping the vectors of its head entity and tail entity to obtain an embedding matrix of the entity pair, specifically including: First, concatenating the vectors of the input head entity and tail entity to obtain a concatenated vector with a dimension of 2*K, where K is the vector dimension of the head entity and the tail entity; Then, reshaping the concatenated vector through a two - dimensional transformation to obtain an embedding matrix of the entity pair with a dimension of M*N, and satisfying M*N = 2*K.
4. The method for knowledge graph reasoning based on deep semantic feature extraction according to claim 1, wherein in step A2, for each triple, splitting and reshaping the vector of its relationship to obtain a set of convolutional kernels, specifically including: First, splitting the vector of the input relationship into I groups of vectors, and satisfying A = I*P*Q, where A is the vector dimension of the relationship, I is the number of splits, and P*Q is the dimension of the two - dimensional convolutional kernel; Then, each vector obtained by splitting is reshaped through a two-dimensional transformation to obtain I convolution kernels with dimensions of P*Q.
5. A knowledge graph reasoning method based on deep semantic feature extraction according to any one of claims 1 to 4, characterized in that In step A2, the semantic feature vectors of the triples are concatenated according to the following formula: V = concat(g([h;t]*Ω i )) Among them, V represents the semantic feature vector of the triple, [h; t] represents the embedding matrix of the entity pair, * represents the convolution operation, and Ω i represents the i-th convolution kernel, g() represents the feature map obtained by convolving the embedding matrix of the entity pair with the convolution kernel, and concat() represents the operation of concatenating each feature map.
6. A knowledge graph reasoning method based on deep semantic feature extraction according to claim 1, wherein: In step A3, the deep convolutional neural network includes a first convolutional block and a second convolutional block; The first convolutional block includes a first convolutional layer, a first activation layer, and a second convolutional layer connected in sequence; the second convolutional block includes a pooling layer, a second activation layer, a third convolutional layer, a third activation layer, and a fourth convolutional layer connected in sequence; Among them, the first convolutional layer takes the semantic feature vectors of the triples as input, and the input of the first convolutional layer and the output of the second convolutional layer are connected through a residual connection as the input of the pooling layer; and the input of the pooling layer and the output of the fourth convolutional layer are connected through a residual connection as the output of the deep convolutional neural network, that is, the deep semantic feature vector.
7. A knowledge graph reasoning method based on deep semantic feature extraction according to claim 6, wherein: The first convolutional layer, the second convolutional layer, the third convolutional layer, and the fourth convolutional layer all use equal-length convolutions.
8. A knowledge graph reasoning method based on deep semantic feature extraction according to claim 1, 2, 6 or 7, characterized in that, In step A3, a fully connected network is used to calculate the confidence score of the triples in the following way: f(h,r,t) = V c ·W Among them, V c represents the deep semantic feature vector extracted by the deep convolutional neural network, and W is the learnable weight parameter.
9. A knowledge graph reasoning method based on deep semantic feature extraction according to claim 8, wherein: In step A4, the loss function used to calculate the loss value is: Among them, f(h, r, t) represents the confidence score of the triple, represents L2 regularization, and λ represents the coefficient of the regularization term.
10. A knowledge graph reasoning method based on deep semantic feature extraction according to claim 1, characterized in that, In step B, according to the missing elements in the incomplete triples, the corresponding elements are extracted from the knowledge graph to be inferred, specifically including: If the missing element is a relationship, all relationships are extracted from the knowledge graph to be inferred; If the missing element is a tail entity, all tail entities are extracted from the knowledge graph to be inferred; If the missing element is a head entity, all head entities are extracted from the knowledge graph to be inferred.
Citation Information
Patent Citations
Knowledge graph completion method and system
CN114610900A
Character relationship knowledge graph completion method based on feature enhancement
CN116258139A