Knowledge graph completion method and system based on multi-view comparative learning

Through the combination of multi-view comparison learning and graph convolution network, the generalization ability and recommendation accuracy of the knowledge graph completion system in the cold start stage is solved, and the completeness and balance of the graph is improved, and it is suitable for a variety of applications. Scene.

CN119312907AActive Publication Date: 2025-01-14NANJING UNIV OF POSTS & TELECOMM

Patent Information

Application Number
CN202411356982.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-01-14
Estimated Expiration
2044-09-27

AI Technical Summary

Technical Problem

The knowledge graph completion system is difficult to obtain timely and effective user feedback during the cold start stage, resulting in limited model generalization ability and recommendation accuracy. The negative sampling deviation problem leads to uneven exposure of new entities or relationships, affecting the completeness and balance of the graph. sex.

Method used

Using a method based on multi-view comparison learning, through data cleaning, graph enhancement, multi-view mask encoding and low-dimensional vector mapping, the total loss function is constructed and the knowledge graph completion model is trained, and the graph completion is used to use the decoder to perform graph completion, combined with the graph volume Accumulate networks and self-supervised learning to improve model prediction accuracy and generalization capabilities.

Benefits of technology

It improves the completeness and balance of the knowledge graph, improves the prediction accuracy and generalization capabilities of the model, enhances the overall performance and robustness of the system, and is suitable for a variety of application scenarios such as search engines and intelligent question-and-answer systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119312907A_ABST
    Figure CN119312907A_ABST
Patent Text Reader

Abstract

The invention relates to a knowledge graph completion method and system based on multi-view comparative learning, and relates to the technical field of artificial intelligence. The method comprises the following steps: receiving original knowledge graph data, and carrying out data cleaning and standardization processing, graph enhancement processing, multi-view mask coding and mask processing and low-dimensional vector mapping and feature regularization processing on the original knowledge graph data; constructing a total loss function of the model, and performing model training and optimization according to the total loss function to obtain a knowledge graph completion model; and calling the knowledge graph completion model, and performing knowledge graph completion by using a decoder. According to the method, the completeness and balance of the atlas can be perfected, the prediction precision and generalization ability of the model are improved, and the overall performance and robustness of the whole system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of artificial intelligence technology, and in particular relates to a knowledge graph completion method and system based on multi-view comparative learning. Background Art

[0002] With the advent of the big data era, knowledge graphs, as an important form of data organization, have been widely used in search engines, intelligent question-answering systems, recommendation systems and other fields. However, in the process of constructing knowledge graphs, due to the diversity and complexity of data sources, there is often a large amount of missing information, which is the so-called "knowledge graph completion" problem. In recent years, research on this issue has gradually emerged and has achieved certain research results, but there are still the following challenges: On the one hand, in the cold start phase, due to the lack of interaction data of new entities or new relationships, the knowledge graph completion system often cannot obtain timely and effective user feedback to form a closed-loop optimization. This means that it is difficult for the model to correct and improve the prediction results according to the actual user behavior, which may lead to limited generalization ability and recommendation accuracy of the model. On the other hand, the negative sampling bias problem is manifested in that when constructing and training the knowledge graph completion model, unobserved relationships are usually used as negative samples. However, in the cold start scenario, this approach is likely to cause the model to misjudge "cold" entities or newly generated relationships, leading to further aggravation of the tendency of popular entities and relationships, which is not conducive to the exposure and recommendation of new entities or relationships, and affects the completeness and balance of the overall graph. Summary of the invention

[0003] The main purpose of the present invention is to overcome the shortcomings and deficiencies of the prior art and to provide a knowledge graph completion method and system based on multi-view comparative learning, which can improve the completeness and balance of the graph, enhance the prediction accuracy and generalization ability of the model, and improve the overall performance and robustness of the entire system.

[0004] According to one aspect of the present invention, the present invention provides a knowledge graph completion method based on multi-view contrast learning, the method comprising the following steps:

[0005] S1: receiving original knowledge graph data, performing data cleaning and standardization processing, graph enhancement processing, multi-view mask encoding and mask processing, and low-dimensional vector mapping and feature regularization processing on the original knowledge graph data;

[0006] S2: construct a total loss function of the model, perform model training and optimization according to the total loss function, and obtain a knowledge graph completion model;

[0007] S3: Call the knowledge graph completion model and use the decoder to complete the knowledge graph.

[0008] Preferably, the data cleaning and standardization process includes:

[0009] De-duplicate, detect and correct errors in the knowledge graph data in the dataset containing entities, relationships and the connection information between the two to ensure the accuracy of entities and relationships, and standardize the naming of entities and the types of relationships.

[0010] Preferably, the image enhancement processing includes:

[0011] Image enhancement processing is performed through three graph enhancement strategies to obtain enhanced graphs of three different perspectives; the three graph enhancement strategies are: node discarding processing, feature noise injection processing and subgraph sampling processing; among them, in the node discarding processing, some nodes and their connecting edges are randomly deleted, and the deletion ratio is automatically adjusted according to the number of relationships in the graph; in the feature noise adding processing, different degrees of noise are added to the relationship features and entity features of the nodes; in the subgraph sampling processing, a partially connected subgraph is selected from the original graph, and neighbor nodes are selected to join the subgraph according to a preset priority sampling strategy until a predetermined subgraph size is reached.

[0012] Preferably, the multi-view mask encoding and mask processing comprises:

[0013] A masked graph autoencoder MaskedGAE is applied to each independent view to extract a high-dimensional feature vector representation, and the propagation rules of the node are updated by applying a path-by-bit random masking strategy.

[0014] Preferably, the low-dimensional vector mapping and feature regularization processing includes:

[0015] The output of the final layer of the encoder is converted into a low-dimensional vector through a projection layer, feature compression and regularization are implemented, and nonlinear transformation is performed using activation functions and cropping functions to convert the output of the final layer into a low-dimensional vector space.

[0016] Preferably, the total loss function of the constructed model includes:

[0017] Independent contrast loss functions are defined for the three enhanced views to maximize the similarity between positive sample pairs and minimize the similarity between negative sample pairs; the three contrast loss functions are combined by weighted summation to obtain a total adversarial loss function; based on the difference between the actual label and the predicted probability, a cross-entropy loss function for the relationship prediction task is constructed, and the adversarial loss function is balanced with the cross-entropy loss function of the prediction task using hyperparameters to obtain a total loss function.

[0018] Preferably, the model training and optimization are performed according to the total loss function to obtain the knowledge graph completion model, including:

[0019] Automatic differentiation is used to calculate the gradient of the total loss function with respect to the model parameters, and the Adam optimization algorithm is used to adjust the model parameters according to the gradient and the current learning rate to achieve adaptive parameter update; the model performance is evaluated using the validation set, and the model training is stopped when the model performance meets the preset conditions to obtain the knowledge graph completion model.

[0020] Preferably, calling the knowledge graph completion model and using a decoder to complete the knowledge graph includes:

[0021] The structural decoder in the MaskedGAE decoder is used to restore the topological structure of the graph, and the interaction between node embeddings is used to predict the existence probability of edges. The degree decoder in the MaskedGAE decoder is used to predict the degree of the node through a regression method to supplement the graph structure information, and all the predicted newly added triple data are integrated back into the original knowledge graph to complete the original knowledge graph.

[0022] Preferably, the method of completing the knowledge graph using a decoder includes:

[0023] The MaskedGAE decoder is constructed by the structure decoder and the degree decoder; the structure decoder directly calculates the inner product of the two node embedding vectors and converts it into the edge probability through the Sigmoid function:

[0024]

[0025] z i 、z j represents the embedding vector of two nodes, and T represents transposition;

[0026] The degree decoder uses the Soffmax function to output a discrete distribution, which represents the probability distribution of different values ​​of the degree of node v:

[0027] g φ (z v )=Softmax(MLP(z v ))

[0028] Among them, z v is the encoding vector of node v, and MLP represents multi-layer perceptron.

[0029] According to another aspect of the present invention, the present invention also provides a knowledge graph completion system based on multi-view contrast learning, the system comprising:

[0030] A processing module, used to receive original knowledge graph data, and perform data cleaning and standardization processing, graph enhancement processing, multi-view mask encoding and mask processing, and low-dimensional vector mapping and feature regularization processing on the original knowledge graph data;

[0031] A training module is used to construct a total loss function of the model, perform model training and optimization according to the total loss function, and obtain a knowledge graph completion model;

[0032] The completion module is used to call the knowledge graph completion model and use the decoder to complete the knowledge graph.

[0033] Beneficial effects: The knowledge graph completion method and system based on multi-view contrastive learning proposed in the present invention combines the ideas of graph convolutional network (GCN) and multi-view contrastive learning. By improving the existing knowledge graph completion model through multi-view contrastive learning, the prediction accuracy and generalization ability of the model can be further improved, thereby improving the overall performance and robustness of the entire system. This method combines the ideas of deep learning and graph neural networks, combines graph convolutional networks with self-supervised learning, and realizes effective prediction of missing information. The present invention can be extended to a variety of practical application scenarios, such as search engines, intelligent question-answering systems, etc., thereby promoting the widespread application and development of knowledge graph technology.

[0034] The features and advantages of the present invention will become clear through reference to the following drawings and detailed description of specific embodiments of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 This is a flow chart of the knowledge graph completion method based on multi-view comparative learning;

[0036] Figure 2 This is an operation flow chart of the knowledge graph completion method based on multi-view comparative learning;

[0037] Figure 3 This is a schematic diagram of the structure of the knowledge graph completion system based on multi-view comparative learning. DETAILED DESCRIPTION

[0038] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0039] Example 1

[0040] Figure 1 This is a flow chart of the knowledge graph completion method based on multi-view contrast learning. Figure 1 and Figure 2 This embodiment provides a knowledge graph completion method based on multi-view contrast learning, and the method includes the following steps:

[0041] S1: receiving original knowledge graph data, performing data cleaning and standardization processing, graph enhancement processing, multi-view mask encoding and mask processing, and low-dimensional vector mapping and feature regularization processing on the original knowledge graph data;

[0042] S2: construct a total loss function of the model, perform model training and optimization according to the total loss function, and obtain a knowledge graph completion model;

[0043] S3: Call the knowledge graph completion model and use the decoder to complete the knowledge graph.

[0044] This method can improve the completeness and balance of the graph, enhance the prediction accuracy and generalization ability of the model, and improve the overall performance and robustness of the entire system.

[0045] Preferably, the data cleaning and standardization process includes:

[0046] De-duplicate, detect and correct errors in the knowledge graph data in the dataset containing entities, relationships and the connection information between the two to ensure the accuracy of entities and relationships, and standardize the naming of entities and the types of relationships.

[0047] Specifically, the important terms and constraints of this embodiment are as follows:

[0048] Graph enhancement: mainly through the enhancement of graph structure data, creating richer and more expressive graph representations to improve the performance of graph neural networks (GNNs) or other graph-based learning algorithms. Graph enhancement includes multiple strategies such as adding edges, node feature enhancement, and subgraph sampling. Its focus is on how to construct or transform the graph so that the structure and feature information of the graph are more conducive to the learning of downstream tasks. This enhancement may be rule-based or learned.

[0049] Masked Graph Autoencoder (MaskedGAE): Masked Graph Autoencoder (MaskGAE) is a graph neural network (GNN) architecture that combines the idea of ​​autoencoders and masking mechanisms to process graph data. The core concept of MaskGAE is to introduce masks in the graph autoencoding task as a self-supervised learning strategy to improve the model's representation ability on graph structured data. Unlike traditional graph autoencoders, MaskGAE introduces masks in the input graph and randomly selects a portion of nodes or edges for "hiding" or "masking". This means that the encoder can only learn the global graph representation based on partially observable graph structures, while the decoder's task is to predict or reconstruct the structure of the entire graph or the masked part based on this limited information.

[0050] Contrastive Learning: Contrastive Learning is a machine learning method that is particularly suitable for unsupervised or self-supervised learning scenarios. Its core idea is to learn how to distinguish different samples in a high-dimensional feature space by comparing data samples (usually in pairs), thereby learning useful representations of the data. This method does not rely on traditional label information, but instead uses the structure and similarity of the data itself. In contrastive learning, the loss function is calculated, that is, the similarity between positive pairs is calculated and maximized, while the similarity between negative pairs is minimized. This process ensures that the feature representation learned by the model can make similar samples close in the feature space, while different samples are far away.

[0051] Automatic differentiation: A technique for automatically calculating the derivative of a function with respect to its variables. Automatic differentiation (AD), also known as automatic derivation, is a technique that uses computer algorithms to efficiently and accurately calculate the derivative of a differentiable function at a certain point. This technique is widely used in scientific computing, engineering problems, economics, as well as machine learning and deep learning, especially in situations where gradient information is needed for optimization, such as minimizing the loss function.

[0052] Adam optimizer: Adam optimizer (Adaptive Moment Estimation) is an efficient gradient descent algorithm widely used in deep learning and other machine learning fields. It can effectively combine the advantages of momentum gradient descent and adaptive learning rate.

[0053] In this step, the original knowledge graph data is received. The data set contains entities, relationships and the connection information between them. Therefore, the original graph can be represented as G = (V, E), where V is the node set and E is the edge set. Each node v∈V has a feature vector De-duplicate, detect and correct errors in the knowledge graph data to ensure the accuracy of entities and relationships. At the same time, standardize entity naming and relationship types for unified processing.

[0054] Preferably, the image enhancement processing includes:

[0055] Image enhancement processing is performed through three graph enhancement strategies to obtain enhanced graphs of three different perspectives; the three graph enhancement strategies are: node discarding processing, feature noise injection processing and subgraph sampling processing; among them, in the node discarding processing, some nodes and their connecting edges are randomly deleted, and the deletion ratio is automatically adjusted according to the number of relationships in the graph; in the feature noise adding processing, different degrees of noise are added to the relationship features and entity features of the nodes; in the subgraph sampling processing, a partially connected subgraph is selected from the original graph, and neighbor nodes are selected to join the subgraph according to a preset priority sampling strategy until a predetermined subgraph size is reached.

[0056] Specifically, the sorted graph data is enhanced. This model proposes a fusion method that integrates three graph enhancement strategies: node discarding, feature noise injection, and subgraph sampling. Node discarding will randomly remove some nodes and their connecting edges to simulate incomplete information, and automatically adjust the deletion ratio according to the number of relationships in the graph; feature noise addition adds random changes to the node features, especially adding a small amount of noise to the relationship features to ensure clear relationships, but adding more noise to entity features; subgraph sampling selects a part of the connected subgraphs from the original graph, focusing on protecting those edges with important or rare relationships. After this series of enhancement steps, three enhanced graphs from different angles are obtained, providing a rich multi-angle view of the original knowledge graph. After graph enhancement processing, three enhanced graphs from different perspectives are obtained.

[0057] The processed data is subjected to graph enhancement. This model uses graph enhancement strategies such as node dropping, feature noise injection, and subgraph sampling to create graph representations from multiple different perspectives. This model integrates three strategies through a new method: node dropping, feature noise injection, and subgraph sampling. While enhancing the relationship, it creates a graph description from multiple perspectives. The details are as follows:

[0058] Node discarding: traverse the entire knowledge graph and count the number of occurrences of each relationship type r freq(r);

[0059] A threshold T is set to divide rare relations and common relations. It is set to the median of the relation frequency distribution, and relations below the median are regarded as rare relations.

[0060] For each relationship type ro, different discard ratios are determined based on whether it is rare or not. The discard ratio of common relations is defined as Drop ratio of rare relations Usually the discard ratio should be set lower than the common relationship, that is;

[0061]

[0062] For each node v, the set of relations it participates in Rv , for R v For each relationship r in, according to the discard ratio To decide whether to discard node v and its related edges.

[0063] Retention probability

[0064] Feature noise injection processing: Identify which node features represent entity attributes and which represent relationship features. For entity features, add a larger scale of Gaussian noise where σ e is the standard deviation with a larger value. For the relationship features, add a small amount of noise Ensure a small standard deviation σ r <σ e , to preserve the clarity of the relationship, we get:

[0065] Entity characteristic noise: Among them, x e represents the original relation feature vector, x e ′ represents the original relation feature vector x e The new vector after adding noise is e Represents the noise term added to the relation feature vector.

[0066] Relation feature noise: Among them, x e represents the original relation feature vector, x e ′ represents the original relation feature vector x e The new vector after adding noise is e Represents the noise term added to the relation feature vector.

[0067] Subgraph sampling processing: Apply the PageRank algorithm to calculate the PageRank value PR of each node i =1 / N, where N is the total number of nodes in the graph. Update the PageRank value of each node according to the PageRank iterative formula until convergence or the maximum number of iterations is reached:

[0068]

[0069] Where d is the damping factor, N(i) is the set of neighbor nodes of node i, and L(j) is the out-degree of node j.

[0070] Select the top m nodes from all nodes sorted from high to low PageRank values ​​as seed nodes, where m is determined based on the proportion of the required subgraph size. Add all seed nodes and their directly connected edges to the subgraph, and use the degree-first sampling strategy to select their neighbor nodes to join the subgraph until the predetermined subgraph size is reached.

[0071] Preferably, the multi-view mask encoding and mask processing comprises:

[0072] A masked graph autoencoder MaskedGAE is applied to each independent view to extract a high-dimensional feature vector representation, and the propagation rules of the node are updated by applying a path-by-bit random masking strategy.

[0073] Specifically, MaskedGAE is applied to each independent view for encoding, and a high-dimensional feature vector representation is extracted. This step uses a masking strategy to mask the attributes of some edges and nodes on the graph data before inputting into GAE, simulating the situation where the relationship information in the graph data is incomplete, and transforming the graph of each view into a partially observable scenario. On this basis, MaskedGAE strives to capture and reconstruct the key features of the original graph and update the node representation, considering the influence of masked neighbor nodes, and applying the propagation rules of the path-wise random masking strategy to update the nodes.

[0074] First, it is necessary to "hide" some edge or node attributes in the graph data according to the set masking strategy path-wise random masking (Path-wise Random Masking).

[0075] Assume that the probability transfer matrix of random walk is P, and for each step t, the transition probability from node i to node j is P ij .

[0076] For each root node r, perform n walk independent first-order or second-order Markov chain random walks, each of which has a length of l walk Steps can be written as:

[0077]

[0078] Construct the masked edge set E mask :

[0079]

[0080] During the propagation process, the neighbor node set needs to be adjusted accordingly, and only the unmasked neighbor nodes and their corresponding edges are considered.

[0081] The propagation rule of each layer of the graph neural network can be expressed by the following formula:

[0082]

[0083] in, is the hidden state of node v in layer l, W l is the weight matrix of this layer, N(v) represents the neighbor set of node v, C uv is the normalization coefficient (such as the inverse of the degree matrix), σ is the nonlinear activation function, and b l is the bias term of the lth layer.

[0084] Therefore, the hidden state update of node v at the l+1th layer after applying the mask strategy can be modified as follows:

[0085]

[0086] Among them, N M (v) represents the actual neighbor set of node v after applying the masking strategy, which includes those neighbor nodes that are not masked during the random walk.

[0087] Preferably, the low-dimensional vector mapping and feature regularization processing includes:

[0088] The output of the final layer of the encoder is converted into a low-dimensional vector through a projection layer, feature compression and regularization are implemented, and nonlinear transformation is performed using activation functions and cropping functions to convert the output of the final layer into a low-dimensional vector space.

[0089] Specifically, the final output of the encoder is converted into a low-dimensional vector z through the projection layer v , implement feature compression and regularization, and use ReLU activation function and clip function for nonlinear transformation to convert the final layer output into a low-dimensional vector space.

[0090] Map the output of the last layer of GCN encoder to a low-dimensional vector space:

[0091]

[0092] Where L represents the number of GCN layers, and Project(·) is a dimensionality reduction operation of a fully connected layer. Mapping to a low-dimensional vector space and achieving certain feature compression and regularization, the projection layer (Projector) takes the following form:

[0093]

[0094] Among them, W project is a weight matrix used to transform high-dimensional Mapping to low-dimensional space; b project is the bias term; norm(·, p) represents the norm normalization operation, where L is used p The norm is used to perform feature scaling; the max(·,∈) operation is optional and is used to ensure that the projected vector value is not too small (close to zero).

[0095] In order to limit the excessively high results, the activation function ReLU is added to limit the maximum value of the output. The norm normalization is combined to ensure non-negativity and limit the maximum value at the same time. Therefore, the norm normalization is performed before using ReLU and the maximum and minimum limits are applied. The clipping function is used to project z v To process:

[0096]

[0097] Among them, the clip(x, l0wer, upper) function is defined as:

[0098]

[0099] Therefore, the clip(., ∈, C) operation limits the output range to between ∈ and C, where ∈ is the minimum lower limit and C is the maximum upper limit, which is used to directly "discard" or limit the data that is too high. The projection result z is obtained through processing. v .

[0100] Preferably, the total loss function of the constructed model includes:

[0101] Independent contrast loss functions are defined for the three enhanced views to maximize the similarity between positive sample pairs and minimize the similarity between negative sample pairs; the three contrast loss functions are combined by weighted summation to obtain a total adversarial loss function; based on the difference between the actual label and the predicted probability, a cross-entropy loss function for the relationship prediction task is constructed, and the adversarial loss function is balanced with the cross-entropy loss function of the prediction task using hyperparameters to obtain a total loss function.

[0102] Specifically, the loss form adopted by this model is:

[0103]

[0104] where z v is the projection representation of the target node, represents a positive sample, is the set of negative samples, is the representation of the negative sample node, and τ is the temperature parameter.

[0105] Since the model has contrastive losses for multiple views, we define independent adversarial losses for each dimension and finally combine them to get the total adversarial loss. For these three dimensions, denoted as A, B and C, the corresponding projection representations are Know The positive sample is represented as and The negative sample set is and The negative sample nodes in each set represent Know

[0106] At this time, the adversarial losses in the three dimensions can be defined as follows:

[0107]

[0108] Then, the total adversarial loss can be combined by weighted summation or simple addition of the losses in each dimension:

[0109]

[0110] where λ A ,λ B and λ C It is the weight factor of the corresponding dimension, which is used to balance the importance of losses in different dimensions.

[0111] By completing the relationship between nodes, we construct the prediction task loss and calculate the cross entropy loss of the relationship completion task:

[0112]

[0113] Where (i, j) represents a pair of nodes in the graph, and V is the set of all considered relationship pairs. ij Represents the true label of this pair of nodes. If it is a binary variable, then y ij =1 means there is a relationship between node i and node j, y ij =0 means there is no relationship. ij is the probability that the model predicts that there is a relationship between node i and node j, ranging from 0 to 1.

[0114] The total loss includes the total adversarial loss and the prediction task loss. The weights of the encoder are updated through back-propagation, and the parameter λ is used to balance the hyperparameters of the weights of the two loss terms:

[0115]

[0116] Preferably, the model training and optimization are performed according to the total loss function to obtain the knowledge graph completion model, including:

[0117] Automatic differentiation is used to calculate the gradient of the total loss function with respect to the model parameters, and the Adam optimization algorithm is used to adjust the model parameters according to the gradient and the current learning rate to achieve adaptive parameter update: the model performance is evaluated using the validation set, and the model training is stopped when the model performance meets the preset conditions to obtain the knowledge graph completion model.

[0118] Specifically, automatic differentiation is used to calculate the gradient of the total loss with respect to the model parameters, and the Adam optimization algorithm is used to adjust the model parameters according to the gradient and the current learning rate to achieve efficient and adaptive parameter updates. Back propagation is performed based on the calculated total loss function to update the network parameters. At the end of each cycle, the validation set is used to evaluate the model performance, and the performance indicators (accuracy) on the validation set are monitored. When the indicators are no longer significantly improved, training is stopped.

[0119] When performing backpropagation, automatic differentiation is used to calculate the total loss L with respect to all trainable parameters (mainly the encoder weights W enc and possible decoder weights W dec The gradient of Where W represents the set of all parameters, and uses the Adam (Adaptive Moment Estimation) optimization algorithm to adaptively adjust the parameter weights, and update the model parameters according to the calculated gradient and the current learning rate. η is the learning rate.

[0120] Based on the calculated total loss function, back propagation is performed to update the network parameters. At the end of each cycle, the validation set is used to evaluate the model performance to ensure the generalization of the model. The performance indicators (accuracy) on the validation set are monitored, and training is stopped when the indicators no longer improve significantly, so that the model gradually learns to distinguish between positive and negative examples, optimizes the quality of feature representation, and obtains a trained MaskedGAE model.

[0121] The trained MaskedGAE model is used to process the test set. Specifically, the data in the test set is input into the model, especially with the help of the MaskedGAE decoder, which is responsible for predicting and generating missing entity-relation pairs based on the patterns and rules learned by the model. This process is equivalent to using the model to fill in the blank links in the knowledge graph, thereby generating a more complete and information-rich version of the knowledge graph than the original test set. Through this step, the model's ability to complete the knowledge graph on unknown data is effectively evaluated, and the effect of the model completing the knowledge graph is intuitively observed.

[0122] Preferably, calling the knowledge graph completion model and using a decoder to complete the knowledge graph includes:

[0123] The topological structure of the graph is restored through the structural decoder in the MaskedGAE decoder, and the interaction between node embeddings is used to predict the existence probability of edges. The degree decoder in the MaskedGAE decoder is used to predict the degree of the node through a regression method to supplement the graph structure information, and all the predicted newly added triple data are integrated back into the original knowledge graph to complete the original knowledge graph.

[0124] Preferably, the method of completing the knowledge graph using a decoder includes:

[0125] The MaskedGAE decoder is constructed by the structure decoder and the degree decoder; the structure decoder directly calculates the inner product of the two node embedding vectors and converts it into the edge probability through the Sigmoid function:

[0126]

[0127] z i 、z j represents the embedding vector of two nodes, and T represents transposition;

[0128] The degree decoder uses the Softmax function to output a discrete distribution, which represents the probability distribution of different values ​​of the degree of node v:

[0129] g φ (z v )=Softmax(MLP(z v ))

[0130] Among them, z v is the encoding vector of node v, and MLP represents multi-layer perceptron.

[0131] Specifically, the decoder of MaskedGAE is constructed by a structure decoder (StructureDecoder) and a degree decoder (DegreeDecoder).

[0132] The structure decoder uses the direct inner product plus Sigmoid function:

[0133]

[0134] This form directly calculates the inner product of the embedding vectors of two nodes and converts it into edge probability through the Sigmoid function.

[0135] The degree decoder (DegreeDecoder) takes the following form:

[0136] g φ (z v )=Softmax(MLP(zv ))

[0137] Among them, z v is the encoding vector of node v. After extracting features through a multi-layer perceptron (MLP), a Softmax function is used to output a discrete distribution, which represents the probability distribution of different values ​​of the degree of node v. However, in this model, considering that the degree is often a numerical value rather than a category, a regression form is also used:

[0138]

[0139] Among them is the predicted degree of node v, obtained by processing the node embedding through MLP and then passing it through a linear layer plus the bias term b.

[0140] Through the decoder, a list of candidate entities is generated based on their proximity or other complex patterns in the embedding space to construct new triple entities. All the predicted new triples are integrated back into the original knowledge graph, and these prediction results are evaluated through the validation set or independent test set to complete the original knowledge graph.

[0141] The knowledge graph completion method based on multi-view contrastive learning proposed in this embodiment combines the ideas of graph convolutional network (GCN) and multi-view contrastive learning. By improving the existing knowledge graph completion model through multi-view contrastive learning, the prediction accuracy and generalization ability of the model can be further improved, thereby improving the overall performance and robustness of the entire system. This method combines the ideas of deep learning and graph neural network, combines graph convolutional network with self-supervised learning, and realizes the effective prediction of missing information. The method of this embodiment can be extended to a variety of practical application scenarios, such as search engines, intelligent question-answering systems, etc., thereby promoting the widespread application and development of knowledge graph technology.

[0142] Example 2

[0143] Figure 3 This is a schematic diagram of the knowledge graph completion system based on multi-view comparative learning. Figure 3 As shown, this embodiment provides a knowledge graph completion system based on multi-view contrast learning, and the system includes:

[0144] The processing module 301 is used to receive the original knowledge graph data, and perform data cleaning and standardization processing, graph enhancement processing, multi-view mask encoding and mask processing, and low-dimensional vector mapping and feature regularization processing on the original knowledge graph data;

[0145] A training module 302 is used to construct a total loss function of the model, perform model training and optimization according to the total loss function, and obtain a knowledge graph completion model;

[0146] The completion module 303 is used to call the knowledge graph completion model and use the decoder to complete the knowledge graph.

[0147] The specific implementation process of the functions realized by each module in this embodiment 2 is the same as the implementation process in embodiment 1, and will not be repeated here.

[0148] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. All equivalent structural changes made by using the contents of the present invention specification and drawings under the concept of the present invention, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present invention.

Claims

1. A knowledge graph completion method based on multi-view contrastive learning, characterized in that: The method comprises the following steps: S1: receiving original knowledge graph data, performing data cleaning and standardization processing, graph enhancement processing, multi-view mask encoding and mask processing, and low-dimensional vector mapping and feature regularization processing on the original knowledge graph data; S2: construct a total loss function of the model, perform model training and optimization according to the total loss function, and obtain a knowledge graph completion model; S3: Call the knowledge graph completion model and use the decoder to complete the knowledge graph.

2. The method according to claim 1, characterized in that The data cleaning and standardization processing includes: De-duplicate, detect and correct errors in the knowledge graph data in the dataset containing entities, relationships and the connection information between the two to ensure the accuracy of entities and relationships, and standardize the naming of entities and the types of relationships.

3. The method according to claim 1, characterized in that: The image enhancement process includes: Image enhancement processing is performed through three graph enhancement strategies to obtain enhanced graphs of three different perspectives; the three graph enhancement strategies are: node discarding processing, feature noise injection processing and subgraph sampling processing; among them, in the node discarding processing, some nodes and their connecting edges are randomly deleted, and the deletion ratio is automatically adjusted according to the number of relationships in the graph; in the feature noise adding processing, different degrees of noise are added to the relationship features and entity features of the nodes; in the subgraph sampling processing, a partially connected subgraph is selected from the original graph, and neighbor nodes are selected to join the subgraph according to a preset priority sampling strategy until a predetermined subgraph size is reached.

4. The method according to claim 1, characterized in that: The multi-view mask encoding and mask processing includes: A masked graph autoencoder MaskedGAE is applied to each independent view to extract a high-dimensional feature vector representation, and the propagation rules of the node are updated by applying a path-by-bit random masking strategy.

5. The method according to claim 1, characterized in that The low-dimensional vector mapping and feature regularization processing include: The output of the final layer of the encoder is converted into a low-dimensional vector through a projection layer, feature compression and regularization are implemented, and nonlinear transformation is performed using activation functions and cropping functions to convert the output of the final layer into a low-dimensional vector space.

6. The method according to claim 1, characterized in that The total loss function of the constructed model includes: Independent contrast loss functions are defined for the three enhanced views to maximize the similarity between positive sample pairs and minimize the similarity between negative sample pairs; the three contrast loss functions are combined by weighted summation to obtain a total adversarial loss function; based on the difference between the actual label and the predicted probability, a cross-entropy loss function for the relationship prediction task is constructed, and the adversarial loss function is balanced with the cross-entropy loss function of the prediction task using hyperparameters to obtain a total loss function.

7. The method according to claim 6, characterized in that The model training and optimization are performed according to the total loss function to obtain the knowledge graph completion model, which includes: Automatic differentiation is used to calculate the gradient of the total loss function with respect to the model parameters, and the Adam optimization algorithm is used to adjust the model parameters according to the gradient and the current learning rate to achieve adaptive parameter update; the model performance is evaluated using the validation set, and the model training is stopped when the model performance meets the preset conditions to obtain the knowledge graph completion model.

8. The method according to claim 7, characterized in that The calling of the knowledge graph completion model and using the decoder to complete the knowledge graph includes: The structural decoder in the MaskedGAE decoder is used to restore the topological structure of the graph, and the interaction between node embeddings is used to predict the existence probability of edges. The degree decoder in the MaskedGAE decoder is used to predict the degree of the node through a regression method to supplement the graph structure information, and all the predicted newly added triple data are integrated back into the original knowledge graph to complete the original knowledge graph.

9. The method according to claim 8, characterized in that The use of a decoder to complete the knowledge graph includes: The MaskedGAE decoder is constructed by the structure decoder and the degree decoder; the structure decoder directly calculates the inner product of the two node embedding vectors and converts it into the edge probability through the Sigmoid function: z i 、z j represents the embedding vector of two nodes, and T represents transposition; The degree decoder uses the Softmax function to output a discrete distribution, which represents the probability distribution of different values ​​of the degree of node v: g φ (With v )=Softmax(MLP(z v )) Among them, z v is the encoding vector of node v, and MLP represents multi-layer perceptron.

10. A knowledge graph completion system based on multi-view contrastive learning, characterized in that: The system comprises: A processing module, used to receive original knowledge graph data, and perform data cleaning and standardization processing, graph enhancement processing, multi-view mask encoding and mask processing, and low-dimensional vector mapping and feature regularization processing on the original knowledge graph data; A training module is used to construct a total loss function of the model, and to perform model training and optimization according to the total loss function to obtain a knowledge graph completion model; The completion module is used to call the knowledge graph completion model and use the decoder to complete the knowledge graph.

Citation Information

Patent Citations

  • Systems and methods for determining regions of interest in histology images

    CA3203464A1

  • Knowledge graph embedding method based on graph convolution contrast learning and XLNet

    CN115936115A

  • Graph comparison recommendation method based on knowledge graph

    CN117892815A

  • Knowledge graph structure optimization method based on graph contrast learning in self-supervised scene

    CN118210929A

  • Data processing system, method and apparatus, and device, storage medium, computer program and computer program product

    WO2023077819A1

Cited By

  • Drainage basin pollution discharge transaction knowledge reasoning method based on TransE and Compgcn

    CN120409701A

  • Graph compression method and device for automobile service information knowledge graph

    CN121188215A

  • Wireless data completion and prediction method, device, equipment, medium and product

    CN122262508A