Knowledge graph entity alignment method, system and device based on graph neural network
By adopting a graph neural network-based method in entity alignment, using global and local information embedding methods and negative sampling technology, the problems of low alignment accuracy and inefficiency in training in the prior art are solved, and more efficient and more accurate entity alignment is achieved.
Patent Information
- Application Number
- CN202210942556.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-08
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2042-08-08
AI Technical Summary
The existing entity alignment methods have problems such as information occlusion, inefficiency in training and insufficient interaction capabilities during the embedding process, resulting in low alignment accuracy and too few potentially aligned entities.
The graph neural network-based method is adopted to build the adjacency matrix and degree matrix of the graph, obtain the initial embedding vector of the entity, and use the global information distribution migration method and targeted negative sampling of local information to calculate the distribution matching loss function and triplet loss function, and update the weight parameters of the graph neural network model until the preset conditions are met.
By narrowing the subspace of the entity distribution, the number of potentially aligned entities can be increased and the alignment accuracy is improved; targeted negative sampling is used to improve network distinction capabilities and improve training efficiency; make full use of interactive information between maps to ensure the overall optimality of the alignment results.
Smart Images

Figure CN115271071B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of data processing technology, and in particular to a knowledge graph entity alignment method, system and device based on graph neural network. Background Art
[0002] At present, in order to efficiently and reasonably process and analyze data and obtain valuable knowledge, knowledge graph technology is widely used in various fields. Knowledge graph is a structured semantic knowledge base used to describe concepts and relationships in the physical world. Its technology is also an important research topic in the field of artificial intelligence. In the process of constructing a huge knowledge graph, due to the multi-source and heterogeneous nature of knowledge, it is inevitable that there will be redundant and repeated knowledge, so corresponding knowledge ablation is required.
[0003] As a way of knowledge ablation, entity alignment (EA) technology obtains the structural information and attribute information of entities from knowledge graphs from different sources, and finds entity pairs that express the same meaning between different knowledge graphs through information processing, so as to serve the subsequent redundant knowledge elimination and knowledge supplementation. In recent years, entity alignment technology has focused on using knowledge embedding methods to achieve alignment. Researchers use graph neural network models to embed knowledge into entities in knowledge graphs, use aligned entity pairs as links, embed entities from different knowledge graphs into a unified low-dimensional real-valued space, and perform minimum distance matching on target entities based on the distance measurement of entities in space. The smaller the distance, the more it will be considered as a potential alignable entity.
[0004] At present, this mainstream entity alignment method still has the following defects: 1) Information occlusion between graphs during the embedding process leads to separation of distribution subspaces, too few potential alignable entities, and is not conducive to subsequent alignment. 2) Inefficient training caused by uniform negative sampling during the embedding process. 3) The minimum distance matching method has weak interaction ability between graphs during the alignment process.
[0005] It can be seen that there is an urgent need for a knowledge graph entity alignment method based on graph neural networks based on global / local information embedding and overall entity matching. Summary of the invention
[0006] In view of this, the embodiments of the present disclosure provide a knowledge graph entity alignment method, system and device based on graph neural network, which at least partially solve the problems of inefficient training process, low alignment accuracy and poor interactivity in the prior art.
[0007] In a first aspect, an embodiment of the present disclosure provides a knowledge graph entity alignment method based on a graph neural network, comprising:
[0008] Step 1: Data preparation, obtaining target information from two graphs with different sources, where the target information includes relationship triples, attribute triples, entity information, relationship type information, and aligned entity pairs;
[0009] Step 2: Data preprocessing: construct the adjacency matrix and degree matrix of each graph, obtain the initial embedding vector of each entity based on the attribute triples and entity information, and use the aligned entity pairs as training data, i.e., the positive sample set S;
[0010] Step 3: Build a graph neural network model, randomly initialize the weight parameters of the graph neural network model, and multiply it with the adjacency matrix;
[0011] Step 4: network forward operation, input the initial embedding vector of the entity into the graph neural network model, perform forward operation, and obtain the output embedding vector;
[0012] Step 5: The distribution migration method that integrates global information builds the actual distribution matrix between all entities based on the embedding vector output in step 4, and calculates the distribution matching loss function that integrates global distribution information.
[0013] Step 6: Targeted negative sampling integrating local information: Based on each entity pair in the positive sample set S, multiple error samples are selected to construct the set S′ of all negative samples, and the triplet loss function integrating local information is calculated.
[0014] Step 7: Back propagate and update the network weight parameters according to the values obtained in steps 5 and 6. and Weighted addition to obtain the joint loss function The stochastic gradient descent algorithm that minimizes the joint loss function is used to update the weight parameters of the graph neural network model;
[0015] Step 8, repeating the contents of steps 4 to 7 until the joint loss function iteration in step 7 reaches a preset condition;
[0016] Step 9: The overall matching method outputs the alignment result, ranks the distances between the entities of the two graphs, roughly selects the top p entities from each of the two graphs, builds an overall similarity matrix based on the embedding vectors of the p entities, and uses the KM algorithm to determine the alignable entity pairs based on the similarity matrix, which is output as the final result of the alignment.
[0017] According to a specific implementation of the embodiment of the present disclosure, step 5 specifically includes:
[0018] Step 5.1, calculate and construct the actual distribution matrix according to the following formula:
[0019]
[0020] Among them, actual is the actual distribution matrix, actual(i,j) represents the element in the i-th row and j-th column of the actual distribution matrix, e i is the ith entity among the n entities in graph 1, v j is the jth entity among the m entities in graph 2, h(e i ) and h(v j ) are e i With v j The embedding vector of ||·|| is the embedding vector modulus operation, and cos_sim is the calculation of h(e i ) and h(v j ) the similarity between the two;
[0021] Step 5.2, construct the expected distribution matrix label, which is the identity matrix, that is, only the diagonal elements are set to 1;
[0022] Step 5.3, calculate the distribution matching loss function integrating global information according to the following formula:
[0023]
[0024] in, is the distribution matching loss function integrating global information, D KL (actual||label) is the KL divergence calculated for actual and label.
[0025] According to a specific implementation of the embodiment of the present disclosure, step 6 specifically includes:
[0026] Step 6.1, targeted selection of error samples: For each positive sample entity in the positive sample set S, select a sufficient number of error entities globally to construct an error sample set, rank the error entities according to the distance between these error entities and the corresponding positive sample entities, select the top 25 error entities with the smallest distance, merge all the error entity sets of the positive samples to construct a negative sample set S′, in which an entity e i will be aligned with the entity v j The other 25 erroneous entities constitute 25 pairs of negative sample entity pairs.
[0027] Step 6.2, calculate the loss function of fusing local information:
[0028] The calculation formula of the fusion local information loss function is as follows:
[0029]
[0030] Among them, (e i, v j ) is a positive sample entity pair, that is, the i-th entity in graph 1 is aligned with the j-th entity in graph 2, (e i , v k ′) is a negative sample entity pair, that is, entity e i The kth pair of 25 pairs of negative sample entity pairs, γ is the separation hyperparameter, is the loss function consisting of the triplet of separation hyperparameters, positive sample spacing, and negative sample loss. f(x, y) is the Manhattan distance function, that is, f(x, y) is |xy|, α k For each negative sample attention weight, the calculation formula is as follows:
[0031]
[0032] Among them, the attention weight formula assigns weights according to the distance of negative sample entities.
[0033] According to a specific implementation of the embodiment of the present disclosure, step 9 specifically includes:
[0034] Step 9.1, coarse sorting based on distance ranking: For all entities in Graph 1 and Graph 2, calculate the distance between the entity and the sample center, and then obtain independent distance-based rankings for the two graphs (where the distance uses Manhattan distance), and select p entities with the smallest distance from the rankings of the two graphs;
[0035] Step 9.2, construct the overall similarity matrix: The calculation formula of the similarity matrix sim is as follows:
[0036] sim(i,j)=f(h(e i ), h(v j ))
[0037] Among them, sim(i, j) is the element in the i-th row and j-th column of the similarity matrix, h(e i ) and h(v j ) are the embedding vectors of the i-th entity in graph 1 and the j-th entity in graph 2 respectively;
[0038] In step 9.3, the KM algorithm selects alignable entity pairs.
[0039] According to a specific implementation of the embodiment of the present disclosure, step 9.3 specifically includes:
[0040] Step 9.3.1, construct a bipartite graph G based on the entities of the two graphs. The vertex set of the bipartite graph is composed of the graph 1 entity set E = {e1, ..., ei, ..., e p} and graph 2 entity set V = {v1, ..., v j , …, v p}, each entity in the vertex set has a corresponding top label value C (this value records the difference between the minimum edge weight of the entity and the top label value of the corresponding entity in the current matching state, which is convenient for subsequent search for a better matching state). The edge set X of the bipartite graph is X = {(e1, v1), ..., (e i , v j ),…,(e p , v p )}, where each edge weight W(i, j) is the element corresponding to the i-th row and j-th column in the similarity matrix;
[0041] Step 9.3.2, according to the principle of minimum edge weight, select the corresponding column entity for each row entity, set the edge weight to the top mark value of the row entity, and determine whether there is a conflict;
[0042] Step 9.3.3, if there is a conflicting alignment selection, increase the top mark value of the conflicting row entity and, if condition C(e i )+C(v j )=W(i, j), re-select the alignment and determine whether there is a conflict. If so, repeat step 9.3.3;
[0043] Step 9.3.4, output each row entity with one and only one column entity alignment, and ensure that the sum of the similarities of the aligned entity pairs is the smallest after matching entity alignment selection.
[0044] In a second aspect, the present disclosure provides a knowledge graph entity alignment system based on a graph neural network, including:
[0045] An acquisition module is used for data preparation to obtain target information from two graphs with different sources, wherein the target information includes relationship triples, attribute triples, entity information, relationship type information, and aligned entity pairs;
[0046] The preprocessing module is used for data preprocessing. For each graph, the adjacency matrix and degree matrix of the graph are constructed respectively. The initial embedding vector of each entity is obtained according to the attribute triples and entity information. The aligned entity pairs are used as training data, i.e., the positive sample set S.
[0047] The construction module is used to build a graph neural network model, randomly initialize the weight parameters of the graph neural network model, and multiply it with the adjacency matrix;
[0048] The operation module is used for network forward operation, inputs the initial embedding vector of the entity into the graph neural network model, performs forward operation, and obtains the output embedding vector;
[0049] The global information fusion module is used to fuse the distribution migration method of global information. According to the embedding vector output in step 4, the actual distribution matrix between all entities is constructed, and the distribution matching loss function of the fused global distribution information is calculated.
[0050] The local information fusion module is used to fuse the targeted negative sampling of local information. Based on each entity pair in the positive sample set S, multiple error samples are selected to construct the set S′ of all negative samples, and the triplet loss function that fuses the local information is calculated.
[0051] The update module is used to back-propagate and update the network weight parameters according to the results obtained in steps 5 and 6. and Weighted addition to obtain the joint loss function The stochastic gradient descent algorithm that minimizes the joint loss function is used to update the weight parameters of the graph neural network model;
[0052] An iteration module, used to repeat the contents of steps 4 to 7 until the iteration of the joint loss function in step 7 reaches a preset condition;
[0053] The output module is used to output the alignment results using the overall matching method. It ranks the distances between the entities in the two graphs, roughly selects the top p entities from each of the two graphs, builds an overall similarity matrix based on the embedding vectors of the p entities, and uses the KM algorithm to determine the alignable entity pairs based on the similarity matrix, which is output as the final result of the alignment.
[0054] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:
[0055] at least one processor; and,
[0056] a memory communicatively connected to the at least one processor; wherein,
[0057] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the knowledge graph entity alignment method based on graph neural network in the aforementioned first aspect or any implementation of the first aspect.
[0058] The knowledge graph entity alignment scheme based on graph neural network in the embodiment of the present disclosure includes: step 1, data preparation, obtaining target information of two graphs from different sources, wherein the target information includes relationship triples, attribute triples, entity information, relationship type information and aligned entity pairs; step 2, data preprocessing, respectively constructing the adjacency matrix and degree matrix of the graph for each graph, obtaining the initial embedding vector of each entity according to the attribute triples and entity information, and taking the aligned entity pairs as training data, i.e., the positive sample set S; step 3, constructing a graph neural network model, randomly initializing the weight parameters of the graph neural network model, and multiplying them with the adjacency matrix; step 4, network forward operation, inputting the initial embedding vector of the entity into the graph neural network model, performing forward operation, and obtaining the output embedding vector; step 5, a distribution migration method that integrates global information, constructing the actual distribution matrix between all entities according to the embedding vector output in step 4, and calculating the distribution matching loss function that integrates the global distribution information. Step 6: Targeted negative sampling integrating local information: Based on each entity pair in the positive sample set S, multiple error samples are selected to construct the set S′ of all negative samples, and the triplet loss function integrating local information is calculated. Step 7: Back propagate to update the weight parameters of the graph neural network model according to the values obtained in steps 5 and 6. and Weighted addition to obtain the joint loss function The network weight parameters are updated using the stochastic gradient descent algorithm that minimizes the joint loss function; Step 8, repeating the contents of Step 4 to Step 7 until the joint loss function iteration described in Step 7 reaches the preset condition; Step 9, the overall matching method outputs the alignment result, ranks the distances between the entities of the two graphs, roughly selects the top p entities from each of the two graphs, constructs an overall similarity matrix based on the embedded vectors of the p entities, and uses the KM algorithm to determine the alignable entity pairs based on the similarity matrix, which are output as the final result of the alignment.
[0059] The beneficial effects of the embodiments of the present disclosure are as follows: through the scheme of the present disclosure, (1) considering the occlusion problem of embedded information between graphs, by constructing the distribution information of the expected distribution and the actual distribution, the subspace of the entity distribution is brought closer during the training process, so that the number of potential alignable entities is increased, and the final entity alignment accuracy is improved;
[0060] (2) By selecting negative samples that are more similar to positive samples, the network's ability to distinguish between positive and negative samples is greatly improved, making the training process more efficient;
[0061] (3) Construct a similarity matrix between entities and make full use of the interactive information between graphs to ensure that the alignment result is the overall optimal result, which significantly improves the alignment accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0063] Figure 1 A schematic diagram of a flow chart of a knowledge graph entity alignment method based on a graph neural network provided in an embodiment of the present disclosure;
[0064] Figure 2 A schematic diagram of the overall matching process involved in a knowledge graph entity alignment method based on a graph neural network provided in an embodiment of the present disclosure;
[0065] Figure 3 An entity distribution dimensionality reduction graph provided by an embodiment of the present disclosure without using the distribution migration method of the present method;
[0066] Figure 4 An entity distribution dimension reduction graph using the distribution migration method of the method provided in the embodiment of the present disclosure;
[0067] Figure 5 A schematic diagram of the structure of a knowledge graph entity alignment system based on a graph neural network provided in an embodiment of the present disclosure;
[0068] Figure 6 A schematic diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0069] The embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0070] The following describes the embodiments of the present disclosure through specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.
[0071] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.
[0072] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The drawings only show components related to the present disclosure rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0073] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.
[0074] The disclosed embodiment provides a knowledge graph entity alignment method based on graph neural network, which can be applied to the knowledge ablation process in Internet processing and analysis scenarios.
[0075] See also Figure 1 , is a flow chart of a knowledge graph entity alignment method based on a graph neural network provided by an embodiment of the present disclosure. Figure 1 As shown, the method mainly comprises the following steps:
[0076] Step 1: Data preparation, obtaining target information from two graphs with different sources, where the target information includes relationship triples, attribute triples, entity information, relationship type information, and aligned entity pairs;
[0077] In the specific implementation, the data set of this implementation method takes the subsets DBPZH-EN (Chinese and English graphs), DBPJA-EN (Japanese and English graphs) and DBPFR-EN (French and English graphs) of the open source data set DBP15K for knowledge graph entity alignment as an example. The data set of this implementation is shown in Table 1.
[0078]
[0079]
[0080] Table 1
[0081] During the data preparation stage, you can first obtain two graph information from different sources, including relationship triples, attribute triples, entity information (entity names, connection relationships between entities, etc.), relationship type information, and aligned entity pairs, to facilitate the next step of the operation process.
[0082] Step 2: Data preprocessing: construct the adjacency matrix and degree matrix of each graph, obtain the initial embedding vector of each entity based on the attribute triples and entity information, and use the aligned entity pairs as training data, i.e., the positive sample set S;
[0083] In the specific implementation, in the data preprocessing stage, for each graph to be aligned, the adjacency matrix and degree matrix of the graph can be constructed respectively, and the initial embedding vector of each entity can be obtained according to the attribute triples and entity information, and the aligned entity pairs are regarded as training data, that is, the positive sample set S.
[0084] Step 3: Build a graph neural network model, randomly initialize the weight parameters of the graph neural network model, and multiply it with the adjacency matrix;
[0085] In specific implementation, a graph neural network model can be constructed, and then the graph convolutional neural network weight parameters can be randomly initialized and multiplied with the adjacency matrix. The steps of constructing the graph neural network model include:
[0086] Using the calculation formula of graph convolutional neural network:
[0087] Among them, W (l) is a randomly initialized weight parameter, which is continuously updated during the subsequent training process. (l) is the output of the l-th layer network, H (l+1) is the l+1th layer network output, σ is the activation function, and are the standardized degree matrix and adjacency matrix respectively.
[0088] Step 4: network forward operation, input the initial embedding vector of the entity into the graph neural network model, perform forward operation, and obtain the output embedding vector;
[0089] In specific implementation, the initial embedding vector of the entity can be input into the graph neural network model, a forward operation can be performed, and the output embedding vector can be obtained.
[0090] Step 5: The distribution migration method that integrates global information builds the actual distribution matrix between all entities based on the embedding vector output in step 4, and calculates the distribution matching loss function that integrates global distribution information.
[0091] Furthermore, the step 5 specifically includes:
[0092] Step 5.1, calculate and construct the actual distribution matrix according to the following formula:
[0093]
[0094] Among them, actual is the actual distribution matrix, actual(i,j) represents the element in the i-th row and j-th column of the actual distribution matrix, e i is the ith entity among the n entities in graph 1, v j is the jth entity among the m entities in graph 2, h(e i ) and h(v j ) are e i With v j The embedding vector of ||·|| is the embedding vector modulus operation, and cos_sim is the calculation of h(e i ) and h(v j ) the similarity between the two;
[0095] Step 5.2, construct the expected distribution matrix label, which is the identity matrix, that is, only the diagonal elements are set to 1;
[0096] Step 5.3, calculate the distribution matching loss function integrating global information according to the following formula:
[0097]
[0098] in, is the distribution matching loss function integrating global information, D KL (actual||label) is the KL divergence calculated for actual and label.
[0099] In specific implementation, the steps of the distribution migration method for integrating global information may include:
[0100] Step 51: Construct the actual distribution matrix:
[0101] Calculate and construct the actual distribution matrix according to the following formula:
[0102]
[0103] Among them, actual is the actual distribution matrix, actual(i,j) represents the element in the i-th row and j-th column of the actual distribution matrix, e i is the ith entity among the n entities in graph 1, v j is the jth entity among the m entities in graph 2, h(e i ) and h(v j ) are e iWith v j The embedding vector of ||·|| is the embedding vector modulus operation, and cos_sim is used to calculate h(e i ) and h(v j ) the similarity between the two;
[0104] Step 52: Construct the expected distribution matrix:
[0105] Construct the expected distribution matrix label, which is the identity matrix, that is, only the diagonal elements are set to 1, which ensures that the elements on the diagonal are the most similar entity pairs;
[0106] Step 53: Calculate the distribution matching loss function integrating global information:
[0107] The distribution matching loss function integrating global information is calculated as follows:
[0108]
[0109] Among them, J1 is the distribution matching loss function integrating global information, D KL (actual||label) is the KL divergence calculated for actual and label.
[0110] Step 6: Targeted negative sampling integrating local information: Based on each entity pair in the positive sample set S, multiple error samples are selected to construct the set S′ of all negative samples, and the triplet loss function integrating local information is calculated.
[0111] Based on the above embodiment, step 6 specifically includes:
[0112] Step 6.1, targeted selection of error samples: For each positive sample entity in the positive sample set S, select a sufficient number of error entities globally to construct an error sample set, rank the error entities according to the distance between these error entities and the corresponding positive sample entities, select the top 25 error entities with the smallest distance, merge all the error entity sets of the positive samples to construct a negative sample set S′, in which an entity e i will be aligned with the entity v j The other 25 erroneous entities constitute 25 pairs of negative sample entity pairs.
[0113] Step 6.2, calculate the loss function of fusing local information:
[0114] The calculation formula of the fusion local information loss function is as follows:
[0115]
[0116] Among them, (e i, v j ) is a positive sample entity pair, that is, the i-th entity in graph 1 is aligned with the j-th entity in graph 2, (e i , v k ′) is a negative sample entity pair, that is, entity e i The kth pair of 25 pairs of negative sample entity pairs, γ is the separation hyperparameter, is the loss function consisting of the triplet of separation hyperparameters, positive sample spacing, and negative sample loss. f(x, y) is the Manhattan distance function, that is, f(x, y) is |xy|, α k For each negative sample attention weight, the calculation formula is as follows:
[0117]
[0118] Among them, the attention weight formula assigns weights according to the distance of negative sample entities.
[0119] In specific implementation, the targeted negative sampling step of fusing local information may include:
[0120] Step 61, targeted selection of error samples: For each positive sample entity in the positive sample set S, select a sufficient number of error entities in the global scope to construct an error sample set, rank the error entities according to the distance between these error entities and the corresponding positive sample entities, select the top 25 error entities with the smallest distance, and merge all the error entity sets of the positive samples to construct a negative sample set S′. That is, in the negative sample set, an entity e i will be aligned with the entity v j The other 25 erroneous entities constitute 25 pairs of negative sample entity pairs.
[0121] Step 62: Calculate the loss function of fusing local information:
[0122] The calculation formula of the fusion local information loss function is as follows:
[0123]
[0124] Among them, (e i , v j ) is a positive sample entity pair, that is, the i-th entity in graph 1 is aligned with the j-th entity in graph 2; (e i , v k ′) is a negative sample entity pair, that is, entity e i The kth pair of 25 pairs of negative sample entity pairs; γ is the separation hyperparameter, which is used to ensure that the loss function value is always positive; J2 is the loss function composed of the separation hyperparameter, the positive sample spacing and the negative sample loss triplet; f(x, y) is the Manhattan distance function, that is, f(x, y) is |xy|; α kFor each negative sample attention weight, the calculation formula is as follows:
[0125]
[0126] Among them, the attention weight formula assigns weights according to the distance of negative sample entities.
[0127] Step 7: Back propagate and update the network weight parameters according to the values obtained in steps 5 and 6. and Weighted addition to obtain the joint loss function The stochastic gradient descent algorithm that minimizes the joint loss function is used to update the weight parameters of the graph neural network model;
[0128] In specific implementation, after J1 and J2 are obtained according to step 5 and step 6, weighted addition can be performed to obtain the joint loss function J, and the weight parameters of the graph neural network model are updated using the stochastic gradient descent algorithm that minimizes the joint loss function, so that the alignment efficiency and accuracy of the graph neural network model are higher.
[0129] Step 8, repeating the contents of steps 4 to 7 until the joint loss function iteration in step 7 reaches a preset condition;
[0130] In the specific implementation, considering the requirements for model accuracy in practical applications, the contents of steps 4 to 7 can be repeated until the iteration of the joint loss function described in step 7 reaches the preset conditions, and a trained graph neural network model is obtained to facilitate subsequent alignment.
[0131] Step 9: The overall matching method outputs the alignment result, ranks the distances between the entities of the two graphs, roughly selects the top p entities from each of the two graphs, builds an overall similarity matrix based on the embedding vectors of the p entities, and uses the KM algorithm to determine the alignable entity pairs based on the similarity matrix, which is output as the final result of the alignment.
[0132] Based on the above embodiment, step 9 specifically includes:
[0133] Step 9.1, coarse sorting based on distance ranking: For all entities in Graph 1 and Graph 2, calculate the distance between the entity and the sample center, and then obtain independent distance-based rankings for the two graphs (where the distance uses Manhattan distance), and select p entities with the smallest distance from the rankings of the two graphs;
[0134] Step 9.2, construct the overall similarity matrix: The calculation formula of the similarity matrix sim is as follows:
[0135] sim(i,j)=f(h(e i ), h(v j ))
[0136] Among them, sim(i, j) is the element in the i-th row and j-th column of the similarity matrix, h(e i ) and h(v j ) are the embedding vectors of the i-th entity in graph 1 and the j-th entity in graph 2 respectively;
[0137] In step 9.3, the KM algorithm selects alignable entity pairs.
[0138] Furthermore, the step 9.3 specifically includes:
[0139] Step 9.3.1, construct a bipartite graph G based on the entities of the two graphs. The vertex set of the bipartite graph is composed of the graph 1 entity set E = {e1, ..., e i ,…,e p} and graph 2 entity set V = {v1, ..., v j , …, v p}, each entity in the vertex set has a corresponding top label value C (this value records the difference between the minimum edge weight of the entity and the top label value of the corresponding entity in the current matching state, which is convenient for subsequent search for a better matching state). The edge set X of the bipartite graph is X = {(e1, v1), ..., (e i , v j ),…,(e p , v p )}, where each edge weight W(i, j) is the element corresponding to the i-th row and j-th column in the similarity matrix;
[0140] Step 9.3.2, according to the principle of minimum edge weight, select the corresponding column entity for each row entity, set the edge weight to the top mark value of the row entity, and determine whether there is a conflict;
[0141] Step 9.3.3, if there is a conflicting alignment selection, increase the top mark value of the conflicting row entity and, if condition C(e i )+C(v j )=W(i, j), re-select the alignment and determine whether there is a conflict. If so, repeat step 9.3.3;
[0142] Step 9.3.4, output each row entity with one and only one column entity alignment, and ensure that the sum of the similarities of the aligned entity pairs is the smallest after matching entity alignment selection.
[0143] In the specific implementation, when the overall matching method outputs the alignment results, the distances between the entities of the two graphs can be ranked, and the top 10,500 entities in each of the two graphs can be roughly screened. The overall similarity matrix (the matrix elements are the similarities between entities) is constructed based on the embedding vectors of the 10,500 entities. The KM algorithm is used to determine the alignable entity pairs based on the similarity matrix, which are output as the final result of the alignment.
[0144] Specifically, Figure 2 As shown, the step of outputting the alignment result by the overall matching method may include:
[0145] Step 91, coarse sorting based on distance ranking: for all entities in graph 1 and graph 2, calculate the distance between the entity and the sample center, and then obtain independent distance-based rankings for the two graphs (where the distance uses Manhattan distance), and select p entities with the smallest distance from the rankings of the two graphs respectively;
[0146] Step 92, construct the overall similarity matrix: The calculation formula of the similarity matrix sim is as follows:
[0147] sim(i,j)=f(h(e i ), h(v j ))
[0148] Among them, sim(i, j) is the element in the i-th row and j-th column of the similarity matrix, h(e i ) and h(v j ) are the embedding vectors of the i-th entity in graph 1 and the j-th entity in graph 2 respectively;
[0149] Step 93: The KM algorithm selects alignable entity pairs:
[0150] Step 931: construct a bipartite graph G based on the entities of the two graphs. The vertex set of the bipartite graph is composed of the graph 1 entity set E = {e1, ..., e i ,…,e 10500} and graph 2 entity set V = {v1, ..., v j , …, v 10500}, each entity in the vertex set has a corresponding top label value C (this value records the difference between the minimum edge weight of the entity and the top label value of the corresponding entity in the current matching state, which is convenient for subsequent search for a better matching state); the edge set X of the bipartite graph = {(e1, v1), …, (e i , v j ),…,(e 10500 , v 10500 )}, where each edge weight W(i, j) is the element corresponding to the i-th row and j-th column in the similarity matrix;
[0151] Step 932: According to the principle of minimum edge weight (greedy selection method), select the corresponding column entity for each row entity, set the edge weight to the top mark value of the row entity, and determine whether there is a conflict (two different row entities select the same column entity);
[0152] Step 933: If there is a conflicting alignment selection, the conflicting row entity increases the top mark value accordingly, and when the condition C(e i )+C(v j )=W(i, j), re-select the alignment and determine whether there is a conflict. If there is a conflict, repeat step 933;
[0153] Step 934: Output entity alignment selection after perfect matching (each row entity has one and only one column entity aligned, and the sum of similarities of the aligned entity pairs is guaranteed to be the smallest match).
[0154] To further illustrate the method of the present disclosure, Figure 3 , Figure 4 The entity distribution dimensionality reduction diagrams before and after the distribution migration method of the present invention are shown respectively. It can be seen from the figure that the entity distribution on the DBPZH-EN dataset using the distribution migration method of the present invention is more compact, the subspaces of the two graph entities are embedded closer, the probability of paired entities appearing is greater, and the possibility of alignment is improved.
[0155] It can be seen from Table 2 that the prediction effect of the present invention on the three data sets of DBPZH-EN (Chinese-English comparison), DBPJA-EN (Japanese-English comparison) and DBPFR-EN (French-English comparison) is better than the current mainstream entity alignment method, where Hits@1 is the accuracy of the entity alignment result.
[0156]
[0157] Table 2
[0158] The knowledge graph entity alignment method based on graph neural network provided in this embodiment takes into account the occlusion problem of embedded information between graphs, constructs the distribution information of expected distribution and actual distribution, and brings the subspace of entity distribution closer during the training process, thereby increasing the number of potential alignable entities and improving the final entity alignment accuracy; adopts targeted selection of negative samples with higher similarity to positive samples, greatly improving the network's ability to distinguish between positive and negative samples, making the training process more efficient; constructs a similarity matrix between entities, and makes full use of the interactive information between graphs to ensure that the alignment result is the overall optimal result, which significantly improves the alignment accuracy.
[0159] Corresponding to the above method embodiment, see Figure 5The present disclosure also provides a knowledge graph entity alignment system 50 based on a graph neural network, including:
[0160] An acquisition module 501 is used for data preparation, and acquires target information of two graphs from different sources, wherein the target information includes relationship triples, attribute triples, entity information, relationship type information, and aligned entity pairs;
[0161] The preprocessing module 502 is used for data preprocessing. For each graph, the adjacency matrix and degree matrix of the graph are constructed respectively. The initial embedding vector of each entity is obtained according to the attribute triples and entity information. The aligned entity pairs are used as training data, i.e., the positive sample set S.
[0162] A construction module 503 is used to construct a graph neural network model, randomly initialize the graph convolutional neural network weight parameters, and multiply them with the adjacency matrix;
[0163] Operation module 504, used for network forward operation, inputting the initial embedding vector of the entity into the network, performing forward operation, and obtaining the output embedding vector;
[0164] The global information fusion module 505 is used to fuse the distribution migration method of global information. According to the embedding vector output in step 4, the actual distribution matrix between all entities is constructed, and the distribution matching loss function of the fused global distribution information is calculated.
[0165] The local information fusion module 506 is used for the targeted negative sampling of the fusion local information. Based on each entity pair in the positive sample set S, a plurality of error samples are selected to construct a set S′ of all negative samples, and the triplet loss function of the fusion local information is calculated.
[0166] Update module 507, used for back propagation update network weight parameters, according to step 5 and step 6 obtained and Weighted addition to obtain the joint loss function The network weight parameters are updated using the stochastic gradient descent algorithm that minimizes the joint loss function;
[0167] Iteration module 508, used to repeat the contents of step 4 to step 7 until the iteration of the joint loss function in step 7 reaches a preset condition;
[0168] Output module 509 is used to output the alignment result by the overall matching method, rank the distances between the entities of the two graphs, roughly select the top p entities from each of the two graphs, build an overall similarity matrix based on the embedded vectors of the p entities, and use the KM algorithm to determine the alignable entity pairs based on the similarity matrix, which are output as the final result of the alignment.
[0169] Figure 5 The system shown can correspondingly execute the contents of the above method embodiment. For the parts not described in detail in this embodiment, refer to the contents recorded in the above method embodiment and will not be repeated here.
[0170] See also Figure 6 The embodiment of the present disclosure further provides an electronic device 60, which includes: at least one processor and a memory connected to the at least one processor. The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the knowledge graph entity alignment method based on the graph neural network in the aforementioned method embodiment.
[0171] The embodiments of the present disclosure also provide a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the knowledge graph entity alignment method based on graph neural network in the aforementioned method embodiment.
[0172] The present disclosure also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the knowledge graph entity alignment method based on graph neural network in the aforementioned method embodiment.
[0173] Reference below Figure 6 , which shows a schematic diagram of the structure of an electronic device 60 suitable for implementing the embodiment of the present disclosure. The electronic device in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0174] like Figure 6As shown, the electronic device 60 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 60 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0175] Typically, the following devices may be connected to the I / O interface 605: input devices 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 608 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 609. The communication device 609 may allow the electronic device 60 to communicate with other devices wirelessly or by wire to exchange data. Although the electronic device 60 with various devices is shown in the figure, it should be understood that it is not required to implement or have all the devices shown. More or fewer devices may be implemented or have alternatively.
[0176] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0177] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0178] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0179] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device can execute the relevant steps of the method embodiment.
[0180] Alternatively, the computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device can perform the relevant steps of the method embodiment.
[0181] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0182] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0183] The units involved in the embodiments described in the present disclosure may be implemented by software or by hardware.
[0184] It should be understood that various parts of the present disclosure may be implemented in hardware, software, firmware, or a combination thereof.
[0185] The above is only a specific implementation of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present disclosure should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A knowledge graph entity alignment method based on graph neural network, characterized in that: include: Step 1: Prepare the Chinese-English graph, the Japanese-English graph, and the French-English graph of the subset of the DBP15K dataset, and obtain the target information of the two graphs from different sources, where the target information includes relationship triples, attribute triples, entity information, relationship type information, and aligned entity pairs; Step 2: Data preprocessing: construct the adjacency matrix and degree matrix of each graph, obtain the initial embedding vector of each entity based on the attribute triples and entity information, and use the aligned entity pairs as training data, i.e., the positive sample set S; Step 3: Build a graph neural network model, randomly initialize the weight parameters of the graph neural network model, and multiply it with the adjacency matrix; Step 4: network forward operation, input the initial embedding vector of the entity into the graph neural network model, perform forward operation, and obtain the output embedding vector; Step 5: The distribution migration method that integrates global information builds the actual distribution matrix between all entities based on the embedding vector output in step 4, and calculates the distribution matching loss function that integrates global distribution information. The step 5 specifically includes: Step 5.1, calculate and construct the actual distribution matrix according to the following formula: Among them, actual is the actual distribution matrix, actual(i,j) represents the element in the i-th row and j-th column of the actual distribution matrix, e i is the ith entity among the n entities in graph 1, v j is the jth entity among the m entities in graph 2, h(e i ) and h(v j ) are e i With v j The embedding vector of ||·|| is the embedding vector modulus operation, and cos_sim is the calculation of h(e i ) and h(v j ) the similarity between the two; Step 5.2, construct the expected distribution matrix label, which is the identity matrix, that is, only the diagonal elements are set to 1; Step 5.3, calculate the distribution matching loss function integrating global information according to the following formula: in, is the distribution matching loss function integrating global information, D KL (actual||label) is the KL divergence calculated for actual and label; Step 6: Targeted negative sampling integrating local information: Based on each entity pair in the positive sample set S, multiple error samples are selected to construct the set S' of all negative samples, and the triplet loss function integrating local information is calculated. The step 6 specifically includes: Step 6.1, targeted selection of error samples: For each positive sample entity in the positive sample set S, select a sufficient number of error entities globally to construct an error sample set, rank the error entities according to the distance between these error entities and the corresponding positive sample entities, select the top 25 error entities with the smallest distance, merge all the error entity sets of the positive samples to construct a negative sample set S', in which an entity e i will be aligned with the entity v j The other 25 wrong entities constitute 25 pairs of negative sample entity pairs; Step 6.2, calculate the loss function of fusing local information: The calculation formula of the fusion local information loss function is as follows: Among them, (e i ,v j ) is a positive sample entity pair, that is, the i-th entity in graph 1 is aligned with the j-th entity in graph 2, (e i ,v k ') is a negative sample entity pair, that is, entity e i The kth pair of 25 pairs of negative sample entity pairs, γ is the separation hyperparameter, is the loss function consisting of the triplet of separation hyperparameters, positive sample spacing, and negative sample loss. f(x, y) is the Manhattan distance function, that is, f(x, y) is |xy|, α k For each negative sample attention weight, the calculation formula is as follows: Among them, the attention weight formula assigns weights according to the distance of negative sample entities; Step 7: Back propagate and update the network weight parameters according to the values obtained in steps 5 and 6. and Weighted addition to obtain the joint loss function The stochastic gradient descent algorithm that minimizes the joint loss function is used to update the weight parameters of the graph neural network model; Step 8, repeating the contents of steps 4 to 7 until the joint loss function iteration in step 7 reaches a preset condition; Step 9: The overall matching method outputs the alignment result, ranks the distances between the entities of the two graphs, roughly selects the top p entities from each of the two graphs, builds an overall similarity matrix based on the embedding vectors of the p entities, and uses the KM algorithm to determine the alignable entity pairs based on the similarity matrix, which is output as the final result of the alignment.
2. The method according to claim 1, characterized in that , the step 9 specifically includes: Step 9.1, coarse sorting based on distance ranking: For all entities in graph 1 and graph 2, calculate the distance between the entity and the sample center, and then obtain independent distance-based rankings for the two graphs, where the distance uses Manhattan distance, and select p entities with the smallest distance from the rankings of the two graphs respectively; Step 9.2, construct the overall similarity matrix: The calculation formula of the similarity matrix sim is as follows: sim(i,j)=f(h(e i ),h(v j )) Among them, sim(i,j) is the element in the i-th row and j-th column of the similarity matrix, h(e i ) and h(v j ) are the embedding vectors of the i-th entity in graph 1 and the j-th entity in graph 2 respectively; In step 9.3, the KM algorithm selects alignable entity pairs.
3. The method according to claim 2, characterized in that , the step 9.3 specifically includes: Step 9.3.1, construct a bipartite graph G based on the entities of the two graphs. The vertex set of the bipartite graph is composed of the graph 1 entity set E = {e1,…,e i ,…,e p } and graph 2 entity set V = {v1,…,v j ,…,v p }, each entity in the vertex set has a corresponding top label value C, which records the difference between the minimum edge weight of the entity and the top label value of the corresponding entity in the current matching state, which is convenient for subsequent search for a better matching state. The edge set X of the bipartite graph is X={(e1,v1),…,(e i ,v j ),…,(e p ,v p )}, where each edge weight W(i,j) is the element corresponding to the i-th row and j-th column in the similarity matrix; Step 9.3.2, according to the principle of minimum edge weight, select the corresponding column entity for each row entity, set the edge weight to the top mark value of the row entity, and determine whether there is a conflict; The step of determining whether there is a conflict comprises: Determine whether two different row entities select the same column entity. If so, it is determined that there is a conflict. If not, it is determined that there is no conflict. Step 9.3.3, if there is a conflicting alignment selection, increase the top mark value of the conflicting row entity and, if condition C(e i )+C(v j )=W(i,j), re-select the alignment and determine whether there is a conflict. If so, repeat step 9.3.3; Step 9.3.4, output each row entity with one and only one column entity alignment, and ensure that the sum of the similarities of the aligned entity pairs is the smallest after matching entity alignment selection.
4. A knowledge graph entity alignment system based on graph neural network, characterized in that: include: The acquisition module is used for the Chinese-English graph, the Japanese-English graph, and the French-English graph in the subset of the DBP15K dataset to obtain the target information of two graphs from different sources, where the target information includes relationship triples, attribute triples, entity information, relationship type information, and aligned entity pairs; The preprocessing module is used for data preprocessing. For each graph, the adjacency matrix and degree matrix of the graph are constructed respectively. The initial embedding vector of each entity is obtained according to the attribute triples and entity information. The aligned entity pairs are used as training data, i.e., the positive sample set S. The construction module is used to build a graph neural network model, randomly initialize the weight parameters of the graph neural network model, and multiply it with the adjacency matrix; The operation module is used for network forward operation, inputs the initial embedding vector of the entity into the graph neural network model, performs forward operation, and obtains the output embedding vector; The global information fusion module is used to fuse the distribution migration method of global information. According to the embedding vector output in step 4, the actual distribution matrix between all entities is constructed, and the distribution matching loss function of the fused global distribution information is calculated. The specific process of the global information fusion module is as follows: Calculate and construct the actual distribution matrix according to the following formula: Among them, actual is the actual distribution matrix, actual(i,j) represents the element in the i-th row and j-th column of the actual distribution matrix, e i is the ith entity among the n entities in graph 1, v j is the jth entity among the m entities in graph 2, h(e i ) and h(v j ) are e i With v j The embedding vector of ||·|| is the embedding vector modulus operation, and cos_sim is the calculation of h(e i ) and h(v j ) the similarity between the two; Construct the expected distribution matrix label, which is the identity matrix, that is, only the diagonal elements are set to 1; The distribution matching loss function integrating global information is calculated as follows: in, is the distribution matching loss function integrating global information, D KL (actual||label) is the KL divergence calculated for actual and label; The local information fusion module is used to fuse the targeted negative sampling of local information. Based on each entity pair in the positive sample set S, multiple error samples are selected to construct the set S' of all negative samples, and the triplet loss function that fuses the local information is calculated. The specific process of the local information fusion module is as follows: Targeted selection of error samples: For each positive sample entity in the positive sample set S, select a sufficient number of error entities globally to construct an error sample set, rank the error entities according to the distance between these error entities and the corresponding positive sample entities, select the top 25 error entities with the smallest distance, merge all the error entity sets of the positive samples to construct a negative sample set S'. In the negative sample set S', an entity e i will be aligned with the entity v j The other 25 wrong entities constitute 25 pairs of negative sample entity pairs; Calculate the loss function of fusing local information: The calculation formula of the fusion local information loss function is as follows: Among them, (e i ,v j ) is a positive sample entity pair, that is, the i-th entity in graph 1 is aligned with the j-th entity in graph 2, (e i ,v k ') is a negative sample entity pair, that is, entity e i The kth pair of 25 pairs of negative sample entity pairs, γ is the separation hyperparameter, is the loss function consisting of the triplet of separation hyperparameters, positive sample spacing, and negative sample loss. f(x, y) is the Manhattan distance function, that is, f(x, y) is |xy|, α k For each negative sample attention weight, the calculation formula is as follows: Among them, the attention weight formula assigns weights according to the distance of negative sample entities; The update module is used to back-propagate and update the network weight parameters according to the results obtained in steps 5 and 6. and Weighted addition to obtain the joint loss function The stochastic gradient descent algorithm that minimizes the joint loss function is used to update the weight parameters of the graph neural network model; An iteration module, used to repeat the contents of steps 4 to 7 until the iteration of the joint loss function in step 7 reaches a preset condition; The output module is used to output the alignment results using the overall matching method. It ranks the distances between the entities in the two graphs, roughly selects the top p entities from each of the two graphs, builds an overall similarity matrix based on the embedding vectors of the p entities, and uses the KM algorithm to determine the alignable entity pairs based on the similarity matrix, which is output as the final result of the alignment.
5. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the knowledge graph entity alignment method based on graph neural network described in any one of the preceding claims 1-3.
Citation Information
Patent Citations
Weight uncertainty-based graph convolutional neural network optimization method and device
CN112651436A
Knowledge graph entity alignment method based on graph neural network
CN113761221A