Link Prediction Method, Electronic Device and Storage Medium in Temporal Network
By extracting the timing adaptive traversal in the timing network and calculating the embedding distance and structural distance, the problem of low prediction accuracy of inductive links in the timing network in the prior art is solved, and higher prediction accuracy and adaptability to sparse networks are achieved.
Patent Information
- Application Number
- CN202210959140.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-10
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2042-08-10
AI Technical Summary
Inductive link prediction methods in existing timing networks have low prediction accuracy in sparse networks, especially inability to effectively capture tightly connected but unsampled node pairs, and rely on common neighbors between nodes, resulting in inaccurate prediction results.
A link prediction method in a timing network is proposed. By extracting the timing adaptive traversal of source nodes and target nodes, obtaining their distance measurement vectors and structure perception vectors on the embedding space and dynamic graph structure, and calculating the embedding distance and structural distance between source nodes and target nodes, thereby predicting the probability of their link forming at the target timestamp.
This method effectively improves the accuracy of inductive link prediction in timing networks, can capture the relationship between nodes more accurately in sparse networks, and reduces dependence on node/edge attributes.
Smart Images

Figure CN115329146B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer technology, and particularly relates to a link prediction method, an electronic device, and a storage medium in a temporal network. Background Art
[0002] Inductive link prediction in temporal networks aims to predict future links related to nodes that did not appear in historical timestamps. Existing inductive link prediction methods mainly focus on learning node representations from node / edge attributes and the dynamic evolution of the network or generating predictions by measuring the distance between nodes in a temporal network. However, the application scope of this method is limited because in many real-world scenarios, node / edge attributes are not available, which makes it impossible to learn node representations from attribute information. Recently, temporal anonymous walks have been proposed to perform inductive link prediction by measuring the distance between nodes. However, this method highly depends on the common neighbors between nodes and has two main drawbacks, especially in sparse temporal networks: on the one hand, it can only explicitly model the connectivity between nodes on the extracted walks and does not consider node pairs that are closely connected but not sampled; on the other hand, randomly sampling the neighbors of nodes in the temporal network or simply choosing the nearest neighbors cannot accurately locate the common neighbors between nodes. Therefore, the above methods reduce the prediction accuracy of inductive links in temporal networks. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a link prediction method, an electronic device, and a storage medium in a temporal network, which can improve the accuracy of inductive link prediction in a temporal network.
[0004] The content of the present invention includes a link prediction method in a temporal network, comprising:
[0005] Respectively extract the temporal adaptive walks of the source node and the target node in the temporal network; the neighbor nodes in the temporal adaptive walks are visible nodes, the visible nodes are nodes that appear in a preset training set, and at least one of the source node and the target node is an invisible node, and the invisible node is a node that does not appear in the training set;
[0006] According to the temporal adaptive walk of the source node, obtain the first distance metric vector of the source node in the embedding space, and according to the temporal adaptive walk of the target node, obtain the second distance metric vector of the target node in the embedding space;
[0007] According to the first distance metric vector and the second distance metric vector, calculate the first distance between the source node and the target node in the embedding space;
[0008] Obtain a first structure-aware vector of the source node on the dynamic graph structure according to the temporal adaptive walk of the source node, and obtain a second structure-aware vector of the target node on the dynamic graph structure according to the temporal adaptive walk of the target node;
[0009] Calculate a second distance between the source node and the target node on the dynamic graph structure according to the first structure-aware vector and the second structure-aware vector;
[0010] Predict the probability that the source node and the target node form a link at the target timestamp according to the first distance and the second distance.
[0011] Optionally, the respectively extracting the temporal adaptive walks of the source node and the target node in the temporal network includes:
[0012] Obtain a first embedding vector of the source node and a second embedding vector of the target node respectively;
[0013] Calculate an embedding distance between the source node and the target node according to the first embedding vector and the second embedding vector;
[0014] If the embedding distance is greater than a preset distance threshold, sample the neighbor nodes closest to the source node to extract the temporal adaptive walk of the source node, and sample the neighbor nodes closest to the target node to extract the temporal adaptive walk of the target node;
[0015] If the embedding distance is less than the distance threshold, randomly sample the neighbor nodes of the source node to extract the temporal adaptive walk of the source node, and randomly sample the neighbor nodes of the target node to extract the temporal adaptive walk of the target node.
[0016] Optionally, the obtaining the first embedding vector of the source node includes:
[0017] Generate an initial embedding vector of the source node;
[0018] If the source node is an invisible node, use the initial embedding vector of the source node as the first embedding vector of the source node;
[0019] If the source node is a visible node, extract the temporal random walk of the source node; generate the initial embedding vectors of the nodes in the temporal random walk; determine the first embedding vector of the source node according to the initial embedding vectors of the nodes in the temporal random walk.
[0020] Optionally, the obtaining the first distance metric vector of the source node in the embedding space according to the temporal adaptive walk of the source node includes:
[0021] Generate the initial embedding vectors of the source node and the neighbor nodes in the temporal adaptive walk of the source node respectively;
[0022] Calculate the weights of the neighbor nodes of the source node according to the initial embedding vectors of the source node and the neighbor nodes of the source node;
[0023] Calculate the first distance metric vector of the source node in the embedding space according to the initial embedding vector of the source node, the initial embedding vectors of the neighbor nodes of the source node, and the weights.
[0024] Optionally, the calculation formula for the weights of the neighbor nodes of the source node is:
[0025]
[0026]
[0027] where the source node has M temporal adaptive walks, and there are m neighbor nodes in the temporal adaptive walks, is the weight of the l-th neighbor node in the τ-th temporal adaptive walk of the source node, 1 ≤ τ ≤ M, 1 ≤ l ≤ m, is the initial embedding vector of the l-th neighbor node in the τ-th temporal adaptive walk of the source node, v s is the initial embedding vector of the source node, and are training parameters, is the l-th neighbor node in the i-th temporal adaptive walk of the source node, 1 ≤ i ≤ M, is the set of the l-th neighbor nodes in the M temporal adaptive walks of the source node;
[0028] The calculation formula for the first distance metric vector of the source node in the embedding space is:
[0029]
[0030]
[0031] where, is the first distance metric vector of the source node in the embedding space, is a learning parameter, and σ is an activation function;
[0032] The calculation formula for the first distance is:
[0033]
[0034] where, is the first distance, is the second distance metric vector of the target node in the embedding space.
[0035] Optionally, the obtaining of the first structure-aware vector of the source node on the dynamic graph structure according to the time-series adaptive walk of the source node includes:
[0036] Generating an anonymous distance coding vector for the neighbor nodes of the source node;
[0037] Generating a distance-aware vector for the neighbor nodes of the source node according to the anonymous distance coding vector of the neighbor nodes of the source node;
[0038] Generating a time coding vector for the neighbor nodes of the source node according to the target timestamp and the timestamps when the neighbor nodes in the time-series adaptive walk of the source node form links with the previous node;
[0039] Generating a time-series distance-aware vector for the neighbor nodes of the source node according to the distance-aware vector and the time coding vector of the neighbor nodes of the source node;
[0040] Generating a state vector for the time-series adaptive walk of the source node according to the time-series distance-aware vector of the neighbor nodes of the source node;
[0041] Generating the first structure-aware vector of the source node on the dynamic graph structure according to the state vector of the time-series adaptive walk of the source node.
[0042] Optionally, the generation formula for the distance-aware vector of the neighbor nodes of the source node is:
[0043] s i = MLP(a i ) = W2(σ(W1a i ));
[0044] where the source node has M time-series adaptive walks, there are m neighbor nodes in the time-series adaptive walk, s i is the distance-aware vector of the i-th neighbor node of the source node, 1 ≤ i ≤ M*m, a i is the anonymous distance coding vector of the i-th neighbor node of the source node, W1 and W2 are training parameters, and σ is an activation function;
[0045] The generation formula for the time coding vector of the neighbor nodes of the source node is:
[0046]
[0047]
[0048] where Ti is the time-coded vector of the i-th neighbor node of the source node, t st is the target timestamp, t i is the timestamp when the i-th neighbor node of the source node forms a link with the previous node in the temporal adaptive walk of the source node, ω1, ω2, …, ω d are learning parameters;
[0049] The generation formula for the temporal distance perception vector of the neighbor nodes of the source node is:
[0050] h i = [s i , T i ;
[0051] where h i is the temporal distance perception vector of the i-th neighbor node of the source node;
[0052] The generation formula for the state vector of the temporal adaptive walk of the source node is:
[0053]
[0054]
[0055]
[0056] where is the state vector of the j-th temporal adaptive walk of the source node, 1 ≤ j ≤ M, is the hidden state vector during the forward transmission of the m-th neighbor node of the j-th temporal adaptive walk of the source node, is the hidden state vector during the backward transmission of the m-th neighbor node of the j-th temporal adaptive walk of the source node, h j,m is the temporal distance perception vector of the m-th neighbor node of the j-th temporal adaptive walk of the source node;
[0057] The generation formula for the first structure perception vector of the source node on the dynamic graph structure is:
[0058]
[0059]
[0060]
[0061] where is the first structure perception vector of the source node on the dynamic graph structure, and are learning parameters;
[0062] The calculation formula of the second distance is as follows:
[0063]
[0064] wherein, is the second distance, is the second structure perception vector of the target node on the dynamic graph structure, and W3 and W4 are learning parameters.
[0065] Optionally, the calculation formula of the probability is as follows:
[0066]
[0067] where z st is the probability, is the first distance, is the second distance, W5 and W6 are training parameters, and σ is an activation function.
[0068] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the link prediction method in the above-mentioned temporal network is implemented.
[0069] The present invention also provides a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the link prediction method in the above-mentioned temporal network.
[0070] The beneficial effects of the present invention are as follows: The temporal adaptive walks of the source node and the target node in the temporal network are respectively extracted, and at least one of the source node and the target node is an invisible node. According to the temporal adaptive walks of the source node and the target node, the distance metric vectors of the source node and the target node in the embedding space are respectively obtained to calculate the first distance between the source node and the target node in the embedding space, and according to the temporal adaptive walks of the source node and the target node, the structure perception vectors of the source node and the target node on the dynamic graph structure are respectively obtained to calculate the second distance between the source node and the target node on the dynamic graph structure, so as to predict the probability that the source node and the target node form a link at the target timestamp according to the first distance and the second distance, effectively improving the accuracy of inductive link prediction in the temporal network. Description of the Drawings
[0071] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0072] Figure 1 It is a schematic flowchart of the link prediction method in the temporal network provided by the embodiment of the present application.
[0073] Figure 2 It is a framework diagram of the DEAL model in the link prediction method in the temporal network provided by the embodiment of the present application.
[0074] Figure 3a It is a schematic diagram of the temporal network provided by the embodiment of the present application.
[0075] Figure 3b It is a schematic diagram of the temporal adaptive walk of the source node provided by the embodiment of the present application.
[0076] Figure 3c It is a schematic diagram of the temporal adaptive walk of the target node provided by the embodiment of the present application.
[0077] Figures 4a to 4b It is a performance comparison diagram of the DEAL model and the basic model in terms of the AP metric in different data-sparse scenarios.
[0078] Figures 5a to 5c It is a performance comparison diagram of the DEAL model with different neighbor sampling methods in terms of the AP metric.
[0079] Figures 6a to 6d It is a performance comparison diagram of the DEAL model in terms of the AP metric under different hyperparameters.
[0080] Figure 7 It is a schematic structural diagram of the electronic device provided by the embodiment of the present application. Detailed implementation manners
[0081] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some, rather than all, of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application.
[0082] As shown in the attached Figure 1As shown in the figure, an embodiment of the present invention provides a link prediction method in a temporal network. It should be noted that the graph network provides an effective method for studying complex systems, which regards elements as nodes and the mutual associations between nodes as edges. In practical scenarios such as social media and web search, network data usually evolves over time, that is, nodes and edges continuously evolve to form a temporal network. As Figure 3a shown, new nodes (i.e., invisible nodes, such as node v t , v5, v6) and edges (such as the edge between node v t and v5) continuously appear in the temporal network. The edges therein can be divided into transductive links connecting visible nodes and inductive links related to invisible nodes. That is, the inductive link can be a link connecting a visible node and an invisible node, or a link connecting invisible nodes.
[0083] This application uses the Distance-Aware Learning (DEAL) model to predict inductive links in a temporal network. The purpose of inductive link prediction is to predict the appearance of future links associated with new nodes (invisible nodes) that did not appear during the training phase. Let represent the temporal network, where both ν and ε are time-varying. Each edge (v i , v j , t ij ) ∈ ε represents a temporal edge that connects nodes v ij and v i at timestamp t j . Let V s represent the visible nodes that appear during the training phase, and V u represent the invisible nodes that appear after the training phase. Then, the prediction of inductive links can be expressed as predicting the probability of {(v i , v j , t ij ) | v i ∈ V u || v j ∈ V u}.
[0084] As shown in the appendix Figure 1 , an embodiment of the present invention provides a link prediction method in a temporal network, including steps 101 to 106, specifically as follows:
[0085] Step 101: Extract the temporal adaptive walks of the source node and the target node in the temporal network respectively; the neighbor nodes in the temporal adaptive walks are visible nodes, the visible nodes are the nodes that appear in a preset training set, at least one of the source node and the target node is an invisible node, and the invisible node is the node that does not appear in the training set.
[0086] Among them, the neighbor nodes in the temporal adaptive walk of the source node are the neighbor nodes of the source node, that is, other nodes in the temporal adaptive walk of the source node except the source node itself. The neighbor nodes in the temporal adaptive walk of the target node are the neighbor nodes of the target node, that is, other nodes in the temporal adaptive walk of the target node except the target node itself.
[0087] As Figure 2 shown, an adaptive sampling module is set in the DEAL model to dynamically combine the methods of randomly sampling neighbor nodes and selecting the nearest neighbor nodes to extract the temporal adaptive walks of the source node and the target node, so as to increase the probability of including the common neighbors of the source node and the target node.
[0088] Specifically, the step of respectively extracting the temporal adaptive walks of the source node and the target node in the temporal network in step 101 includes:
[0089] Obtaining the first embedding vector of the source node and the second embedding vector of the target node respectively;
[0090] Calculating the embedding distance between the source node and the target node according to the first embedding vector and the second embedding vector;
[0091] If the embedding distance is greater than a preset distance threshold, sample the neighbor nodes closest to the source node to extract the temporal adaptive walk of the source node, and sample the neighbor nodes closest to the target node to extract the temporal adaptive walk of the target node;
[0092] If the embedding distance is less than the distance threshold, randomly sample the neighbor nodes of the source node to extract the temporal adaptive walk of the source node, and randomly sample the neighbor nodes of the target node to extract the temporal adaptive walk of the target node.
[0093] Among them, the source node v s can be a visible node or an invisible node. When the source node v s is an invisible node, the first embedding vector of the source node v s is its initial embedding vector; when the source node v s is an invisible node, the first embedding vector of the source node v s is the trained embedding vector.
[0094] Specifically, the step of obtaining the first embedding vector of the source node includes:
[0095] Generating the initial embedding vector of the source node;
[0096] If the source node is an invisible node, use the initial embedding vector of the source node as the first embedding vector of the source node;
[0097] If the source node is a visible node, extract the temporal random walk of the source node; generate the initial embedding vectors of the nodes in the temporal random walk; determine the first embedding vector of the source node according to the initial embedding vectors of the nodes in the temporal random walk.
[0098] Each node in the temporal network has a unique identification code ID. According to the identification code of the node, the initial embedding vector of the node can be generated, which is initialized by an embedding layer with an embedding dimension of d. Therefore, according to the source node v s 's identification code, generate the initial embedding vector v s of the source node v s .
[0099] If the source node v s is an invisible node, the first embedding vector s of the source node v is its initial embedding vector v s .
[0100] If the source node v s is a visible node, train the embedding vector of the source node v s to obtain the first embedding vector s of the source node v It should be noted that it is also possible to pre-train the embedding vectors of each visible node in the training set before prediction, so that the trained embedding vector of the source node v s can be directly obtained during prediction as the first embedding vector
[0101] Specifically, collect the nodes of the link by backtracking the timestamps of the edges in the training set, thereby forming each temporal random walk of the source node v s , that is:
[0102] w = {(v1, v2…, v n )|(v i-1 , v i , t i ) ∈ ε,
[0103] where v1 is the starting point of a temporal random walk, that is v s , n is the length of a temporal random walk, that is the number of walking steps, t2 > t3 > … > t n , indicating that the nodes on a temporal random walk should be arranged in chronological order, (v i-1 , v i , ti ) ∈ ε is a temporal edge, indicating node v i-1 and v i form a link at timestamp t i to form a link.
[0104] The source node v s has M temporal random walks, namely:
[0105]
[0106] First, according to the identification codes of each node in the M temporal random walks, the initial embedding vectors of each node are generated correspondingly. Then, according to the initial embedding vectors of all nodes in the M temporal random walks, the embedding vector of the source node v s is updated, namely:
[0107]
[0108]
[0109] where, is the initial embedding vector of the l-th neighbor node of the τ-th temporal random walk of the source node v s , and the neighbor node refers to other nodes in the temporal random walk except the source node v s outside, 1 ≤ τ ≤ M, 1 ≤ l ≤ n - 1, is the aggregated representation of all the l-th neighbor nodes in the M temporal random walks of the source node v s , is the final updated representation of the source node v s , that is, the first embedding vector of the source node v s That is to say, when the source node v s is a visible node, the first embedding vector of the source node v s is is is the average pooling aggregation function. To avoid introducing additional trainable parameters, mean pooling is used here to focus on measuring the distance between node embeddings in the subsequent process.
[0110] In addition, obtaining the second embedding vector of the target node includes:
[0111] generating the initial embedding vector of the target node;
[0112] if the target node is an invisible node, then taking the initial embedding vector of the target node as the second embedding vector of the target node;
[0113] If the target node is a visible node, extract the temporal random walk of the target node; generate the initial embedding vectors of the nodes in the temporal random walk; determine the second embedding vector of the target node according to the initial embedding vectors of the nodes in the temporal random walk.
[0114] Similarly, the target node v t can be a visible node or an invisible node, but at least one of the source node v s and the target node v t is an invisible node. When the target node v t is an invisible node, the second embedding vector t of the target node v is its initial embedding vector v t ; when the target node v t is an invisible node, the second embedding vector t of the target node v is the trained embedding vector The method for obtaining the second embedding vector t of the target node v is the same as the method for obtaining the first embedding vector s of the source node v and will not be elaborated here in detail.
[0115] After obtaining the first embedding vector and the second embedding vector , use the L2 normalization method to measure the embedding distance d' s between the source node v t and the target node v st , that is:
[0116]
[0117] It should be noted that the temporal random walk in this embodiment only propagates the information of visible nodes (i.e., neighbor nodes appearing in the training set), while ignoring the information of invisible nodes.
[0118] If the embedding distance d' s between the source node v t and the target node v st is large, then the source node v s and the target node v t may be invisible nodes, and all their neighbor nodes are invisible nodes. In this case, use nearest sampling to sample the nearest neighbor nodes to increase the probability of capturing the common neighbors between the source node v s and the target node v t . If the source node v s and the target node vt The embedding distance d' between st is small, and its historical neighbor nodes are often similar visible nodes. Sample neighbor nodes of the source node v s and the target node v t on the full time scale to avoid missing their early common neighbors.
[0119] Therefore, during the extraction of the temporal adaptive walk, the sampling probability of the neighbor node v i is as follows:
[0120]
[0121] where is the historical interaction node of the last step on the adaptive walk, λ is a hyperparameter that determines the intensity of recent sampling. When λ equals 0, recent sampling degenerates to uniform sampling, and d threshold is a trade-off parameter that controls the threshold for choosing random neighbor node sampling or nearest neighbor node sampling.
[0122] According to the sampling probability of the neighbor node v i select the temporal adaptive walks of the source node v and the target node v s and the target node v t . The source node v s has M temporal adaptive walks The target node v t has M temporal adaptive walks As Figure 3b shown, the three temporal adaptive walks of the source node v s are respectively v s →v2→v1, v s →v4→v2, v s →v3→v t , as Figure 3c shown, the three temporal adaptive walks of the target node v t are respectively v t →v3→v s , v t →v4→v2, v t →v5→v6.
[0123] Then, as Figure 2 shown, the DEAL model also has a dual-channel distance metric module that measures the distance between the source node v s and the target node v t based on the embedding space (i.e., the first distance) and the distance based on the dynamic graph structure (i.e., the second distance).
[0124] Step 102: Obtain the first distance metric vector of the source node in the embedding space according to the temporal adaptive walk of the source node, and obtain the second distance metric vector of the target node in the embedding space according to the temporal adaptive walk of the target node.
[0125] After obtaining the temporal adaptive walks of the source node and the target node, propagate information from the neighbor nodes visible to the source node and the target node, and learn the corresponding distance metric representations in the embedding space, that is, the distance metric vectors.
[0126] Specifically, the obtaining the first distance metric vector of the source node in the embedding space according to the temporal adaptive walk of the source node in Step 102 includes:
[0127] Generate initial embedding vectors for the source node and the neighbor nodes in the temporal adaptive walk of the source node respectively;
[0128] Calculate the weights of the neighbor nodes of the source node according to the initial embedding vectors of the source node and the neighbor nodes of the source node;
[0129] Calculate the first distance metric vector of the source node in the embedding space according to the initial embedding vector of the source node, the initial embedding vectors of the neighbor nodes of the source node, and the weights.
[0130] Source node v s Has M temporal adaptive walks Each temporal adaptive walk has m neighbor nodes, For the source node v s Is the set of the l-th neighbor nodes in the M temporal adaptive walks of v, 1 ≤ l ≤ m.
[0131] Use an embedding layer to generate a d-dimensional embedding vector for each node (including the source node v s And its neighbor nodes in the temporal adaptive walk). Then, learn the weights of each neighbor node in the temporal adaptive walk, that is:
[0132]
[0133] Where, Is the weight of the l-th neighbor node in the τ-th temporal adaptive walk of the source node v s , 1 ≤ τ ≤ M, 1 ≤ l ≤ m, Is the initial embedding vector of the l-th neighbor node in the τ-th temporal adaptive walk of the source node v s , v s Is the initial embedding vector of the source node v s , And are trainable parameters, LeakyRelu is an activation function, and [,] represents a concatenation operation.
[0134] Then, the attention weights are normalized using the softmax function, i.e.:
[0135]
[0136] where, is the final weight of the l-th neighbor node in the τ-th temporal adaptive walk of the source node v s , is the l-th neighbor node in the i-th temporal adaptive walk of the source node v s , 1 ≤ i ≤ M, is the set of the l-th neighbor nodes in the M temporal adaptive walks of the source node v s .
[0137] Then, according to the attention scores, the embeddings of all the l-th neighbor nodes of the source node v s (i.e., ) are combined, i.e.:
[0138]
[0139] where, is a learnable parameter, is the l-th neighbor node in the τ-th temporal adaptive walk of the source node v s , 1 ≤ τ ≤ M, 1 ≤ l ≤ m, and σ is the ReLu activation function.
[0140] Then, average pooling is used to combine the embedding of the source node v s and the aggregated representation of the neighbor nodes at different positions to generate the final representation of the source node v s , i.e., the first distance metric vector of the source node v s in the embedding space
[0141]
[0142] where, is the average pooling aggregation function,
[0143] In addition, the obtaining the second distance metric vector of the target node in the embedding space according to the temporal adaptive walk of the target node in step 102 includes:
[0144] Generating initial embedding vectors of the target node and the neighbor nodes in the temporal adaptive walk of the target node respectively;
[0145] Calculate the weights of the neighbor nodes of the target node according to the initial embedding vectors of the target node and its neighbor nodes;
[0146] Calculate the second distance metric vector of the target node in the embedding space according to the initial embedding vector of the target node, the initial embedding vectors of the neighbor nodes of the target node, and the weights.
[0147] Among them, the target node v t has M temporal adaptive walks target node v t The second distance metric vector is target node v t The second distance metric vector is calculated in the same way as the first distance metric vector of the source node v s and will not be elaborated here. It should be noted that during the prediction process, the source node v
[0148] or the target node v s may be an invisible node, and the embedding vector of the invisible node has not been well trained. However, this embodiment benefits from multi-hop information propagation and can link the invisible node v t or v s to visible nodes, thereby obtaining valuable representations of the invisible node v t or v s or v t and ensuring the accuracy of subsequent predictions.
[0149] Step 103: Calculate the first distance between the source node and the target node in the embedding space according to the first distance metric vector and the second distance metric vector.
[0150] After obtaining the first distance metric vector s of the source node v and the second distance metric vector t of the target node v multiply the first distance metric vector by the second distance metric vector to obtain the first distance s between the source node v t and the target node v in the embedding space, that is:
[0151]
[0152] Step 104: Obtain the first structure-aware vector of the source node on the dynamic graph structure according to the temporal adaptive walk of the source node, and obtain the second structure-aware vector of the target node on the dynamic graph structure according to the temporal adaptive walk of the target node.
[0153] In addition to measuring the first distance between the source node v s and the target node v t in the embedding space it is also proposed to generate structure-aware vectors for the source node v s and the target node v t on the dynamic graph structure for measuring distances.
[0154] Specifically, the obtaining of the first structure-aware vector of the source node on the dynamic graph structure according to the temporal adaptive walk of the source node in Step 104 includes:
[0155] Generate the distance encoding vector of the neighbor nodes of the source node;
[0156] Generate the distance-aware vector of the neighbor nodes of the source node according to the distance encoding vector of the neighbor nodes of the source node;
[0157] Generate the time encoding vector of the neighbor nodes of the source node according to the target timestamp and the timestamps when the neighbor nodes and the previous node form links in the temporal adaptive walk of the source node;
[0158] Generate the temporal distance-aware vector of the neighbor nodes of the source node according to the distance-aware vector and the time encoding vector of the neighbor nodes of the source node;
[0159] Generate the state vector of the temporal adaptive walk of the source node according to the temporal distance-aware vector of the neighbor nodes of the source node;
[0160] Generate the first structure-aware vector of the source node on the dynamic graph structure according to the state vector of the temporal adaptive walk of the source node.
[0161] The M temporal adaptive walks of the source node v s are The M temporal adaptive walks of the target node v t are For each neighbor node in the M temporal adaptive walks of the source node v s and the M temporal adaptive walks of the target node v t generate a distance encoding vector through anonymous distance encoding. The purpose of anonymous distance encoding is to generate a vector to measure the source node v on the graph structure sand the target node v t The distance between them
[0162] Each temporal adaptive walk consists of a sequence of nodes with a backtracking time, such as Figure 3b v s →v4→v2 in. Therefore, for each neighbor v appearing in i an anonymous distance coding vector a i can be generated, that is:
[0163]
[0164] where represents the number of times neighbor v i appears at a certain position in ( or ) and can be expressed as:
[0165]
[0166] where represents the j-th node on the walk .
[0167] represents the distance from neighbor node v i to the source node v s , represents the distance from neighbor node v i to the target node v t . As shown in Figures 3a to 3b , the number of different positions of neighbor node v4 of source node v s in its temporal adaptive walk is The number of different positions of neighbor node v4 of target node v t in its temporal adaptive walk is (0, 1, 0) T , that is
[0168] The anonymous distance coding generates a vector for each neighbor by concatenating and Regarding neighbor node v i as an intermediate node to measure the distance between source node v s and target node v t . Since the above distance coding process is anonymous, that is, it does not require the identification code ID of the node, it is applicable to inductive scenarios on temporal networks.
[0169] Then, the source node vs The neighbor node v i The anonymous distance coding vector a i Is input into a multi - layer perceptron (MLP) to obtain its distance perception vector That is:
[0170] s i = MLP(a i ) = W2(σ(W1a i ))
[0171] Among them, And Are the trainable parameters in the MLP, and σ represents the ReLu activation function
[0172] To consider the temporal dynamics of the dynamic graph structure, random Fourier features are used to encode the time intervals between temporal edges, and any positive definite kernel can be approximated according to Bochner's theorem. The time coding vector can be expressed as:
[0173]
[0174] Among them, ω1, ω2,…, ω d Are learnable parameters. Given the target timestamp t s In (v t , v st ), t st And the neighbor node v i In the temporal adaptive walk forms a link (v i-1 , v i-1 , t i ), the timestamp t i Of, the time coding vector can be obtained i That is: That is:
[0175]
[0176] Then, the distance perception vector s i Of the neighbor node v i Is concatenated with the time coding vector T i To obtain As its temporal distance perception vector h i That is:
[0177] h i = [s i , T i .
[0178] In obtaining the temporal distance perception vector h i Of each neighbor node v iAfter that, BiLSTM is used to model each temporal adaptive walk, and the last state of BiLSTM is used as the state vector of the j-th temporal adaptive walk of the source node v, that is: s of the j-th temporal adaptive walk where
[0179]
[0180]
[0181]
[0182] where is the state vector of the j-th temporal adaptive walk of the source node v s of the j-th temporal adaptive walk 1 ≤ j ≤ M, is the hidden state vector during the forward transmission of the m-th neighbor node of the j-th temporal adaptive walk of the source node v s of the j-th temporal adaptive walk and is the hidden state vector during the backward transmission of the m-th neighbor node of the j-th temporal adaptive walk of the source node v, h s is the j-th temporal adaptive walk of the source node v and j,m is the temporal distance perception vector of the m-th neighbor node of the j-th temporal adaptive walk of the source node v s of the j-th temporal adaptive walk To combine the temporal distance information of different temporal adaptive walks, a self-attention network is used to dynamically determine the importance of different temporal adaptive walks, so as to generate the final representation of the source node v:
[0183] where s is the state vector of M temporal adaptive walks of the source node v
[0184]
[0185]
[0186] where is the state vector of M temporal adaptive walks of the source node v s and are learnable parameters in the self-attention network
[0187] Then, average pooling is used to obtain the first structure perception vector of the source node v on the dynamic graph structure s that is: that is:
[0188]
[0189] In addition, obtaining the second structure-aware vector of the target node on the dynamic graph structure according to the time-series adaptive walk of the target node includes:
[0190] Generating an anonymous distance coding vector of the neighbor nodes of the target node;
[0191] Generating a distance-aware vector of the neighbor nodes of the target node according to the anonymous distance coding vector of the neighbor nodes of the target node;
[0192] Generating a time coding vector of the neighbor nodes of the target node according to the target timestamp and the timestamps of the links formed by the neighbor nodes and the previous node in the time-series adaptive walk of the target node;
[0193] Generating a time-series distance-aware vector of the neighbor nodes of the target node according to the distance-aware vector and the time coding vector of the neighbor nodes of the target node;
[0194] Generating a state vector of the time-series adaptive walk of the target node according to the time-series distance-aware vector of the neighbor nodes of the target node;
[0195] Generating the second structure-aware vector of the target node on the dynamic graph structure according to the state vector of the time-series adaptive walk of the target node.
[0196] Among them, the second structure-aware vector of the target node v t on the dynamic graph structure is The second structure-aware vector of the target node v t is The generation method of which is the same as that of the first structure-aware vector s of the source node v and will not be elaborated here.
[0197] Step 105: Calculate the second distance between the source node and the target node on the dynamic graph structure according to the first structure-aware vector and the second structure-aware vector.
[0198] Concatenate the first structure-aware vector s of the source node v and the second structure-aware vector t of the target node v and input them into a multi-layer perceptron to generate a prediction score to measure the distance between the source node v s and the target node v t on the dynamic graph structure, that is, the second distance
[0199]
[0200] Among them, and are learnable parameters in the MLP, and σ represents the ReLu activation function.
[0201] Step 106: Predict the probability that the source node and the target node form a link at the target timestamp according to the first distance and the second distance.
[0202] As Figure 2 shown, input the first distance and the second distance into a multi-layer perceptron MLP to generate the final probability prediction score, to measure the probability z s that the source node v t and the target node v st (future timestamp) form a link at the target timestamp t st , that is:
[0203]
[0204] Among them, and are trainable parameters, and σ is the ReLu activation function.
[0205] To train the DEAL model, with the cross-entropy function as the optimization objective, learn the trainable parameters:
[0206]
[0207] Among them, (v s , v t , t st ) ∈ ε is the observed temporal edge in the training set, and σ is the sigmoid function. v n represents the negative sample, and z sn is the negative sample edge (v s , v n , t st ), that is, replace the target node v n in (v s , v t , t st ) with v t , and the corresponding prediction score. In addition, Q is the number of negative samplings, and P n (v) represents the negative sampling distribution in the node space, and the number of negative samplings is set to 1. Finally, use the Back-Propagation Through Time (BPTT) algorithm to train the proposed DEAL model.
[0208] To verify the effectiveness of the DEAL model in this application, the performance of the DEAL model and the benchmark models was tested on three sparse and attribute-free temporal network datasets, namely MathOverflow, AskUbuntu, and StackOverflow. These three datasets come from three websites, namely Math Overflow, Ask Ubuntu, and Stack Overflow, respectively, and form dynamic graphs of interactions. Specifically, each time edge (v s ,v t ,t st ) ∈ ε in each dynamic network contains three types of interaction, that is, at timestamp t st , user v s answers the question of user v t , comments on the question of user v t , and comments on the answer of user v t .
[0209] Data from the most recent 90 days of MathOverflow, the most recent 30 days of AskUbuntu, and the most recent 3 days of StackOverflow were used for the experiment. Temporal links were divided into training, validation, and test sets in a 70%, 15%, 15% ratio in chronological order on the three datasets. In addition, inductive links associated with invisible nodes that did not appear in the training set were used for model evaluation in the validation and test sets. Table 1 summarizes the statistical situation after preprocessing of the three datasets.
[0210]
[0211] Table 1
[0212] The benchmark models compared with the DEAL model are as follows:
[0213] 1. GraphSAGE inductively learns node representations by sampling visible nodes and propagating information, where the embedding vectors of visible nodes can be learned during training.
[0214] 2. GAT adopted the same settings as GraphSAGE in the experiment, except that it uses an attention method to determine the weights of different neighbors in message passing.
[0215] 3. GraphSAGE+T considers the temporal dynamic information of the network on the basis of GraphSAGE by concatenating the node embedding with the time encoding vector.
[0216] 4. GAT+T uses the concatenation method to combine the node embedding obtained by GAT and the time encoding vector.
[0217] 5. TGAT proposed a temporal graph attention layer to aggregate temporal information and topological information from neighboring nodes, and further designed a temporal encoding function based on Bochner's theorem to achieve continuous-time encoding.
[0218] 6. TGN developed a temporal graph network to learn dynamic node embeddings through memory networks and graph-based operations, and further introduced an advanced training strategy to effectively learn from data sequences.
[0219] 7. CAW-N proposed a random anonymous walk method to generate relative identity embeddings between two nodes by measuring the distance between two nodes on a dynamic graph structure for inductive link prediction.
[0220] The hyperparameters of the DEAL model in this application are tuned on the validation set to determine the best choices for different datasets. Specifically, the vector dimension d is adjusted in {60, 80, 100, 120, 140}, the scaling parameter λ is searched in {1e -7 , 1e -6 , 1e -5 , 1e -4}, the trade-off threshold d threshold is looped in {0.1, 0.15, 0.2, 0.25, 0.3}, the number of walks M is adjusted in {2, 4, 8, 16, 32}, and the walk length m is set to 2. In addition, the Adam optimizer with a learning rate of 1e -4 is used to train the learnable parameters in the DEAL model, and the batch size is set to 64. In addition, accuracy (ACC), AUC, and AP are used to evaluate the performance of the DEAL model and the baseline model in predicting inductive links.
[0221] The performance of the DEAL model and the baseline model in this application is shown in Table 2. The best-performing baseline model and the best-performing model in each column are underlined and bolded, respectively.
[0222]
[0223] Table 2
[0224] For the baseline models, first, we compare the embedding-based methods GraphSAGE and GAT with their corresponding temporal versions, namely GraphSAGE+T and GAT+T. It can be found that GraphSAGE+T consistently outperforms GraphSAGE on AskUbuntu and StackOverflow, but is at a disadvantage on MathOverflow. GAT+T outperforms GAT on AskUbuntu, but is worse than GAT in most cases on MathOverflow and StackOverflow. This indicates that the simple combination of temporal encoding and node embedding cannot always maintain the prediction performance in multiple scenarios. In addition, it can be observed that the performance of TGAT and TGN is not satisfactory, which is due to their high dependence on edge attribute information, resulting in poor performance in experimental settings where attribute information is unavailable. In contrast, on the three datasets, by learning the relative identity vectors of nodes through anonymous distance encoding, CAW-N has the best performance among the baseline models in all metrics.
[0225] For the DEAL model in this application, as can be observed from Table 2, on all three datasets, the DEAL model consistently has better performance than the competitive baseline models in terms of accuracy, AUC, and AP metrics, verifying the effectiveness of the DEAL model. In addition, it is worth noting that the performance improvement on small-scale datasets is more obvious than that on large-scale datasets. Among them, DEAL improves by 8.30%, 10.53%, and 7.04% respectively in terms of accuracy, AUC, and AP metrics on MathOverflow, with improvement rates of 3.88%, 4.93%, and 5.02% respectively on AskUbuntu, and improvement rates of 0.11%, 1.30%, and 1.52% respectively on StackOverflow. This shows that the algorithm can not only beat the competitive baseline models in sparse data scenarios, but also show more obvious effectiveness in practical application scenarios with limited data.
[0226] To clarify the contributions of the components in the DEAL model to the inductive link prediction performance, the proposed DEAL model was compared with its three variants: (1) w / o AdaSampler, which replaces the adaptive neighbor sampling in the DEAL model with random sampling; (2) w / o Embedding and w / o Structure, which remove the distance prediction based on the distance in the embedding space and the distance prediction based on the dynamic graph structure, respectively. Table 3 shows the results of DEAL and its variants in terms of accuracy, AUC, and AP metrics. First, it can be observed that the DEAL model outperforms the variant model w / o AdaSampler in all cases on the three datasets, indicating that through the pre-trained visible node embeddings, the adaptive sampling module in this application can dynamically select appropriate sampling strategies from recent sampling and random sampling, capture the common neighbors of the source node and the target node, and improve the prediction performance.
[0227]
[0228] Table 3
[0229] Furthermore, comparing w / o Embedding and w / o Structure with the DEAL model, it can be seen that both the distance based on the embedding space and the distance based on the dynamic graph structure contribute to accurate inductive link prediction on the temporal network. The distance based on the dynamic graph structure has a greater impact than the distance based on the embedding space because on the three datasets shown in Table 3, w / o Embedding always achieved better performance than w / o Structure. This may be because in the scenario of data sparsity, it is difficult to learn visible node embeddings, so the effectiveness of explicit distance encoding on the dynamic graph structure is more obvious. On large datasets, the performance gap between w / o Embedding and w / o Structure is particularly obvious. For example, the accuracy, AUC, and AP of w / o Embedding on MathOverflow increased by 14.82%, 8.66%, and 12.06% respectively, while the corresponding improvement rates on StackOverflow were 22.34%, 10.97%, and 14.16%. This indicates that the advantages of the distance strategy method based on the dynamic graph structure compared to the distance measurement method based on the embedding space are more obvious on large datasets than on small datasets.
[0230] To test the sensitivity of the DEAL model to data sparsity, temporal links in the training set are randomly deleted, and the original edges are retained according to the ratio γ, where γ is adjusted among {20%, 40%, 60%, 80%, 100%}. In addition, the best baseline model CAW-N and the variant model w / o AdaSampler are also considered to verify the effectiveness of the adaptive sampling module and the dual-channel distance measurement module in different data sparsity scenarios by comparing DEAL with w / o AdaSampler and by comparing w / o AdaSampler and CAW-N. Experiments are conducted using AskUbuntu and StackOverflow. Considering that the Mathoverflow dataset is very small, removing a large number of temporal links in the training set will lead to unstable training. The results on the AP metric are as Figure 5a and Figure 5b shown, and the results on the precision and AUC metrics show a similar phenomenon.
[0231] From Figure 4a and Figure 4b it can be seen that, first of all, as the training data increases, the performance of all models on StackOverflow generally improves, except that w / o AdaSampler shows a stable trend at a relatively large ratio. However, differently, on AskUbuntu, when the proportion of training data increases, the performance of the DEAL model continues to improve, while the performance of CAW-N and w / o AdaSampler first improves, reaches the best performance at about 80%, and then begins to decline. The reason for the performance decline of CAW-N and w / o AdaSampler may be that on small datasets, without the adaptive sampling method of this application, it is impossible to accurately detect the common neighbors of the source node and the target node, resulting in unsatisfactory performance.
[0232] In addition, by comparing the DEAL model and w / o AdaSampler, it can be seen that on both datasets, at a small proportion of training data, the performance of the DEAL model is slightly better than that of w / o AdaSampler. However, when the ratio reaches 80%, the performance gap between the DEAL model and w / o AdaSampler becomes obvious, indicating that adaptive sampling plays a relatively more important role in scenarios with rich training data. In addition, by comparing w / o AdaSampler and CAW-N on StackOverflow, it can be seen that the improvement at a small proportion of training data is particularly obvious, indicating that the embedding-based distance measurement contributes relatively more to the performance on sparse large datasets.
[0233] To verify that the adaptive sampling method in this application is superior to other neighbor sampling methods, the DEAL model is compared with the following different DEAL variant models: (1) DEAL Random , which replaces the adaptive sampling in the DEAL model with random sampling; (2) DEAL Recent , which uses recent sampling to select the nearest neighbors, with a probability proportional to exp(λ(t i - t i-1 ))), where t i and t i-1 are the timestamps of the candidate neighbor and the previous node during the walk, respectively; (3) DEAL Early , which is the opposite of DEAL Recent , and it tends to select the early nodes in the historical interactions as neighbor nodes, with a probability proportional to exp(λ(t i-1 - t i ).
[0234] In addition, the scaling parameter λ in the DEAL model and the variant models DEAL Recent and DEAL Early is adjusted in {1e -7 , 1e -6 , 1e -5 , 1e -4} to observe the impact of λ on the model performance. Figure 6a 、 Figure 6b and Figure 6c give the results of the DEAL and the three variant models on the AP metric for three datasets.
[0235] From Figure 5a 、 Figure 5b and Figure 5c , it can be first observed that as the scaling parameter λ increases, the performance of DEAL Early continuously decreases on all three datasets, because the selected early neighbors do not consider the time dynamics in the temporal network. For DEAL Recent , it can be seen that when λ increases, the performance of DEAL Recent first increases and then generally decreases. This shows that when λ is small, DEAL Recent can help capture the nearest neighbor nodes of the source node and the target node, considering the dynamic characteristics of the network to a certain extent, and obtaining better performance than DEAL Random and DEAL Early . However, the value of λ on MathOverflow is 1e -5 , and the values of λ on AskUbuntu and StackOverflow are 1e -6After reaching the peak prediction performance at different times, the time-scale limitation of sampling neighbors led to a decline in model performance.
[0236] In addition, it can be seen that the performance of DEAL is generally better than that of the variant models on the three datasets, verifying the effectiveness of the adaptive sampling in this application for selecting valuable neighbors to measure the distance between nodes. Specifically, the adaptive sampling module measures the distance between the source node and the target node in the pre-trained embedding space through L2 normalization, dynamically selects the method of neighbor sampling between random sampling or recent sampling, and extracts the temporal adaptive walk. That is to say, the adaptive sampling can effectively consider the dynamic characteristics of the network while ensuring the time scale.
[0237] Adjust the hyperparameters in the DEAL model, including adjusting the number of pre-training iterations in {6, 8, 10, 12, 14}, adjusting the sampling threshold d in {0.1, 0.15, 0.2, 0.25, 0.3} threshold , adjust the number of walks M in {2, 4, 8, 16, 32}, and adjust the vector dimension d in {60, 80, 100, 120, 140}, so as to test the sensitivity of the DEAL model to different hyperparameters. The AP metric results on the three datasets are as Figures 6a to 6d shown.
[0238] The number of pre-training iterations is from Figure 6a It can be observed from that when the number of pre-training iterations increases from 6 to 14, the performance of the DEAL model generally improves on StackOverflow, while the performance on MathOverflow and AskUbuntu decreases slightly. This difference may be due to the different scales of the three datasets, indicating that a relatively larger number of iterations are required for pre-training on a large dataset.
[0239] The sampling threshold is from Figure 6b It can be seen that as the threshold d in the adaptive sampling threshold increases from 0.1 to 0.3, the performance of DEAL fluctuates on AskUbuntu and StackOverflow, showing an overall slightly upward trend, while the performance on MathOverflow first increases and then decreases after reaching the peak at a threshold of 0.2. This may be because for the small dataset MathOverflow, the node embeddings cannot be learned as well as those of the large datasets AskUbuntu and StackOverflow, making the node embeddings relatively evenly distributed in the embedding space. Therefore, setting a small threshold in the MathOverflow dataset is appropriate.
[0240] The number of walks is from Figure 6cIt can be seen that when the number of walks M increases, the performance of the DEAL model generally improves on the three datasets. On MathOverflow and AskUbuntu, as the number of walks increases, the rising rate continues to decline. Especially when the number of walks reaches 8, the performance remains stable. Different from this, on the StackOverflow dataset, the performance still improves rapidly at a relatively large number of walks. This may be because on large-scale datasets, relatively more temporal adaptive walks are needed to help measure the distance between the source node and the target node in the embedding space and the dynamic graph structure.
[0241] The vector dimension ranges from Figure 6d It can be seen that as the vector dimension d increases from 60 to 140, the performance of DEAL on the two large datasets of AskUbuntu and StackOverflow improves significantly and shows a stable trend after d = 100. This is because a larger vector dimension increases the representation ability of the DEAL model for distance measurement. Different from this, on MathOverflow, when the vector dimension increases, the performance of the DEAL model first increases from d = 60 to 100 and then shows a continuous downward trend. This may be because on small datasets, an overly large vector dimension may lead to overfitting problems and reduce the generalization ability of the DEAL model on the test set.
[0242] Therefore, the adaptive sampling method in this application uses the pre-trained visible node embeddings to dynamically sample neighbor nodes, which improves the probability of capturing the common neighbors of the source node and the target node. The dual-channel distance measurement module in this application measures the distance between the source node and the target node in the embedding space and the dynamic graph structure simultaneously, and is used to predict future links. A large number of experiments conducted on three temporal network datasets show that this algorithm has significantly improved in terms of accuracy, AUC, and AP metrics.
[0243] In summary, the embodiment of this application extracts the temporal adaptive walks of the source node and the target node in the temporal network respectively. At least one of the source node and the target node is an invisible node. According to the temporal adaptive walks of the source node and the target node, the distance metric vectors of the source node and the target node in the embedding space are obtained respectively to calculate the first distance between the source node and the target node in the embedding space. And according to the temporal adaptive walks of the source node and the target node, the structure-aware vectors of the source node and the target node on the dynamic graph structure are obtained respectively to calculate the second distance between the source node and the target node on the dynamic graph structure. Thus, according to the first distance and the second distance, the probability that the source node and the target node form a link at the target timestamp is predicted, effectively improving the accuracy of inductive link prediction in the temporal network.
[0244] Figure 7 Fig. 1 shows a schematic diagram of the hardware structure of a specific electronic device provided in this embodiment. The device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. Among them, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are communicatively connected to each other inside the device through the bus 1050.
[0245] The processor 1010 may be implemented in the form of a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0246] The memory 1020 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When implementing the technical solutions provided in the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.
[0247] The input / output interface 1030 is used to connect to an input / output module to implement information input and output. The input / output module may be configured as a component in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Among them, the input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0248] The communication interface 1040 is used to connect to a communication module (not shown in the figure) to implement communication interaction between this device and other devices. Among them, the communication module may implement communication in a wired manner (such as USB, network cable, etc.) or in a wireless manner (such as mobile network, WIFI, Bluetooth, etc.).
[0249] The bus 1050 includes a path for transmitting information between various components of the device (such as the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).
[0250] It should be noted that although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040, and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, those skilled in the art can understand that the above device may also only include the components necessary to implement the solution of the embodiments of this specification, and do not necessarily include all the components shown in the figure.
[0251] An embodiment of the present invention provides a non-transitory computer-readable storage medium, in which multiple instructions are stored, and these instructions can be loaded by a processor to execute the steps in any one of the link prediction methods in the timing network provided by the embodiments of the present invention.
[0252] The non-transitory computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
[0253] Those of ordinary skill in the art should understand that: the discussion of any of the above embodiments is only exemplary, and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples; under the idea of the present invention, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations in different aspects of the present invention as described above, and they are not provided in detail for the sake of brevity.
[0254] In addition, for simplicity of explanation and discussion, and so as not to render the present invention difficult to understand, well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Further, the devices may be shown in block diagram form in order to avoid rendering the present invention difficult to understand, and this also takes into account the fact that details of the implementation of such block diagram devices are highly dependent on the platform on which the present invention is to be implemented (i.e., such details should be fully within the understanding of those of ordinary skill in the art). In cases where specific details (such as circuits) are set forth to describe exemplary embodiments of the present invention, it will be apparent to those of ordinary skill in the art that the present invention may be practiced without such specific details or with variations of such specific details. Accordingly, these descriptions should be regarded as illustrative rather than restrictive.
[0255] Although the present invention has been described in connection with specific embodiments thereof, many alternatives, modifications, and variations will be apparent to those of ordinary skill in the art based on the foregoing description. For example, other memory architectures (such as dynamic RAM (DRAM)) may be used with the embodiments discussed.
[0256] Embodiments of the present invention are intended to cover all such alternatives, modifications, and variations that fall within the broad scope of the appended claims. Accordingly, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A link prediction method in a temporal network, characterized in that Including: Separately extract the temporal adaptive walks of the source node and the target node in the temporal network; The neighbor nodes in the temporal adaptive walks are visible nodes, the visible nodes are nodes that appear in a preset training set, at least one of the source node and the target node is an invisible node, and the invisible node is a node that does not appear in the training set; According to the temporal adaptive walk of the source node, obtain the first distance metric vector of the source node in the embedding space, and according to the temporal adaptive walk of the target node, obtain the second distance metric vector of the target node in the embedding space; According to the first distance metric vector and the second distance metric vector, calculate the first distance between the source node and the target node in the embedding space; According to the temporal adaptive walk of the source node, obtain the first structure perception vector of the source node on the dynamic graph structure, and according to the temporal adaptive walk of the target node, obtain the second structure perception vector of the target node on the dynamic graph structure; According to the first structure perception vector and the second structure perception vector, calculate the second distance between the source node and the target node on the dynamic graph structure; According to the first distance and the second distance, predict the probability that the source node and the target node form a link at the target timestamp; The separately extracting the temporal adaptive walks of the source node and the target node in the temporal network includes: Separate obtain the first embedding vector of the source node and the second embedding vector of the target node; According to the first embedding vector and the second embedding vector, calculate the embedding distance between the source node and the target node; If the embedding distance is greater than a preset distance threshold, sample the neighbor nodes closest to the source node to extract the temporal adaptive walk of the source node, and sample the neighbor nodes closest to the target node to extract the temporal adaptive walk of the target node; If the embedding distance is less than the distance threshold, randomly sample the neighbor nodes of the source node to extract the temporal adaptive walk of the source node, and randomly sample the neighbor nodes of the target node to extract the temporal adaptive walk of the target node.
2. The link prediction method in the timing network according to claim 1, characterized in that, The obtaining the first embedding vector of the source node includes: Generate the initial embedding vector of the source node; If the source node is an invisible node, use the initial embedding vector of the source node as the first embedding vector of the source node; If the source node is a visible node, extract the temporal random walk of the source node; generate the initial embedding vectors of the nodes in the temporal random walk; determine the first embedding vector of the source node according to the initial embedding vectors of the nodes in the temporal random walk.
3. The link prediction method in the timing network according to claim 1, characterized in that The obtaining the first distance metric vector of the source node in the embedding space according to the temporal adaptive walk of the source node includes: Separate generate the initial embedding vectors of the source node and the neighbor nodes in the temporal adaptive walk of the source node; According to the initial embedding vectors of the source node and the neighbor nodes of the source node, calculate the weights of the neighbor nodes of the source node; Calculate a first distance metric vector of the source node in the embedding space based on the initial embedding vector of the source node, the initial embedding vectors of the neighbor nodes of the source node, and weights.
4. The link prediction method in the timing network according to claim 3, characterized in that The calculation formula for the weights of the neighbor nodes of the source node is: ; ; Among them, the source node has temporal adaptive walks, and in the temporal adaptive walks, there are neighbor nodes. is the weight of the th neighbor node in the th temporal adaptive walk of the source node, 1 , 1 , is the initial embedding vector of the th neighbor node in the th temporal adaptive walk of the source node. is the initial embedding vector of the source node. , and are training parameters. is the th neighbor node in the th temporal adaptive walk of the source node, 1 , is the set of the th neighbor nodes in the th temporal adaptive walk of the source node; The calculation formula for the first distance metric vector of the source node in the embedding space is: ; ; wherein, is the first distance metric vector of the source node in the embedding space, is a learning parameter, is an activation function; The calculation formula for the first distance is: ; wherein, is the first distance, is the second distance metric vector of the target node in the embedding space.
5. The link prediction method in the timing network according to claim 1, characterized in that Obtaining the first structure-aware vector of the source node on the dynamic graph structure according to the temporal adaptive walk of the source node includes: Generating an anonymous distance encoding vector of the neighbor nodes of the source node; Generating a distance-aware vector of the neighbor nodes of the source node according to the anonymous distance encoding vector of the neighbor nodes of the source node; Generating a time encoding vector of the neighbor nodes of the source node according to the target timestamp and the timestamps at which the neighbor nodes of the source node form links with the previous node in the temporal adaptive walk of the source node; Generating a temporal distance-aware vector of the neighbor nodes of the source node according to the distance-aware vector and the time encoding vector of the neighbor nodes of the source node; Generating a state vector of the temporal adaptive walk of the source node according to the temporal distance-aware vector of the neighbor nodes of the source node; Generating a first structure-aware vector of the source node on the dynamic graph structure according to the state vector of the temporal adaptive walk of the source node.
6. The link prediction method in the temporal network according to claim 5, characterized in that The generation formula for the distance-aware vector of the neighbor nodes of the source node is: ; Among them, the source node has temporal adaptive walks, and in the temporal adaptive walks there are neighbor nodes. is the distance perception vector of the th neighbor node of the source node, 1 * , is the anonymous distance coding vector of the th neighbor node of the source node, and are training parameters, is the activation function; The generation formula for the time encoding vector of the neighbor nodes of the source node is: ; ; wherein, is the time encoding vector of the -th neighbor node of the source node, is the target timestamp, is the timestamp when the -th neighbor node in the temporal adaptive walk of the source node forms a link with the previous node, is the learning parameter; The generation formula for the temporal distance-aware vector of the neighbor nodes of the source node is: ; Among them, is the timing distance perception vector of the th neighbor node of the source node; The generation formula for the state vector of the temporal adaptive walk of the source node is: ; ; ; Among them, is the state vector of the th temporal adaptive walk of the source node, 1 , is the hidden state vector during the forward transmission of the th neighbor node of the th temporal adaptive walk of the source node, is the hidden state vector during the backward transmission of the th neighbor node of the th temporal adaptive walk of the source node, is the temporal distance perception vector of the th neighbor node of the th temporal adaptive walk of the source node; The generation formula for the first structure-aware vector of the source node on the dynamic graph structure is: , ; ; , , ; Among them, is the first structure perception vector of the source node on the dynamic graph structure, , and are learning parameters; The calculation formula for the second distance is: ; Wherein, is the second distance, is the second structure perception vector of the target node on the dynamic graph structure, and are learning parameters.
7. The link prediction method in the temporal network according to claim 1, wherein The calculation formula for the probability is: ; wherein, is the probability, is the first distance, is the second distance, and are training parameters, is the activation function.
8. An electronic device, characterized in that, Including a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that when the processor executes the program, it implements the link prediction method in the temporal network according to any one of claims 1 to 7.
9. A non-transitory computer-readable storage medium, characterized in that, The non-transitory computer-readable storage medium stores computer instructions for causing the computer to execute the link prediction method in the temporal network according to any one of claims 1 to 7.
Citation Information
Patent Citations
Wireless sensor network link quality prediction method
CN103716808A
Network link determination method, device and equipment
CN111064603A