A knowledge graph link prediction method fusing multi-source information

CN119204195BActive Publication Date: 2026-07-24UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
UNIV OF ELECTRONICS SCI & TECH OF CHINA
Filing Date
2024-08-28
Publication Date
2026-07-24

Smart Images

  • Figure CN119204195B_ABST
    Figure CN119204195B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of knowledge graphs, and discloses a knowledge graph link prediction method fusing multiple sources of information, which uses a graph autoencoder to train a converted relation graph of a knowledge graph, obtains higher-quality entity features and relation features, filters low-correlation neighborhood entities from the semantic and spatial angles, then applies soft hints to the coding of semantic features and hard hints to the coding of high-quality path features, and jointly trains; scores corresponding to a structure modeling model and a text modeling model are preprocessed and feature-extracted, and candidate entities are weighted and summed through weights; when a specific link prediction task is performed, the obtained scores are sorted, and the link prediction task is completed according to the score sorting result. The method alleviates the over-smoothing problem of an existing structure modeling model, reduces the calculation cost, compensates for the entity ambiguity and spatial limitations of an existing text modeling model, and can better complete the knowledge graph link prediction task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of knowledge graph technology, specifically to a method for predicting knowledge graph links by combining structural information, text, and path information. Background Technology

[0002] Knowledge graphs are datasets stored as triples (head entity, relation, tail entity), and have been widely applied in intelligent fields such as question answering, recommendation systems, and vertical domain retrieval. Most existing knowledge graphs are constructed manually or semi-automatically, and generally suffer from incomplete information, significantly limiting their effectiveness in downstream applications. Knowledge graph link prediction methods, based on existing triple sets, fully explore the potential relationships between entities, predict new facts, or identify erroneous knowledge, thereby further enriching and improving existing knowledge graphs.

[0003] Knowledge graph link prediction is a task based on the ranking of triple scores. The basic idea is as follows: First, calculate the score of each triple corresponding to the candidate entity in the entity set according to the self-designed model; then rank the scores; finally, add the candidate entities with higher scores to the knowledge graph, thus realizing knowledge graph link prediction.

[0004] Knowledge graph link prediction models are typically based on structural or textual information. Knowledge graph representation learning is a traditional method based on structural information modeling. While simple and efficient, this approach only considers the triple information of the knowledge graph, leading to insufficient modeling and performance degradation. Considering the inherent topological structure information of knowledge graphs, a knowledge graph link prediction method based on graph neural networks has been proposed. The strategy iteratively aggregates messages from neighboring entities to the target entity, thereby learning the topological structure. This type of method achieves excellent performance and is widely used by modeling the structural information of the knowledge graph. However, it cannot provide rich semantic associations between entities and relations and is inherently susceptible to the incompleteness of the knowledge graph. To address the limitations of graph neural network-based methods, a knowledge graph link prediction method based on pre-trained language models (PLMs) has been proposed to utilize the inherent textual description information of the knowledge graph. This strategy encodes the textual description information corresponding to entities and relations. This type of method also achieves excellent performance; however, its modeling heavily relies on triples and their textual description information, failing to capture long-distance structures in the knowledge graph, ignoring topological biases to some extent, and exhibiting spatial limitations. Summary of the Invention

[0005] The technical problem to be solved by this invention is to propose a knowledge graph link prediction method that integrates multi-source information. This method addresses the problems of current graph neural network methods, which suffer from insufficient effective information when training sparse graphs and a large number of low-relevance entities when training dense graphs due to the limited number of aggregation layers. Pre-trained language model methods ignore spatial limitations and entity ambiguity. This invention designs a lightweight ensemble model that combines a proposed structural information modeling model with a joint text and path information modeling model, thereby improving link prediction performance.

[0006] The technical solution adopted by the present invention to solve the above-mentioned technical problems is as follows:

[0007] A knowledge graph link prediction method that integrates multi-source information includes the following steps:

[0008] A knowledge graph link prediction method integrating multi-source information, characterized by comprising the following steps:

[0009] Step 1: Establish a structured information modeling model based on an efficient message passing mechanism, and use optimized entity features for efficient message passing; the structured information modeling model first trains the transformed relation graph through a graph autoencoder to obtain relation features and entity features, and then filters low-relevance entities by calculating semantic thresholds and retains entities that are spatially close.

[0010] Step 2: Establish a joint modeling model of text and path information based on text semantic enhancement; the text information modeling model first adds the soft cues in the cue learning to semantic encoding, then adds the preprocessed path information to the predefined hard cues for path encoding, and performs joint training of semantic and path encoding;

[0011] Step 3: Integrate the different score distributions of the text information modeling model and the structural information modeling model, train the ensemble weights corresponding to the scores of the two models, and perform weighted summation and reordering of the scores to obtain the ensemble model;

[0012] Step 4: After completing the ensemble model training in Step 3, use the model for actual knowledge graph link prediction tasks.

[0013] Furthermore, the specific process for establishing the structural information modeling model is as follows:

[0014] Step 11: Entity feature initialization; generate the initial feature matrix of the relationship using random initialization. Let G be a set of m x d real matrixes, where m is the number of relation types in the knowledge graph G and d is the embedding dimension; transform the original knowledge graph G into a relation graph G. r A graph autoencoder is used to optimize the initial feature matrix of the relations, transforming the relation graph G... rStructural knowledge is incorporated into relational features, and the initial feature matrix of the relation is used. and adjacency matrix A r After passing through a two-layer graph convolutional network (GCN), it is embedded into an intermediate vector.

[0015] Z = GCN(h) r A r )

[0016] Next, the dot product is used to reconstruct the original knowledge graph G:

[0017]

[0018] in The graph adjacency matrix is ​​the result of decoding and reconstruction; σ is the Sigmoid activation function; Z T It is the transpose of the intermediate vector Z;

[0019] Aggregate the neighborhood relation types of entities using an attention-based approach, for each triple (e q ,r q ,e a )∈Tra, where Tra is the training set, e q To query entities, r q To query the relationship, e a For the answer entity, the initial entity features are obtained by weighted summation based on the attention coefficients.

[0020]

[0021]

[0022] in To query entity e q The set of neighborhood relation types, For relation r q Embedded, For entity e q neighborhood relationship r i The embedding is σ, where σ is the Sigmoid activation function and || is the feature concatenation operation;

[0023] Step 12: Efficient message passing. Through L layers of efficient message passing, the valid message is passed from the query entity to the answer entity and other target entities. Before each layer of message passing, the entity-entity relevance β is calculated based on the target entity, source entity, and query entity. E Calculate the entity-relationship relevance β based on the target entity, source relationship, and query relationship. R And calculate an average relevance based on all target entities. Then, a threshold β is set, and all candidates in the entity set E′ are... The corresponding target entities are removed, thereby reducing interfering messages through semantic-level filtering. After semantic-level filtering, messages of each target entity are aggregated using an attention-based approach. Attention is used to distinguish the different weights of neighborhood messages of the target entity, thus obtaining the neighborhood message embedding.

[0024]

[0025]

[0026] in Here is the weight matrix for the l-th layer; For entity e i Embedded at layer l-1; For relation r i Embedded at layer l-1; For target entity e o The set of neighboring entities; For target entity e o The set of relation types corresponding to the neighborhood entity set; β oj For each neighboring message, the relevance is determined.

[0027] Then, neighborhood message embedding By merging the messages of the target entity itself, the initial target entity embedding is obtained.

[0028]

[0029] in or For connection operations; ⊙ represents the Hadamard product; For target entity e o Embedded at layer l-1;

[0030] Calculate the embedding of each target entity Embedded to query entity Given the spatial distance D, perform spatial-level filtering on the target entities in the l-th layer, retaining a specific number K spatially similar entities:

[0031]

[0032] Step 13: Train using hard negative samples; after L layers of message passing, obtain the answer entity and at most (L·K-1) other target entities in the candidate entity set E′, and embed the answer entity of the Lth layer. Input into the scoring function S:

[0033]

[0034] in This is the weight matrix;

[0035] Log loss function is used during negative sample training:

[0036]

[0037] Tra represents the set of difficult negative samples.

[0038] Furthermore, the process for establishing a text information modeling model is as follows:

[0039] Step 21: Semantic feature learning; Semantic encoding is implemented through a semantic dual encoder, consisting of a head entity-relation encoder BERT. hr BERT physical encoder t BERT Head Entity-Relationship Encoder hr The header entity, header entity description, relation, relation description, and soft hints are encoded, and the tail entity encoder BERT is used. t Encode the tail entity and its description; insert soft prompts for the entity before and after the input head entity. Insert soft hints about relationships before and after the entered relationships. Where E is the entity set; R is the relation set;

[0040] The hidden state is extracted from the last layer of the semantic dual encoder using an average pooling strategy, and the semantic feature score S is calculated using cosine similarity. r (h,r,t), as shown in the following formula:

[0041]

[0042] Where h is the header entity; r is the relation; e hr BERT Head Entity-Relationship Encoder hr Embedding of output header entities and relations; e t BERT is a physical encoder for tails. t The tail entity of the output is embedded;

[0043] Step 22: Path Feature Learning; The random walk algorithm is used to extract the relation path corresponding to each triple in the dataset, and the highly reliable path from the head entity to the tail entity is calculated and selected; Path encoding is implemented through a dual-encoder path encoder, consisting of a hard-cue canonical encoder (BERT). hP BERT physical encoder t Hard hints for the BERT encoder hPEncode the head entity and the highly reliable path from the head entity to the tail entity, while utilizing the self-designed hard hint encoder BERT. hP Input:

[0044] Template="First path about[Entity]is[p1], second is[p2],,...,-th is[p i ]."

[0045] Where [Entity] is the header entity tag; [p i [] represents the path label;

[0046] Input the hard template into BERT hP In this process, the hidden state is extracted from the last layer of the path dual encoder using an average pooling strategy, and the head entity-path embedding is obtained through L2 normalization. hP BERT, a tail-mounted solid encoder with dual path encoders. t BERT, a tail entity encoder with semantic dual encoders t Share all parameters and use spatial distance to calculate path feature score S. P (h,r,t):

[0047] S P (h,r,t)=distance(e hP e t )=-||e hP -e t ||

[0048] Where ||·|| represents the L2 norm;

[0049] Step 23, Joint Training Strategy: Semantic feature learning and path feature learning are combined into one training round. A self-supervised pre-trained language model is used to implement semantic feature learning and path feature learning, and then joint training is performed.

[0050]

[0051] in ε is the loss function for semantic feature learning; ε is the scaling parameter. The loss function is used for path feature learning; the goal of joint training is to minimize the loss value of the joint loss function.

[0052] Furthermore, the semantic feature learning uses the InfoNCE loss function for path feature training:

[0053]

[0054] Where Train is the training set; N is the set of negative samples consisting of the highest-scoring non-answer entities corresponding to each query triple after the first iteration of the structural information modeling training phase; t′ is the negative sample in the negative sample set; τ is the temperature coefficient, used to control the model's ability to distinguish negative samples;

[0055] Maximum margin hinge loss function is used in path feature learning:

[0056]

[0057] Among them, Tra N Let λ be a set of negative triples, and λ be the interval distance.

[0058] Furthermore, step 3 is detailed below:

[0059] Step 31: Preprocessing and feature extraction; use maximum-minimum normalization to convert the score Sc i (h,r,t) is linearly mapped to the interval [0,1] to obtain the normalized score Sc. i ′(h,r,t):

[0060]

[0061] Where min(·) is the minimum value function; N all For any query triple (h,r,t) a The corresponding set of all positive and negative samples; max(·) is the maximum value function; Sc i In ′(h,r,t), i=1 represents the score of the structural information modeling model, and i=2 represents the score of the text information modeling model.

[0062] Normalized scores are used for feature extraction to obtain the features f(Sc) corresponding to the two models. i ′,T):

[0063]

[0064] Where T = (h, r, t) represents any positive or negative triplet; mean(·) is the mean function; || is the feature concatenation operation; var(·) is the variance function; x (Sc ′, T) Interaction features between the two models:

[0065] x (Sc′,T) =[Sc1′,Sc1′×Sc2′,Sc1′-Sc2′,Sc2′]

[0066] Step 32: Integrate weight calculation and model training; combine the features f(Sc) corresponding to the two models respectively. iThe weights (T, '') are passed to the multilayer perceptron (MLP) to calculate the ensemble weights.

[0067]

[0068] Calculate the ensemble score J(h,r,t):

[0069]

[0070] For any triple score Sc2(h,r,t) of the text information modeling model, there is a unique triple score Sc1(h,r,t) of the structure information modeling model.

[0071] The ensemble model is trained using the maximum-interval hinge loss function:

[0072]

[0073] Tra J The training set corresponding to the ensemble model; For the set of negative triples corresponding to the ensemble model, N J J(h,r,t) represents the set of negative samples corresponding to any query triple in the ensemble model; m is the interval distance; + ) is the query for the triple (h,r,t) a The integrated score of the corresponding positive triples; J(h,r,t) - ) is the query for the triple (h,r,t) a The integrated score of the corresponding negative triplet.

[0074] The beneficial effects of this invention are:

[0075] 1) In graph neural network methods, highly relevant messages are passed on. On the one hand, this avoids the exponential growth of the number of entities when training dense graphs, which alleviates the oversmoothing problem and reduces computational costs. On the other hand, when training sparse graphs, messages are passed to deeper layers to learn more effective knowledge.

[0076] 2) Soft cues are added to the semantic dual encoder to alleviate the entity ambiguity problem in PLM, improve the feature quality of entities and relations, and combine path information and text information to standardize the input with hard cues, thereby alleviating spatial limitations and improving model accuracy.

[0077] 3) The lightweight adaptive ensemble model complements the two types of models, greatly reducing the model training cost while further improving the evaluation effect of knowledge graph link prediction. Attached Figure Description

[0078] Figure 1This is an overall flowchart of the knowledge graph link prediction method in this invention;

[0079] Figure 2 This is a schematic diagram illustrating the principle of efficient message passing in this invention.

[0080] Figure 3 This is a schematic diagram illustrating the principle of text semantic enhancement in this invention. Detailed Implementation

[0081] This invention aims to propose a knowledge graph link prediction method that integrates multi-source information. On the one hand, it optimizes existing graph neural network methods; on the other hand, it enriches the feature modeling of pre-trained language models. The goal is to improve the model efficiency and accuracy of these two methods. Furthermore, it attempts to complement these two improved methods to further enhance the model's evaluation performance. The overall implementation process is as follows: Figure 1 As shown, S1, the relation optimization model is used to obtain higher quality initial entity features and relation features, and low-relevance neighborhood entities are filtered from semantic and spatial perspectives to pass messages to deeper layers; S2, soft cues from cue learning are applied to semantic feature encoding, while hard cues are applied to feature encoding of high-quality paths, and joint training is performed; S3, the scores corresponding to the structural modeling model and the text modeling model are preprocessed and feature extracted, and the ensemble weights of the corresponding scores are obtained through training, and then the candidate entities are weighted and summed; S4, when performing the specific link prediction task, the scores obtained by the ensemble model are reordered, and finally the link prediction task is completed based on the score order.

[0082] Example:

[0083] The following uses a knowledge graph G to be learned with n entities and m relation types as an example to illustrate the solution of this invention in detail. The specific implementation process is as follows:

[0084] Step 1: Use optimized entity features for efficient message passing. For example... Figure 2 As shown, the entire process is divided into three sub-steps: entity feature initialization, efficient message passing, and training using difficult negative samples.

[0085] Step 11: Entity Feature Initialization. Using a graph autoencoder (hereinafter referred to as graph autoencoder), structural knowledge between relations is extracted from the transformed relation graph, and the optimized relation features are used to initialize entity features. An initial feature matrix of relations is generated using a random initialization method. Let G be a set of m x d real matrixes, where m is the number of relation types in the knowledge graph G and d is the embedding dimension. The goal is to transform the original knowledge graph G into a relation graph Gi. r A graph autoencoder is used to optimize the initial feature matrix of the relations, transforming the relation graph G...r Structural knowledge is incorporated into relational features, and the initial feature matrix of the relation is used. and adjacency matrix A r After passing through a two-layer graph convolutional network (GCN), it is embedded into an intermediate vector.

[0086] Z = GCN(h) r A r )

[0087] Next, the dot product is used to reconstruct the original image G:

[0088]

[0089] in The graph adjacency matrix is ​​the result of decoding and reconstruction; σ is the Sigmoid activation function; Z T It is the transpose of the intermediate vector Z.

[0090] Reconstruct the adjacency matrix Adjacency matrix A of the original graph r The adjacency matrices should be as similar as possible, as they determine the graph's structure. Therefore, the cross-entropy loss function is used during training.

[0091]

[0092] Where A ij The value (0 or 1) of the element in the i-th row and j-th column of the adjacency matrix of the original graph; To reconstruct the corresponding element values ​​in the adjacency matrix.

[0093] Aggregate the neighborhood relation types of entities using an attention-based approach, for each triple (e q ,r q ,e a )∈Tra, where Tra is the training set, e q To query the entity, r q To query the relationship, e a For the answer entity, the initial entity features are obtained by weighted summation based on the attention coefficients.

[0094]

[0095]

[0096] in To query entity e q The set of neighborhood relation types, For relation r q Embedded, For entity e qneighborhood relationship r i The embedding is denoted by σ, where σ is the Sigmoid activation function and || is the feature concatenation operation.

[0097] Step 12, Efficient Message Passing. Through L layers of efficient message passing, valid messages are passed from the query entity to the answer entity and other target entities. At each layer, semantic-level filtering is performed by calculating the entity-entity relevance and entity-relationship relevance of the target entities. Then, spatial-level filtering is performed on the aggregated target entities, thus passing the valid messages to the next layer. Specifically, before each layer of message passing, the entity-entity relevance β is calculated based on the target entity, source entity, and query entity. E Calculate the entity-relationship relevance β based on the target entity, source relationship, and query relationship. R And calculate an average relevance based on all target entities. Then, a threshold β is set, and all candidates in the entity set E′ are... The corresponding target entities are removed, thereby reducing interfering messages and lowering computational costs through semantic-level filtering. After semantic-level filtering, messages are aggregated for each target entity using an attention-based approach. Attention is used to distinguish the different weights of neighborhood messages of the target entity, thus obtaining the neighborhood message embedding.

[0098]

[0099]

[0100] in Here is the weight matrix for the l-th layer; For entity e i Embedded at layer l-1; For relation r i Embedded at layer l-1; For target entity e o The set of neighboring entities; For target entity e o The set of relation types corresponding to the neighborhood entity set; The relevance of each neighboring message.

[0101] After message passing, the obtained neighborhood message embedding It is also necessary to merge the messages of the target entity itself to obtain the initial target entity embedding.

[0102]

[0103] in or For connection operations; ⊙ represents the Hadamard product; For target entity e o Embedded at layer l-1.

[0104] Calculate the embedding of each target entity Embedded to query entity Given the spatial distance D, perform spatial-level filtering on the target entities in the l-th layer, retaining a specific number K spatially similar entities:

[0105]

[0106] Step 13: Training using difficult negative samples. After L layers of message passing, the answer entity and at most (L·K-1) other target entities in the candidate entity set E′ are obtained. The answer entity of the Lth layer is then embedded. Input into the scoring function S:

[0107]

[0108] in e is the weight matrix; q To query the entity, r q To query the relationship, e a The answer entity.

[0109] The model uses a log loss function:

[0110]

[0111] Tra represents the set of difficult negative samples.

[0112] Step 2: Utilize cue-based learning to model text and path information. For example... Figure 3 As shown, the entire process is divided into three sub-steps: semantic feature learning, path feature learning, and joint training strategy.

[0113] Step 21: Semantic Feature Learning. First, textual information preprocessing is performed on entities and relations. Then, a semantic dual encoder is used to encode the different parts corresponding to the query triples. Soft cues are added to improve encoding quality. Finally, cosine similarity is calculated to obtain the semantic feature score. Specifically, semantic encoding is implemented through a semantic dual encoder, consisting of a head entity-relation encoder (BERT). hr BERT physical encoder t BERT Head Entity-Relationship Encoder hr The header entity, header entity description, relation, relation description, and soft hints are encoded, and the tail entity encoder BERT is used. t Encode the tail entity and its description. Insert soft prompts for the entities before and after the input head entity. Insert soft hints about relationships before and after the entered relationships.

[0114] Where E is the entity set; d represents the set of relations; d is the dimension of the hidden state.

[0115] For the semantic dual encoder BERT t The input contains only the tail entity t and its corresponding text description. The hidden states are extracted from the last layer of the encoder using average pooling. The semantic feature score S is calculated using cosine similarity. r (h,r,t), as shown in the following formula.

[0116]

[0117] Where h is the header entity; r is the relation; e hr BERT Head Entity-Relationship Encoder hr Embedding of output header entities and relations; e t BERT is a physical encoder for tails. t The output tail entity is embedded.

[0118] Semantic feature learning uses the InfoNCE loss function for path feature training:

[0119]

[0120] Where Train is the training set; N is the negative sample set consisting of the 1000 non-answer entities with the highest scores corresponding to each query triple after the first iteration of the structural information modeling training phase; t′ is the negative sample in the negative sample set; τ is the temperature coefficient, used to control the model's discrimination of negative samples.

[0121] Step 22: Path Feature Learning. First, path information is preprocessed on the query triples to obtain highly reliable paths. Then, the head entity and its highly reliable paths are encoded, and hard cues are used to standardize the input. Finally, the path feature score is obtained by calculating the spatial distance to the tail entity. Specifically, a random walk algorithm is used to extract multiple relation paths corresponding to each triple in the dataset. The Path-Constraint Resource Allocation Algorithm (PCRA) is used to calculate highly reliable paths from the head entity to the tail entity, and the three paths with the highest reliability are selected. Path encoding is implemented using a dual-encoder, consisting of a hard-cue standardization encoder (BERT). hP BERT physical encoder t Hard hints for the BERT encoder hPThe three highly reliable paths—the head entity, the head entity to the tail entity, and the self-designed hard hint encoder BERT—are encoded. hP Input:

[0122] Template="First path about[Entity]is[p1], second is[p2],thrid is[p3]."

[0123] Where [Entity] is the header entity tag; [p i [] represents the path label.

[0124] Input the hard template into BERT hP In this process, the hidden state is extracted from the last layer of the encoder using an average pooling strategy, and the head entity-path embedding is obtained through L2 normalization. hP BERT encoder with dual path encoder t BERT, a dual encoder for semantic and semantic encoding t Share all parameters and use spatial distance to calculate path feature score S. P (h,r,t):

[0125] S P (h,r,t)=distance(e hP ,e t )-||e hP -e t ||

[0126] Where ||·|| represents the L2 norm.

[0127] Maximum margin hinge loss function is used in path feature learning:

[0128]

[0129] Where Tra is the training set, Tra N Let N be the set of negative triples, where N is the set of negative samples consisting of the 1000 non-answer entities with the highest scores corresponding to each query triple after the first iteration of the structural information modeling training phase, and λ is the interval distance.

[0130] Step 23, Joint Training Strategy. The semantic feature learning module and the path feature learning module are combined into a single training round. A self-supervised pre-trained language model (PLM) is used to learn semantic features and path features, and then jointly trained.

[0131]

[0132] in ε is the loss function for the semantic feature learning module; ε is the scaling parameter. This is the loss function for the path feature learning module. The goal of joint training is to minimize the loss value of the joint loss function, thereby fully utilizing the implicit knowledge in PLM and the topological structure information inherent in the knowledge graph.

[0133] Step 3: Integrate the different score distributions of the text information modeling model and the structural information modeling model. The integration process includes two sub-steps: preprocessing and feature extraction, and integration weight calculation and model training.

[0134] Step 31: Preprocessing and Feature Extraction. The score Sc is processed using maximum-minimum normalization. i (h,r,t) is linearly mapped to the interval [0,1] to obtain the normalized score Sc. i ′(h,r,t):

[0135]

[0136] Where min(·) is the minimum value function; N all For any query triple (h,r,t) + The corresponding set of all positive and negative samples; max(·) is the maximum value function; Sc i In ′(h,r,t), i=1 represents the score of the text information modeling model, and i=2 represents the score of the structure information modeling model.

[0137] Feature extraction is performed on the normalized scores to obtain the features f(Sc) corresponding to the two models. i ′,T):

[0138]

[0139] Where T = (h, r, t) represents any positive or negative triplet; mean(·) is the mean function; || is the feature concatenation operation; var(·) is the variance function; x (Sc ′, T) Interaction features between the two models:

[0140] x (Sc′,T) =[Sc1′,Sc1′×Sc2′,Sc1′-Sc2′,Sc2′]

[0141] Step 32: Integration weight calculation and model training. The features f(Sc) corresponding to the two models are respectively integrated. i The weights (T, '') are passed to the multilayer perceptron (MLP) to compute the ensemble weights.

[0142]

[0143] Where σ is the activation function; MLP i (·) can perform dimension transformation on vectors. The ensemble model converts the merged feature vectors into one-dimensional vectors; T = (h, r, t) is any positive or negative triplet.

[0144] Calculate the ensemble score J(h,r,t):

[0145]

[0146] in For the ensemble weights, T = (h, r, t) represents any positive or negative triple, and the ensemble model is any query triple (h, r, t). + Calculate the ensemble weights for all positive and negative triples corresponding to ); Sc i (h,r,t) represents the score of any positive or negative triple. For any triple score Sc2(h,r,t) of the text information modeling model, there is a unique triple score Sc1(h,r,t) of the structure information modeling model.

[0147] The ensemble model is trained using the maximum-interval hinge loss function:

[0148]

[0149] Tra J The training set corresponding to the ensemble model; For the set of negative triples corresponding to the ensemble model, N J J(h,r,t) represents the set of negative samples corresponding to any query triple in the ensemble model; m is the interval distance; + ) is the query for the triple (h,r,t) a The integrated score of the corresponding positive triples; J(h,r,t) - ) is the query for the triple (h,r,t) a The integrated score of the corresponding negative triplet.

[0150] Step 4: After completing model training in Step 3, the model can be used for actual knowledge graph link prediction tasks. For example, for a missing triple to be completed (a, b, ?), the goal is to predict the tail entities that head entity a might have based on relation b. For each query triple, the ensemble scores of each candidate triple corresponding to the trained and weighted summation of the ensemble model are ranked, and the entity in the candidate triple with the highest score is taken as the link prediction result.

[0151] Although the present invention has been described herein with reference to embodiments thereof, the above embodiments are merely preferred embodiments of the present invention, and the implementation of the present invention is not limited to the above embodiments. It should be understood that those skilled in the art can design many other modifications and implementations, which will fall within the scope and spirit of the principles disclosed in this application.

Claims

1. A knowledge graph link prediction method that integrates multi-source information, characterized in that, Includes the following steps: Step 1: Establish a structured information modeling model based on an efficient message passing mechanism, and use optimized entity features for efficient message passing; The structural information modeling model first trains the transformed relation graph through a graph autoencoder to obtain relation features and entity features. Then, it filters low-relevance entities by calculating semantic thresholds and retains entities that are spatially close. The specific process for establishing the structural information modeling model is as follows: Step 11: Entity feature initialization; generate the initial feature matrix of the relationship using random initialization. , for OK The set of real matrices of columns, where For knowledge graphs Number of relation types To embed dimensions; the original knowledge graph Transform into a relationship diagram A graph autoencoder is used to optimize the initial feature matrix of the relations, transforming the relation graph. Structural knowledge is incorporated into relational features, and the initial feature matrix of the relation is used. and adjacency matrix After two layers of graph convolutional network Embedded as an intermediate vector : Next, dot product is used to reconstruct the original knowledge graph. : in For decoding and reconstructing the graph adjacency matrix; for Activation function; It is an intermediate vector transpose; Aggregate the neighborhood relation types of entities using an attention-based approach, for each triple. Where Tra is the training set. To query entities, To query the relationship, For the answer entity, the initial entity features are obtained by weighted summation based on the attention coefficients. : in , To query entities The set of neighborhood relation types, For relationship Embedded, For entities Neighborhood Relationships Embedded, for Activation function For feature splicing operations; Step 12: Efficient message passing, after... Efficient message passing at each layer ensures that valid messages are delivered from the query entity to the answer entity and other target entities. Before each layer of message passing, entity-entity relevance is calculated based on the target entity, source entity, and query entity. Calculate entity-relationship relevance based on target entity, source relation, and query relation. And calculate an average relevance based on all target entities. Then set a threshold. In the candidate entity set In, all The corresponding target entities are removed, thereby reducing interfering messages through semantic-level filtering. After semantic-level filtering, messages of each target entity are aggregated using an attention-based approach. Attention is used to distinguish the different weights of neighborhood messages of the target entity, thus obtaining the neighborhood message embedding. : in Here is the weight matrix for the l-th layer; For entities In the Layer embedding; For relationship In the Layer embedding; For target entity The set of neighboring entities; For target entity The set of relation types corresponding to the neighborhood entity set; For each neighboring message, the relevance is determined. Then, neighborhood message embedding By merging the messages of the target entity itself, the initial target entity embedding is obtained. : in or ; For connection operation; For Hadamah accumulation; For target entity In the Layer embedding; Calculate the embedding of each target entity Embedded to query entity spatial distance , for the The target entities of the layer are spatially filtered, retaining a specific number. Spatial similar entities: Step 13: Training using difficult negative samples; after After layer message passing, a candidate entity set is obtained. The answer entity and the maximum The other target entities will be the first Layered answer entity embedding Input to scoring function middle: in This is the weight matrix; Log loss function is used during negative sample training: in For a difficult negative sample set; Step 2: Establish a joint modeling model of text and path information based on text semantic enhancement; the text information modeling model first adds the soft cues in the cue learning to semantic encoding, then adds the preprocessed path information to the predefined hard cues for path encoding, and performs joint training of semantic and path encoding; The process for establishing the text information modeling model is as follows: Step 21: Semantic feature learning; Semantic encoding is implemented through a dual semantic encoder, consisting of a head entity encoder and a relation encoder. He Tail Solid Encoder Head Entity-Relationship Encoder Encode the head entity, head entity description, relation, relation description, and soft hints; tail entity encoder. Encode the tail entity and its description; insert soft prompts for the entity before and after the input head entity. Insert soft hints about relationships before and after the input relationships. ;in R is the entity set; R is the relation set; The hidden state is extracted from the last layer of the semantic dual encoder using an average pooling strategy, and the semantic feature score is calculated using cosine similarity. As shown in the following formula: in For head entities; For relationship; Head Entity-Relationship Encoder The output header entities and embedded relationships; Tail-mounted physical encoder The tail entity of the output is embedded; Step 22: Path feature learning; The random walk algorithm is used to extract the relation path corresponding to each triple in the dataset, calculate and select the highly reliable path from the head entity to the tail entity; path encoding is implemented through a dual path encoder, consisting of a hard-completion canonical encoder. He Tail Solid Encoder Hard hints for encoder specifications Encode the head entity and the highly reliable path from the head entity to the tail entity, while utilizing a self-designed hard hint specification encoder. Input: in For head entity tags; For path labels; hard template Input to In the process, the average pooling strategy is used to extract the hidden state from the last layer of the path dual encoder, and then... Normalization yields head entity-path embedding ; Tail solid encoder of path dual encoder Tail entity encoder with semantic dual encoder Share all parameters and use spatial distance to calculate path feature scores. : in It is an L2 norm; Step 23, Joint Training Strategy: Semantic feature learning and path feature learning are combined into one training round. A self-supervised pre-trained language model is used to implement semantic feature learning and path feature learning, and then joint training is performed. in The loss function for semantic feature learning; This is a proportional parameter; The loss function is used for learning path features; the goal of joint training is to minimize the loss value of the joint loss function. Step 3: Integrate the different score distributions of the text information modeling model and the structural information modeling model, train the ensemble weights corresponding to the scores of the two models, and perform weighted summation and reordering of the scores to obtain the ensemble model; Step 4: After completing the ensemble model training in Step 3, use the model for actual knowledge graph link prediction tasks.

2. The knowledge graph link prediction method integrating multi-source information according to claim 1, characterized in that, The graph adjacency matrix reconstructed by decoding is the same as the original graph adjacency matrix. They should be as similar as possible; use the cross-entropy loss function during training. in The adjacency matrix of the original graph is the first... Line number The element value of the column (0 or 1); To reconstruct the corresponding element values ​​in the adjacency matrix.

3. The knowledge graph link prediction method integrating multi-source information according to claim 2, characterized in that, The semantic feature learning uses the InfoNCE loss function for path feature training. in For training set; After the first iteration of the training phase of the structural information modeling model, a negative sample set consisting of a set number of non-answer entities with the highest scores corresponding to each query triplet is generated. These are negative samples from the negative sample set. This is a temperature coefficient used to control the model's ability to distinguish negative samples; Maximum margin hinge loss function is used in path feature learning: in, It is a set of negative triples. This refers to the interval distance.

4. The knowledge graph link prediction method integrating multi-source information according to claim 3, characterized in that, Step 3 is as follows: Step 31: Preprocessing and feature extraction; use maximum-minimum normalization to normalize the scores. Linear mapping to the [0,1] interval yields the normalized score. : in It is a minimum value function; For any query triple The corresponding set of all positive and negative samples; It is a function for maximizing the value; In the diagram, i=1 represents the score of the structural information modeling model, and i=2 represents the score of the text information modeling model. Normalized scores are used for feature extraction to obtain the features corresponding to the two models. : in For any positive and negative triplet It is a mean function; For feature splicing operations; It is the variance function; Interaction features between the two models: Step 32: Integrate weight calculation and model training; combine the features corresponding to the two models respectively. Passed to multilayer perceptron Calculate the integrated weights : Calculate the integrated score : For any triplet score of the text information modeling model Each of these corresponds to a unique triplet score in the structural information modeling model. ; The ensemble model is trained using the maximum-interval hinge loss function: in The training set corresponding to the ensemble model; For the set of negative triples corresponding to the ensemble model, The set of negative samples corresponding to any query triple in the ensemble model; The interval distance; To query triples The integrated score of the corresponding positive triple; To query triples The integrated score of the corresponding negative triplet.

5. The knowledge graph link prediction method integrating multi-source information according to claim 4, characterized in that, Step 4 specifically involves: sorting the ensemble scores of each candidate triple after training and weighted summation of the ensemble model, and using the entity in the candidate triple with the highest score as the link prediction result.

6. The knowledge graph link prediction method integrating multi-source information according to claim 5, characterized in that, The resource allocation algorithm using relational constraints selects the three paths with the highest reliability as highly reliable paths.