Discrete dynamic graph link prediction method based on adaptive product space
By introducing adaptive product space and reinforcement learning optimization technology into dynamic graph neural networks, the embedding distortion problem caused by single space embedding is solved, and more efficient dynamic graph link prediction is achieved.
Patent Information
- Application Number
- CN202411694458.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-03-14
AI Technical Summary
The existing dynamic graph neural networks use a single spatial embedding when conducting link prediction, and it is difficult to effectively capture the structural and temporal characteristics of complex dynamic networks.
A discrete dynamic graph link prediction method based on adaptive product space is proposed. By combining Euclidean space, hyperbolic space and hyperspherical space, the product space is constructed as an embedded space, and a reinforcement learning mechanism is designed to dynamically optimize the geometric configuration of the product space, including the dimensional proportions and curvature parameters of each space.
It effectively improves the accuracy of dynamic graph link prediction, can better capture the structural and temporal characteristics of dynamic graphs, and significantly improves the expression ability and prediction performance of the method.
Smart Images

Figure CN119623512A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of graph neural networks and dynamic graph data analysis, and in particular to a discrete dynamic graph link prediction method based on an adaptive product space. Background Art
[0002] With the rapid development of information technology and big data, relational data plays an important role in practical applications such as recommendation systems, social networks, disease transmission networks, and financial transaction networks. Traditional graph neural networks usually model these complex networks as static graphs, using the network's structural information and node feature information for graph learning to solve graph analysis tasks such as link prediction and node classification. However, many real-world networks are dynamic and evolve over time, and static graph methods perform poorly when processing these dynamic graphs. This is because static graph methods fail to effectively capture the temporal information in dynamic graphs, resulting in low accuracy and efficiency in predicting changes in link and node states.
[0003] Existing dynamic graph neural network methods mainly use Euclidean space embedding, that is, embedding the structural information of the graph into Euclidean space. This method has achieved certain success in processing dynamic network embedding, but it still has limitations in its ability to capture complex structures. This limitation is mainly caused by the highly skewed power-law degree distribution that is prevalent in real-world networks. In this distribution, most nodes have small degrees, while a few nodes have extremely large degrees. In order to better represent these complex network structures, recent studies have proposed introducing hyperbolic space into dynamic graph modeling. Hyperbolic geometry achieves smaller embedding distortion when embedding scale-free and hierarchical graphs, and thus has significant advantages in processing graph data with tree and hierarchical structures. However, real-world networks usually contain complex mixed structures, and single space embedding methods perform poorly when processing these mixed structures. Therefore, a method that can integrate multiple geometric features is needed to improve the performance of dynamic graph link prediction. Summary of the invention
[0004] The purpose of the present invention is to solve the embedding distortion problem of existing dynamic graph neural networks when using a single space embedding for link prediction, and proposes a discrete dynamic graph link prediction method based on adaptive product space. This method constructs the product space as the embedding space by combining Euclidean space, hyperbolic space and hyperspherical space, and designs a reinforcement learning mechanism to dynamically optimize the geometric configuration of the product space, including the dimensional ratio and curvature parameters of each space, so as to effectively improve the accuracy of dynamic graph link prediction and better capture its structural and temporal characteristics when processing complex dynamic networks.
[0005] To achieve the above object, the technical solution provided by the present invention is: a discrete dynamic graph link prediction method based on an adaptive product space, comprising the following steps:
[0006] S1: Get the dynamic relationship network and make it into dynamic graph data, then split it into multiple ordered discrete graph snapshots according to fixed time intervals. Each discrete graph snapshot contains nodes and links, initializes the node features of the nodes, and constructs an adjacency matrix. The above multiple ordered discrete graph snapshots form a discrete dynamic graph dataset in chronological order;
[0007] S2: construct a product space as the embedding space, which is obtained by calculating the Cartesian product of the Euclidean space, the hyperbolic space and the hyperspherical space, and initialize the dimension ratio and curvature parameters of the Euclidean space, the hyperbolic space and the hyperspherical space;
[0008] S3: After splitting the node features of the discrete graph snapshot at the current moment in the discrete dynamic graph dataset into three parts according to the dimensional ratio, they are projected into the Euclidean space, hyperbolic space and hyperspherical space in the product space through exponential mapping to obtain the three projected features, and then the three projected features are spliced to obtain the initial node embedding;
[0009] S4: Taking the initial node embedding and adjacency matrix of the discrete graph snapshot at the current moment as input, message passing is performed in the product space, which includes linear transformation, neighborhood aggregation and nonlinear activation in sequence, so as to obtain node embedding containing geometric structure information;
[0010] S5: Design a historical information fusion unit to store the node embeddings of a fixed number of discrete graph snapshots before the current discrete graph snapshot to preserve historical information, and then aggregate the node embeddings of the stored discrete graph snapshots through the attention mechanism to generate historical node embeddings;
[0011] S6: Based on the node embedding obtained in step S4 and the historical node embedding generated in step S5, HyperGRU is used to update the node embedding of the discrete graph snapshot at the current moment to generate a comprehensive historical embedding of the discrete graph snapshot at the current moment;
[0012] S7: Use the Fermi-Dirac decoder to decode the comprehensive historical embedding of the discrete graph snapshot at the current moment obtained in step S6, calculate the link prediction probability of any two nodes, and optimize the parameters in the message passing process through the cross entropy loss function;
[0013] S8: Apply a reinforcement learning mechanism to optimize the dimensional ratios and curvature parameters of the Euclidean space, hyperbolic space, and hyperspherical space in the product space constructed in step S2;
[0014] S9: Using the node features and connection matrix of the discrete graph snapshot at the current moment, after message passing and HyperGRU update, the Fermi-Dirac decoder is used to calculate the link prediction probability at the next moment.
[0015] Furthermore, in step S1, after constructing the discrete graph snapshot, the node features of its nodes are obtained by random initialization or using one-hot vectors, and a two-dimensional array is used to store edge data. This two-dimensional array is called the connection matrix A.
[0016] Furthermore, in step S2, the constructed product space is composed of Euclidean space, hyperbolic space and hyperspherical space as component spaces, which is expressed as is the product space, Euclidean space, is a hyperbolic space, is the hypersphere space, × is the Cartesian product. For this product space, two problems need to be solved, namely, the characteristic dimension ratio of each component space (e:b:s) and the selection of curvature c. e, b, and s represent different numbers respectively. Let α ε , and They represent the proportion of Euclidean space, hyperbolic space and hyperspherical space in the total space respectively. The initial proportions satisfy the following conditions:
[0017]
[0018] The initial curvatures of Euclidean space, hyperbolic space and hyperspherical space are set to 0, -1 and 1 respectively.
[0019] Further, in step S3, the node features of the nodes are mapped into the product space, and the node features of the input node i are set to is a natural number field, n is the dimension, and it is split into three parts according to the ratio e:b:s As the initial features of Euclidean space, hyperbolic space and hyperspherical space, the formulas for projecting them into the product space using the exponential mapping function are as follows:
[0020]
[0021] In the formula, is the initial product space feature, and They are exponential maps with the origin o in Euclidean space, hyperbolic space and hyperspherical space respectively.
[0022] Further, in step S4, the message transmission of node i in the product space includes the following processes in sequence:
[0023] S41: In the product space, the linear transformation operation of the lth layer is:
[0024]
[0025] In the formula, is the hidden vector, is the spatial feature of the previous layer, W and b are weight and bias parameters, and for Möbius multiplication and Möbius addition;
[0026]
[0027]
[0028] In the formula, and They are respectively the exponential map and logarithmic map on the origin o in the product space, is the translation transformation;
[0029] S42: In the product space, the domain aggregation operation at the lth layer is:
[0030]
[0031] In the formula, is the temporary hidden vector after domain aggregation, are all neighbor nodes of node i, d i and d j are the degrees of node i and node j respectively, calculated by the connection matrix A, d i is the sum of the values of the i-th row of the connected matrix A, d j is the sum of the values of the j-th row of the connected matrix A;
[0032] S43: In the product space, the nonlinear activation operation of the lth layer is:
[0033]
[0034] In the formula, the activation function σ uses LeakReLU.
[0035] Further, in step S5, the historical information storage unit is responsible for storing the w discrete graph snapshot embeddings before the current time t Embed the w discrete graph snapshots in the historical information storage unit into Z(tw), Z(t-w+1), ..., Z(t-1), that is, Perform weighted aggregation to generate historical node embeddings The attention mechanism adaptively assigns weights based on the relevance of the discrete graph snapshot to the current moment. The calculation process is:
[0036] M=[Z(tw)||Z(t-w+1)||...||Z(t-1)]
[0037] e=RT tanh(QM T )
[0038] a=softmax(e)
[0039]
[0040] Where M is an embedding of w discrete graph snapshots. The concatenated matrix, e and a are intermediate variables, tanh is the hyperbolic tangent function, R and Q are the weight vector and attention matrix, T is the matrix transpose operation, and softmax is the normalized exponential function.
[0041] Further, in step S6, HyperGRU is used to update the node embedding of the discrete graph snapshot at the current moment to capture the temporal characteristics of the dynamic graph. The input is the hidden embedding obtained through multi-layer convolution space message passing. and history node embedding Generate the comprehensive historical embedding Z(t) of the discrete graph snapshot at the current time t. The update process is as follows:
[0042]
[0043]
[0044]
[0045]
[0046] In the formula, r t 、u t and m t They are reset gate, update gate and candidate hidden state, W r , W u and W are the weights corresponding to the comprehensive historical embedding, U r , U u and U is the weight of the corresponding hidden embedding, b r , b u and b are the corresponding bias parameters, σ and is a nonlinear activation function, diag is used to represent the diagonal matrix, and finally, Z(t) will be used to update the historical information storage unit and serve as the input for the next link prediction.
[0047] Further, in step S7, the comprehensive historical embedding Z(t) is decoded by a Fermi-Dirac decoder, the link prediction probability between any two nodes is calculated, and the parameters are optimized by a cross entropy loss function, which specifically includes the following steps:
[0048] S71: Use the Fermi-Dirac decoder to calculate the link prediction probability, the link prediction probability P of nodes i and j at time t+1 i,j The calculation of (t+1) is as follows:
[0049]
[0050] In the formula, Z i (t) and Z j (t) is the feature of nodes i and j in the comprehensive historical embedding Z(t), is the distance function in the product space, g and s are hyperparameters;
[0051] S72: Optimize parameters through cross entropy loss function:
[0052]
[0053] Where L is the loss function, P i',j' (t+1) is the predicted probability of linking nodes i' and j' at time t+1. Since the dynamic graph data in the real world is sparse, that is, the number of negative edges is much larger than the number of positive edges, in the discrete graph snapshot at the current time t, all positive edges e are selected. i,j ∈ε t+1 , negative sampling and positive edges have the same number of negative edges To calculate, ε t+1 represents a positive edge set.
[0054] Further, in step S8, the dimensional ratio and curvature parameters of each space in the product space are dynamically optimized by applying a reinforcement learning mechanism, including the following steps:
[0055] S81: Define state S t , by the ratio of each spatial dimension express;
[0056] S82: Define an action, which involves adjusting the dimension ratio by a minimum value δ within a predefined range. Possible actions a t Including increasing or decreasing each ratio, a t Represented as a triple Respectively represent the adjustment direction and amplitude of the dimensional ratio of Euclidean space, hyperbolic space and hyperspherical space. Each a t The value of is one of {+δ, 0, -δ}, that is, increase, remain unchanged or decrease, and when performing action a t After that, normalization can still be maintained;
[0057] S83: Define rewards. The rewards are calculated based on the performance improvement of the link prediction task. The reward R at time step t is t The calculation is as follows:
[0058] R t =λ1(AUC t -AUC t-1 )+λ2(AP t -AP t-1 )
[0059] In the formula, AUC t is the area under the ROC curve at time t, AUC t-1 is the area under the ROC curve at time t-1, AP t and AP t-1 is the average accuracy at time t and time t-1, λ1 and λ2 are weights;
[0060] S84: Define strategy, π(a t |s t ) is determined in state S t Take action a t The strategy uses the policy gradient method to update the policy parameters and optimize the next action selection:
[0061]
[0062] In the formula, π(a t+1 |s t+1 ) is the strategy at time t+1, η is the learning rate, is the gradient of the strategy, indicating the direction of improvement of the strategy under the current parameter settings;
[0063] S85: Learnable curvature. In addition to adjusting the dimensional ratio, the curvature of hyperbolic space and hyperspherical space is also considered a learnable parameter. The curvature c affects the geometric properties of the space, and its optimization is crucial for accurately modeling the structural characteristics of the data. The curvature learning process:
[0064]
[0065] In the formula, c t and c t-1 are the curvatures at time t and time t-1, respectively, denotes the derivative of the loss function with respect to the curvature, which is updated using gradient descent to ensure that it adapts to the geometric properties of the data over time;
[0066] S86: Integrate the adaptive adjustment mechanism into the overall process. In each training iteration, the dimension ratio and curvature are updated based on reinforcement learning and gradient descent mechanism. The adaptive adjustment process of the product space is as follows: In each training iteration, first calculate the current state Based on the strategy π(a t |s t) Select the corresponding action, and then update the dimensional ratio of each space according to the selected action Next, the reward R is calculated based on the performance improvement t , using reinforcement learning to update the policy π(a t |s t ), and finally update the curvature parameters of the hyperbolic space and the hyperspherical space by the gradient descent method
[0067] Further, in step S9, after optimizing the parameters and product space configuration, the node features and connection matrix of the discrete graph snapshot at the current time t are used, and after message passing and HyperGRU update, the link prediction probability at the next time is calculated using the Fermi-Dirac decoder.
[0068] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0069] 1. Adaptive product space design: By introducing the product space composed of Euclidean space, hyperbolic space and hyperspherical space, the present invention can effectively capture the characteristics of different geometric structures in dynamic graphs, and dynamically optimize the dimension ratio and curvature parameters through reinforcement learning to improve the expression ability and prediction performance.
[0070] 2. Improve prediction accuracy: Experimental results show that the performance of the present invention on multiple data sets is better than that of the advanced discrete dynamic graph benchmark method based on a single space, and it has significant improvements in both AUC and AP indicators in the dynamic link prediction task.
[0071] 3. Reinforcement learning optimization strategy: Reinforcement learning is used to dynamically adjust the geometric configuration of the product space, which can be adaptively optimized according to data characteristics and task requirements, significantly improving the flexibility and generalization ability of the method.
[0072] 4. Strong stability: By introducing multi-space joint modeling and dynamic optimization strategies, it has stronger robustness and stability when processing high-dimensional dynamic data.
[0073] 5. Wide applicability: The present invention is applicable to a variety of dynamic graph scenarios, including social networks, traffic networks, and knowledge graphs, and can effectively handle complex and diverse dynamic graph evolution characteristics. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] Figure 1 It is a framework diagram of the method of the present invention. DETAILED DESCRIPTION
[0075] The present invention will be further described below in conjunction with specific examples, but the embodiments of the present invention are not limited thereto.
[0076] like Figure 1As shown, this embodiment discloses a discrete dynamic graph link prediction method based on an adaptive product space, which has been implemented on a PyCharm platform based on Python language, and includes the following steps:
[0077] 1) Load the FBW dataset
[0078] First, load the prepared dataset FBW from the local computer. FBW is a social network dataset consisting of a social network graph of Facebook posts, where each node represents a user and each edge represents an interaction with its posts. The dataset includes 45,435 nodes and 180,011 edges. The dataset covers the activity of the past three years. It is constructed as 36 discrete graph snapshots, and node features are generated by random initialization, and edge information is saved in the connection matrix A.
[0079] 2) The constructed product space is composed of Euclidean space, hyperbolic space and hyperspherical space as component spaces, expressed as is the product space, Euclidean space, is a hyperbolic space, is the hypersphere space, × is the Cartesian product. For this product space, two problems need to be solved, namely, the characteristic dimension ratio of each component space (e:b:s) and the selection of curvature c. e, b, and s represent different numbers respectively. Let α ε , and They represent the proportion of Euclidean space, hyperbolic space and hyperspherical space in the total space respectively. The initial proportions satisfy the following conditions:
[0080]
[0081] Initialize the dimension ratio of each space to 1:1:1 and the curvature to 0, 1, -1.
[0082] 3) Input all node features X(t) and the connection matrix A of the discrete graph snapshot at time t in the data set into the product space for message passing. First, initialize all node features X(t) into the product space to obtain the features X ε (t) and Represent all node features in Euclidean space, hyperbolic space and hyperspherical space respectively, It represents the features obtained after all node features of the discrete graph snapshot are mapped to the product space. The method of mapping a single node feature to the product space is: let the node feature of the input node i be is a natural number field, n is the dimension, and it is split into three parts according to the ratio e:b:s As the initial features of Euclidean space, hyperbolic space and hyperspherical space, the formulas for projecting them into the product space using the exponential mapping function are as follows:
[0083]
[0084] In the formula, is the initial product space feature, and They are exponential mappings with the origin o in Euclidean space, hyperbolic space, and hyperspherical space. After all nodes are projected, we get
[0085] 4) The features of the discrete graph snapshot at time t Multi-layer message passing is performed in the product space, and after linear transformation, neighborhood aggregation and nonlinear activation, the hidden vector is obtained The message transmission of node i at layer l includes the following processes in sequence:
[0086] In the product space, the linear transformation operation of the lth layer is:
[0087]
[0088] In the formula, is the hidden vector, is the spatial feature of the previous layer, W and b are weight and bias parameters, and for Möbius multiplication and Möbius addition;
[0089]
[0090]
[0091] In the formula, and They are respectively the exponential map and logarithmic map on the origin o in the product space, is the translation transformation;
[0092] In the product space, the domain aggregation operation at the lth layer is:
[0093]
[0094] In the formula, is the temporary hidden vector after domain aggregation, are all neighbor nodes of node i, d i and d jare the degrees of node i and node j respectively, calculated by the connection matrix A, d i is the sum of the values of the i-th row of the connected matrix A, d j is the sum of the values of the j-th row of the connected matrix A;
[0095] In the product space, the nonlinear activation operation of the lth layer is:
[0096]
[0097] In the formula, the activation function σ uses LeakReLU.
[0098] All nodes are passed through multiple layers of message passing.
[0099] 5) The historical information storage unit is responsible for storing the w discrete graph snapshot embeddings before the current time t Embed the w discrete graph snapshots in the historical information storage unit into Z(tw), Z(t-w+1), ..., Z(t-1), that is, Perform weighted aggregation to generate historical node embeddings The attention mechanism adaptively assigns weights based on the relevance of the discrete graph snapshot to the current moment. The calculation process is:
[0100] M=[Z(tw)||Z(t-w+1)||...||Z(t-1)]
[0101] e=R T tanh(QM T )
[0102] a=softmax(e)
[0103]
[0104] Where M is an embedding of w discrete graph snapshots. The concatenated matrix, e and a are intermediate variables, tanh is the hyperbolic tangent function, R and Q are the weight vector and attention matrix, T is the matrix transpose operation, and softmax is the normalized exponential function.
[0105] 6) Use HyperGRU to update the node embedding of the discrete graph snapshot at the current moment to capture the temporal characteristics of the dynamic graph. The input is the hidden embedding obtained through multi-layer convolution space message passing. and history node embedding Generate the comprehensive historical embedding Z(t) of the discrete graph snapshot at the current time t. The update process is as follows:
[0106]
[0107]
[0108]
[0109]
[0110] In the formula, r t 、u t and m t They are reset gate, update gate and candidate hidden state, W r , W u and W are the weights corresponding to the comprehensive historical embedding, U r , U u and U is the weight of the corresponding hidden embedding, b r , b u and b are the corresponding bias parameters, σ and is a nonlinear activation function, diag is used to represent the diagonal matrix, and finally, Z(t) will be used to update the historical information storage unit and serve as the input for the next link prediction.
[0111] 7) Decode the comprehensive historical embedding Z(t) through the Fermi-Dirac decoder, calculate the link prediction probability between any two nodes, and optimize the parameters through the cross entropy loss function, which specifically includes the following steps:
[0112] The link prediction probability of nodes i and j at time t+1 is calculated using the Fermi-Dirac decoder. i,j The calculation of (t+1) is as follows:
[0113]
[0114] In the formula, Z i (t) and Z j (t) is the feature of nodes i and j in the comprehensive historical embedding Z(t), is the distance function in the product space, g and s are hyperparameters;
[0115] Optimize parameters through cross entropy loss function:
[0116]
[0117] Where L is the loss function, P i',j' (t+1) is the predicted probability of linking nodes i' and j' at time t+1. Since the dynamic graph data in the real world is sparse, that is, the number of negative edges is much larger than the number of positive edges, in the discrete graph snapshot at the current time t, all positive edges e are selected. i,j ∈ε t+1 , negative sampling and positive edges have the same number of negative edges To calculate, ε t+1 represents a positive edge set.
[0118] 8) Apply reinforcement learning mechanism to dynamically optimize the dimensionality ratio and curvature parameters of each space in the product space.
[0119] The following steps are involved:
[0120] S81: Define state S t , by the ratio of each spatial dimension express;
[0121] S82: Define an action, which involves adjusting the dimension ratio by a minimum value δ within a predefined range. Possible actions a t Including increasing or decreasing each ratio, a t Represented as a triple Respectively represent the adjustment direction and amplitude of the dimensional ratio of Euclidean space, hyperbolic space and hyperspherical space. Each a t The value of is one of {+δ, 0, -δ}, that is, increase, remain unchanged or decrease, and when performing action a t After that, normalization can still be maintained;
[0122] First, we define the reward, which is calculated based on the performance improvement of the link prediction task. The reward R at time step t is t The calculation is as follows:
[0123] R t =λ1(AUC t -AUC t-1 )+λ2(AP t -AP t-1 )
[0124] In the formula, AUC t is the area under the ROC curve at time i, AUC t-1 is the area under the ROC curve at time t-1, AP t and AP t-1 is the average accuracy at time t and time t-1, λ1 and λ2 are weights;
[0125] Then define the strategy, π(a t |s t ) is determined in state S t Take action a t The strategy uses the policy gradient method to update the policy parameters and optimize the next action selection:
[0126]
[0127] In the formula, π(a t+1 |s t+1) is the strategy at time t+1, η is the learning rate, is the gradient of the strategy, indicating the direction of improvement of the strategy under the current parameter settings;
[0128] In addition to adjusting the dimensionality ratio, the curvature of the hyperbolic space and the hyperspherical space is also considered a learnable parameter. The curvature c affects the geometric properties of the space, and its optimization is crucial for accurately modeling the structural characteristics of the data. The curvature learning process:
[0129]
[0130] In the formula, c t and c t-1 are the curvatures at time t and time t-1, respectively, denotes the derivative of the loss function with respect to the curvature, which is updated using gradient descent to ensure that it adapts to the geometric properties of the data over time;
[0131] Finally, the adaptive adjustment mechanism is integrated into the overall process. In each training iteration, the dimension ratio and curvature are updated based on reinforcement learning and gradient descent mechanism. The adaptive adjustment process of the product space is as follows: In each training iteration, the current state is first calculated. Based on the strategy π(a t |s t ) Select the corresponding action, and then update the dimensional ratio of each space according to the selected action Next, the reward R is calculated based on the performance improvement t , using reinforcement learning to update the policy π(a t |s t ), and finally update the curvature parameters of the hyperbolic space and the hyperspherical space by the gradient descent method
[0132] 9) After optimizing the parameters and product space configuration, the node features X(t) and the connection matrix A of the discrete graph snapshot at the current time t are used. After message passing and HyperGRU update, the Fermi-Dirac decoder is used to calculate the link prediction probability P(t+1) at the next time.
[0133] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations made without departing from the spirit and principle of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A discrete dynamic graph link prediction method based on adaptive product space, characterized in that: The following steps are involved: S1: Get the dynamic relationship network and make it into dynamic graph data, then split it into multiple ordered discrete graph snapshots according to fixed time intervals. Each discrete graph snapshot contains nodes and links, initializes the node features of the nodes, and constructs an adjacency matrix. The above multiple ordered discrete graph snapshots form a discrete dynamic graph dataset in chronological order; S2: construct a product space as the embedding space, which is obtained by calculating the Cartesian product of the Euclidean space, the hyperbolic space and the hyperspherical space, and initialize the dimension ratio and curvature parameters of the Euclidean space, the hyperbolic space and the hyperspherical space; S3: After splitting the node features of the discrete graph snapshot at the current moment in the discrete dynamic graph dataset into three parts according to the dimensional ratio, they are projected into the Euclidean space, hyperbolic space and hyperspherical space in the product space through exponential mapping to obtain the three projected features, and then the three projected features are spliced to obtain the initial node embedding; S4: Taking the initial node embedding and adjacency matrix of the discrete graph snapshot at the current moment as input, message passing is performed in the product space, which includes linear transformation, neighborhood aggregation and nonlinear activation in sequence, so as to obtain node embedding containing geometric structure information; S5: Design a historical information fusion unit to store the node embeddings of a fixed number of discrete graph snapshots before the current discrete graph snapshot to preserve historical information, and then aggregate the node embeddings of the stored discrete graph snapshots through the attention mechanism to generate historical node embeddings; S6: Based on the node embedding obtained in step S4 and the historical node embedding generated in step S5, HyperGRU is used to update the node embedding of the discrete graph snapshot at the current moment to generate a comprehensive historical embedding of the discrete graph snapshot at the current moment; S7: Use the Fermi-Dirac decoder to decode the comprehensive historical embedding of the discrete graph snapshot at the current moment obtained in step S6, calculate the link prediction probability of any two nodes, and optimize the parameters in the message passing process through the cross entropy loss function; S8: Apply a reinforcement learning mechanism to optimize the dimensional ratios and curvature parameters of the Euclidean space, hyperbolic space, and hyperspherical space in the product space constructed in step S2; S9: Using the node features and connection matrix of the discrete graph snapshot at the current moment, after message passing and HyperGRU update, the Fermi-Dirac decoder is used to calculate the link prediction probability at the next moment.
2. The discrete dynamic graph link prediction method based on adaptive product space according to claim 1 is characterized in that: In step S1, after constructing the discrete graph snapshot, the node features of its nodes are obtained by random initialization or using one-hot vectors, and a two-dimensional array is used to store the edge data. This two-dimensional array is called the connection matrix A.
3. The discrete dynamic graph link prediction method based on adaptive product space according to claim 2 is characterized in that: In step S2, the constructed product space is composed of Euclidean space, hyperbolic space and hyperspherical space as component spaces, expressed as is the product space, Euclidean space, is a hyperbolic space, is the hypersphere space, × is the Cartesian product. For this product space, two problems need to be solved, namely, the characteristic dimension ratio of each component space (e:b:s) and the selection of curvature c. e, b, and s represent different numbers respectively. Let α ε , and They represent the proportion of Euclidean space, hyperbolic space and hyperspherical space in the total space respectively. The initial proportions satisfy the following conditions: The initial curvatures of Euclidean space, hyperbolic space and hyperspherical space are set to 0, -1 and 1 respectively.
4. The discrete dynamic graph link prediction method based on adaptive product space according to claim 3 is characterized in that: In step S3, the node features of the nodes are mapped into the product space, and the node features of the input node i are set to is a natural number field, n is the dimension, and it is split into three parts according to the ratio e:b:s As the initial features of Euclidean space, hyperbolic space and hyperspherical space, the formulas for projecting them into the product space using the exponential mapping function are as follows: In the formula, is the initial product space feature, and They are exponential maps with the origin o in Euclidean space, hyperbolic space and hyperspherical space respectively.
5. The discrete dynamic graph link prediction method based on adaptive product space according to claim 4 is characterized in that: In step S4, the message transmission of node i in the product space includes the following processes in sequence: S41: In the product space, the linear transformation operation of the lth layer is: In the formula, is the hidden vector, is the spatial feature of the previous layer, W and b are weight and bias parameters, and for Möbius multiplication and Möbius addition; In the formula, and They are respectively the exponential mapping and logarithmic mapping on the origin o in the product space, is the translation transformation; S42: In the product space, the domain aggregation operation at the lth layer is: In the formula, is the temporary hidden vector after domain aggregation, are all neighbor nodes of node i, d i and d j are the degrees of node i and node j respectively, calculated by the connection matrix A, d i is the sum of the values in the i-th row of the connected matrix A, d j is the sum of the values of the j-th row of the connected matrix A; S43: In the product space, the nonlinear activation operation of the lth layer is: In the formula, the activation function σ uses LeakReLU.
6. The discrete dynamic graph link prediction method based on adaptive product space according to claim 5 is characterized in that: In step S5, the historical information storage unit is responsible for storing the w discrete graph snapshot embeddings before the current time t Embed the w discrete graph snapshots in the historical information storage unit into Z(tw), Z(t-w+1), ..., Z(t-1), that is, Perform weighted aggregation to generate historical node embeddings The attention mechanism adaptively assigns weights based on the relevance of the discrete graph snapshot to the current moment. The calculation process is: M=[Z(tw)||Z(t-w+1)||...||Z(t-1)] e=R T tanh(QM T ) a=softmax(e) Where M is an embedding of w discrete graph snapshots. The concatenated matrix, e and a are intermediate variables, tanh is the hyperbolic tangent function, R and Q are the weight vector and attention matrix, T is the matrix transpose operation, and softmax is the normalized exponential function.
7. The discrete dynamic graph link prediction method based on adaptive product space according to claim 6 is characterized in that: In step S6, HyperGRU is used to update the node embedding of the discrete graph snapshot at the current moment to capture the temporal characteristics of the dynamic graph. The input is the hidden embedding obtained through multi-layer convolutional space message passing. and history node embedding Generate the comprehensive historical embedding Z(t) of the discrete graph snapshot at the current time t. The update process is as follows: In the formula, r t 、u t and m t They are reset gate, update gate and candidate hidden state, W r , W u and W are the weights corresponding to the comprehensive historical embedding, U r , U u and U is the weight of the corresponding hidden embedding, b r , b u and b are the corresponding bias parameters, σ and is a nonlinear activation function, diag is used to represent the diagonal matrix, and finally, Z(t) will be used to update the historical information storage unit and serve as the input for the next link prediction.
8. The discrete dynamic graph link prediction method based on adaptive product space according to claim 7 is characterized in that: In step S7, the comprehensive historical embedding Z(t) is decoded by a Fermi-Dirac decoder, the link prediction probability between any two nodes is calculated, and the parameters are optimized by a cross entropy loss function, which specifically includes the following steps: S71: Use the Fermi-Dirac decoder to calculate the link prediction probability, the link prediction probability P of nodes i and j at time t+1 i,j The calculation of (t+1) is as follows: In the formula, Z i (t) and Z j (t) is the feature of nodes i and j in the comprehensive historical embedding Z(t), is the distance function in the product space, g and s are hyperparameters; S72: Optimize parameters through cross entropy loss function: Where L is the loss function, P i',j' (t+1) is the predicted probability of linking nodes i' and j' at time t+1. Since the dynamic graph data in the real world is sparse, that is, the number of negative edges is much larger than the number of positive edges, in the discrete graph snapshot at the current time t, all positive edges e are selected. i,j ∈ε t+1 , negative sampling and positive edges have the same number of negative edges To calculate, ε t+1 represents a positive edge set.
9. The discrete dynamic graph link prediction method based on adaptive product space according to claim 8, characterized in that: In step S8, a reinforcement learning mechanism is applied to dynamically optimize the dimensional ratio and curvature parameters of each space in the product space, including the following steps: S81: Define state S t , by the ratio of each spatial dimension express; S82: Define an action, which involves adjusting the dimension ratio by a minimum value δ within a predefined range. Possible actions a t Including increasing or decreasing each ratio, a t Represented as a triple Respectively represent the adjustment direction and amplitude of the dimensional ratio of Euclidean space, hyperbolic space and hyperspherical space. Each a t The value of is one of {+δ, 0, -δ}, that is, increase, remain unchanged or decrease, and when performing action a t After that, normalization can still be maintained; S83: Define rewards. The rewards are calculated based on the performance improvement of the link prediction task. The reward R at time step t is t The calculation is as follows: R t =λ1(AUC t -AUC t-1 )+λ2(AP t -AP t-1 ) In the formula, AUC t is the area under the ROC curve at time t, AUC t-1 is the area under the ROC curve at time t-1, AP t and AP t-1 is the average accuracy at time t and time t-1, λ1 and λ2 are weights; S84: Define strategy, π(a t |s t ) is determined in state S t Take action a t The strategy uses the policy gradient method to update the policy parameters and optimize the next action selection: In the formula, π(a t+1 |s t+1 ) is the strategy at time t+1, η is the learning rate, is the gradient of the strategy, indicating the direction of improvement of the strategy under the current parameter settings; S85: Learnable curvature. In addition to adjusting the dimensional ratio, the curvature of hyperbolic space and hyperspherical space is also considered a learnable parameter. The curvature c affects the geometric properties of the space, and its optimization is crucial for accurately modeling the structural characteristics of the data. The curvature learning process: In the formula, c t and c t-1 are the curvatures at time t and time t-1, respectively, denotes the derivative of the loss function with respect to the curvature, which is updated using gradient descent to ensure that it adapts to the geometric properties of the data over time; S86: Integrate the adaptive adjustment mechanism into the overall process. In each training iteration, the dimension ratio and curvature are updated based on reinforcement learning and gradient descent mechanism. The adaptive adjustment process of the product space is as follows: In each training iteration, first calculate the current state Based on the strategy π(a t |s t ) Select the corresponding action, and then update the dimensional ratio of each space according to the selected action Next, the reward R is calculated based on the performance improvement t , using reinforcement learning to update the policy π(a t |s t ), and finally update the curvature parameters of the hyperbolic space and the hyperspherical space by the gradient descent method 10. The discrete dynamic graph link prediction method based on adaptive product space according to claim 9, characterized in that: In step S9, after optimizing the parameters and product space configuration, the node features and connection matrix of the discrete graph snapshot at the current time t are used. After message passing and HyperGRU update, the Fermi-Dirac decoder is used to calculate the link prediction probability at the next time.
Citation Information
Cited By
Industrial production parameter intelligent matching method and system based on knowledge graph
CN120578963A
Method for reducing large model illusion of question-answering system based on knowledge graph representation learning
CN120632046A