Dynamic knowledge graph prediction method and device, electronic equipment and storage medium

By constructing a graph model to extract and encode implicit relationships in historical event corpora, the problem of undiscovered implicit relationships in dynamic knowledge graphs is solved, thus improving the accuracy and dynamism of knowledge graphs.

CN116796001BActive Publication Date: 2025-12-05INST OF AUTOMATION CHINESE ACAD OF SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310628310.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-30
Publication Date
2025-12-05
Estimated Expiration
2043-05-30

AI Technical Summary

Technical Problem

The dynamic knowledge graphs constructed in the existing technology cannot effectively extract the implicit relationships between entities, resulting in insufficient accuracy and affecting their application effect.

Method used

The model is constructed using a graph, which includes a structural encoder, a latent relation extraction module, a relation encoding module, and an entity temporal representation module. By acquiring historical event corpora, latent relations are extracted and encoded to construct a knowledge graph for the current moment, which includes existing and latent relationships of entities.

Benefits of technology

It improves the accuracy of knowledge graphs, making them more effective in applications, and maintains dynamism through continuous updates, achieving accurate dynamic predictions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116796001B_ABST
    Figure CN116796001B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of natural language processing, and provides a dynamic knowledge graph prediction method and device, electronic equipment and a storage medium, the method acquires historical event corpus; the historical event corpus is input into a graph construction model to obtain a knowledge graph at a current time. The graph construction model realizes extraction and coding of implied relationships in the historical event corpus through an implied relationship extraction module and a relationship coding module, obtains the knowledge graph at the current time through an entity time sequence representation module, so that the obtained knowledge graph not only contains relationship information of each entity that already exists in the historical event corpus, but also contains the association relationship of each entity implied in the historical event corpus, the accuracy of the knowledge graph is higher, and the subsequent application effect of the knowledge graph is better. Moreover, through continuous updating of the historical event corpus, accurate dynamic prediction of the knowledge graph can be realized. The application has been subsidized by a national key research and development plan project (2019YQ1601).
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing technology, and in particular to a dynamic knowledge graph prediction method, apparatus, electronic device, and storage medium. Background Technology

[0002] Traditional knowledge graphs (KGs) represent various entities and relationships in the real world in a structured way as multi-relational data and are applied to various downstream tasks, such as information retrieval, dialogue systems, reading comprehension, and healthcare. However, events in the real world are often changing, and the semantics of many entities and relationships often evolve over time. Therefore, dynamic knowledge graphs have been proposed and widely used.

[0003] Dynamic knowledge graphs are primarily constructed by extracting important entities and relationships from text corpora at different times using extraction algorithms and tools. Due to limitations in the construction algorithms or tools, only the apparent relationships between entities can be extracted, and many important implicit relationships remain undiscovered. This leads to a lack of connections between entities, which to some extent limits the accuracy of dynamic knowledge graphs and consequently affects their accurate application.

[0004] Therefore, there is an urgent need to provide a dynamic knowledge graph prediction method to solve the problem of inaccurate dynamic knowledge graphs constructed in existing technologies. Summary of the Invention

[0005] This invention provides a dynamic knowledge graph prediction method, apparatus, electronic device, and storage medium to address the deficiencies in the prior art.

[0006] This invention provides a dynamic knowledge graph prediction method, comprising:

[0007] Obtain historical event corpora;

[0008] The historical event corpus is input into the graph construction model to obtain the knowledge graph of the current moment output by the graph construction model;

[0009] The graph construction model includes a structural encoder, a latent relation extraction module, a relation encoding module, and an entity temporal representation module. The graph construction model is trained based on event corpus samples.

[0010] The structural encoder is used to extract the entities and the relationship information between them at each historical moment in the historical event corpus. Based on the entities and the relationship information, the knowledge graph at each historical moment is determined, and the knowledge graph at each historical moment is structurally encoded to obtain the feature representation of each entity at each historical moment.

[0011] The implicit relationship extraction module is used to calculate the first association relationship between entities at each historical moment and the second association relationship between entities at any two historical moments based on the feature representation of each entity at each historical moment, and to construct an entity association relationship graph based on the first association relationship and the second association relationship.

[0012] The relation encoding module is used to encode the entity association graph to obtain the neighbor representation of each entity in the entity association graph;

[0013] The entity temporal representation module is used to extract the temporal representation of each entity at the current moment based on the feature expression of each entity at each historical moment and the neighbor representation of each entity in the entity association graph, and to construct the knowledge graph at the current moment based on the temporal representation of each entity at the current moment.

[0014] According to a dynamic knowledge graph prediction method provided by the present invention, based on the feature representation of each entity at each historical moment, the method calculates a first association relationship between entities at each historical moment and a second association relationship between entities at any two historical moments, including:

[0015] Based on the feature representation of each entity at each historical moment, calculate the first association relationship between every two entities for which the relationship information does not exist at each historical moment, and the second association relationship between every two entities for which the relationship information does not exist at any two historical moments.

[0016] According to the present invention, a dynamic knowledge graph prediction method is provided, which constructs an entity relationship graph based on the first association relationship and the second association relationship, including:

[0017] Perform a sparsification operation on the first association relationship to obtain the first sparsification operation result;

[0018] Perform a sparsification operation on the second association relationship to obtain the second sparsification operation result;

[0019] Based on the results of the first sparsification operation and the second sparsification operation, the entity association graph is constructed.

[0020] According to the present invention, a dynamic knowledge graph prediction method is provided, wherein the relation encoding module is a relational graph neural network based on an attention mechanism;

[0021] Encoding the entity association graph yields neighbor representations for each entity in the graph, including:

[0022] Calculate the attention coefficient between adjacent entities in the entity association graph;

[0023] Based on the attention coefficient, the relationship representations between entities in the entity association graph are aggregated to obtain the neighbor representations of each entity in the entity association graph.

[0024] According to a dynamic knowledge graph prediction method provided by the present invention, the temporal representation includes global temporal representation and local temporal representation;

[0025] Based on the feature representations of each entity at each historical moment and the neighbor representations of each entity in the entity association graph, the temporal representations of each entity at the current moment are extracted, including:

[0026] The feature representations of each entity at each historical moment are encoded to obtain the local temporal representations of each entity at the current moment.

[0027] The neighbor representations of each entity in the entity association graph are encoded to obtain the global temporal representation of each entity at the current time.

[0028] According to the present invention, a dynamic knowledge graph prediction method is provided, which constructs a knowledge graph at the current time based on the temporal representation of each entity at the current time, including:

[0029] Based on the gating module, the local temporal representations of each entity at the current time and the global temporal representations of each entity at the current time are fused to obtain the fusion result of each entity at the current time.

[0030] Based on the fusion results, a knowledge graph for the current moment is constructed.

[0031] According to a dynamic knowledge graph prediction method provided by the present invention, based on the feature representation of each entity at each historical moment, the method calculates a first association relationship between entities at each historical moment and a second association relationship between entities at any two historical moments, including:

[0032] Based on the feature representation of each entity at each historical moment, the cosine similarity metric function is used to calculate the first association between entities at each historical moment and the second association between entities at any two historical moments.

[0033] The present invention also provides a dynamic knowledge graph prediction device, comprising:

[0034] The corpus acquisition module is used to acquire historical event corpora.

[0035] The graph prediction module is used to input the historical event corpus into the graph construction model to obtain the knowledge graph of the current moment output by the graph construction model.

[0036] The graph construction model includes a structural encoder, a latent relation extraction module, a relation encoding module, and an entity temporal representation module. The graph construction model is trained based on event corpus samples.

[0037] The structural encoder is used to extract the entities and the relationship information between them at each historical moment in the historical event corpus. Based on the entities and the relationship information, the knowledge graph at each historical moment is determined, and the knowledge graph at each historical moment is structurally encoded to obtain the feature representation of each entity at each historical moment.

[0038] The implicit relationship extraction module is used to calculate the first association relationship between entities at each historical moment and the second association relationship between entities at any two historical moments based on the feature representation of each entity at each historical moment, and to construct an entity association relationship graph based on the first association relationship and the second association relationship.

[0039] The relation encoding module is used to encode the entity association graph to obtain the neighbor representation of each entity in the entity association graph;

[0040] The entity temporal representation module is used to extract the temporal representation of each entity at the current moment based on the feature expression of each entity at each historical moment and the neighbor representation of each entity in the entity association graph, and to construct the knowledge graph at the current moment based on the temporal representation of each entity at the current moment.

[0041] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the dynamic knowledge graph prediction method as described above.

[0042] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the dynamic knowledge graph prediction method as described above.

[0043] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the dynamic knowledge graph prediction method as described above.

[0044] This invention provides a dynamic knowledge graph prediction method, apparatus, electronic device, and storage medium. The method first acquires historical event corpora; then, it inputs these corpora into a knowledge graph construction model to obtain the knowledge graph at the current moment. This graph construction model extracts and encodes implicit relationships from the historical event corpora through an implicit relationship extraction module and a relationship encoding module. Subsequently, it obtains the knowledge graph at the current moment through an entity temporal representation module. This results in a knowledge graph that not only contains existing relationship information of entities in the historical event corpora but also includes implicit relationships between entities, leading to higher accuracy and better subsequent applications. Furthermore, continuous updates to the historical event corpora ensure timely updates to the obtained knowledge graph, enabling accurate dynamic prediction of the dynamic knowledge graph. Attached Figure Description

[0045] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on the drawings described below without creative effort.

[0046] Figure 1 This is a flowchart illustrating the dynamic knowledge graph prediction method provided by the present invention;

[0047] Figure 2 This is a schematic diagram of the graph construction model in the dynamic knowledge graph prediction method provided by the present invention;

[0048] Figure 3 This is a schematic diagram of the structure of the dynamic knowledge graph prediction device provided by the present invention;

[0049] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0050] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0051] The terms "first" and "second" in the specification of this invention may explicitly or implicitly include one or more of the features. In the description of the invention, unless otherwise stated, "a plurality of" means two or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0052] In existing technologies, due to limitations in construction algorithms or tools, implicit relationships between entities cannot be extracted, which to some extent limits the accuracy of dynamic knowledge graphs and thus affects their accurate application. Therefore, this invention provides a dynamic knowledge graph prediction method.

[0053] Figure 1 This is a flowchart illustrating a dynamic knowledge graph prediction method provided in an embodiment of the present invention, such as... Figure 1 As shown, the method includes:

[0054] S1, Obtain historical event corpus;

[0055] S2, input the historical event corpus into the graph construction model to obtain the knowledge graph of the current moment output by the graph construction model;

[0056] The graph construction model includes a structural encoder, a latent relation extraction module, a relation encoding module, and an entity temporal representation module. The graph construction model is trained based on event corpus samples.

[0057] The structural encoder is used to extract the entities and the relationship information between them at each historical moment in the historical event corpus. Based on the entities and the relationship information, the knowledge graph at each historical moment is determined, and the knowledge graph at each historical moment is structurally encoded to obtain the feature representation of each entity at each historical moment.

[0058] The implicit relationship extraction module is used to calculate the first association relationship between entities at each historical moment and the second association relationship between entities at any two historical moments based on the feature representation of each entity at each historical moment, and to construct an entity association relationship graph based on the first association relationship and the second association relationship.

[0059] The relation encoding module is used to encode the entity association graph to obtain the neighbor representation of each entity in the entity association graph;

[0060] The entity temporal representation module is used to extract the temporal representation of each entity at the current moment based on the feature expression of each entity at each historical moment and the neighbor representation of each entity in the entity association graph, and to construct the knowledge graph at the current moment based on the temporal representation of each entity at the current moment.

[0061] Specifically, the dynamic knowledge graph prediction method provided in this embodiment of the invention can be executed by an electronic device, a component within the electronic device, an integrated circuit, or a chip. The electronic device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, and smart wearable devices, while non-mobile electronic devices can be servers, network-attached storage devices, and personal computers, etc., without specific limitations here.

[0062] First, execute step S1 to obtain historical event corpus. This historical event corpus can be dialogue corpus, knowledge question and answer related corpus, or belong to the general knowledge domain. The historical event corpus can be obtained from corpora such as news events and Wikipedia.

[0063] After obtaining the historical event corpus, the historical event corpus can be cleaned. The cleaning method can be to remove outliers, which can include abnormal event data and abnormal entities.

[0064] Then, step S2 is executed, where the historical event corpus is input into the knowledge graph construction model, and the knowledge graph for the current moment is constructed using the knowledge graph construction model. The construction process of this knowledge graph is dynamic, that is, as time goes by, the event corpus of the current moment becomes the historical event corpus for the next moment, and thus the knowledge graph for the next moment can be constructed using the historical event corpus at this time.

[0065] like Figure 2 As shown, the graph construction model may include a structure encoder, a hidden relation extraction module, a relation encoding module, and an entity temporal representation module. The structure encoder, the hidden relation extraction module, the relation encoding module, and the entity temporal representation module are connected in sequence, and the structure encoder is connected to the entity temporal representation module.

[0066] The historical event corpus is input into a structural encoder. The encoder extracts information about entities and their relationships at each historical moment. Using this information, a knowledge graph for each historical moment is determined. This knowledge graph is then structurally encoded to obtain the feature representations of each entity at that moment. Entities can include time, geographical location, object name, person name, organization / institution name, character value, monetary value, etc. The relationships between entities are the representational relationships directly expressed in the historical event corpus.

[0067] Here, the calculation formula for the structure encoder can be:

[0068]

[0069] The structure encoder may include multiple layers, where l is the layer number of the structure encoder. For t i The output of entity s at the (l+1)th layer of the structural encoder, where s refers to a specific entity. For t i The time-matter entity s is the output of the l-th layer of the structure encoder, and f is the processing function of the (l+1)-th layer of the structure encoder. For t i The entity e at time s The set of neighboring entities, e s For a specific entity, e o For t i Divide e at time s Other specific entities besides s, o generally refers to any other entity besides s. For t i The output of entity o at time step l of the structure encoder, x r R is a vector representation of the relationship information between entity s and entity o, and W1 and W2 are learnable parameter matrices, respectively.

[0070] t i The output of each entity at time t in the last layer of the structural encoder is t. i The characteristic representation of each entity at any given time.

[0071] The feature representations of each entity at each historical moment are input into the implicit relationship extraction module, which can automatically discover the important implicit relationships between different entities, calculate the first relationship between each entity at each historical moment and the second relationship between each entity at any two historical moments.

[0072] Here, both the first and second associations represent the implicit relationships between entities. It can be understood that the first association is the implicit relationship between entities within each time slice, while the second association is the implicit relationship between entities across time slices.

[0073] Both the first and second association relationships can be measured by using the cosine similarity function to assess the strength of similarity between entities. The first association relationship can be represented by a first similarity matrix, and the second association relationship can be represented by a second similarity matrix. The cosine similarity function can be expressed as:

[0074]

[0075] Where d(x,y) represents the similarity matrix between variable matrices x and y, T represents the matrix transpose, and W3, W4 ∈ R d×d Here are the learnable weight parameters, and d is a constant.

[0076] Subsequently, an entity relationship graph is constructed using the first and second association relationships with similarity greater than 0. This entity relationship graph only considers the implicit relationships between entities and does not consider the relationship information that already exists between entities in the historical event corpus.

[0077] The entity association graph is input into the relation encoding module, which encodes the graph to obtain the neighbor representations of each entity. To fully utilize the newly learned implicit relationships, the relation encoding module can be a relational graph neural network based on an attention mechanism. Furthermore, when encoding the entity association graph, the attention coefficients between adjacent entities in the graph can be calculated using the following formula:

[0078]

[0079] Where, α ij Let l be the attention coefficient between entity i and entity j, when l = 0. The feature representation of entity i output by the structure encoder. and These are the outputs of the l-th layer of the implicit relation extraction module. To characterize the relationship between entity i and entity j, To characterize the relationship between entity i and entity k, This indicates that entity i is in the entity relationship graph. The set of neighboring entities in R, a∈R 3d and is the learnable parameter matrix in each layer of the relational encoding module, f(·) is the LeakyReLU activation function, and || is the vector concatenation operation.

[0080] Then, using the attention coefficient, the relationship representations between entities in the entity association graph are aggregated to obtain the neighbor representations of each entity in the entity association graph. That is:

[0081]

[0082] in, Let g(·) be the neighbor representation of entity i, i.e., the output of the l-th layer of the relational encoding module, g(·) be the ReLU activation function, and W6 and W7 be the parameter matrices of each layer in the relational encoding module.

[0083] The feature representations of each entity at each historical moment output by the structural encoder and the neighbor representations of each entity in the entity association graph output by the relation encoding module are both input into the entity temporal representation module. The temporal representation module can then extract the temporal representation of each entity at the current moment. The entity temporal representation module can be a gated recurrent network.

[0084] The temporal representation of each entity at the current moment can include both global and local temporal representations. The global temporal representation can reflect the global temporal information of each entity, while the local temporal representation can reflect the semantic changes of each entity in the recent period.

[0085] Therefore, when extracting the temporal representation of each entity at the current moment, the feature representation of each entity at each historical moment can be encoded to obtain the local temporal representation of each entity at the current moment. This process can be represented by the following formula:

[0086]

[0087] in, This is the local temporal representation of entity s at time t+1. h is the local temporal representation of entity s at time t. s,t It is the feature representation of entity s at time t.

[0088] Encode the neighbor representations of each entity in the entity association graph to obtain the global temporal representation of each entity at the current time.

[0089] This process can be represented by the following formula:

[0090]

[0091] in, Let be the global temporal representation of entity s at time t+1. Let z be the global temporal representation of entity s at time t. s,t It is the neighbor representation of entity s in the entity association graph at time t.

[0092] Subsequently, the knowledge graph for the current time step is constructed using the temporal representations of each entity at the current time step. This process can utilize the gating module in a gated recurrent network to fuse the local and global temporal representations of each entity at the current time step, obtaining the fused result of each entity at the current time step. This fused result is then used to construct the knowledge graph for the current time step. The fused result of each entity at the current time step can be represented by the following formula:

[0093]

[0094] Among them, e s,t+1 For the fusion result of entity s at time t+1, g e ∈R d It is a learnable gated vector.

[0095] The dynamic knowledge graph prediction method provided in this embodiment of the invention first acquires historical event corpora; then, it inputs the historical event corpora into a knowledge graph construction model to obtain the knowledge graph at the current moment. This knowledge graph construction model extracts and encodes implicit relationships in the historical event corpora through an implicit relationship extraction module and a relationship encoding module, and then obtains the knowledge graph at the current moment through an entity temporal representation module. This results in a knowledge graph that not only contains existing relationship information of each entity in the historical event corpora but also includes implicit relationships between entities in the historical event corpora, leading to higher accuracy and better subsequent applications. Furthermore, continuous updates to the historical event corpora ensure timely updates to the obtained knowledge graph, enabling accurate dynamic prediction of the dynamic knowledge graph.

[0096] Based on the above embodiments, the dynamic knowledge graph prediction method provided in this embodiment of the invention calculates the first association relationship between entities at each historical moment and the second association relationship between entities at any two historical moments based on the feature representation of each entity at each historical moment, including:

[0097] Based on the feature representation of each entity at each historical moment, calculate the first association relationship between every two entities for which the relationship information does not exist at each historical moment, and the second association relationship between every two entities for which the relationship information does not exist at any two historical moments.

[0098] Specifically, in order to improve the calculation efficiency, when calculating the first and second association relationships, only the association relationships between entities that are not related in the knowledge graph at historical moments are calculated.

[0099] Therefore, by utilizing the feature representations of each entity at each historical moment, we can calculate the first association between every two entities that do not have relational information at each historical moment, i.e.:

[0100]

[0101] in, Indicates t p Knowledge graph of time Any two entities e i ,e j The first similarity matrix between them For t p Knowledge graph of time The number of entities in the data. For t p Knowledge graph of time Any two entities e i ,e j Similarity between them For t p Entity e at any moment i Feature representation, For t p Entity e at any moment j The characteristic expression of.

[0102] We can use the feature representations of each entity at each historical moment to calculate the occurrence of any two moments t. p and t q Two entities e that do not have relational information i ,e j The second relationship between them is:

[0103]

[0104] in, Indicates t p Knowledge graph of time Any entity and t q Knowledge graph of time The second similarity matrix between any two entities. Indicates t p Knowledge graph of time The i-th entity e i and t q Knowledge graph of time The j-th entity e j Similarity between them For t p Entity e at any moment i Feature representation, For t q Entity e at any moment j The characteristic expression of.

[0105] Based on the above embodiments, the dynamic knowledge graph prediction method provided in this embodiment of the invention constructs an entity association graph based on the first association relationship and the second association relationship, including:

[0106] Perform a sparsification operation on the first association relationship to obtain the first sparsification operation result;

[0107] Perform a sparsification operation on the second association relationship to obtain the second sparsification operation result;

[0108] Based on the results of the first sparsification operation and the second sparsification operation, the entity association graph is constructed.

[0109] Specifically, in order to preserve important relationships and reduce noise interference, sparsification operations are performed on the first and second relationships respectively to obtain the results of the first and second sparsification operations.

[0110] That is:

[0111]

[0112]

[0113] in, express The result of the first sparsification operation, express The result of the first sparsification operation, Represents the first similarity matrix The i-th row. Represents the second similarity matrix The result of the second sparsification operation, express The result of the second sparsification operation, Represents the second similarity matrix The i-th row. for Take the first k1 largest values ​​from the list. for The top k2 values ​​with the largest values ​​are selected, where k1 and k2 are constants. Here, each... Recorded t p Important implicit relationships in the knowledge graph of each moment, It records the important implicit relationships between entities that appear at different times.

[0114] Subsequently, using the results of the first and second sparsification operations, an entity association graph is constructed. when exist medium entity and Construct t between p The implicit relationship of time. When At that time, medium entity and This constructs implicit relationships across time points. It should be noted that this only applies to... The newly constructed implicit relationships are considered, but the relationship information that already exists in the historical event corpus is not considered.

[0115] Based on the above embodiments, the dynamic knowledge graph prediction method provided in this embodiment of the invention uses a graph construction model trained based on the following steps:

[0116] The event corpus samples were sorted by time, and 80%, 10%, and 10% of the data were used as the training set, validation set, and test set, respectively.

[0117] The training set is input into the initial model, which then automatically learns the graph construction function to obtain the construction result.

[0118] Using the construction results, the loss function value is calculated, and the structural parameters of the initial construction model are updated according to the loss function value until the initial construction model converges. At this point, the obtained structural parameters are optimized relative to the event corpus samples.

[0119] Based on the accuracy of the converged initial model in graph construction on the validation set, the initial model that performs best on the validation set is selected as the final trained graph construction model.

[0120] The trained graph construction model was tested on a test set to evaluate its accuracy and precision. In this embodiment, the datasets ICEWS14, ICEWS05-15, and ICEWS18 were used as test sets to test the graph construction model. The performance of the graph construction model was measured using MRR, HITS@1, and HITS@10 metrics. The test results are shown in Table 1. The graph construction model achieved good results on all three metrics.

[0121] Table 1. Model performance test results for different databases

[0122]

[0123] like Figure 3 As shown, based on the above embodiments, this embodiment of the invention provides a dynamic knowledge graph prediction device, including:

[0124] Corpus acquisition module 31 is used to acquire historical event corpus;

[0125] The graph prediction module 32 is used to input the historical event corpus into the graph construction model to obtain the knowledge graph of the current moment output by the graph construction model;

[0126] The graph construction model includes a structural encoder, a latent relation extraction module, a relation encoding module, and an entity temporal representation module. The graph construction model is trained based on event corpus samples.

[0127] The structural encoder is used to extract the entities and the relationship information between them at each historical moment in the historical event corpus. Based on the entities and the relationship information, the knowledge graph at each historical moment is determined, and the knowledge graph at each historical moment is structurally encoded to obtain the feature representation of each entity at each historical moment.

[0128] The implicit relationship extraction module is used to calculate the first association relationship between entities at each historical moment and the second association relationship between entities at any two historical moments based on the feature representation of each entity at each historical moment, and to construct an entity association relationship graph based on the first association relationship and the second association relationship.

[0129] The relation encoding module is used to encode the entity association graph to obtain the neighbor representation of each entity in the entity association graph;

[0130] The entity temporal representation module is used to extract the temporal representation of each entity at the current moment based on the feature expression of each entity at each historical moment and the neighbor representation of each entity in the entity association graph, and to construct the knowledge graph at the current moment based on the temporal representation of each entity at the current moment.

[0131] Based on the above embodiments, the dynamic knowledge graph prediction device provided in this embodiment of the invention calculates a first association relationship between entities at each historical moment and a second association relationship between entities at any two historical moments based on the feature representation of each entity at each historical moment, including:

[0132] Based on the feature representation of each entity at each historical moment, calculate the first association relationship between every two entities for which the relationship information does not exist at each historical moment, and the second association relationship between every two entities for which the relationship information does not exist at any two historical moments.

[0133] Based on the above embodiments, the dynamic knowledge graph prediction device provided in this embodiment of the invention constructs an entity association graph based on the first association relationship and the second association relationship, including:

[0134] Perform a sparsification operation on the first association relationship to obtain the first sparsification operation result;

[0135] Perform a sparsification operation on the second association relationship to obtain the second sparsification operation result;

[0136] Based on the results of the first sparsification operation and the second sparsification operation, the entity association graph is constructed.

[0137] Based on the above embodiments, the dynamic knowledge graph prediction device provided in this embodiment of the invention has a relation encoding module that is a relational graph neural network based on an attention mechanism;

[0138] Encoding the entity association graph yields neighbor representations for each entity in the graph, including:

[0139] Calculate the attention coefficient between adjacent entities in the entity association graph;

[0140] Based on the attention coefficient, the relationship representations between entities in the entity association graph are aggregated to obtain the neighbor representations of each entity in the entity association graph.

[0141] Based on the above embodiments, the dynamic knowledge graph prediction device provided in this embodiment of the invention includes global temporal representation and local temporal representation in its temporal representation.

[0142] Based on the feature representations of each entity at each historical moment and the neighbor representations of each entity in the entity association graph, the temporal representations of each entity at the current moment are extracted, including:

[0143] The feature representations of each entity at each historical moment are encoded to obtain the local temporal representations of each entity at the current moment.

[0144] The neighbor representations of each entity in the entity association graph are encoded to obtain the global temporal representation of each entity at the current time.

[0145] Based on the above embodiments, the dynamic knowledge graph prediction device provided in this embodiment of the invention constructs the knowledge graph at the current time based on the temporal representation of each entity at the current time, including:

[0146] Based on the gating module, the local temporal representations of each entity at the current time and the global temporal representations of each entity at the current time are fused to obtain the fusion result of each entity at the current time.

[0147] Based on the fusion results, a knowledge graph for the current moment is constructed.

[0148] Based on the above embodiments, the dynamic knowledge graph prediction device provided in this embodiment of the invention calculates a first association relationship between entities at each historical moment and a second association relationship between entities at any two historical moments based on the feature representation of each entity at each historical moment, including:

[0149] Based on the feature representation of each entity at each historical moment, the cosine similarity metric function is used to calculate the first association between entities at each historical moment and the second association between entities at any two historical moments.

[0150] Specifically, the functions of each module in the dynamic knowledge graph prediction device provided in this embodiment of the invention correspond one-to-one with the operation flow of each step in the above method-like embodiments, and the achieved effects are also the same. For details, please refer to the above embodiments, and this will not be repeated in this embodiment of the invention.

[0151] Figure 4 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 4As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430, and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 can call logical instructions in the memory 430 to execute the dynamic knowledge graph prediction method provided in the above embodiments. The method includes: acquiring historical event corpus; inputting the historical event corpus into a knowledge graph construction model to obtain the knowledge graph of the current moment output by the knowledge graph construction model; wherein the knowledge graph construction model includes a structural encoder, a latent relation extraction module, a relation encoding module, and an entity temporal representation module, and the knowledge graph construction model is trained based on event corpus samples; the structural encoder is used to extract the entities and the relation information between entities at each historical moment in the historical event corpus, determine the knowledge graph of each historical moment based on the entities and the relation information, and perform structural encoding on the knowledge graph of each historical moment to obtain the knowledge graph of each historical moment. The system comprises: a feature representation of each entity at a given historical moment; a latent relation extraction module for calculating a first association between entities at each historical moment and a second association between entities at any two historical moments based on the feature representation of each entity at each historical moment, and constructing an entity association graph based on the first and second associations; a relation encoding module for encoding the entity association graph to obtain neighbor representations of each entity in the entity association graph; and an entity temporal representation module for extracting temporal representations of each entity at the current moment based on the feature representation of each entity at each historical moment and the neighbor representations of each entity in the entity association graph, and constructing a knowledge graph for the current moment based on the temporal representations of each entity at the current moment.

[0152] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0153] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the dynamic knowledge graph prediction method provided in the above embodiments. The method includes: acquiring historical event corpus; inputting the historical event corpus into a knowledge graph construction model to obtain a knowledge graph of the current moment output by the knowledge graph construction model; wherein the knowledge graph construction model includes a structural encoder, a latent relation extraction module, a relation encoding module, and an entity temporal representation module, and the knowledge graph construction model is trained based on event corpus samples; the structural encoder is used to extract the entities and the relation information between the entities at each historical moment in the historical event corpus, and based on the entities and the relation information, to determine the knowledge graph of each historical moment. The system constructs a knowledge graph and encodes the structure of the knowledge graph at each historical moment to obtain the feature representation of each entity at each historical moment. The implicit relation extraction module is used to calculate the first association relationship between entities at each historical moment and the second association relationship between entities at any two historical moments based on the feature representation of each entity at each historical moment, and constructs an entity association relationship graph based on the first association relationship and the second association relationship. The relation encoding module is used to encode the entity association relationship graph to obtain the neighbor representation of each entity in the entity association relationship graph. The entity temporal representation module is used to extract the temporal representation of each entity at the current moment based on the feature representation of each entity at each historical moment and the neighbor representation of each entity in the entity association relationship graph, and constructs the knowledge graph at the current moment based on the temporal representation of each entity at the current moment.

[0154] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the dynamic knowledge graph prediction method provided in the above embodiments. The method includes: acquiring historical event corpus; inputting the historical event corpus into a knowledge graph construction model to obtain a knowledge graph of the current moment output by the knowledge graph construction model; wherein the knowledge graph construction model includes a structural encoder, a latent relation extraction module, a relation encoding module, and an entity temporal representation module, and the knowledge graph construction model is trained based on event corpus samples; the structural encoder is used to extract the entities and the relational information between entities at each historical moment in the historical event corpus, determine the knowledge graph at each historical moment based on the entities and the relational information, and perform a process for each historical moment... The knowledge graph is structurally encoded to obtain the feature representation of each entity at each historical moment. The implicit relationship extraction module is used to calculate the first association relationship between entities at each historical moment and the second association relationship between entities at any two historical moments based on the feature representation of each entity at each historical moment, and to construct an entity association graph based on the first association relationship and the second association relationship. The relationship encoding module is used to encode the entity association graph to obtain the neighbor representation of each entity in the entity association graph. The entity temporal representation module is used to extract the temporal representation of each entity at the current moment based on the feature representation of each entity at each historical moment and the neighbor representation of each entity in the entity association graph, and to construct the knowledge graph at the current moment based on the temporal representation of each entity at the current moment.

[0155] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0156] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0157] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A dynamic knowledge graph prediction method, characterized in that, include: Obtain historical event corpora; The historical event corpus is input into the graph construction model to obtain the knowledge graph of the current moment output by the graph construction model; The graph construction model includes a structural encoder, a latent relation extraction module, a relation encoding module, and an entity temporal representation module. The graph construction model is trained based on event corpus samples. The structural encoder is used to extract the entities and the relationship information between them at each historical moment in the historical event corpus. Based on the entities and the relationship information, the knowledge graph at each historical moment is determined, and the knowledge graph at each historical moment is structurally encoded to obtain the feature representation of each entity at each historical moment. The implicit relationship extraction module is used to calculate the first association relationship between entities at each historical moment and the second association relationship between entities at any two historical moments based on the feature representation of each entity at each historical moment, and to construct an entity association relationship graph based on the first association relationship and the second association relationship. The relation encoding module is used to encode the entity association graph to obtain the neighbor representation of each entity in the entity association graph; The entity temporal representation module is used to extract the temporal representation of each entity at the current moment based on the feature representation of each entity at each historical moment and the neighbor representation of each entity in the entity association graph, and to construct the knowledge graph at the current moment based on the temporal representation of each entity at the current moment. Based on the feature representations of each entity at each historical moment, the first association relationship between entities at each historical moment and the second association relationship between entities at any two historical moments are calculated, including: Based on the feature representation of each entity at each historical moment, calculate the first association relationship between every two entities that do not have the relationship information at each historical moment and the second association relationship between every two entities that do not have the relationship information at any two historical moments; Based on the feature representations of each entity at each historical moment, the first association relationship between entities at each historical moment and the second association relationship between entities at any two historical moments are calculated, including: Based on the feature representation of each entity at each historical moment, the cosine similarity metric function is used to calculate the first association between entities at each historical moment and the second association between entities at any two historical moments.

2. The dynamic knowledge graph prediction method according to claim 1, characterized in that, Based on the first association and the second association, an entity association graph is constructed, including: Perform a sparsification operation on the first association relationship to obtain the first sparsification operation result; Perform a sparsification operation on the second association relationship to obtain the second sparsification operation result; Based on the results of the first sparsification operation and the second sparsification operation, the entity association graph is constructed.

3. The dynamic knowledge graph prediction method according to claim 1, characterized in that, The relation encoding module is a relational graph neural network based on an attention mechanism; Encoding the entity association graph yields neighbor representations for each entity in the graph, including: Calculate the attention coefficient between adjacent entities in the entity association graph; Based on the attention coefficient, the relationship representations between entities in the entity association graph are aggregated to obtain the neighbor representations of each entity in the entity association graph.

4. The dynamic knowledge graph prediction method according to any one of claims 1-3, characterized in that, The temporal representation includes global temporal representation and local temporal representation; Based on the feature representations of each entity at each historical moment and the neighbor representations of each entity in the entity association graph, the temporal representations of each entity at the current moment are extracted, including: The feature representations of each entity at each historical moment are encoded to obtain the local temporal representations of each entity at the current moment. The neighbor representations of each entity in the entity association graph are encoded to obtain the global temporal representation of each entity at the current time.

5. The dynamic knowledge graph prediction method according to claim 4, characterized in that, Based on the temporal representations of each entity at the current moment, a knowledge graph for the current moment is constructed, including: Based on the gating module, the local temporal representations of each entity at the current time and the global temporal representations of each entity at the current time are fused to obtain the fusion result of each entity at the current time. Based on the fusion results, a knowledge graph for the current moment is constructed.

6. A dynamic knowledge graph prediction device, characterized in that, include: The corpus acquisition module is used to acquire historical event corpora. The graph prediction module is used to input the historical event corpus into the graph construction model to obtain the knowledge graph of the current moment output by the graph construction model. The graph construction model includes a structural encoder, a latent relation extraction module, a relation encoding module, and an entity temporal representation module. The graph construction model is trained based on event corpus samples. The structural encoder is used to extract the entities and the relationship information between them at each historical moment in the historical event corpus. Based on the entities and the relationship information, the knowledge graph at each historical moment is determined, and the knowledge graph at each historical moment is structurally encoded to obtain the feature representation of each entity at each historical moment. The implicit relationship extraction module is used to calculate the first association relationship between entities at each historical moment and the second association relationship between entities at any two historical moments based on the feature representation of each entity at each historical moment, and to construct an entity association relationship graph based on the first association relationship and the second association relationship. The relation encoding module is used to encode the entity association graph to obtain the neighbor representation of each entity in the entity association graph; The entity temporal representation module is used to extract the temporal representation of each entity at the current moment based on the feature representation of each entity at each historical moment and the neighbor representation of each entity in the entity association graph, and to construct the knowledge graph at the current moment based on the temporal representation of each entity at the current moment. Based on the feature representations of each entity at each historical moment, the first association relationship between entities at each historical moment and the second association relationship between entities at any two historical moments are calculated, including: Based on the feature representation of each entity at each historical moment, calculate the first association relationship between every two entities that do not have the relationship information at each historical moment and the second association relationship between every two entities that do not have the relationship information at any two historical moments; Based on the feature representations of each entity at each historical moment, the first association relationship between entities at each historical moment and the second association relationship between entities at any two historical moments are calculated, including: Based on the feature representation of each entity at each historical moment, the cosine similarity metric function is used to calculate the first association between entities at each historical moment and the second association between entities at any two historical moments.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the dynamic knowledge graph prediction method as described in any one of claims 1-5.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the dynamic knowledge graph prediction method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Internet of things risk positioning method based on dynamic hierarchical knowledge graph

    CN114884727A

  • Event prediction method and device based on dynamic knowledge graph

    CN115062779A