A knowledge graph prediction model training method, system, device and medium

By constructing a quadruple dataset and generating connection and adjacency matrices, a knowledge graph prediction model is trained, which solves the problem of inaccurate link prediction in existing technologies and achieves higher prediction accuracy and stability, especially for event prediction in dynamic data.

CN116561329BActive Publication Date: 2026-03-17HEFEI UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-12
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

Existing technologies for knowledge graph link prediction are inaccurate, making it difficult to effectively perform time series modeling and global structure inference of multi-relationship graphs, especially for predicting future events in dynamically evolving data.

Method used

By constructing a quadruple dataset, connecting entity vectors, relation vectors, and time vectors, entity relation vectors are generated, and connection matrices and adjacency matrices are constructed. These matrices are then used to train the original prediction model until the model converges, forming a stable prediction model.

Benefits of technology

It improves the prediction accuracy and stability of knowledge graphs, enables better handling of event prediction in dynamic data, and enhances the ability to infer the global structure of future events.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116561329B_ABST
    Figure CN116561329B_ABST
Patent Text Reader

Abstract

This invention provides a training method, system, device, and medium for a knowledge graph prediction model, comprising: acquiring a quadruple dataset of a knowledge graph, each quadruple including a head entity, a relation, a tail entity, and time; processing the quadruple dataset to obtain a connection matrix and an adjacency matrix; and training an original prediction model using the connection matrix and the adjacency matrix to obtain a trained prediction model. This invention establishes a relatively complete knowledge graph dataset based on the flow characteristics of time-oriented dynamic knowledge graph data; it combines knowledge graph node relationships with matrix theory to construct entity relation vectors, and combines these entity relation vectors with the distances between entities to construct a connection matrix, thereby improving the stability and accuracy of the entity and relation matrices and obtaining superior prediction results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a training method, system, device, and medium for a knowledge graph prediction model. Background Technology

[0002] Knowledge graphs, first proposed by Google, are knowledge bases that connect structured information through a graph structure. Building a knowledge graph involves using deep learning algorithms to construct a "entity-relationship-entity" triple model from data in a specific domain and storing it in a graph database. Knowledge graph link prediction uses existing triples in the knowledge graph to predict unknown triples. For example, (h, r, ?) represents predicting the tail entity from a known head entity and relation, and (?, r, t) represents predicting the head entity from a known relation and tail entity. With the growth of data, modeling dynamically evolving multi-relation graph data has attracted considerable interest. However, predicting future events based on such data requires global structural inference over time and the ability to integrate temporal and structural information. These capabilities are not well understood using existing triples. Therefore, proposing a technical solution for time-series modeling of multi-relation graphs, global structural inference of the execution order of future timestamps, and prediction of new events has become an urgent problem to solve. Summary of the Invention

[0003] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide a training method, system, device and medium for knowledge graph prediction models to solve the problem of inaccurate link prediction in the prior art.

[0004] The first aspect of the present invention provides a training method for a knowledge graph prediction model, comprising: acquiring a quadruple dataset of a knowledge graph, wherein each quadruple includes a head entity, a relation, a tail entity, and a time;

[0005] By connecting the entity vector, relation vector, and time vector in each of the quadruples, the entity-relation vector is obtained;

[0006] Based on the entity relationship vector and the distance between the two entities, a connection matrix is ​​constructed;

[0007] Based on the relationship between any two nodes in the knowledge graph, an adjacency matrix is ​​constructed.

[0008] The connection matrix and the adjacency matrix are input into the original prediction model in parallel. The original prediction model is trained under the constraint of the loss function until the original prediction model converges, thus obtaining the trained prediction model.

[0009] In one embodiment of the present invention, the step of concatenating the entity vector, relation vector, and time vector in each of the four tuples to obtain the entity-relation vector includes:

[0010] h_r = concat(h,r,τ);

[0011] Where h_r is the entity-relationship vector, h is the entity vector, r is the relationship vector, and τ is the time vector.

[0012] In one embodiment of the present invention, the distance between the two entities is obtained by calculating the similarity between the two entities, and the acquisition step includes:

[0013]

[0014] Wherein, s(x i ,x j x represents the similarity between two entities. i For the i-th entity, x j Let j be the j-th entity.

[0015] In one embodiment of the present invention, the step of constructing a connection matrix based on the entity relationship vector and the distance between the two entities includes:

[0016]

[0017] Where F is the relationship matrix, n is the number of entities, and X is the unit spatial dimension constructed between entities, relationships, and time, and the expression for X is:

[0018]

[0019] In one embodiment of the present invention, the step of constructing an adjacency matrix based on the relationship between any two nodes in a knowledge graph includes:

[0020] For each node in the knowledge graph, calculate the weight of the relationship between the node and its neighboring nodes. The nodes and their weights constitute the adjacency matrix.

[0021] In one embodiment of the present invention, the loss function is:

[0022] f r (y)=‖y1-y2‖+γ‖y1 2 -y2 2 ||;

[0023] Where y1 is the output of the original prediction model inputted by the relationship matrix, y2 is the output of the original prediction model inputted by the adjacency matrix, and γ is the relationship coefficient.

[0024] In one embodiment of the present invention, the step of training the original prediction model under the constraint of the loss function until the original prediction model converges to obtain the trained prediction model includes:

[0025] Step 1: Input the connection matrix and adjacency matrix of a quadruple into the original prediction model in parallel, calculate the predicted value, calculate the loss value of the predicted value and the label value using a loss function, and correct the network parameters of the original prediction model based on the loss value; wherein, the quadruple dataset includes the original quadruple and the quadruple carrying the label;

[0026] Step 2: Repeat Step 1 until the preset number of iterations is completed or the loss value is less than the preset threshold. Select the model with the smallest loss as the prediction model after training.

[0027] A second aspect of the present invention also provides a training system for a knowledge graph prediction model, comprising:

[0028] The acquisition module is used to acquire the quadruple dataset of the knowledge graph. Each quadruple includes a head entity, relation, tail entity, and time.

[0029] The sample processing module is used to connect the entity vector, relation vector, and time vector in each of the four tuples to obtain the entity relation vector; based on the entity relation vector and the distance between two entities, a connection matrix is ​​constructed; and based on the relationship between any two nodes in the knowledge graph, an adjacency matrix is ​​constructed.

[0030] The training module is used to input the connection matrix and the adjacency matrix into the original prediction model in parallel, and train the original prediction model under the constraint of the loss function until the original prediction model converges, thus obtaining the trained prediction model.

[0031] A third aspect of the present invention also provides a computer 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 steps of the method described in the training method of a knowledge graph prediction model of the first aspect of the present invention.

[0032] A fourth aspect of the invention also provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps described in the training method for a knowledge graph prediction model of the first aspect of the invention.

[0033] As described above, the training method, system, device, and medium for a knowledge graph prediction model of the present invention have the following beneficial effects:

[0034] This invention adds time series data of node occurrences to existing triples to form quadruples. These time series represent the distance between node occurrence and real-world time. A connection matrix and an adjacency matrix are constructed based on each quadruple. The original prediction model is trained using these matrices to obtain the trained prediction model. This invention establishes a relatively complete knowledge graph dataset based on the flow characteristics of time-oriented dynamic knowledge graph data. It combines knowledge graph node relationships with matrix theory to construct entity relationship vectors, and combines these vectors with the distances between entities to construct connection matrices. This improves the stability and accuracy of the entity and relationship matrices, resulting in superior prediction results. Attached Figure Description

[0035] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0036] Figure 1 The diagram shown is a flowchart of the training method in the first embodiment of the present invention.

[0037] Figure 2 The diagram shown is a structural block diagram of the training system according to the second embodiment of the present invention.

[0038] Figure 3 The diagram shown is a schematic representation of a computer device according to a third embodiment of the present invention. Detailed Implementation

[0039] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.

[0040] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Therefore, the figures only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0041] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.

[0042] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.

[0043] Please see Figure 1 The first embodiment of the present invention relates to a training method for a knowledge graph prediction model, specifically including:

[0044] Step S101: Obtain the quadruple dataset of the knowledge graph.

[0045] Specifically, a knowledge graph is a graph-like structure that includes nodes representing entities and edges describing the relationships between entities. There is a one-to-one correspondence between nodes and entities. A knowledge graph can include one or more relationships, i.e., one or more types of edges. Based on the positional relationship between entities and edges, the entity corresponding to the starting node of an edge is called the head entity, and correspondingly, the node pointed to by that edge is called the tail entity. They form a triple (h, r, t). In this embodiment, the knowledge graph prediction model is applied to a natural disaster application scenario. In this scenario, the knowledge graph data also includes a large volume of time series data representing the distance between the disaster occurrence and the actual time. Therefore, in this embodiment, the knowledge graph dataset considers time information in time-aware embedding based on the existing triples, forming multiple quadruples G = (h, r, t, τ), where h = {h1...h2}. n Let} be the set of header entities, and n be the number of header entities; r = {r1...r2} z Let} be the set of relations, and z be the number of relations; t = {t1, ..., t2} n} is the set of tail entities; τ = {τ1……τ} n} is a collection of time series for each entity, and τ provides additional time information about when the facts can be established. It should be understood that the knowledge graph dataset in this embodiment can be obtained from an open-source knowledge graph database, or it can be obtained as needed by analyzing the characteristics of the disaster knowledge graph and understanding the flow characteristics of the time-oriented dynamic data of the knowledge graph. The knowledge graph dataset is constructed based on the category to which each entity belongs under a specific relationship.

[0046] Step S102: Process the quadruple dataset to obtain the connection matrix and adjacency matrix.

[0047] Specifically, before processing the quadruple dataset, the initial natural language needs to be word-embedded to obtain entity vectors and relation vectors. Word embedding is defined as calculating the weight of each attribute value in a column of values ​​with the same attribute to obtain the corresponding numerical value. In this embodiment, a graph neural network is used to obtain the entity vector, relation vector, and time vector of each quadruple. It should be understood that the entity vector here includes the head entity and the tail entity.

[0048] To elaborate further, knowledge graph representation learning involves learning a low-dimensional vector representation of entities and relations within a knowledge graph, while also incorporating semantic information. This allows for easier extraction and utilization of information from the knowledge graph in downstream tasks. By applying graph neural networks, each entity utilizes information from related entities during the knowledge graph representation learning process, breaking down barriers between them and resulting in a more complete and richer representation of entities and relations. Connecting the entity vector, relation vector, and time vector in each quadruple yields the entity-relation vector, whose expression is:

[0049] h_r = concat(h,r,τ);

[0050] Where h_r is the entity-relationship vector, h is the entity vector, r is the relationship vector, and τ is the time vector.

[0051] Continuing the explanation, a connection matrix is ​​constructed based on the entity relationship vector and the distance between two entities. The distance between two entities is obtained by calculating their similarity, which involves the following steps:

[0052]

[0053] Wherein, s(x i ,x j x represents the similarity between two entities. i For the i-th entity, x j Let j be the j-th entity.

[0054] Continuing the explanation, since knowledge graphs can represent structured relationships between entities, the graph neural network in this embodiment utilizes deep neural networks to integrate topological and attribute feature information in graph data. This provides more refined feature representations of nodes or substructures and can be easily combined with downstream tasks in a decoupled or end-to-end manner, cleverly meeting the requirements of knowledge graphs for learning the attribute and structural features of entities and relationships. Therefore, this embodiment uses a connection matrix and an adjacency matrix to train the original prediction model. The connection matrix is ​​a normal connection that integrates entity and relationship matrices while absorbing the distance between entities. Its expression is:

[0055]

[0056] Where F is the relationship matrix, n is the number of entities, and X is the unit spatial dimension constructed between entities, relationships, and time, and the expression for X is:

[0057]

[0058] The adjacency matrix is ​​constructed based on the relationship between any two nodes in a knowledge graph. The steps to obtain it include: for each node in the knowledge graph, calculating the weight of the relationship between the node and its neighboring nodes, and the nodes and their weights constitute the adjacency matrix.

[0059] Step S103: Use the connection matrix and adjacency matrix to train the original prediction model to obtain the trained prediction model.

[0060] Specifically, the training steps include: inputting the relationship matrix and adjacency matrix into the original prediction model in parallel; training the original prediction model under the constraints of the loss function until the original prediction model converges, thus obtaining the trained prediction model. The loss function is expressed as:

[0061] f r (y)=‖y1-y2‖+γ‖y1 2 -y2 2 ||;

[0062] Where y1 is the output of the original prediction model, which is the input of the connection matrix, and its expression is y1=f(F*ω+b), where ω and b are the network parameters of the original prediction model, respectively.

[0063] y2 is the adjacency matrix input to the original prediction model output, and its expression is y1=f(M*ω+b);

[0064] γ is the relation coefficient, which is predefined and takes values ​​between (0,1).

[0065] Further explanation: The quadruple dataset obtained in step S101 includes the original quadruples and labeled quadruples. These labels can be provided by the open-source knowledge graph database or can be manually annotated as needed. The quadruple dataset is divided into training and testing sets according to a preset ratio. The training set is used to train the original prediction model, and the testing set is used to test the trained prediction model. Only if the trained prediction model meets the preset requirements is it used as the final prediction model. Furthermore, during training, the values ​​of members in the measured class are used as the average weights of their neighboring nodes. By aggregating the label information of their neighboring nodes, a relational feature of a node is created, thereby obtaining the relational features of other unlabeled data. During prediction, a relaxed labeling method is used to assign labels to unlabeled nodes based on parallel processing. Predictions are made for each unlabeled node in the network through continuous iteration until the error is sufficiently small. Specifically, the training steps include:

[0066] Step 1: Input a four-tuple connection matrix and adjacency matrix into the original prediction model in parallel, calculate the predicted value, use the loss function to calculate the loss value between the predicted value and the label value, and correct the network parameters of the original prediction model based on the loss value;

[0067] Step 2: Repeat Step 1 until the preset number of iterations is completed or the loss value is less than the preset threshold. Select the model with the smallest loss as the prediction model after training.

[0068] Furthermore, step three involves inputting the test set into the trained prediction model to verify its reliability. If the prediction accuracy is greater than a preset threshold, the trained prediction model is used as the final prediction model; otherwise, steps one to two are repeated.

[0069] Furthermore, this embodiment also evaluates the accuracy of the prediction model using accuracy and the statistical algorithm MRR (Mean reciprocal rank) to achieve the optimal dimension of the four-tuple dataset. It should be understood that, for a given training set, accuracy is the ratio of the number of correctly classified samples to the total number of samples. MRR is used to evaluate the performance of the retrieval system by the ranking of correctly retrieved values ​​in the retrieval results, and its expression is:

[0070]

[0071] Where, k i For each query result's rank, its corresponding Reciprocal Rank (RR) score is: The average value of all RRs is the MRR value.

[0072] To elaborate further, when acquiring new natural disaster data, steps S101-S102 are used to process it to obtain the corresponding connection matrix and adjacency matrix, which are then input into the prediction model trained in step S103 to obtain the prediction result.

[0073] As can be seen, the knowledge graph dataset in this embodiment adds time series data of node occurrences to the existing triples, forming quadruples. These time series represent the distance between node occurrence and real-world time. A connection matrix and an adjacency matrix are constructed based on each quadruple. The original prediction model is trained using these matrices to obtain the trained prediction model. This invention establishes a relatively complete knowledge graph dataset based on the flow characteristics of time-oriented dynamic knowledge graph data. It combines knowledge graph node relationships with matrix theory to construct entity relationship vectors, and combines these vectors with the distances between entities to construct connection matrices. This improves the stability and accuracy of the entity and relationship matrices, thereby obtaining superior prediction results.

[0074] Please see Figure 2 The second embodiment of the present invention relates to a training system for a knowledge graph prediction model, which corresponds to a training method for a knowledge graph prediction model disclosed in the first embodiment, and specifically includes:

[0075] The acquisition module is used to acquire the quadruple dataset of the knowledge graph. Each quadruple includes a head entity, relation, tail entity, and time.

[0076] Specifically, a knowledge graph is a graph-like structure that includes nodes representing entities and edges describing the relationships between entities. There is a one-to-one correspondence between nodes and entities. A knowledge graph can include one or more relationships, i.e., one or more types of edges. Based on the positional relationship between entities and edges, the entity corresponding to the starting node of an edge is called the head entity, and correspondingly, the node pointed to by that edge is called the tail entity. They form a triple (h, r, t). In this embodiment, the knowledge graph prediction model is applied to a natural disaster application scenario. In this scenario, the knowledge graph data also includes a large volume of time series data representing the distance between the disaster occurrence and the actual time. Therefore, in this embodiment, the knowledge graph dataset considers time information in time-aware embedding based on the existing triples, forming multiple quadruples G = (h, r, t, τ), where h = {h1...h2}. n Let} be the set of header entities, and n be the number of header entities; r = {r1...r2} z Let} be the set of relations, and z be the number of relations; t = {t1, ..., t2} n} is the set of tail entities; τ = {τ1……τ} n} is a collection of time series for each entity, and τ provides additional time information about when the facts can be established. It should be understood that the knowledge graph dataset in this embodiment can be obtained from an open-source knowledge graph database, or it can be obtained as needed by analyzing the characteristics of the disaster knowledge graph and understanding the flow characteristics of the time-oriented dynamic data of the knowledge graph. The knowledge graph dataset is constructed based on the category to which each entity belongs under a specific relationship.

[0077] The sample processing module is used to process the quadruple dataset to obtain the connection matrix and the adjacency matrix. The specific steps include: connecting the entity vector, relation vector and time vector in each quadruple to obtain the entity relation vector; constructing the connection matrix based on the entity relation vector and the distance between two entities; and constructing the adjacency matrix based on the relationship between any two nodes in the knowledge graph.

[0078] Specifically, before processing the quadruple dataset, the initial natural language needs to be word-embedded to obtain entity vectors and relation vectors. Word embedding is defined as calculating the weight of each attribute value in a column of values ​​with the same attribute to obtain the corresponding numerical value. In this embodiment, a graph neural network is used to obtain the entity vector, relation vector, and time vector of each quadruple. It should be understood that the entity vector here includes the head entity and the tail entity.

[0079] To elaborate further, knowledge graph representation learning involves learning a low-dimensional vector representation of entities and relations within a knowledge graph, while also incorporating semantic information. This allows for easier extraction and utilization of information from the knowledge graph in downstream tasks. By applying graph neural networks, each entity utilizes information from related entities during the knowledge graph representation learning process, breaking down barriers between them and resulting in a more complete and richer representation of entities and relations. Connecting the entity vector, relation vector, and time vector in each quadruple yields the entity-relation vector, whose expression is:

[0080] h_r = concat(h,r,τ);

[0081] Where h_r is the entity-relationship vector, h is the entity vector, r is the relationship vector, and τ is the time vector.

[0082] Continuing the explanation, a connection matrix is ​​constructed based on the entity relationship vector and the distance between two entities. The distance between two entities is obtained by calculating their similarity, which involves the following steps:

[0083]

[0084] Wherein, s(x i ,x jx represents the similarity between two entities. i For the i-th entity, x j Let j be the j-th entity.

[0085] Continuing the explanation, since knowledge graphs can represent structured relationships between entities, the graph neural network in this embodiment utilizes deep neural networks to integrate topological and attribute feature information in graph data. This provides more refined feature representations of nodes or substructures and can be easily combined with downstream tasks in a decoupled or end-to-end manner, cleverly meeting the requirements of knowledge graphs for learning the attribute and structural features of entities and relationships. Therefore, this embodiment uses a connection matrix and an adjacency matrix to train the original prediction model. The connection matrix is ​​a normal connection that integrates entity and relationship matrices while absorbing the distance between entities. Its expression is:

[0086]

[0087] Where F is the relationship matrix, n is the number of entities, and X is the unit spatial dimension constructed between entities, relationships, and time, and the expression for X is:

[0088]

[0089] The adjacency matrix is ​​constructed based on the relationship between any two nodes in a knowledge graph. The steps to obtain it include: for each node in the knowledge graph, calculating the weight of the relationship between the node and its neighboring nodes, and the nodes and their weights constitute the adjacency matrix.

[0090] The training module is used to train the original prediction model using the relationship matrix and the adjacency matrix to obtain the trained prediction model. Specifically, it includes: inputting the relationship matrix and the adjacency matrix into the original prediction model in parallel, training the original prediction model under the constraints of the loss function until the original prediction model converges, and obtaining the trained prediction model.

[0091] Specifically, the training steps include: inputting the relationship matrix and adjacency matrix into the original prediction model in parallel; training the original prediction model under the constraints of the loss function until the original prediction model converges, thus obtaining the trained prediction model. The loss function is expressed as:

[0092] f r (y)=‖y1-y2‖+γ‖y1 2 -y2 2 ||;

[0093] Where y1 is the output of the original prediction model, which is the input of the connection matrix, and its expression is y1=f(F*ω+b), where ω and b are the network parameters of the original prediction model, respectively.

[0094] y2 is the adjacency matrix input to the original prediction model output, and its expression is y1=f(M*ω+b);

[0095] γ is the relation coefficient, which is predefined and takes values ​​between (0,1).

[0096] To further explain, the quadruple dataset acquired by the module includes the original quadruples and labeled quadruples. These labels can be provided by the open-source knowledge graph database or can be manually annotated as needed. The quadruple dataset is divided into training and testing sets according to a preset ratio. The training set is used to train the original prediction model, and the testing set is used to test the trained prediction model. Only the trained prediction model that meets the preset requirements is used as the final prediction model. Furthermore, during training, the values ​​of members in the measured class are used as the average weights of their neighboring nodes. By aggregating the label information of their neighboring nodes, a relational feature of a node is created, thereby obtaining the relational features of other unlabeled data. During prediction, a relaxed labeling method is used to assign labels to unlabeled nodes based on parallel processing. Predictions are made for each unlabeled node in the network through continuous iteration until the error is sufficiently small. Specifically, the training steps include:

[0097] Step 1: Input a four-tuple connection matrix and adjacency matrix into the original prediction model in parallel, calculate the predicted value, use the loss function to calculate the loss value between the predicted value and the label value, and correct the network parameters of the original prediction model based on the loss value;

[0098] Step 2: Repeat Step 1 until the preset number of iterations is completed or the loss value is less than the preset threshold. Select the model with the smallest loss as the prediction model after training.

[0099] Furthermore, step three involves inputting the test set into the trained prediction model to verify its reliability. If the prediction accuracy is greater than a preset threshold, the trained prediction model is used as the final prediction model; otherwise, steps one to two are repeated.

[0100] Furthermore, this embodiment also includes an evaluation module that evaluates the accuracy of the prediction model using accuracy and the statistical algorithm MRR (Mean Reciprocal Rank) to achieve the optimal dimension of the four-tuple dataset. It should be understood that, for a given training set, accuracy is the ratio of the number of correctly classified samples to the total number of samples. MRR is used to evaluate the performance of the retrieval system by the ranking of correctly retrieved values ​​in the retrieval results, and its expression is:

[0101]

[0102] Where, k iFor each query result's rank, its corresponding Reciprocal Rank (RR) score is: The average value of all RRs is the MRR value.

[0103] To elaborate further, when acquiring new natural disaster data, the sample processing module processes it to obtain the corresponding connection matrix and adjacency matrix, which are then input into the prediction model trained in the training module to obtain the prediction results.

[0104] As can be seen, the knowledge graph dataset in this embodiment adds time series data of node occurrences to the existing triples, forming quadruples. These time series represent the distance between node occurrence and real-world time. A connection matrix and an adjacency matrix are constructed based on each quadruple. The original prediction model is trained using these matrices to obtain the trained prediction model. This invention establishes a relatively complete knowledge graph dataset based on the flow characteristics of time-oriented dynamic knowledge graph data. It combines knowledge graph node relationships with matrix theory to construct entity relationship vectors, and combines these vectors with the distances between entities to construct connection matrices. This improves the stability and accuracy of the entity and relationship matrices, thereby obtaining superior prediction results.

[0105] Please see Figure 3 The third embodiment of the present invention relates to a computer device, including a memory 301, a processor 302, and a computer program stored in the memory 301 and executable on the processor 302. When the processor 302 executes the computer program, it performs the following steps:

[0106] Obtain a dataset of quadruples from the knowledge graph, where each quadruple includes a head entity, a relation, a tail entity, and a time.

[0107] Connect the entity vector, relation vector, and time vector in each quadruple to obtain the entity-relation vector;

[0108] A connection matrix is ​​constructed based on the entity relationship vector and the distance between two entities;

[0109] Based on the relationship between any two nodes in the knowledge graph, an adjacency matrix is ​​constructed.

[0110] The relationship matrix and adjacency matrix are input into the original prediction model in parallel. The original prediction model is trained under the constraint of the loss function until it converges, and the trained prediction model is obtained.

[0111] The memory 301 and processor 302 are connected via a bus. This bus can include any number of interconnecting buses and bridges, connecting various circuits of one or more processors 302 and memory 301. The bus can also connect various other circuits, such as peripheral devices 303, voltage regulators 304, and power management circuits, which are well-known in the art and therefore will not be described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by processor 302 is transmitted over a wireless medium via an antenna, which further receives data and transmits it to processor 302.

[0112] Processor 302 is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory 301 can be used to store data used by processor 302 during operation.

[0113] Those skilled in the art will understand that Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0114] The fourth embodiment of the present invention relates to a storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0115] Obtain a dataset of quadruples from the knowledge graph, where each quadruple includes a head entity, a relation, a tail entity, and a time.

[0116] Connect the entity vector, relation vector, and time vector in each quadruple to obtain the entity-relation vector;

[0117] A connection matrix is ​​constructed based on the entity relationship vector and the distance between two entities;

[0118] Based on the relationship between any two nodes in the knowledge graph, an adjacency matrix is ​​constructed.

[0119] The relationship matrix and adjacency matrix are input into the original prediction model in parallel. The original prediction model is trained under the constraint of the loss function until it converges, and the trained prediction model is obtained.

[0120] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0121] In summary, the present invention provides a training method, system, device, and medium for a knowledge graph prediction model. The knowledge graph dataset incorporates time series data representing node occurrences into existing triples, forming quadruples. These time series represent the distance between node occurrence and real-world time. A connection matrix and an adjacency matrix are constructed based on each quadruple. The original prediction model is trained using these matrices to obtain the trained prediction model. This invention establishes a relatively complete knowledge graph dataset based on the time-oriented flow characteristics of dynamic knowledge graph data. By combining knowledge graph node relationships with matrix theory, entity relationship vectors are constructed. These entity relationship vectors are then combined with the distances between entities to construct a connection matrix, improving the stability and accuracy of the entity and relationship matrices, thereby obtaining superior prediction results. Therefore, this invention effectively overcomes the various shortcomings of existing technologies and has high industrial application value.

[0122] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. A method for training a knowledge graph prediction model, characterized in that, The method comprises the following steps: obtain a quadruple dataset of a knowledge graph, each quadruple comprising a head entity, a relation, a tail entity and a time; connect the entity vector, the relation vector and the time vector in each quadruple to obtain an entity relation vector; construct a contact matrix based on the entity relation vector and the distance between two entities; construct an adjacency matrix based on the relationship between any two nodes in the knowledge graph; parallelly input the contact matrix and the adjacency matrix into an original prediction model, train the original prediction model under the constraint of a loss function until the original prediction model converges, and obtain a trained prediction model; wherein the knowledge graph prediction model is applied to a natural disaster application scenario, and before processing the quadruple dataset, an initial natural language is subjected to word embedding to obtain an entity vector and a relation vector, and the natural language is associated with a natural disaster; the step of connecting the entity vector, the relation vector and the time vector in each quadruple to obtain an entity relation vector comprises: ; wherein, is an entity relation vector, is an entity vector, is a relation vector, is a time vector; the distance between the two entities is obtained by calculating the similarity between the two entities, and the obtaining step comprises: ; wherein, is a similarity between two entities, is a first entity, is a second entity, is a first entity, is a second entity; the step of constructing a contact matrix based on the entity relation vector and the distance between two entities comprises: wherein, is a connection matrix, is the number of entities, is the unit space dimensionality constructed between entities, relations and time, and The expression of is: 。 2. The training method of claim 1, wherein, the step of constructing an adjacency matrix based on the relationship between any two nodes in the knowledge graph comprises: for each node in the knowledge graph, calculate the weight of the relationship between the node and the adjacent node, and the nodes and the weights constitute the adjacency matrix.

3. The training method of claim 1, wherein, the loss function is: ; wherein, inputting the output of the original predictive model for the adjacency matrix, inputting the output of the original predictive model for the adjacency matrix, is a relation coefficient.

4. The training method of claim 3, wherein, the step of training the original prediction model under the constraint of the loss function until the original prediction model converges, and obtaining a trained prediction model comprises: step one, parallelly input the contact matrix and the adjacency matrix of a quadruple into an original prediction model, calculate a prediction value, calculate the loss value of the prediction value and the label value by using a loss function, and correct the network parameters of the original prediction model according to the loss value; wherein the quadruple dataset comprises an original quadruple and a quadruple carrying a label; step two, repeat step one until a preset iteration number is completed or the loss value is less than a preset threshold, and select the model with the minimum loss as the trained prediction model. 5.A training system of a knowledge graph prediction model, characterized in that, The method comprises the following steps: an acquisition module is configured to obtain a quadruple dataset of a knowledge graph, each quadruple comprising a head entity, a relation, a tail entity and a time; a sample processing module is configured to connect the entity vector, the relation vector and the time vector in each quadruple to obtain an entity relation vector, construct a contact matrix based on the entity relation vector and the distance between two entities, and construct an adjacency matrix based on the relationship between any two nodes in the knowledge graph; a training module is configured to parallelly input the contact matrix and the adjacency matrix into an original prediction model, train the original prediction model under the constraint of a loss function until the original prediction model converges, and obtain a trained prediction model; wherein the knowledge graph prediction model is applied to a natural disaster application scenario, and before processing the quadruple dataset, an initial natural language is subjected to word embedding to obtain an entity vector and a relation vector, and the natural language is associated with a natural disaster; The step of connecting the entity vector, the relation vector and the time vector in each of the four tuples to obtain an entity relation vector comprises: ; wherein, is an entity relation vector, is an entity vector, is a relation vector, is a time vector; The distance between the two entities is obtained by calculating the similarity between the two entities, and the obtaining step comprises: ; wherein, is a similarity between two entities, is a first entity, is a second entity, is a first entity, is a second entity; The step of constructing a contact matrix based on the entity relation vector and the distance between the two entities comprises: wherein, is a connection matrix, is the number of entities, is the unit space dimensionality constructed between entities, relations and time, and the expression of is: 。 6. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that: The processor executes the computer program to implement the steps of the method in any one of claims 1-4.

7. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1-4.