Training method of extraction model and determining method of topological structure in dynamic graph
By introducing a time context information extraction model into the dynamic graph and optimizing parameters using the bidirectional RNN model, the problem of insufficient embedded dynamic graphs in the prior art is solved, and more comprehensive dynamic graph analysis and higher quality embedded results are achieved.
Patent Information
- Application Number
- CN202510099418.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-05-13
AI Technical Summary
The existing dynamic graph embedding technology has shortcomings in capturing the structural information of graph nodes and processing time series data, and lacks comprehensiveness in the analysis of dynamic graphs.
A training method for extracting time context information is proposed. By obtaining the node feature information of each snapshot of the dynamic graph, the embedding vector and loss function values are determined, the context information is obtained using the bidirectional RNN model, and the model parameters are optimized through the total loss function value.
Effectively capture the structural information and time series data of graph nodes, improve the comprehensiveness and accuracy of dynamic graph analysis, and optimize model parameters to improve the quality of dynamic graph embedding.
Smart Images

Figure CN119990185A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of dynamic graph embedding learning, and in particular to a method for training an extraction model and a method for determining a topological structure in a dynamic graph. Background Art
[0002] Dynamic graphs are a special type of graph data structure whose edge connections or node features change over time. They are widely used in social networks, transportation systems, communication networks, etc. Compared with static graphs, the analysis of dynamic graphs is more complicated. In addition to processing the spatial characteristics of the graph data structure, it is also necessary to consider the evolution of the graph data structure over time.
[0003] Existing dynamic graph embedding technologies are mainly based on deep learning models (such as autoencoders) to learn node embedding of dynamic graphs, which can capture the dynamic characteristics of graph data structure evolving over time and adapt to changes in graph data structure.
[0004] Existing dynamic graph embedding techniques are insufficient in capturing the structural information of graph nodes and processing time series data, and lack comprehensiveness in the analysis of dynamic graphs. Summary of the invention
[0005] The present application provides a method for training an extraction model and a method for determining a topological structure in a dynamic graph, so as to solve the technical problems of insufficient capture of structural information of graph nodes and processing of time series data, as well as lack of comprehensiveness in the analysis of dynamic graphs.
[0006] In a first aspect, the present application provides a training method for a temporal context information extraction model, comprising:
[0007] S1, obtaining node feature information of each first snapshot in the dynamic graph;
[0008] S2, determining an embedding vector of each first snapshot and a first loss function value of each first snapshot according to node feature information of each first snapshot;
[0009] S3, inputting the embedding vector of each first snapshot into a bidirectional recurrent neural network (RNN) model to obtain first context information of each first snapshot;
[0010] S4, obtaining a first topological structure of the second snapshot reconstructed based on each first snapshot according to the first context information of each first snapshot and the embedding vector of each first snapshot;
[0011] S5, determining a total loss function value of the dynamic graph embedding according to the first topological structure of each second snapshot, the total loss function value comprising: the first loss function value and a second loss function value, the second loss function value being determined based on the first topological structure of each second snapshot;
[0012] S6, determine whether the total loss function value is less than the preset loss function value. If it is less than the preset loss function value, determine the bidirectional RNN model as the temporal context information extraction model; if it is not less than the preset loss function value, update the parameters in the bidirectional RNN model based on the total loss function value, and repeat steps S1-S5 until the total loss function value is less than the preset loss function value.
[0013] In one or more embodiments, after acquiring node feature information of each first snapshot in the dynamic graph, the method further includes:
[0014] For each node in each snapshot, the node feature information of the adjacent nodes of the node is integrated into the node feature information of the node to obtain the updated node feature information of the node. For each snapshot, the node feature information of the snapshot includes: the updated node feature information of each node in the snapshot.
[0015] In one or more embodiments, determining the embedding vector of each first snapshot and the first loss function value of each first snapshot according to the node feature information of each first snapshot includes:
[0016] For each snapshot of node feature information, the node feature information of the snapshot is spliced with the node feature information of an adjacent snapshot to obtain spliced node feature information;
[0017] Inputting the spliced node feature information into a multi-layer perceptron model to obtain node feature information of a preset dimension;
[0018] Inputting the node feature information of the preset dimension into a static graph embedding model to obtain an embedding vector of each first snapshot;
[0019] For each node in each snapshot, determine the sum of first inner products of the node and a node set of co-occurring nodes in a fixed-length random walk, and the sum of second inner products involving the node under a negative sampling distribution;
[0020] For each snapshot, a sum of the first inner products and the second inner products of all nodes in the snapshot is determined as a first loss function value of the snapshot.
[0021] In one or more embodiments, obtaining, according to the first context information of each first snapshot and the embedding vector of each first snapshot, a first topological structure of the second snapshot reconstructed based on each first snapshot includes:
[0022] Integrate the first context information of each first snapshot into the embedding vector of each first snapshot to obtain a fused embedding vector;
[0023] Based on a decoder, the fused embedding vector is decoded to obtain a first topological structure of the second snapshot reconstructed based on each first snapshot.
[0024] In one or more embodiments, before determining the total loss function value of the dynamic graph embedding according to the first topological structure of each second snapshot, the method further includes:
[0025] For each second snapshot, obtaining a first adjacency matrix of the first snapshot corresponding to the second snapshot and a second adjacency matrix of the second snapshot;
[0026] The second loss function value is determined according to the first adjacency matrix and the second adjacency matrix.
[0027] In a second aspect, the present application provides a method for determining a topological structure in a dynamic graph, comprising:
[0028] Get the dynamic image to be processed;
[0029] Determining an embedding vector of each snapshot according to node feature information of each snapshot in the dynamic graph to be processed;
[0030] Inputting the embedding vector of each snapshot into a temporal context information extraction model to obtain context information of each snapshot, wherein the temporal context information extraction model is trained based on the method according to any one of claims 1 to 5;
[0031] The topological structure of the dynamic graph to be processed is determined according to the context information of each snapshot and the embedding vector of each snapshot.
[0032] In a third aspect, the present application provides a training device for a temporal context information extraction model, comprising:
[0033] A first acquisition module, used to acquire node feature information of each first snapshot in the dynamic graph;
[0034] A first determination module, used to determine an embedding vector of each first snapshot and a first loss function value of each first snapshot according to node feature information of each first snapshot;
[0035] A first processing module, used for inputting the embedding vector of each first snapshot into a bidirectional recurrent neural network (RNN) model to obtain first context information of each first snapshot;
[0036] A second processing module, configured to obtain, according to the first context information of each first snapshot and the embedding vector of each first snapshot, a first topological structure of the second snapshot reconstructed based on each first snapshot;
[0037] A second determination module is used to determine a total loss function value of the dynamic graph embedding according to the first topological structure of each second snapshot, the total loss function value comprising: the first loss function value and a second loss function value, the second loss function value being determined based on the first topological structure of each second snapshot;
[0038] The third processing module is used to determine whether the total loss function value is less than the preset loss function value. If it is less than the preset loss function value, the bidirectional RNN model is determined as the time context information extraction model; if it is not less than the preset loss function value, the parameters in the bidirectional RNN model are updated based on the total loss function value, and steps S1-S5 are repeated until the total loss function value is less than the preset loss function value.
[0039] In one or more embodiments, the first acquisition module, after acquiring the node feature information of each first snapshot in the dynamic graph, is further configured to:
[0040] For each node in each snapshot, the node feature information of the adjacent nodes of the node is integrated into the node feature information of the node to obtain the updated node feature information of the node. For each snapshot, the node feature information of the snapshot includes: the updated node feature information of each node in the snapshot.
[0041] In one or more embodiments, the first determining module is specifically configured to:
[0042] For each snapshot of node feature information, the node feature information of the snapshot is spliced with the node feature information of an adjacent snapshot to obtain spliced node feature information;
[0043] Inputting the spliced node feature information into a multi-layer perceptron model to obtain node feature information of a preset dimension;
[0044] Inputting the node feature information of the preset dimension into a static graph embedding model to obtain an embedding vector of each first snapshot;
[0045] For each node in each snapshot, determine the sum of first inner products of the node and a node set of co-occurring nodes in a fixed-length random walk, and the sum of second inner products involving the node under a negative sampling distribution;
[0046] For each snapshot, a sum of the first inner products and the second inner products of all nodes in the snapshot is determined as a first loss function value of the snapshot.
[0047] In one or more embodiments, the second processing module is specifically configured to:
[0048] Integrate the first context information of each first snapshot into the embedding vector of each first snapshot to obtain a fused embedding vector;
[0049] Based on a decoder, the fused embedding vector is decoded to obtain a first topological structure of the second snapshot reconstructed based on each first snapshot.
[0050] In one or more embodiments, the second determination module, before determining the total loss function value of the dynamic graph embedding according to the first topological structure of each second snapshot, is further configured to:
[0051] For each second snapshot, obtaining a first adjacency matrix of the first snapshot corresponding to the second snapshot and a second adjacency matrix of the second snapshot;
[0052] The second loss function value is determined according to the first adjacency matrix and the second adjacency matrix.
[0053] In a fourth aspect, a device for determining a topological structure in a dynamic graph includes:
[0054] The second acquisition module is used to acquire the dynamic image to be processed;
[0055] A third determination module determines an embedding vector of each snapshot according to node feature information of each snapshot in the dynamic graph to be processed;
[0056] A fourth processing module, used for inputting the embedding vector of each snapshot into a temporal context information extraction model to obtain context information of each snapshot, wherein the temporal context information extraction model is trained based on the method according to any one of claims 1 to 5;
[0057] The fourth determination module is used to determine the topological structure of the dynamic graph to be processed according to the context information of each snapshot and the embedding vector of each snapshot.
[0058] In a fifth aspect, the present application provides an electronic device, including:
[0059] a processor, and a memory communicatively connected to the processor;
[0060] The memory stores computer-executable instructions;
[0061] The processor executes the computer-executable instructions stored in the memory to implement the method described in the first aspect and any one of the embodiments above.
[0062] In a sixth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the above-mentioned first aspect and any one of the embodiments.
[0063] In the seventh aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, is used to implement the training method of the extraction model and the method for determining the topological structure in the dynamic graph as described in the first aspect and various possible implementation methods of the first aspect.
[0064] The present application provides a training method for an extraction model and a method for determining a topological structure in a dynamic graph. The method first obtains node feature information of each first snapshot in the dynamic graph; then, based on the node feature information of each first snapshot, determines the embedding vector of each first snapshot and the first loss function value of each first snapshot; then, inputs the embedding vector of each first snapshot into a bidirectional recurrent neural network (RNN) model to obtain the first context information of each first snapshot; based on the first context information of each first snapshot and the embedding vector of each first snapshot, obtains the first topological structure of the second snapshot reconstructed based on each first snapshot; based on the first topological structure of each second snapshot, determines the total loss function value of the dynamic graph embedding, the total loss function value includes: the first loss function value and the second loss function value, the second loss function value is determined based on the first topological structure of each second snapshot; finally, determines whether the total loss function value is less than a preset loss function value, if it is less than the preset loss function value, determines the bidirectional RNN model as a temporal context information extraction model; if it is not less than the preset loss function value, updates the parameters in the bidirectional RNN model based on the total loss function value, and repeats steps S1-S5 until the total loss function value is less than the preset loss function value. In the above method, by embedding the node features in each first snapshot and using the bidirectional RNN model to obtain the time series context information, the forward and backward time context information can be considered at the same time to obtain a more comprehensive time series dependency relationship, so as to better learn the dynamic changes of the node feature information of each first snapshot and improve the accuracy of generating the first topological structure of the second snapshot reconstructed based on each first snapshot; by judging whether the total loss function value is less than the preset loss function value, the parameters in the bidirectional RNN model can be updated and optimized, so as to more effectively extract the first context information of each first snapshot. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0066] Figure 1 Schematic diagram of the training method of the temporal context information extraction model provided in the embodiment of the present application Figure 1 ;
[0067] Figure 2 Schematic diagram of the training method of the temporal context information extraction model provided in the embodiment of the present application Figure 2 ;
[0068] Figure 3 Schematic diagram of the training method of the temporal context information extraction model provided in the embodiment of the present application Figure 3 ;
[0069] Figure 4 Schematic diagram of the training method of the temporal context information extraction model provided in the embodiment of the present application Figure 4 ;
[0070] Figure 5 Schematic diagram of the process of determining the topological structure in the dynamic graph provided in the embodiment of the present application Figure 1 ;
[0071] Figure 6 A schematic diagram of the structure of a training device for a temporal context information extraction model provided in an embodiment of the present application;
[0072] Figure 7 A schematic diagram of the structure of a device for determining a topological structure in a dynamic graph provided in an embodiment of the present application;
[0073] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0074] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0075] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0076] First, the terms involved in this application are explained:
[0077] Snapshot: refers to the state of a dynamic graph at a certain moment, including the structure of the graph (nodes and edges) and the characteristics of each node (such as labels, attributes, status, etc.) at a certain moment;
[0078] Embedding: refers to mapping nodes, edges or the entire graph from a high-dimensional space to a low-dimensional continuous vector space. The embedding of each graph is calculated based on the topological structure of the graph and the characteristics of the nodes, representing the structural information and attribute information of the nodes in the graph at a specific time or state.
[0079] Recurrent Neural Networks (RNN): refers to a type of neural network architecture used to process sequence data. It can capture the dynamic information of time series or ordered data and can process sequence data such as text, time series or audio.
[0080] Graph Convolutional Network (GCN): refers to a neural network model used to process graph data. Graph convolutional networks can combine the topological structure of the graph with the node features, and extract the relationship and feature information between nodes through graph convolution operations;
[0081] Graph Attention Networks (GAT): refers to a graph neural network combined with an attention mechanism. GAT introduces an attention mechanism, which enables the model to dynamically assign different weights to different neighbors when aggregating neighbor node information;
[0082] Bidirectional Long Short-Term Memory (BiLSTM): refers to an improved recurrent neural network (RNN) designed specifically for processing sequence data. BiLSTM captures bidirectional dependencies in a sequence by combining the outputs of the forward and backward LSTM networks.
[0083] Multi-Layer Perceptron (MLP): refers to a feedforward neural network consisting of an input layer, a hidden layer, and an output layer. The input layer receives data, the hidden layer processes the data, and the output layer outputs the results. The neurons in each layer are fully connected to every neuron in the adjacent layer.
[0084] Secondly, the technical background technology involved in this application is described as follows:
[0085] Dynamic graphs are a special type of graph data structure whose edge connections or node features change over time. They are widely used in social networks, transportation systems, communication networks, etc. Compared with static graphs, the analysis of dynamic graphs is more complicated. In addition to processing the spatial characteristics of the graph data structure, it is also necessary to consider the evolution of the graph data structure over time.
[0086] Among the existing dynamic graph embedding technologies, Graph Attention Networks (GAT) introduces the attention mechanism, which enables the model to dynamically assign different weights to different neighbor nodes when aggregating neighbor node information, and can flexibly and effectively process graphs with complex connection patterns; deep learning models (such as autoencoders) can capture the dynamic characteristics of the evolution of graph data structures over time and adapt to changes in graph data structures by learning node embeddings of dynamic graphs.
[0087] Existing dynamic graph embedding techniques are insufficient in capturing the structural information of graph nodes and processing time series data, and lack comprehensiveness in the analysis of dynamic graphs.
[0088] The training method of the extraction model and the method for determining the topological structure in the dynamic graph provided by the present application are intended to solve the above technical problems of the prior art. The inventive concept of the present application is as follows: for each snapshot in the dynamic graph, by introducing a time context information extraction model, while considering the past and future node feature information of each snapshot, according to the time series of each snapshot, the processing results of the forward time series are combined with the processing results of the reverse time series, which can effectively capture the bidirectional dependencies in the time series, and at the same time enhance the embedding vectors of each first snapshot, thereby improving the accuracy of the generation of the first topological structure of the second snapshot reconstructed based on each first snapshot. Finally, the total loss function value of the dynamic graph embedding is introduced, and by comparing it with the preset loss function value, the parameters in the bidirectional RNN model can be updated and optimized according to the comparison results.
[0089] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0090] Figure 1 Schematic diagram of the training method of the temporal context information extraction model provided in the embodiment of the present application Figure 1 .like Figure 1 As shown, the training method of the temporal context information extraction model includes the following steps:
[0091] S1, obtaining node feature information of each first snapshot in the dynamic graph.
[0092] In this step, the dynamic graph includes a plurality of first snapshots, and the node feature information of each first snapshot is different. For each first snapshot, the node feature information of each first snapshot in the dynamic graph is obtained.
[0093] In a possible implementation, the dynamic graph can be defined as: G = (G t ,t=1,2,…,T), where G t represents the first snapshot in the dynamic graph, that is, the static graph at different times, and T is the preset number of time segments, that is, the number of first snapshots that need to be divided within a certain time range.
[0094] First Snapshot G t can be defined as a triple, G t =(V t ,E t ,X t ), where V t Represents the first snapshot G t The set of all nodes in E t Represents the first snapshot G t The set of all edges in X t Represents the first snapshot G t Node feature information.
[0095] For different times t, the first snapshot G t V t 、E t and X t In this application, it is assumed that the number of nodes in the dynamic graph will not increase or decrease with the change of time t, and all the edges and node feature information connecting the nodes, that is, E t and X t , will change according to the change of time t.
[0096] Then the first snapshot G t It can be defined as, G t =(V,E t ,X t ), where for the first snapshot G t The set modulus operation of all nodes in |V|=N, where N represents the number of nodes in the dynamic graph G. The number of nodes in each first snapshot of the dynamic graph is the same, which is N.
[0097] First Snapshot G t The nodes in the matrix and the connection relationship between the nodes can be represented by the adjacency matrix A t To indicate that A t is an N×N matrix.
[0098] First Snapshot G t Node feature information X t It is an N×D matrix, where D represents the dimension of the original feature space.
[0099] In a possible implementation, after step S1, the method further includes: for each node in each snapshot, integrating the node feature information of the node's adjacent nodes into the node feature information of the node to obtain updated node feature information of the node, and for each snapshot, the node feature information of the snapshot includes: updated node feature information of each node in the snapshot.
[0100] In one possible implementation, each snapshot contains multiple nodes. For each node in each snapshot, a graph convolutional network can be used for processing, and the node feature information of the node's adjacent nodes can be integrated into the node feature information of the node to obtain the updated node feature information of the node. The updated node feature information of each node in each snapshot is used as the node feature information of each snapshot.
[0101] Exemplarily, for each snapshot, the adjacency matrix and the node feature information matrix are input into the graph convolutional network using a graph convolutional layer to obtain the node features processed by the graph convolutional layer, that is, the node feature information after the node is updated.
[0102] S2: Determine an embedding vector of each first snapshot and a first loss function value of each first snapshot according to the node feature information of each first snapshot.
[0103] In this step, based on the node feature information of each first snapshot, node feature information that can effectively represent the nodes in each first snapshot can be obtained, and the node feature information of each first snapshot is mapped from a high-dimensional space to a low-dimensional continuous vector space to obtain an embedding vector of each first snapshot. At the same time, the difference between the node feature information of each first snapshot and the embedding vector of each first snapshot is determined as the first loss function value of each first snapshot.
[0104] In a possible implementation, the node feature information of each first snapshot is a high-dimensional vector, and the node feature information of each first snapshot can be embedded and calculated through a graph convolutional network or a graph attention network to obtain the embedded vectors of each first snapshot in a low-dimensional continuous vector space.
[0105] The first loss function of each first snapshot can reflect the difference in the embedding vectors of each first snapshot by learning the similarity and dissimilarity relationship of the nodes, minimize the distance of similar nodes, and maximize the distance of dissimilar nodes.
[0106] For example, if the first snapshot Gt There are several nodes (v1, v2, ..., v n ), each node feature information is (x1,x2,…,x n ), after embedding calculation through graph convolutional network, the embedding vector of each node is (h1,h2,…,h n ), taking the set of embedding vectors of each node as the first snapshot G t The embedding vector of .
[0107] S3: Input the embedding vector of each first snapshot into the bidirectional RNN model to obtain the first context information of each first snapshot.
[0108] In this step, the embedding vector of each first snapshot is used as the input of the bidirectional RNN model. The bidirectional RNN model can be used to learn the embedding vector of each first snapshot, and the first context information of each first snapshot can be extracted from the timing information in the embedding vector of each first snapshot.
[0109] In one possible implementation, the bidirectional RNN model can be a special type of recurrent neural network model that considers both past and future information when processing sequence data, combining two independent RNNs, one processing the forward time series (from the past to the future) and the other processing the reverse time series (from the future to the past).
[0110] Exemplarily, the embedding vector of each first snapshot can be input into a bidirectional long short-term memory network (Bidirectional Long Short-Term Memory, BiLSTM) model, and the forward LSTM vector of each first snapshot can be extracted from the beginning to the end according to the time sequence of each first snapshot, and the backward LSTM vector of each first snapshot can be extracted from the end to the beginning according to the time sequence of each first snapshot. The forward LSTM vector and the backward LSTM vector of each first snapshot are the first context information of each first snapshot.
[0111] S4, obtaining a first topological structure of the second snapshot reconstructed based on each first snapshot according to the first context information of each first snapshot and the embedding vector of each first snapshot.
[0112] In this step, the first context information of each first snapshot represents the time series information of each first snapshot, and the embedding vector of each first snapshot represents the node feature information of each first snapshot. The first context information of each first snapshot is combined with the embedding vector of each first snapshot, and each first snapshot is reconstructed according to the time series information and node feature information of each first snapshot to obtain the first topological structure of the corresponding second snapshot.
[0113] In a possible implementation, the first topological structure of the second snapshot reconstructed from each first snapshot includes the nodes of the second snapshot, the edges between the nodes, and the node feature information.
[0114] Exemplarily, the nodes in the first topological structure of the second snapshot reconstructed from each first snapshot are the same as the nodes in the first snapshot, and the existence of edges between the nodes can be determined by calculating the distance and similarity of the embedding vectors of each first snapshot, and the node feature information includes the node feature information of the first snapshot represented by the embedding vectors of each first snapshot, and the first context information of the first snapshot.
[0115] S5, determining a total loss function value of dynamic graph embedding according to the first topological structure of each second snapshot;
[0116] The total loss function value includes: a first loss function value and a second loss function value, and the second loss function value is determined based on the first topological structure of each second snapshot.
[0117] In this step, the first topological structure of each second snapshot is compared with the corresponding first snapshot, the difference is determined as the second loss function value, the sum of the first loss function values of each first snapshot is added to the sum of the second loss function values, and the sum is used as the total loss function value of dynamic graph embedding.
[0118] In a possible implementation, the first topological structure of each second snapshot is compared with each corresponding first snapshot, and according to the degree of similarity, the difference in the degree of similarity is used as the second loss function value.
[0119] The sum of the first loss function values of the first snapshots and the sum of the second loss function values determined based on the first topological structures of the second snapshots are added together, and the obtained sum value can be used as the total loss function value of dynamic graph embedding.
[0120] For example, taking the dynamic graph containing three first snapshots as an example, such as the first snapshot A, the first snapshot B, and the first snapshot C, the first topological structure a of the second snapshot, the first topological structure b of the second snapshot, and the first topological structure c of the second snapshot are reconstructed respectively, wherein the first loss function value corresponding to the first snapshot A is L A , the corresponding second loss function value is L a , the first loss function value corresponding to the first snapshot B is L B , the corresponding second loss function value is L b , the first loss function value corresponding to the first snapshot C is L C , the corresponding second loss function value is L c , the sum of the first loss function values of each first snapshot is L1=L A +L B+L C The sum of the second loss values determined based on the first topological structures of the second snapshots is L2=L a +L b +L c , then the total loss function value L of dynamic graph embedding s =L1+L2.
[0121] S6, determine whether the total loss function value is less than the preset loss function value. If it is less than the preset loss function value, the bidirectional RNN model is determined as a temporal context information extraction model; if it is not less than the preset loss function value, update the parameters in the bidirectional RNN model based on the total loss function value, and repeat steps S1-S5 until the total loss function value is less than the preset loss function value.
[0122] In this step, a loss function value is set in advance as a control, and the total loss function value is compared with the preset loss function value. If it is less than the preset loss function value, the bidirectional RNN model of step S3 is determined as a temporal context information extraction model; if it is not less than the preset loss function value, the parameters in the bidirectional RNN model are updated according to the relationship between the total loss function value and the parameters in the bidirectional RNN model, and steps S1-S5 are repeated to compare the total loss function value with the preset loss function value. When the total loss function value is less than the preset loss function value, the bidirectional RNN model is determined as a temporal context information extraction model.
[0123] In a possible implementation, the bidirectional RNN model parameters can be updated according to the total loss function value until the total loss function value is less than the preset loss function value, indicating that the bidirectional RNN model can extract the time context information of each first snapshot at this time, and the bidirectional RNN model is then determined as a time context information extraction model.
[0124] The training method of the temporal context information extraction model provided in the embodiment of the present application is by obtaining the node feature information of each first snapshot in the dynamic graph; then, according to the node feature information of each first snapshot, determining the embedding vector of each first snapshot and the first loss function value of each first snapshot; then, inputting the embedding vector of each first snapshot into the bidirectional RNN model to obtain the first context information of each first snapshot; according to the first context information of each first snapshot and the embedding vector of each first snapshot, obtaining the first topological structure of the second snapshot reconstructed based on each first snapshot; according to the first topological structure of each second snapshot, determining the total loss function value of the dynamic graph embedding, the total loss function value includes: the first loss function value and the second loss function value, the second loss function value is determined based on the first topological structure of each second snapshot; finally, judging whether the total loss function value is less than the preset loss function value, if it is less than the preset loss function value, determining the bidirectional RNN model as the temporal context information extraction model; if it is not less than the preset loss function value, updating the parameters in the bidirectional RNN model based on the total loss function value, and repeating steps S1-S5 until the total loss function value is less than the preset loss function value. In this embodiment, by embedding the node features in each first snapshot and using the bidirectional RNN model to obtain time series context information, the forward and backward time context information can be considered at the same time to obtain a more comprehensive temporal dependency relationship, so as to better learn the dynamic changes of the node feature information of each first snapshot and improve the accuracy of generating the first topological structure of the second snapshot reconstructed based on each first snapshot; by judging whether the total loss function value is less than the preset loss function value, the parameters in the bidirectional RNN model can be updated and optimized, so as to more effectively extract the first context information of each first snapshot.
[0125] Based on the above embodiments, Figure 2 Schematic diagram of the training method of the temporal context information extraction model provided in the embodiment of the present application Figure 2 .like Figure 2 As shown, a possible implementation of the above step S2 is:
[0126] S210 . For each snapshot of node feature information, concatenate the node feature information of the snapshot with the node feature information of an adjacent snapshot to obtain concatenated node feature information.
[0127] In this step, each snapshot has adjacent snapshots, and each snapshot contains corresponding node feature information. For the node feature information of each snapshot, the node feature information of the snapshot is spliced with the node feature information of the adjacent snapshot to obtain the spliced node feature information.
[0128] In a possible implementation, the current snapshot and its adjacent snapshots may be horizontally connected in chronological order. The current snapshot may be a snapshot in which a previous adjacent snapshot and a next adjacent snapshot exist in the sequence of snapshots horizontally connected in chronological order, or may be the first snapshot in which only a next adjacent snapshot exists in the sequence of snapshots horizontally connected in chronological order, or may be the last snapshot in which only a previous adjacent snapshot exists in the sequence of snapshots horizontally connected in chronological order.
[0129] The node feature information of the current snapshot is concatenated with the node information of the adjacent snapshot. For a snapshot with a previous adjacent snapshot and a next adjacent snapshot in a snapshot sequence horizontally connected in chronological order, the node feature information matrices of the snapshots can be directly added together. For the first snapshot or the last snapshot in a snapshot sequence horizontally connected in chronological order, the average value of the node feature information matrices of the current snapshot and the adjacent snapshots can be used as the node feature matrix of the previous adjacent snapshot or the next adjacent snapshot to fill in.
[0130] Exemplarily, the concatenated node feature information can be expressed as:
[0131]
[0132] Among them, Z t Represents the node feature information of the snapshot at time t, Z t-1 Represents the node feature information of the snapshot at time t-1, that is, the previous adjacent snapshot at time t, Z t+1 represents the node feature information of the snapshot at time t+1, that is, the adjacent snapshot after time t. Z1 represents the node feature information of the snapshot at the initial time, that is, the first snapshot in the snapshot sequence horizontally connected in chronological order. T Represents the node feature information of the snapshot at time T, that is, the last snapshot in the snapshot sequence horizontally connected in chronological order.
[0133] S220, input the spliced node feature information into a multi-layer perceptron model to obtain node feature information of a preset dimension.
[0134] In this step, the concatenated node feature information is used as the input of the multi-layer perceptron model. The multi-layer perceptron model can be used to control the dimension of the output node feature information to obtain node feature information of a preset dimension.
[0135] In one possible implementation, the multilayer perceptron model includes multiple fully connected layers, which may include an input layer, a hidden layer, and an output layer. The spliced node feature information is received through the input layer, and a nonlinear transformation of the node feature information is performed through at least one fully connected layer of the hidden layer. The transformation result is multiplied by a preset weight matrix. The spliced node feature information can be mapped to a preset dimension and output to obtain the node feature information of the preset dimension.
[0136] Exemplarily, the node feature information of the preset dimension can be expressed as:
[0137]
[0138] in, is a preset weight matrix, D represents the dimension of the original feature space, D c Indicates the preset dimensions of the output.
[0139] S230: Input node feature information of a preset dimension into a static graph embedding model to obtain an embedding vector of each first snapshot.
[0140] In this step, for each first snapshot, the node feature information of the preset dimension is used as the input of the static graph embedding model. The static graph embedding model can convert the node feature information of the preset dimension into a low-dimensional vector representation to obtain the embedding vector of each first snapshot.
[0141] Exemplarily, the static graph embedding model can be a type of algorithm model for learning low-dimensional vector representations of nodes or edges in a static graph, and the low-dimensional vector representation can be an embedding vector. The static graph embedding model can embed each node in the graph into a low-dimensional vector space, so that the node feature information is preserved as much as possible in the embedding space.
[0142] In a possible implementation, a K-Core based Temporal Graph Convolutional Network (CTGCN) model may be used to determine the embedding vectors of each first snapshot.
[0143] Exemplarily, for each first snapshot, the first snapshot is partitioned based on the degree of the nodes in the first snapshot to obtain a series of nested subgraphs with different node degrees, namely, K-Core subgraphs, which can represent the first snapshot G t The largest subgraph in which all nodes have a degree greater than or equal to k. In each K-Core subgraph, the feature transformation can be defined as:
[0144]
[0145] Among them, Mk represents the adjacency matrix of the K-Core subgraph, with coefficient σ(x)=1 / (1+e -x ), C t Represents the feature transformation matrix.
[0146] Next, for each feature transformation in the K-Core subgraph, the temporal dependency is processed by the recurrent neural network RNN, and the output embedding matrix can be defined as:
[0147]
[0148] Among them, k max represents the total number of different partitions in the K-Core subgraph. When l = 1, is a zero matrix.
[0149] Afterwards, the embedding matrices of all K-Core subgraphs are aggregated to obtain the corresponding embedding matrix of the first snapshot, which can be defined as:
[0150]
[0151] S240 . For each node in each snapshot, determine the sum of first inner products of the node and a node set of co-occurring nodes in a fixed-length random walk, and the sum of second inner products involved in the node under a negative sampling distribution.
[0152] In this step, for each node in each snapshot, other nodes can be divided into two different parts, including the node set of nodes and co-occurring nodes in the fixed-length random walk, and the nodes under the negative sampling distribution. The sum of the first inner products of the nodes and the node set of co-occurring nodes in the fixed-length random walk and the sum of the second inner products involving the nodes under the negative sampling distribution are calculated respectively.
[0153] In one possible implementation, the sum of the first inner products of a node and a node set of co-occurring nodes in a fixed-length random walk can be: p =σ( u ,b v >), which represents the similarity between the embedding of node u and the embedding of co-occurring node v;
[0154] The sum of the second inner products of the nodes involved in the negative sampling distribution can be: n =σ( u ,b v′ >), which represents the similarity between the embedding of node u and the embedding of node v′ under the negative sampling distribution.
[0155] Among them, σ represents the activation function, b u represents the embedding vector of node u, b v Represents the embedding vector of the co-occurring node v.
[0156] S250: For each snapshot, determine the sum of the first inner products and the second inner products of all nodes in the snapshot as the first loss function value of the snapshot.
[0157] In this step, for each snapshot, the sum of the first inner products of each node in the snapshot can be added to obtain the sum of the first inner products of all nodes in the snapshot, the sum of the second inner products of each node in the snapshot can be added to obtain the sum of the second inner products of all nodes in the snapshot, and then the sum of the first inner products and the sum of the second inner products of all nodes in the snapshot are added, and the obtained sum is used as the first loss function value of the snapshot.
[0158] In a possible implementation, for each snapshot, CTGCN may be used to determine the first loss function value of the snapshot.
[0159] Exemplarily, based on the above example, the first loss function value can be defined as:
[0160]
[0161] Among them, V represents the set of all nodes, represents the loss term generated by each node, represents the set of nodes that co-occur with node u in a fixed-length random walk, represents the negative sampling distribution, and Q is a hyperparameter to balance the two parts.
[0162] The training method of the time context information extraction model provided in the embodiment of the present application comprises the following steps: for the node feature information of each snapshot, the node feature information of the snapshot is spliced with the node feature information of the adjacent snapshot to obtain the spliced node feature information; then the spliced node feature information is input into the multi-layer perceptron model to obtain the node feature information of the preset dimension; the node feature information of the preset dimension is input into the static graph embedding model to obtain the embedding vector of each first snapshot; for each node in each snapshot, the sum of the first inner products of the node and the node set of the co-occurring nodes in the fixed-length random walk and the sum of the second inner products of the node under the negative sampling distribution are determined; finally, for each snapshot, the sum of the first inner products and the second inner products of all the nodes in the snapshot is determined as the first loss function value of the snapshot. In this embodiment, by splicing the node feature information of a snapshot with adjacent snapshots, the changes in the node in the time series can be captured, the changes in the node feature information at different time points can be fully considered, and the perception ability of the time context information extraction model for time series information can be enhanced; by combining the multi-layer perceptron model and the static graph embedding model, the node feature information of the preset dimension of each snapshot can be effectively mapped to a low-dimensional vector space, and the embedding vector of each first snapshot is obtained; by measuring the similarity and negative sampling relationship between nodes and determining the first loss function value of the snapshot, the time context information extraction model can be effectively optimized, and the learning of the node relationship and time series changes in the corresponding snapshot of the model can be strengthened.
[0163] Based on the above embodiments, Figure 3 Schematic diagram of the training method of the temporal context information extraction model provided in the embodiment of the present application Figure 3 .like Figure 3 As shown, a possible implementation of the above step S4 is:
[0164] S310: Integrate the first context information of each first snapshot into the embedding vector of each first snapshot to obtain a fused embedding vector.
[0165] In this step, the embedding vectors of each first snapshot can represent the node feature information of each first snapshot in a low-dimensional space, and integrate the first context information of each first snapshot into the embedding vector of each first snapshot to obtain a fused embedding vector. The fused embedding vector contains the node feature information of each first snapshot in the low-dimensional space and the first context information of each first snapshot.
[0166] In a possible implementation, the first context information of each first snapshot is integrated into the embedding vector of each first snapshot. The forward LSTM vector and the backward LSTM vector of each first snapshot extracted by using the bidirectional BiLSTM are concatenated, and the vector obtained after the concatenation is the fused embedding vector.
[0167] Exemplarily, for the t-th snapshot, its first context information is expressed as and Then the fused embedding vector can be expressed as:
[0168]
[0169] Among them, W e It is a trainable weight matrix used to set the weights for the concatenation of the forward LSTM vector and the backward LSTM vector.
[0170] For example, in the first context information of the t-th snapshot, The vector obtained after concatenating them is [0.1, 0.2, 0.3, 0.4].
[0171] S320: Based on a decoder, the fused embedding vector is decoded to obtain a first topological structure of a second snapshot reconstructed based on each first snapshot.
[0172] In this step, the fused embedding vector is input into the decoder for decoding processing, and the nodes in the first topological structure of the second snapshot reconstructed from each first snapshot are obtained based on the low-dimensional mapping of the node feature information by the fused embedding vector, and the connection relationship between the nodes in the second snapshot is inferred based on the fused embedding vector to obtain the edges in the first topological structure of the second snapshot reconstructed from each first snapshot, and the first topological structure based on the second snapshot reconstructed from each first snapshot is obtained based on the nodes and edges in the first topological structure of the second snapshot reconstructed from each first snapshot.
[0173] In one possible implementation, the fused embedding vector may be a low-dimensional representation of a node in a snapshot or a low-dimensional representation of the entire snapshot. The decoder may remap the fused embedding vector to a structure or feature of a snapshot, and infer the connection relationship of the second snapshot (i.e., the existence or non-existence of edges between nodes) based on the fused embedding vector, thereby predicting a first topological structure of the second snapshot reconstructed based on each first snapshot.
[0174] The decoder can use one or more layers of a fully connected neural network to map the fused embedding vector to the topological structure of the second snapshot, including the presence or absence of edges between nodes and the adjacency matrix of the second snapshot.
[0175] The training method of the time context information extraction model provided in the embodiment of the present application obtains a fused embedding vector by integrating the first context information of each first snapshot into the embedding vector of each first snapshot; then, based on the decoder, the fused embedding vector is decoded to obtain the first topological structure of the second snapshot reconstructed based on each first snapshot. In this embodiment, by integrating the first context information of each first snapshot into the embedding vector of each first snapshot, the dynamic changes of each first snapshot in the time series can be captured, and the representation of each first snapshot by the embedding vector can be enhanced. The fused embedding vector not only contains the node feature information of each first snapshot, but also reflects the correlation of each first snapshot at different times; when the embedding vector is enhanced by the first context information of each first snapshot, when the decoder decodes the fused embedding vector, it can more accurately map the fused embedding vector to the first topological structure of the second snapshot reconstructed by each first snapshot.
[0176] Based on the above embodiments, Figure 4 Schematic diagram of the training method of the temporal context information extraction model provided in the embodiment of the present application Figure 4 .like Figure 4 As shown, before the above step S5, the training method of the temporal context information extraction model further includes:
[0177] S410: For each second snapshot, obtain a first adjacency matrix of the first snapshot corresponding to the second snapshot and a second adjacency matrix of the second snapshot.
[0178] In this step, a second snapshot is reconstructed based on the first snapshot. For each second snapshot, a first adjacency matrix of the first snapshot is obtained based on the nodes, edges, and node feature information of the first snapshot corresponding to the second snapshot. A second adjacency matrix of the second snapshot is obtained based on the nodes, edges, and node feature information carried during the reconstruction of the first snapshot.
[0179] In one possible implementation, the second adjacency matrix of the second snapshot may be obtained by calculating the inner product of the embedding vector for generating the second snapshot, and the embedding vector for generating the second snapshot may be a fused embedding vector obtained by integrating the first context information of each first snapshot into the embedding vector of each first snapshot.
[0180] For example, the first adjacency matrix of the first snapshot may be an N×N matrix A t , N represents the number of nodes in each first snapshot of the dynamic graph, and the matrix A t Element A t (i, j) can indicate whether there is a connection relationship between nodes i and j, that is, whether there is a corresponding edge. t(i,j)=1 means there is a connection between node i and node j. t (i, j) = 0 means that there is no connection between node i and node j.
[0181] The second adjacency matrix of the second snapshot can be expressed as:
[0182]
[0183] Among them, E t Represents the embedding vector based on bidirectional BiLSTM fusion, Indicates E t , σ represents the activation function (usually an activation function suitable for adjacency matrix prediction), which can map the result of the inner product to the [0,1] interval.
[0184] S420. Determine a second loss function value according to the first adjacency matrix and the second adjacency matrix.
[0185] In this step, the second loss function value is determined by calculating the second loss function value according to the first adjacency matrix and the second adjacency matrix.
[0186] Exemplarily, the calculation formula of the second loss function value of the t-th second snapshot may be:
[0187]
[0188] Among them, the matrix Elements It can indicate whether there is a connection relationship between node i and node j, that is, whether there is a corresponding edge. Indicates that there is a connection between node i and node j. Indicates that there is no connection between node i and node j.
[0189] The training method of the time context information extraction model provided in the embodiment of the present application obtains, for each second snapshot, the first adjacency matrix of the first snapshot corresponding to the second snapshot and the second adjacency matrix of the second snapshot; then, the second loss function value is determined according to the first adjacency matrix and the second adjacency matrix. In this embodiment, based on the first adjacency matrix of the first snapshot corresponding to the second snapshot and the second adjacency matrix of the second snapshot, the difference between the first adjacency matrix of the first snapshot and the second adjacency matrix of the second snapshot is quantified by determining the second loss function value, so that the gap between the first snapshot and the reconstructed second snapshot can be effectively measured.
[0190] Figure 5 Schematic diagram of the process of determining the topological structure in the dynamic graph provided in the embodiment of the present application Figure 1 .like Figure 5As shown, the method for determining the topological structure in the dynamic graph includes the following steps:
[0191] S510: Obtain a dynamic image to be processed.
[0192] In this step, the input data of the dynamic graph is obtained and converted into a representation of the graph structure to obtain the dynamic graph to be processed.
[0193] In a possible implementation, the dynamic graph to be processed may be segmented and processed according to different time periods, and the segmented snapshots are arranged according to time periods to form a time series of the dynamic graph to be processed.
[0194] The dynamic graph to be processed may include all nodes, edges, and node feature information of each snapshot. Nodes may represent entity objects, edges represent connection relationships between nodes, and node feature information may include attributes, identifiers, behaviors, and other information of the entity objects corresponding to the nodes.
[0195] S520: Determine an embedding vector of each snapshot according to node feature information of each snapshot in the dynamic graph to be processed.
[0196] In this step, embedding calculation is performed on the node feature information of each snapshot in the dynamic graph to be processed to obtain the embedded representation of the nodes of each snapshot, and the embedded representations of all nodes of each snapshot are concatenated to obtain the embedded vector of each snapshot.
[0197] In one possible implementation, a graph neural network can be used to generate embedding vectors for each snapshot, and the feature information of each node in each snapshot is embedded and calculated to obtain the feature vector of each node. The feature vector of each node is then weightedly summed with the feature vectors of neighboring nodes to obtain the updated feature vector of each node. The updated feature vector of each node is further processed by a nonlinear activation function and pooled, and then the embedding vector of each snapshot is output.
[0198] For example, based on the embedding vectors of each snapshot, the nodes in each snapshot can be classified, and possible connection relationships between different nodes can also be predicted.
[0199] S530, inputting the embedding vector of each snapshot into a temporal context information extraction model to obtain context information of each snapshot;
[0200] The temporal context information extraction model is obtained by training based on any one of the embodiments of the training method for the temporal context information extraction model described above.
[0201] In this step, the embedding vector of each snapshot is used as the input of the temporal context information extraction model, and the embedding vector of each snapshot is extracted based on the temporal context information extraction model to obtain the context information of each snapshot.
[0202] In one possible implementation, the temporal context information extraction model can be a bidirectional RNN model, which simultaneously considers the forward time series and reverse time series of the embedding vectors of each input snapshot, and performs splicing or weighted averaging on the corresponding time period, and finally outputs the context information of each snapshot.
[0203] S540: Determine the topological structure of the dynamic graph to be processed according to the context information of each snapshot and the embedding vector of each snapshot.
[0204] In this step, the topological structure of each snapshot is reconstructed according to the context information of each snapshot and the embedding vector of each snapshot, and then the set of the topological structures of each snapshot is used as the topological structure of the dynamic graph to be processed.
[0205] In a possible implementation, the number and types of nodes in each snapshot of the dynamic graph are the same, the nodes of the topological structure of each snapshot reconstructed are the same as the nodes of the topological structure of each snapshot before the reconstruction, and the edges of the topological structure of each snapshot reconstructed can be the same as, or can be increased or decreased compared with the edges of the topological structure of each snapshot before the reconstruction.
[0206] Exemplarily, snapshot K in the dynamic graph includes node 1, node 2, and node 3. There is a connection relationship between node 1 and node 2, that is, there is edge 1. There is a connection relationship between node 1 and node 3, that is, there is edge 2. Then the reconstructed snapshot includes node 1, node 2, and node 3. There is a connection relationship between node 1 and node 2, that is, edge 1 is the same. There is a connection relationship between node 2 and node 3, that is, there is edge 3. Compared with snapshot K, edge 3 is increased and edge 2 is reduced.
[0207] The method for determining the topological structure in a dynamic graph provided in an embodiment of the present application is to obtain the dynamic graph to be processed; then determine the embedding vector of each snapshot according to the node feature information of each snapshot in the dynamic graph to be processed; then input the embedding vector of each snapshot into the time context information extraction model to obtain the context information of each snapshot, wherein the time context information extraction model is trained based on any embodiment of the training method of the above-mentioned time context information extraction model; finally, determine the topological structure of the dynamic graph to be processed according to the context information of each snapshot and the embedding vector of each snapshot. In this embodiment, the node feature information of each snapshot in the dynamic graph to be processed is combined with the context information of each snapshot, which effectively combines the structural information and time dynamic information of the dynamic graph, and can improve the comprehensiveness of the analysis of the dynamic graph; the trained time context information extraction model is used to extract the context information of each snapshot, which can effectively capture the changing law of the time dimension in the dynamic graph, thereby improving the accuracy of the prediction of the topological structure of the dynamic graph to be processed.
[0208] Based on the above embodiments, the following are device embodiments involved in this application:
[0209] Figure 6 A schematic diagram of the structure of a training device for a temporal context information extraction model provided in an embodiment of the present application. Figure 6 As shown, the training device 600 of the temporal context information extraction model includes:
[0210] A first acquisition module 610 is used to acquire node feature information of each first snapshot in the dynamic graph;
[0211] A first determination module 620, configured to determine an embedding vector of each first snapshot and a first loss function value of each first snapshot according to node feature information of each first snapshot;
[0212] A first processing module 630, configured to input the embedding vector of each first snapshot into a bidirectional RNN model to obtain first context information of each first snapshot;
[0213] A second processing module 640 is used to obtain a first topological structure of a second snapshot reconstructed based on each first snapshot according to the first context information of each first snapshot and the embedding vector of each first snapshot;
[0214] A second determination module 650 is used to determine a total loss function value of dynamic graph embedding according to the first topological structure of each second snapshot, where the total loss function value includes: a first loss function value and a second loss function value, where the second loss function value is determined based on the first topological structure of each second snapshot;
[0215] The third processing module 660 is used to determine whether the total loss function value is less than the preset loss function value. If it is less than the preset loss function value, the bidirectional RNN model is determined as a time context information extraction model; if it is not less than the preset loss function value, the parameters in the bidirectional RNN model are updated based on the total loss function value, and steps S1-S5 are repeated until the total loss function value is less than the preset loss function value.
[0216] In an optional embodiment, after acquiring the node feature information of each first snapshot in the dynamic graph, the first acquisition module 610 is further configured to:
[0217] For each node in each snapshot, the node feature information of the node's adjacent nodes is integrated into the node feature information of the node to obtain the updated node feature information of the node. For each snapshot, the node feature information of the snapshot includes: the updated node feature information of each node in the snapshot.
[0218] In an optional embodiment, the first determining module 620 is specifically configured to:
[0219] For the node feature information of each snapshot, the node feature information of the snapshot is spliced with the node feature information of an adjacent snapshot to obtain spliced node feature information;
[0220] Input the spliced node feature information into the multi-layer perceptron model to obtain node feature information of a preset dimension;
[0221] Inputting node feature information of a preset dimension into a static graph embedding model to obtain an embedding vector of each first snapshot;
[0222] For each node in each snapshot, determine the sum of first inner products of the node and the node set of co-occurring nodes in a fixed-length random walk, and the sum of second inner products involving the node under a negative sampling distribution;
[0223] For each snapshot, the sum of the first inner products and the second inner products of all nodes in the snapshot is determined as the first loss function value of the snapshot.
[0224] In an optional embodiment, the second processing module 640 is specifically configured to:
[0225] Integrate the first context information of each first snapshot into the embedding vector of each first snapshot to obtain a fused embedding vector;
[0226] Based on the decoder, the fused embedding vector is decoded to obtain a first topological structure of the second snapshot reconstructed based on each first snapshot.
[0227] In an optional embodiment, the second determination module 650, before determining the total loss function value of the dynamic graph embedding according to the first topological structure of each second snapshot, is further configured to:
[0228] For each second snapshot, obtaining a first adjacency matrix of the first snapshot corresponding to the second snapshot and a second adjacency matrix of the second snapshot;
[0229] A second loss function value is determined based on the first adjacency matrix and the second adjacency matrix.
[0230] Figure 7 A schematic diagram of a structure of a device for determining a topological structure in a dynamic graph provided in an embodiment of the present application. Figure 7 As shown, the device 700 for determining the topological structure in the dynamic graph includes:
[0231] The second acquisition module 710 is used to acquire the dynamic image to be processed;
[0232] A third determination module 720 determines an embedding vector of each snapshot according to node feature information of each snapshot in the dynamic graph to be processed;
[0233] A fourth processing module 730 is used to input the embedding vector of each snapshot into a temporal context information extraction model to obtain context information of each snapshot, where the temporal context information extraction model is trained by a training device based on the temporal context information extraction model;
[0234] The fourth determination module 740 is used to determine the topological structure of the dynamic graph to be processed according to the context information of each snapshot and the embedding vector of each snapshot.
[0235] Based on the above embodiments, Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 8 As shown, the electronic device 800 includes: a processor 810, a memory 820 and a bus 830;
[0236] The memory 820 is used to store computer executable instructions of the processor 810;
[0237] The processor 810 is configured to execute the technical solution of any of the aforementioned method embodiments by executing computer execution instructions.
[0238] Optionally, the memory 820 may be independent or integrated with the processor 810 .
[0239] Optionally, the memory 820 may include a random access memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.
[0240] The bus 830 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the drawings of the present application, but this does not mean that there is only one bus or one type of bus.
[0241] The above-mentioned processor can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0242] The electronic device is used to execute the technical solution of any of the aforementioned method embodiments, and its implementation principle and technical effect are similar and will not be repeated here.
[0243] An embodiment of the present application also provides a computer-readable storage medium on which computer execution instructions are stored. When the computer execution instructions are executed by a processor, they are used to implement the technical solution provided by any of the above method embodiments.
[0244] An embodiment of the present application also provides a computer program product, including a computer program, which includes computer instructions stored in a computer-readable storage medium. When the computer program is executed by a processor, it is used to implement the technical solution provided by any of the above method embodiments.
[0245] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0246] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0247] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0248] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.
[0249] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. If not specifically stated, the processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. If not specifically stated, the storage unit may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc.
[0250] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0251] In the above embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0252] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0253] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A training method for a temporal context information extraction model, characterized in that: S1, obtaining node feature information of each first snapshot in the dynamic graph; S2, determining an embedding vector of each first snapshot and a first loss function value of each first snapshot according to node feature information of each first snapshot; S3, inputting the embedding vector of each first snapshot into a bidirectional recurrent neural network (RNN) model to obtain first context information of each first snapshot; S4, obtaining a first topological structure of the second snapshot reconstructed based on each first snapshot according to the first context information of each first snapshot and the embedding vector of each first snapshot; S5, determining a total loss function value of the dynamic graph embedding according to the first topological structure of each second snapshot, the total loss function value comprising: the first loss function value and a second loss function value, the second loss function value being determined based on the first topological structure of each second snapshot; S6, determine whether the total loss function value is less than the preset loss function value. If it is less than the preset loss function value, determine the bidirectional RNN model as the temporal context information extraction model; if it is not less than the preset loss function value, update the parameters in the bidirectional RNN model based on the total loss function value, and repeat steps S1-S5 until the total loss function value is less than the preset loss function value.
2. The method according to claim 1, characterized in that: After acquiring the node feature information of each first snapshot in the dynamic graph, the method further includes: For each node in each snapshot, the node feature information of the adjacent nodes of the node is integrated into the node feature information of the node to obtain the updated node feature information of the node. For each snapshot, the node feature information of the snapshot includes: the updated node feature information of each node in the snapshot.
3. The method according to claim 1, characterized in that The step of determining the embedding vector of each first snapshot and the first loss function value of each first snapshot according to the node feature information of each first snapshot includes: For each snapshot of node feature information, the node feature information of the snapshot is spliced with the node feature information of an adjacent snapshot to obtain spliced node feature information; Inputting the spliced node feature information into a multi-layer perceptron model to obtain node feature information of a preset dimension; Inputting the node feature information of the preset dimension into a static graph embedding model to obtain an embedding vector of each first snapshot; For each node in each snapshot, determine the sum of first inner products of the node and a node set of co-occurring nodes in a fixed-length random walk, and the sum of second inner products involving the node under a negative sampling distribution; For each snapshot, a sum of the first inner products and the second inner products of all nodes in the snapshot is determined as a first loss function value of the snapshot.
4. The method according to claim 1, characterized in that: The obtaining, according to the first context information of each first snapshot and the embedding vector of each first snapshot, a first topological structure of the second snapshot reconstructed based on each first snapshot includes: Integrate the first context information of each first snapshot into the embedding vector of each first snapshot to obtain a fused embedding vector; Based on a decoder, the fused embedding vector is decoded to obtain a first topological structure of the second snapshot reconstructed based on each first snapshot.
5. The method according to any one of claims 1 to 4, characterized in that: Before determining the total loss function value of the dynamic graph embedding according to the first topological structure of each second snapshot, the method further includes: For each second snapshot, obtaining a first adjacency matrix of the first snapshot corresponding to the second snapshot and a second adjacency matrix of the second snapshot; The second loss function value is determined according to the first adjacency matrix and the second adjacency matrix.
6. A method for determining a topological structure in a dynamic graph, characterized in that: include: Get the dynamic image to be processed; Determining an embedding vector of each snapshot according to node feature information of each snapshot in the dynamic graph to be processed; Inputting the embedding vector of each snapshot into a temporal context information extraction model to obtain context information of each snapshot, wherein the temporal context information extraction model is trained based on the method according to any one of claims 1 to 5; The topological structure of the dynamic graph to be processed is determined according to the context information of each snapshot and the embedding vector of each snapshot.
7. A training device for a temporal context information extraction model, characterized in that: include: A first acquisition module, used to acquire node feature information of each first snapshot in the dynamic graph; A first determination module, used to determine an embedding vector of each first snapshot and a first loss function value of each first snapshot according to node feature information of each first snapshot; A first processing module, used for inputting the embedding vector of each first snapshot into a bidirectional recurrent neural network (RNN) model to obtain first context information of each first snapshot; A second processing module, configured to obtain, according to the first context information of each first snapshot and the embedding vector of each first snapshot, a first topological structure of the second snapshot reconstructed based on each first snapshot; A second determination module is used to determine a total loss function value of the dynamic graph embedding according to the first topological structure of each second snapshot, the total loss function value comprising: the first loss function value and a second loss function value, the second loss function value being determined based on the first topological structure of each second snapshot; The third processing module is used to determine whether the total loss function value is less than the preset loss function value. If it is less than the preset loss function value, the bidirectional RNN model is determined as the time context information extraction model; if it is not less than the preset loss function value, the parameters in the bidirectional RNN model are updated based on the total loss function value, and steps S1-S5 are repeated until the total loss function value is less than the preset loss function value.
8. A device for determining a topological structure in a dynamic graph, characterized in that: include: The second acquisition module is used to acquire the dynamic image to be processed; A third determination module determines an embedding vector of each snapshot according to node feature information of each snapshot in the dynamic graph to be processed; A fourth processing module, used for inputting the embedding vector of each snapshot into a temporal context information extraction model to obtain context information of each snapshot, wherein the temporal context information extraction model is trained based on the method according to any one of claims 1 to 5; The fourth determination module is used to determine the topological structure of the dynamic graph to be processed according to the context information of each snapshot and the embedding vector of each snapshot.
9. An electronic device, characterized in that: include: a processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.
11. A computer program product, characterized in that The method comprises a computer program, which is used to implement the method according to any one of claims 1 to 6 when the computer program is executed by a processor.