Knowledge graph representation learning reasoning method and system

Through hierarchical sampling and information aggregation of graph neural networks, combined with sparse negative sampling strategy, the problems of insufficient interpretability and high time complexity in knowledge graph representation learning are solved, and efficient and accurate knowledge reasoning is achieved.

CN119129715APending Publication Date: 2024-12-13NANJING UNIV OF INFORMATION SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411212292.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

The existing knowledge graph representation learning methods have problems such as insufficient interpretability, high time complexity and increased computational volume in knowledge reasoning, especially when considering higher-order relationships.

Method used

Using a hierarchical sampling strategy to identify central entities and neighbor entities related to user query from the knowledge graph, aggregate information through the graph neural network and perform multiple rounds of updates, combined with the sparse negative sampling strategy, use the attention mechanism to weight the aggregate information to reduce Compute the amount and improve the model's understanding of complex relationships.

Benefits of technology

The accuracy and efficiency of knowledge reasoning are significantly improved. Through multiple rounds of updates and sparsity negative sampling strategies, the model can accurately score and accurately predict answer entities, improving the overall performance of the knowledge representation model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119129715A_ABST
    Figure CN119129715A_ABST
Patent Text Reader

Abstract

The invention discloses a knowledge graph representation learning reasoning method and system in the field of knowledge reasoning, and aims to solve the technical problem of lack of interpretability in the reasoning process. The method comprises the following steps: selecting a central entity related to user query and all neighbor entities connected with the central entity through a query relationship from a knowledge graph; calculating a probability value of each neighbor entity associated with the central entity, gradually accumulating from the neighbor entity with the maximum probability value until the sum of the accumulated probability values exceeds a preset probability threshold value, and stopping sampling the entities of the current layer; aggregating information contained in the neighbor entities into connected central entities by using a graph neural network so as to update each entity; repeating the process until a preset sampling layer number is reached; inputting the updated entity and the query relationship into a trained knowledge representation model, and outputting a predicted answer entity; the overall performance of the model can be improved, and the reasoning accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a knowledge graph representation learning reasoning method and system, belonging to the technical field of knowledge reasoning. Background Art

[0002] The knowledge graph is a complex network composed of a large number of triples, each of which consists of a head entity, a relationship, and a tail entity, which together represent a specific fact. In the field of artificial intelligence, these structured facts are widely used in intelligent question answering, recommendation systems, medical discovery, and many other aspects. When faced with incomplete queries, such as when one entity and one relationship are known but another entity is unknown, the task of the knowledge reasoning model is to use the information of the knowledge graph to infer the missing entity. To achieve this goal, knowledge representation learning becomes crucial, which involves converting entities and relationships into vectors in numerical form.

[0003] Knowledge representation learning is a hot research direction in the field of knowledge graphs, including the following main methods: triple-based methods, such as TransE, TransR, and RotatE, express the semantic information between entities and relations by mapping them into vector space, but this method may lack interpretability when performing knowledge reasoning; tensor decomposition-based methods, such as RESCAL and DistMult, regard the knowledge graph as a three-dimensional adjacency matrix, where each element of the matrix indicates whether a triple exists; neural network-based methods, such as ConvE and ConvKB, transform the knowledge reasoning task into a deep learning problem, and identify patterns between triples by learning weights and biases. However, these methods may face challenges of high time complexity and insufficient interpretability; graph neural network (GNN)-based methods, such as R-GCN and KBAT, specialize in processing graph structured data and capture high-order neighbor information of entities through information propagation. Although these models perform well in capturing complex relationships, the amount of computation required may also increase exponentially as the number of orders considered increases. Therefore, a new method is urgently needed to address the shortcomings of the above existing methods. Summary of the invention

[0004] The purpose of the present invention is to provide a knowledge graph representation learning reasoning method and system, which can improve the accuracy and efficiency of reasoning and enhance the overall performance of the knowledge representation model.

[0005] In order to solve the above technical problems, the present invention is implemented by adopting the following technical solutions.

[0006] In a first aspect, the present invention provides a knowledge graph representation learning and reasoning method, comprising: Selecting a central entity related to the user query and all neighbor entities connected to the central entity through a query relationship from the knowledge graph; wherein the knowledge graph includes a plurality of entities; Calculate the probability value of each neighbor entity associated with the central entity, and sort the probability values ​​in descending order, starting from the neighbor entity with the largest probability value and gradually accumulating them until the total accumulated probability value exceeds the preset probability threshold P, and stop sampling the entities in the current layer; Aggregate the information contained in the neighbor entities into the connected central entity using a graph neural network to update each entity; Repeat sampling and updating the entities of each layer until the preset number of sampling layers L is reached; The updated entities and query relations are input into the trained knowledge representation model, and the predicted answer entity is output; wherein the knowledge representation model scores the possible entities in the knowledge graph, and selects the entity with the highest score as the final predicted answer entity.

[0007] In combination with the first aspect, further, calculating the probability value of each neighbor entity being associated with the central entity includes: Calculating the correlation value between the neighbor entity and the query relationship and the central entity; The relevance value is normalized to convert the relevance value into a probability value associated with the central entity.

[0008] In combination with the first aspect, further, the expression of the correlation value between the neighbor entity and the query relationship and the central entity is: ; in, represents the correlation value; Represents the layer-level central entity Embedding Represents the layer-level neighbor entity Embedding Represents a query relationship; The calculation expression of the probability value is: ; Where j represents the index of all neighbor entities; N represents the total number of neighbor entities; Represents the probability value.

[0009] In combination with the first aspect, further, the using a graph neural network to aggregate the information contained in the neighbor entities into a connected central entity includes: The information contained in the neighbor entity is weightedly aggregated based on the attention mechanism to obtain the weight of the neighbor entity. The expression of the weight is: ; ; in, Represents the weight value of the neighbor entity; represents the activation function; represents the learnable parameter matrix; Represents a vector concatenation operation; Indicates that the central entity is Representation of layers; Indicates that the neighbor entity is Representation of layers; Indicates that the current center entity and neighbor entities are Relationship representation of layers; represents a learnable bias; represents the weight of the neighbor entity; A learnable parameter matrix representing the neighbor entities; represents the parameterized bias; Weighted aggregation is performed again according to the weights of the neighbor entities to integrate the information contained in all neighbor entities connected to each central entity, and the integrated information of the neighbor entities is aggregated into the central entity of the entity itself to update the current entity.

[0010] In combination with the first aspect, further, the expression for updating the current entity is: ; ; in, represents the information representation of neighbor entities after weighted aggregation; R represents the number of relationships; represents a trainable parameter matrix; a representation of the updated entity; Represents an aggregate function; A representation that represents the current central entity.

[0011] In combination with the first aspect, further, the training process of the knowledge representation model includes: The negative sampling strategy is used to evaluate and calculate the neighbor connection density between each central entity and the neighbor entity. The expression of the neighbor connection density is: ; in, Represents the neighbor connection density between a single central entity and its neighbor entities; Represents the number of connections between a single central entity and its neighbor entities; Indicates the number of neighbor entities connected to a single central entity; According to the neighbor connection density, the entities are classified according to type into dense entities and sparse entities, and different negative sampling strategies are determined according to different types, and negative samples are generated; wherein the dense entity sampling is based on a sampling strategy of similarity, and entities similar to existing entities in the knowledge graph in the feature space are selected as negative samples; the sparse entity adopts a random sampling strategy, and entities randomly determined in the feature space are selected as negative samples; The knowledge representation model is trained based on the generated negative samples and the existing entities in the knowledge graph, and the parameters of the model are optimized using a loss function, and the performance of the model is evaluated, and the parameters of the model are adjusted based on the evaluation results.

[0012] In combination with the first aspect, further, classifying entities by type according to neighbor connection density includes: Compare the neighbor connection density between the current central entity and the neighbor entities with the average neighbor connection density of the preset knowledge graph to determine whether the current entity is dense; If the neighbor connection density between the current central entity and the neighbor entities is higher than the average neighbor connection density of the preset knowledge graph, the current entity is a dense entity; if the neighbor connection density between the current central entity and the neighbor entities is lower than the average neighbor connection density of the preset knowledge graph, the current entity is a sparse entity.

[0013] In combination with the first aspect, further, the expression of the average neighbor connection density of the preset knowledge graph is: ; in, represents the average neighbor connection density of the knowledge graph; N represents the total number of entities in the knowledge graph; Represents the neighbor connection density of the i-th entity.

[0014] In combination with the first aspect, further, the loss function is expressed as: ; Where L represents the result of the loss function; i represents the index of the sample in the loss function; Represents the score of negative samples; Indicates the score of existing entities in the knowledge graph; Represents a hyperparameter.

[0015] Second, a knowledge graph representation learning reasoning system includes: An acquisition module, used to select a central entity related to a user query and all neighbor entities connected to the central entity through a query relationship from the knowledge graph; wherein the knowledge graph includes a plurality of entities; A layer sampling module is used to calculate the probability value of each neighbor entity associated with the central entity, and sort the probability values ​​in descending order, starting from the neighbor entity with the largest probability value and gradually accumulating them until the total accumulated probability value exceeds a preset probability threshold P, and then stop sampling entities in the current layer; An updating module, configured to aggregate the information contained in the neighbor entities into the connected central entity using a graph neural network, so as to update each entity; An iterative control module, used for repeatedly sampling and updating entities of each layer until a preset number of sampling layers L is reached; A prediction module is used to input the updated entities and query relations into the trained knowledge representation model and output the predicted answer entity; wherein the knowledge representation model scores the possible entities in the knowledge graph and selects the entity with the highest score as the final predicted answer entity.

[0016] Compared with the prior art, the present invention has the following beneficial effects: The present invention adopts a hierarchical sampling strategy. First, the central entity that is closely related to the user query and the neighbor entities directly connected to it through the query relationship are identified in the knowledge graph. By calculating the correlation between these neighbor entities and the central entity, and sorting and accumulating them in descending order according to the probability value, we can screen out the entities that are critical to the reasoning task until the accumulated probability value exceeds the preset threshold P. Then, using graph neural network technology, these selected neighbor entity information are aggregated to update the representation of the central entity. This process is repeated until the preset number of sampling layers L is reached, ensuring that the model can fully utilize the structured information in the knowledge graph.

[0017] Through hierarchical kernel sampling, we significantly reduced the amount of computation required by the model during reasoning. At the same time, the introduction of sparse negative sampling, which uses different sampling strategies according to the density of the entity, further improves the quality of model training. In addition, the deep information aggregation capability of the graph neural network enhances the model's in-depth understanding of complex relationships in the knowledge graph. The fusion of these technologies enables the knowledge representation model to accurately score all potential answer entities and accurately predict the entity with the highest score as the final answer after receiving multiple rounds of updated entity and query relationships. This process not only improves the accuracy of knowledge reasoning, but also improves the efficiency of the reasoning process. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 Shown is a flow chart of a knowledge graph representation learning and reasoning method provided by an embodiment of the present invention; Figure 2 FIG. 4 is a schematic diagram of hierarchical kernel sampling provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0019] The technical solution of the present invention is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present invention and the specific features in the embodiments are detailed descriptions of the technical solution of the present invention, rather than limitations on the technical solution of the present invention. The embodiments of the present invention and the technical features in the embodiments may be combined with each other unless there is a conflict.

[0020] The term "and / or" is only a description of the association relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " generally indicates that the related objects are in an "or" relationship.

[0021] In the knowledge graph, an entity is one of the basic elements that make up a triple, and together with a relationship and another entity, it expresses a fact. Each triple consists of a head entity, a relationship, and a tail entity, forming a "(subject, predicate, object)" structure. The head entity represents the subject or question of the query, the relationship describes the connection between the head entity and the tail entity, and the tail entity is the object associated with the head entity.

[0022] An entity can be a person, a place, an organization, or any concrete or abstract concept. For example, "someone" as the head entity, "is" as the relationship, and "physicist" as the tail entity together constitute a fact expressing a person's occupation.

[0023] In the process of knowledge representation learning, these entities and their relationships are converted into numerical vectors, allowing computers to analyze and process this information and reflect the semantic connections between entities. This representation method enables knowledge graphs to support a variety of AI applications, such as intelligent question answering and recommendation systems.

[0024] In addition, in order to optimize the process of knowledge representation learning, the strategy of selecting core entities in the knowledge graph is set by setting the probability threshold P and the number of sampling layers L. The probability threshold P determines when the sampling process ends, while the number of sampling layers L determines the depth of sampling, that is, the hierarchical range of entities considered in the knowledge graph. In this way, we can focus on entities that are more important or central in the graph, thereby improving the performance and efficiency of the model. Example 1

[0025] See also Figure 1 This embodiment introduces a knowledge graph representation learning and reasoning method, including: Step S1: Select a central entity related to the user query and all neighbor entities connected to the central entity through a query relationship from the knowledge graph; wherein the knowledge graph includes a plurality of entities; Step S2: Calculate the probability value of each neighbor entity associated with the central entity, and sort the probability values ​​from large to small, starting from the neighbor entity with the largest probability value and gradually accumulating them until the total accumulated probability value reaches or exceeds the preset probability threshold P, and stop sampling the entities in the current layer; Specifically, step S21 calculates the correlation value between the neighbor entity and the query relationship and the central entity. The expression of the correlation value is: ; in, represents the correlation value; Represents the layer-level central entity Embedding Represents the layer-level neighbor entity Embedding Represents a query relationship; Step S22: normalize all calculated correlation values ​​to convert the correlation values ​​into probability values ​​associated with the central entity.

[0026] Specifically, the calculated correlation values ​​are different. In order to facilitate the use of these values ​​in subsequent probability distribution calculations, normalization processing is required, that is, the correlation values ​​are adjusted to a predetermined range, such as [0, 1], so that the values ​​are comparable.

[0027] The normalized relevance value is converted into a probability distribution, which means that the relevance value of each entity can be regarded as a probability value, and the entity has the possibility of becoming the answer entity. In the probability distribution, the sum of the probability values ​​of all entities is equal to 1.

[0028] Furthermore, the normalized correlation value is converted into the probability distribution expression:

[0029] Among them, j represents the index of all neighbor entities; N represents the total number of neighbor entities.

[0030] Step S3: Aggregate the information contained in the neighbor entities into the connected central entity using a graph neural network to update each entity; When updating an entity, instead of simply merging the information of neighbor entities, an attention mechanism is introduced to determine the contribution of each neighbor entity to the current entity.

[0031] Specifically, the step of aggregating the information of the neighbor entities to the connected central entity includes: Step S31: weight the information contained in the neighbor entity based on the attention mechanism to obtain the weight of the neighbor entity.

[0032] The attention mechanism assigns a weight to each neighbor entity, which reflects the importance of the neighbor entity to the current entity, and the neighbor entity with a larger weight has a greater impact on the update of the current entity. The information of the neighbor entity will be weighted and aggregated according to the weight, and when updating the current entity, the neighbor entity information with a larger weight will be given priority.

[0033] Furthermore, the expression of weight is: ; ; in, Represents the weight value of the neighbor entity; represents the activation function; represents the learnable parameter matrix; Represents a vector concatenation operation; Indicates that the central entity is Representation of layers; Indicates that the neighbor entity is Representation of layers; Indicates that the current center entity and neighbor entities are Relationship representation of layers; represents a learnable bias; represents the weight of the neighbor entity; A learnable parameter matrix representing the neighbor entities; represents the parameterized bias.

[0034] Step S32: weighted aggregation is performed again according to the weights of the neighbor entities to integrate the information of all neighbor entities connected to each central entity, and the integrated neighbor entity information is aggregated into the central entity of the entity to update the current entity.

[0035] Specifically, after information propagation using graph neural networks, each central entity receives information from its neighboring entities and aggregates the central entity's own representation (i.e., the current vector representation) with the representation of its neighboring entities. Through the aggregation operation, the entity representation will be updated so that the new representation of each entity will comprehensively consider its own information as well as the information of its neighbors, thereby providing a more comprehensive perspective.

[0036] The updated entity representations will be used in subsequent model training and optimization steps, as well as the final knowledge reasoning task.

[0037] Furthermore, the expression for updating the current entity is: ; ; in, represents the information representation of neighbor entities after weighted aggregation; R represents the number of relationships; represents a trainable parameter matrix; a representation of the updated entity; Represents an aggregate function; A representation that represents the current central entity.

[0038] Step S4, see Figure 2 , repeat sampling and updating the entities of each layer (i.e. repeat steps S1 to S3) until the preset number of sampling layers L is reached; It should be noted that the sampling and updating of each layer are performed independently, and each layer may introduce new neighbor entities.

[0039] In a further embodiment of the present invention, the entity information update is completed by aggregating its own representation and the representation of neighbor entities, but relying solely on this to update the entity representation may lead to overfitting, so it is necessary to introduce negative samples when training the knowledge representation model to improve the generalization ability.

[0040] Specifically, the training process of the knowledge representation model includes: Step S61: Use a negative sampling strategy to evaluate and calculate the neighbor connection density between each central entity and its neighbor entities, and divide the entities into dense entities and sparse entities according to the neighbor connection density; When training a knowledge representation model, in addition to using entities that already exist in the knowledge graph (positive samples), negative samples (i.e. randomly generated entities that do not exist in the knowledge graph) are also used to improve the model's ability to distinguish. The negative sampling strategy is a method of selecting different negative sampling strategies based on the connection density of entities in the knowledge graph; According to the connection density of entities in the knowledge graph, that is, the neighbor connection density between a central entity and its neighbor entities, entities are classified into dense entities and sparse entities.

[0041] Specifically, the expression of the neighbor connection density between each central entity and the neighbor entities is: ; in, Represents the neighbor connection density between a single central entity and its neighbor entities; Represents the number of connections between a single central entity and its neighbor entities; Indicates the number of neighbor entities connected to a single central entity.

[0042] Furthermore, the method for determining the entity type includes: Step S611: compare the neighbor connection density between the current central entity and the neighbor entities with the average neighbor connection density of the preset knowledge graph to determine whether the current entity is dense.

[0043] Specifically, the expression of the average neighbor connection density of the knowledge graph is: ; in, represents the average neighbor connection density of the knowledge graph; N represents the total number of entities in the knowledge graph; Represents the neighbor connection density of the i-th entity.

[0044] Step S612: If the neighbor connection density between the current central entity and the neighbor entities is higher than the average neighbor connection density of the preset knowledge graph, the current entity is a dense entity; if the neighbor connection density between the current central entity and the neighbor entities is lower than the average neighbor connection density of the preset knowledge graph, the current entity is a sparse entity.

[0045] Step S62: Determine different negative sampling strategies according to dense entities and sparse entities, and generate negative samples; wherein, dense entity sampling is based on a sampling strategy based on similarity, selecting entities (positive samples) in the feature space that are similar to existing entities in the knowledge graph as negative samples, while sparse entities adopt a random sampling strategy, selecting entities randomly determined in the feature space as negative samples; Through the negative sampling strategy, the knowledge representation model not only learns the features of positive samples, but also learns the features that should not be matched through negative samples.

[0046] Step S63: train the knowledge representation model based on the generated negative samples and the existing entities in the knowledge graph, optimize the parameters of the model using a loss function, evaluate the performance of the model, and adjust the model parameters based on the evaluation results.

[0047] Furthermore, the loss function expression involving all samples, including positive samples and negative samples, is: ; Where L represents the result of the loss function; i represents the index of the sample in the loss function; represents the score of negative samples, that is, the score assigned to entities that are randomly generated by the knowledge representation model and do not exist in the knowledge graph; Represents the score assigned to the existing entities (positive samples) in the knowledge graph; represents a hyperparameter that controls the sensitivity of the difference between positive and negative sample scores.

[0048] Specifically, the loss function is used to calculate the difference between each existing entity (positive sample) and the negative sample in the knowledge graph. If the score of the negative sample is higher than the score of the positive sample, the loss function will penalize the model, causing the model to adjust its parameters to increase the gap between the positive and negative sample scores.

[0049] It should be noted that the size of the penalty is related to the difference between the positive and negative sample scores plus the margin. Through this loss function, the model learns to assign higher scores to positive samples while keeping the scores of negative samples low, thereby improving the model's reasoning ability, that is, obtaining a trained knowledge representation model.

[0050] Step S5: input the updated entity into the trained knowledge representation model and output the predicted answer entity; wherein the knowledge representation model scores the possible entities in the knowledge graph and selects the entity with the highest score as the final predicted answer entity.

[0051] In the process of knowledge representation learning, a triple can be represented as (head entity , query relationship , tail entity In a further embodiment of the present invention, when a user raises a query, the query may only contain a question entity and a query relationship, but lack an answer entity, thereby forming an incomplete triple (question entity ,relation ,? ), in order to accurately predict the answer entity, the incomplete triples are input into the trained knowledge representation model. The model will score all possible tail entities in the knowledge graph based on the sampled and updated entity representations. The model uses a certain model to calculate the scores by using the embedding vectors of entities and relations to evaluate the rationality or possibility of each possible triple. Among all the scored triples, the triple with the highest score is selected, and its head entity That is, the central entity and the tail entity This is the answer entity predicted by the model.

[0052] Example 2 It should be noted that the application scenarios demonstrate the key role of entities in the knowledge graph. They not only help the system understand the specific content of user queries, but also provide users with richer and more personalized services through the relationships between entities.

[0053] For example, in an intelligent question-answering system, accurate questions and answers can be provided through the understanding of entities and relationships. For example, when a user queries "Which museum is the painting "Mona Lisa" collected in?", the intelligent question-answering system uses the information stored in the knowledge graph to identify that "Mona Lisa" is a head entity (central entity), "collection" is a query relationship, and "museum" is a tail entity. The intelligent question-answering system can retrieve the connection between "Mona Lisa" and "Louvre" through entities and the relationship between entities, and input (Mona Lisa, collection, Louvre Museum) into the knowledge representation model, thereby informing the user that the painting is collected in the Louvre Museum in Paris, France.

[0054] In a recommendation system, the use of entities can provide personalized recommendations. Suppose a user often listens to a certain artist on a music streaming service platform. The system will identify this artist as an entity and recommend other music works or artists that other users may be interested in based on the user's historical preferences and the relationship between similar artists. For example, if a user likes "The Beatles", the system may recommend music by "The Rolling Stones" because the two entities are related in terms of musical style and era background, and they may share similar relationships and attributes in the knowledge graph.

[0055] Example 3 A knowledge graph representation learning reasoning system, comprising: An acquisition module, used to select a central entity related to a user query and all neighbor entities connected to the central entity through a query relationship from the knowledge graph; wherein the knowledge graph includes a plurality of entities; A layer sampling module is used to calculate the probability value of each neighbor entity associated with the central entity, and sort the probability values ​​in descending order, starting from the neighbor entity with the largest probability value and gradually accumulating them until the total accumulated probability value exceeds a preset probability threshold P, and then stop sampling entities in the current layer; An updating module, configured to aggregate the information contained in the neighbor entities into the connected central entity using a graph neural network, so as to update each entity; An iterative control module, used for repeatedly sampling and updating entities of each layer until a preset number of sampling layers L is reached; A prediction module is used to input the updated entity into the trained knowledge representation model and output the predicted answer entity; wherein the knowledge representation model scores the possible entities in the knowledge graph and selects the entity with the highest score as the final predicted answer entity.

[0056] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present invention and the claims, which all fall within the protection of the present invention.

Claims

1. A knowledge graph representation learning and reasoning method, It is characterized in that include: Selecting a central entity related to the user query and all neighbor entities connected to the central entity through a query relationship from the knowledge graph; wherein the knowledge graph includes a plurality of entities; Calculate the probability value of each neighbor entity associated with the central entity, and sort the probability values ​​in descending order, starting from the neighbor entity with the largest probability value and gradually accumulating them until the total accumulated probability value exceeds the preset probability threshold P, and stop sampling the entities in the current layer; Aggregate the information contained in the neighbor entities into the connected central entity using a graph neural network to update each entity; Repeat sampling and updating the entities of each layer until the preset number of sampling layers L is reached; The updated entities and query relations are input into the trained knowledge representation model, and the predicted answer entity is output; wherein the knowledge representation model scores the possible entities in the knowledge graph, and selects the entity with the highest score as the final predicted answer entity.

2. The knowledge graph representation learning and reasoning method according to claim 1, It is characterized in that The calculating the probability value of each neighbor entity being associated with the central entity comprises: Calculating the correlation value between the neighbor entity and the query relationship and the central entity; The relevance value is normalized to convert the relevance value into a probability value associated with the central entity.

3. The knowledge graph representation learning and reasoning method according to claim 2, It is characterized in that The expression of the correlation value between the neighbor entity and the query relationship and the central entity is: ; in, represents the correlation value; Represents the layer-level central entity Embedding Represents the layer-level neighbor entity Embedding Represents a query relationship; The calculation expression of the probability value is: ; Where j represents the index of all neighbor entities; N represents the total number of neighbor entities; Represents the probability value.

4. The knowledge graph representation learning and reasoning method according to claim 1, It is characterized in that The aggregating the information contained in the neighbor entities into the connected central entity by using the graph neural network includes: The information contained in the neighbor entity is weightedly aggregated based on the attention mechanism to obtain the weight of the neighbor entity. The expression of the weight is: ; ; in, Represents the weight value of the neighbor entity; represents the activation function; represents the learnable parameter matrix; Represents a vector concatenation operation; Indicates that the central entity is Representation of layers; Indicates that the neighbor entity is Representation of layers; Indicates that the current center entity and neighbor entities are Relationship representation of layers; represents a learnable bias; represents the weight of the neighbor entity; A learnable parameter matrix representing the neighbor entities; represents the parameterized bias; Weighted aggregation is performed again according to the weights of the neighbor entities to integrate the information contained in all neighbor entities connected to each central entity, and the integrated information of the neighbor entities is aggregated into the central entity of the entity itself to update the current entity.

5. The knowledge graph representation learning and reasoning method according to claim 4, It is characterized in that The expression for updating the current entity is: ; ; in, represents the information representation of neighbor entities after weighted aggregation; R represents the number of relationships; represents a trainable parameter matrix; a representation of the updated entity; Represents an aggregate function; A representation that represents the current central entity.

6. The knowledge graph representation learning and reasoning method according to claim 1, It is characterized in that The training process of the knowledge representation model includes: The negative sampling strategy is used to evaluate and calculate the neighbor connection density between each central entity and the neighbor entity. The expression of the neighbor connection density is: ; in, Represents the neighbor connection density between a single central entity and its neighbor entities; Represents the number of connections between a single central entity and its neighbor entities; Indicates the number of neighbor entities connected to a single central entity; According to the neighbor connection density, the entities are classified according to type into dense entities and sparse entities, and different negative sampling strategies are determined according to different types, and negative samples are generated; wherein the dense entity sampling is based on a sampling strategy of similarity, and entities similar to existing entities in the knowledge graph in the feature space are selected as negative samples; the sparse entity adopts a random sampling strategy, and entities randomly determined in the feature space are selected as negative samples; The knowledge representation model is trained based on the generated negative samples and the existing entities in the knowledge graph, and the parameters of the model are optimized using a loss function, and the performance of the model is evaluated, and the parameters of the model are adjusted based on the evaluation results.

7. The knowledge graph representation learning and reasoning method according to claim 6, It is characterized in that The entities are classified by type according to the neighbor connection density, including: Compare the neighbor connection density between the current central entity and the neighbor entities with the average neighbor connection density of the preset knowledge graph to determine whether the current entity is dense; If the neighbor connection density between the current central entity and the neighbor entities is higher than the average neighbor connection density of the preset knowledge graph, the current entity is a dense entity; if the neighbor connection density between the current central entity and the neighbor entities is lower than the average neighbor connection density of the preset knowledge graph, the current entity is a sparse entity.

8. The knowledge graph representation learning and reasoning method according to claim 7, It is characterized in that The expression of the average neighbor connection density of the preset knowledge graph is: ; in, represents the average neighbor connection density of the knowledge graph; N represents the total number of entities in the knowledge graph; Represents the neighbor connection density of the i-th entity.

9. The knowledge graph representation learning and reasoning method according to claim 6, It is characterized in that The expression of the loss function is: ; Where L represents the result of the loss function; i represents the index of the sample in the loss function; Represents the score of negative samples; Indicates the score of existing entities in the knowledge graph; Represents a hyperparameter.

10. A knowledge graph representation learning reasoning system, It is characterized in that include: An acquisition module, used to select a central entity related to a user query and all neighbor entities connected to the central entity through a query relationship from the knowledge graph; wherein the knowledge graph includes a plurality of entities; A layer sampling module is used to calculate the probability value of each neighbor entity associated with the central entity, and sort the probability values ​​in descending order, starting from the neighbor entity with the largest probability value and gradually accumulating them until the total accumulated probability value exceeds a preset probability threshold P, and then stop sampling entities in the current layer; An updating module, configured to aggregate the information contained in the neighbor entities into the connected central entity using a graph neural network, so as to update each entity; An iterative control module, used for repeatedly sampling and updating entities of each layer until a preset number of sampling layers L is reached; A prediction module is used to input the updated entities and query relations into the trained knowledge representation model and output the predicted answer entity; wherein the knowledge representation model scores the possible entities in the knowledge graph and selects the entity with the highest score as the final predicted answer entity.