Method and device for predicting relationship between users in parameter-efficient dynamic social network

CN116523123BActive Publication Date: 2026-09-29TSINGHUA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310424079.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-19
Publication Date
2026-09-29
Estimated Expiration
2043-04-19

AI Technical Summary

Technical Problem

以往动态社交网络中用户间关系预测方法一般在静态链接预测模型之上引入额外的时间编码器,并且所处理的时间跨度单位固定,导致准确率低且开销大的问题,本发明提出一种参数高效的动态社交网络中用户间关系预测方法,其基本思路为在一个图神经网络模型上构建元学习策略和随机梯度聚合机制,最终得出节点间产生关联边的可能性

Benefits of technology

[0049]本发明实施例的参数高效的动态社交网络中用户间关系预测方法和装置,能够捕获多个时间跨度范围下动态图信息,从而实现高效的动态社交网络中用户间关系预测。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116523123B_ABST
    Figure CN116523123B_ABST
Patent Text Reader

Abstract

The application discloses a parameter-efficient user relationship prediction method and device in a dynamic social network, and the method comprises the following steps: constructing a static subgraph containing a training set and a test set based on a user feature matrix; segmenting a random time window generated according to the static subgraph in the training set to obtain a plurality of time windows; inputting each static subgraph into a graph neural network model to calculate a frame-level loss and a window-aware loss, and optimizing model parameters of the graph neural network model according to an aggregation result of a frame-level loss gradient and a window-aware loss gradient to obtain a trained neural network model; inputting the static subgraph in the test set into the trained neural network model to obtain a matching value of whether there is a relationship between any two node users in a dynamic social network, so as to obtain a relationship prediction result between users according to the matching value. The application can capture dynamic graph information in a plurality of time span ranges, thereby realizing efficient user relationship prediction in a dynamic social network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of relationship prediction technology, and in particular to a method and apparatus for predicting relationships between users in dynamic social networks with high parameter efficiency. Background Technology

[0002] Social networks are graph-structured networks composed of human users based on their behavioral relationships. The core idea of ​​predicting user relationships is to predict whether edges exist between nodes in the network. Social networks are dynamic, essentially dynamic graphs (also called dynamic networks), characterized by edges dynamically appearing and disappearing between nodes over time, representing the changes in nodes and edges within the network. Dynamic link prediction is a core algorithm for predicting user relationships in dynamic social networks and is also one of the core operations of graph data mining algorithms, such as association mining, recommendation, knowledge completion, and knowledge reasoning. In specific applications, dynamic link prediction can calculate the degree of association between scholars in academic collaboration networks, thereby enabling expert-assisted recommendations; in the field of knowledge graphs, dynamic link prediction can calculate the temporal relationships between various knowledge concepts, forming causal reasoning. The essence of dynamic link prediction is to provide a temporal encoding for capturing and modeling this dynamic nature of graphs, in order to better understand network evolution.

[0003] In recent years, with the significant achievements of Graph Neural Networks (GNNs) in graph representation learning, current dynamic link prediction methods are generally based on GNNs. However, the graphs for which GNNs are applicable require a defined set of nodes and edges. Therefore, existing dynamic link prediction methods must introduce a dedicated component for encoding temporal parameters, called a temporal encoder. The dynamic graph is then divided into several static subgraphs according to time intervals, and GNNs are applied to each of these static subgraphs before the dynamic encoder concatenates their information. For example, EvolveGCN [Pareja, 2020] uses a recurrent neural network to update the parameters of the internal GNN between static subgraphs, thus giving the GNN the ability to encode some temporal information. While these methods are simple and intuitive, they inevitably introduce additional learning parameters to the entire model, resulting in significant computational overhead and a tendency for accuracy to decrease due to overfitting. In recent years, dynamic link prediction methods have emerged that attempt to reduce the use of temporal encoders, such as ROLAND [You, 2022]. Its principle is to forward the information learned from the static subgraphs and the model's gradient optimization loss to the GNN in the next subgraph through an event encoder of length 2. However, this approach causes the model to adjust its learning parameters based on information from only one static subgraph at a time, ignoring the long-term dependencies in the dynamic graph, leading to a performance degradation on dynamic link prediction tasks. Summary of the Invention

[0004] The present invention aims to at least partially solve one of the technical problems in the related art.

[0005] Therefore, the core idea of ​​predicting user relationships in dynamic social networks is to predict whether any two user nodes in the graph structure of the dynamic social network will have a future connection edge. This can be applied to various social data mining tasks, such as recommending interested friends based on users' past attention behavior. Previous methods for predicting user relationships in dynamic social networks generally introduce an additional time encoder on top of a static link prediction model, and the time span processed is fixed, leading to low accuracy and high overhead. This invention proposes a parameter-efficient method for predicting user relationships in dynamic social networks. Its basic idea is to construct a meta-learning strategy and a stochastic gradient aggregation mechanism on a graph neural network model, ultimately determining the probability of a connection edge between nodes. Experimental results show that on a dynamic network with 24,000 edges, the prediction accuracy of this method can reach 1.5 times that of ordinary methods, while requiring 27% fewer parameters.

[0006] Another objective of this invention is to provide a parameter-efficient device for predicting relationships between users in dynamic social networks.

[0007] To achieve the above objectives, this invention proposes a parameter-efficient method for predicting user relationships in dynamic social networks, comprising:

[0008] Obtain a dynamic social network and its corresponding user feature matrix, and construct a static subgraph containing a training set and a test set based on the user feature matrix; wherein, the dynamic social network contains multiple user nodes and multiple relationship edges;

[0009] Multiple time windows are obtained by segmenting the random time windows generated from the static subgraphs in the training set;

[0010] Each static subgraph within the multiple time windows is input into the graph neural network model to calculate frame-level loss and window-aware loss. The model parameters of the graph neural network model are optimized based on the aggregation results of the frame-level loss gradient and the window-aware loss gradient to obtain a trained neural network model.

[0011] The static subgraphs in the test set are input into the trained neural network model to obtain a matching value indicating whether there is a relationship between any two user nodes in the dynamic social network, and the relationship prediction result between users is obtained based on the matching value.

[0012] In addition, the parameter-efficient method for predicting user relationships in dynamic social networks according to the above embodiments of the present invention may also have the following additional technical features:

[0013] Furthermore, in one embodiment of the present invention, the step of segmenting the random time window generated based on the static subgraph in the training set to obtain multiple time windows includes:

[0014] A random time window is generated based on the number of static subgraphs in the training set;

[0015] A random time window sequence is obtained based on the starting position and size of the generated random time window;

[0016] The random time window sequence is segmented to obtain multiple time windows that contain static subgraphs in the training set.

[0017] Furthermore, in one embodiment of the present invention, the graph neural network model includes GNN layers and MLP layers, and the step of inputting each static subgraph within the plurality of time windows into the graph neural network model to calculate frame-level loss includes:

[0018] For a static subgraph G t The GNN layer is represented as:

[0019]

[0020] in h represents the representation of node u at level l in the static subgraph t. 0 =, where X is the user feature matrix, and the probability of an edge existing between nodes u and v is predicted using a multilayer perceptron (MLP) layer:

[0021]

[0022] Where || represents the aggregation operation. The relationship between u and v predicted by the neural network model in the static subgraph G t The probability that an edge exists in the array depends on the actual label. The training loss is obtained through cross-entropy loss:

[0023]

[0024] in Represents a sliding window i The training loss is expressed as the model parameters are... Frame-level loss gradient:

[0025]

[0026] The network parameters of the GNN and MLP layers in the next static subgraph are updated using the frame-level loss gradient, with a learning rate of τ.

[0027]

[0028] Furthermore, in one embodiment of the invention, the current static subgraph is used in the GNN layer. t The training loss is used to update the network parameters to be added to the next static subgraph, and in the next static subgraph G t+1 The additional loss generated is represented as:

[0029]

[0030] Furthermore, in one embodiment of the invention, the aggregated sliding window w is utilized i Received w -1 loss gradients optimize network parameters, denoted as φ(·), and expressed as:

[0031]

[0032] The preset sliding window has l w A static subgraph (1,…,t,…) w ), and assign an adaptive decay factor D to each gradient. t The calculation method is as follows:

[0033]

[0034]

[0035] Where τ is the learning rate, δ is a constant, and ⊙ is the element-wise dot product between vectors;

[0036] r t Represented as:

[0037]

[0038] Where ρ is the trade-off parameter;

[0039] The window-aware loss gradient is calculated as follows:

[0040]

[0041] Where M is a randomly generated 0-1 binary matrix;

[0042] Optimize network parameters of GNN and MLP layers using window-aware loss gradients and frame-level loss gradients:

[0043]

[0044] To achieve the above objectives, another aspect of the present invention proposes a parameter-efficient device for predicting user relationships in dynamic social networks, comprising:

[0045] A static subgraph construction module is used to obtain a dynamic social network and its corresponding user feature matrix, and to construct a static subgraph containing a training set and a test set based on the user feature matrix; wherein, the dynamic social network contains multiple user nodes and multiple relationship edges;

[0046] The time window segmentation module is used to segment a random time window generated based on a static subgraph in the training set to obtain multiple time windows;

[0047] The network model training module is used to input each static subgraph within the multiple time windows into the graph neural network model to calculate frame-level loss and window-aware loss, and optimize the model parameters of the graph neural network model based on the aggregation results of frame-level loss gradient and window-aware loss gradient to obtain a trained neural network model.

[0048] The user relationship prediction module is used to input the static subgraph of the test set into the trained neural network model to obtain a matching value indicating whether there is a relationship between any two user nodes in the dynamic social network, so as to obtain the relationship prediction result between users based on the matching value.

[0049] The parameter-efficient method and apparatus for predicting user relationships in dynamic social networks according to embodiments of the present invention can capture dynamic graph information over multiple time spans, thereby achieving efficient prediction of user relationships in dynamic social networks.

[0050] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0051] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:

[0052] Figure 1 This is a flowchart of a parameter-efficient method for predicting user relationships in a dynamic social network according to an embodiment of the present invention.

[0053] Figure 2 This is a framework diagram of a parameter-efficient method for predicting user relationships in dynamic social networks according to an embodiment of the present invention;

[0054] Figure 3 This is a schematic diagram illustrating the generation of random windows in a dynamic social network according to an embodiment of the present invention;

[0055] Figure 4 This is a flowchart illustrating the random generation of window sequences according to an embodiment of the present invention;

[0056] Figure 5 This is a schematic diagram illustrating the calculation of frame-level model loss and window-level loss according to an embodiment of the present invention;

[0057] Figure 6 This is a schematic diagram of adaptive gradient aggregation calculation according to an embodiment of the present invention;

[0058] Figure 7 This is a schematic diagram of the structure of a parameter-efficient dynamic social network relationship prediction device according to an embodiment of the present invention. Detailed Implementation

[0059] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0060] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0061] The following description, with reference to the accompanying drawings, outlines a parameter-efficient method and apparatus for predicting user relationships in dynamic social networks, based on embodiments of the present invention.

[0062] Figure 1 This is a flowchart of a parameter-efficient method for predicting user relationships in a dynamic social network, according to an embodiment of the present invention.

[0063] like Figure 1 As shown, the method includes, but is not limited to, the following steps:

[0064] S1. Obtain the dynamic social network and its corresponding user feature matrix, and construct a static subgraph containing the training set and test set based on the user feature matrix; wherein, the dynamic social network contains multiple user nodes and multiple relation edges;

[0065] S2, the random time window generated from the static subgraph in the training set is divided into multiple time windows;

[0066] S3. Input each static subgraph within multiple time windows into the graph neural network model to calculate frame-level loss and window-aware loss, and optimize the model parameters of the graph neural network model based on the aggregation results of frame-level loss gradient and window-aware loss gradient to obtain a trained neural network model.

[0067] S4. Input the static subgraph in the test set into the trained neural network model to obtain the matching value of whether there is a relationship between any two user nodes in the dynamic social network, so as to obtain the relationship prediction result between users based on the matching value.

[0068] In some embodiments of the present invention, the problem that the present invention aims to solve can be formally defined as follows:

[0069] The input is a dynamic social network (a type of dynamic graph), which consists of a series of static subgraphs, represented as: Among them G t This represents the static subgraph at time t. Let n be the set of all nodes (i.e., users) in the graph, and A set representing edges (i.e., user interactions).

[0070] The static subgraph at time t is represented as G. t =(V t E t ), where V t E t This is the set of nodes and edges in this static subgraph. Therefore, we can obtain... and At this moment, the links between nodes in the static subgraph are determined by the adjacency matrix A. t ∈R n×n Indicates. When v i v j ∈V t And (v) i v j )∈E t hour, otherwise At the same time, define the feature matrix Let k be the initial vector for each node, where k is the vector length.

[0071] The problem of dynamic link prediction is to construct a method f, and then, by inputting two node vectors into f, to predict whether there exists an edge between the nodes corresponding to the two vectors at time t+1, i.e., f: (G 1:t X)→E t+1 .

[0072] Understandably, this invention achieves user relationship prediction in dynamic social networks by designing a parameter-efficient dynamic graph link prediction technique. The basic idea is to construct a meta-learning strategy and a stochastic gradient aggregation mechanism on a graph neural network model, enabling it to dynamically adjust its parameters according to graph changes without using a time encoder, ultimately achieving a parameter-efficient prediction method. The entire computation is performed within a framework flow, as follows: Figure 2 As shown.

[0073] like Figure 2 As shown, first, input a dynamic social network. and its corresponding user feature matrix X.

[0074] Secondly, a series of random time windows are generated based on the number of static subgraphs in the dynamic social network. Based on the starting position and random size of the randomly generated time windows, a series of random time window sequences are formed.

[0075] Then, based on the generated random time window sequence, It is divided into several time windows, and each window contains a series of static sub-graphs.

[0076] Then, for each static subgraph within a time window, the meta-learning policy is integrated into a simplified graph neural network, and frame-level loss is computed by predicting the edges of the current static subgraph. The loss gradient is then passed to the next static subgraph. At this point, the invention establishes a correlation between two adjacent static subgraphs and removes all time-specific encoders, thereby improving performance.

[0077] Finally, this invention constructs another special gradient loss called window loss gradient, and saves the window loss gradients of all static subgraphs within a random time window. Adaptive gradient aggregation is used to determine which snapshot to keep or ignore, thus obtaining the window-aware gradient. This invention integrates frame-level loss gradients and window-aware gradients to jointly optimize the model parameters of the graph neural network, iterating until the loss converges. The resulting parameters are the parameter weights used in the algorithm. Ultimately, these parameters can be used to obtain a matching value indicating whether a relationship exists between any two nodes in a dynamic social network, and this value can be used to predict relationships between users.

[0078] The following section, with reference to the accompanying drawings, details the parameter-efficient method for predicting user relationships in dynamic social networks according to embodiments of the present invention.

[0079] Specifically, such as Figure 3 As shown, taking a dynamic social network as an example, Figure 3 The interaction relationships between users on days 1, 2, ..., n are denoted as G1, G2, ..., Gn. n G i (1≤i≤n) is a static subgraph consisting of several nodes and directed edges. Each node represents a user, and a directed edge linking one node to another indicates that a user has actively interacted with another user.

[0080] In some embodiments of the present invention, such as Figure 4 As shown, it is necessary to generate a random time window sequence for dynamic social networks.

[0081] Specifically, a series of random time windows are generated based on the number of static subgraphs in the dynamic social network. First, the starting position ts of the random time windows is generated, and then the random window size l is generated. w This allows us to obtain the end position te of the random time window, and store this start and end position as the start and end information of the window in the generated random window sequence r. It is important to note that the start position ts of the first window sequence is 0.

[0082] Next, the steps of generating a new random window by determining its starting position and size are repeated. The starting position of this new window must be within the range of the previous random window, and its ending position must be after the ending position of the previous random window. The size of the random window should not exceed one-tenth of the number of static subgraphs. This random window sequence is then stored in the random window sequence r. When the ending position of the generated random window is greater than or equal to the number of static subgraphs, the repetition process ends, and r at this point is output to the next step.

[0083] In some embodiments of the present invention, it is necessary to divide the window into random windows.

[0084] Specifically, the dynamic social network is segmented based on the random window sequence r output above. Figure 3 Taking the dynamic social network as an example, the method generates three random windows based on the previous step, namely r = [<1, 3>, <3, 5>, <5, n>]. Then, it is necessary to... G1, G2, and G3 are selected as window #1, G3, G4, and G5 are selected as window #2, and so on. It should be noted that when the window's ending position te > n, this method only selects G... n That concludes the discussion.

[0085] At this point, use the symbol w. i This represents the i-th window, for example... Figure 3 In the example, w1 = G1, G2, G3. The set of all the windows obtained is denoted as W, and it serves as the input for the next step.

[0086] In some embodiments of the present invention, such as Figure 5 As shown, it is necessary to calculate the frame-level model loss.

[0087] It is understandable that, given W, for a time window w i For each static subgraph within the current static subgraph, this step integrates the meta-learning policy into a simplified graph neural network and computes the frame-level loss by predicting the edges of the current static subgraph, then passes the loss gradient to the next static subgraph. Figure 5 A neural network architecture diagram for constructing this computational method is given.

[0088] Specifically, firstly during the training process, for the static subgraph G... t A GNN network unit is trained on the current subgraph, and after training, the next static subgraph G is trained. t+1 Direct prediction is performed using lossless backpropagation. This results in two types of losses: frame-aware loss and window-aware loss. This step backpropagates the gradient of the frame-aware loss to G. t+1The corresponding GNN unit is used, and the window-aware loss is collected to optimize the long-term window gradient. As all window-aware losses are collected from the beginning to the end of a sliding window, the window gradients are used for backpropagation to optimize the model parameters for the next window.

[0089] Formally, for a static subgraph G t The GNN layer used in this step is represented as follows:

[0090]

[0091] in Let h represent the representation of node u at level l in the static subgraph t, and h 0 =X. Then, this step uses a multilayer perceptron (MLP) layer to predict the probability that an edge exists between nodes u and v:

[0092]

[0093] Where || represents the aggregation operation. The relationship between u and v predicted by the neural network in the static subgraph G t The probability that an edge exists in the array depends on the actual label. The training loss can be obtained using cross-entropy loss:

[0094]

[0095] in Indicates a sliding window w i The training loss. In each training step, the model parameters are represented as... Furthermore, the loss gradient can be approximated using the following formula:

[0096]

[0097] Then, this gradient is used to update the neural network parameters of the GNN and MLP layers in the next static subgraph, with a learning rate of τ:

[0098]

[0099] In some embodiments of the present invention, it is necessary to calculate window-level loss and aggregate the loss.

[0100] First, calculate the gradient of the multi-static subgraph loss. For the random window obtained in the above steps, assume the window size is l. w And the sliding step size from the next window is l s From snapshot G t arrive The i-th window w iFor example, for each static subgraph within the window, the edges of the next static subgraph are predicted by collecting window-aware loss; that is, the GNN unit uses the current static subgraph G... t The training loss is used to update the parameters and add them to the next static subgraph, and then to the next static subgraph G. t+1 The additional loss generated is represented as:

[0101]

[0102] Furthermore, adaptive loss gradient aggregation is performed. The dynamic GNN unit operates within a sliding window w. i After training from the first static subgraph to the last static subgraph is completed, a total of l can be collected. w -1 loss gradient. These gradients are aggregated to optimize a more comprehensive model parameter tuning than using the gradients of a single snapshot. This process is denoted as φ(·) and expressed as:

[0103]

[0104] in This is the result of gradient aggregation across the entire sliding window. In this case, simply using summation for the design of φ will inevitably subject the gradient to the influence of local basis values ​​in the short term. To overcome this problem, this invention designs an adaptive gradient layer to enhance the robustness of dynamic learning. For example... Figure 6 As shown:

[0105] Assuming there is l in the window w A static subgraph (1, ..., t, ..., l) w In this invention, an adaptive decay factor D is assigned to each gradient. t The calculation method is as follows:

[0106]

[0107]

[0108] Where τ is the learning rate, and δ is a very small constant (typically taken as 10). -6 ), used to ensure the attenuation factor D t There will be no division by zero issue. ⊙ represents element-wise dot product between vectors, r t It is calculated from the gradient already obtained, and is represented as follows:

[0109]

[0110] The value ρ determines the trade-off between the previously accumulated gradient and the current loss gradient, and is typically set to 0.1.

[0111] Subsequently, to further reduce the influence of local optima, this invention designs a random masking mechanism. This involves generating a binary random mask vector, performing element-wise multiplication with an adaptively adjusted loss gradient, and then summing all results to obtain the final window-aware loss gradient for the current sliding window. The calculation is as follows:

[0112]

[0113] Where M is a randomly generated 0-1 binary matrix (i.e., a mask). Using this method, the present invention can randomly select a batch of static subgraphs in a dynamic social network and adaptively aggregate all loss gradients on the batch of static subgraphs into a comprehensive loss gradient.

[0114] For the next sliding window, the parameters of the GNN and MLP layers are optimized by combining the window-level loss gradient from the previous window and the frame-level model loss gradient from the previous static subgraph.

[0115]

[0116] After that, according to Figure 2 The process iterates continuously until the last window reaches the end of the dynamic social network, at which point the iteration ends. Finally, using the learned node representations, an additional MLP layer is used during the inference phase to calculate whether a behavioral relationship exists between two nodes in the future.

[0117] Furthermore, the experiments of this invention selected the dynamic social network provided by the Bitcoin-Alpha platform for testing. This dynamic social network contains 3783 node users, a total of 24186 behavioral relationship edges, and is divided into 226 static subgraphs with an average edge density of 2.5890 × 10⁻⁶. -3 The experiment used the first 70% of the static subgraphs of the data for training, and the last 30% for testing and comparison. The experiment used the predicted mean reciprocal rank (MRR) to evaluate the accuracy of this invention compared to other existing methods in predicting user relationships in dynamic social networks. MRR represents the average of the reciprocal rank of the tail nodes that can be correctly predicted to interact with the head node in the future. Its calculation formula is:

[0118]

[0119] Where N is the node number in the test set, and Rank(i) represents the position of the correct tail node in the list sorted by the predicted logarithm. Furthermore, the size of the model parameters is used to compare the computational cost of this invention with other existing methods.

[0120] (1) Accuracy of dynamic link prediction. Experimental results show that the accuracy of this method in dynamic link prediction is much higher than that of other comparative methods. Compared with the current mainstream methods, the MRR of this method on the Bitcoin-Alpha dynamic social network is 36.74% (±3.9389%, randomized repeated 10 times), which is 1.5 times higher than the MRR of the existing method ROLAND [You, 2022] (14.52±0.6506%), and much higher than the existing EvolveGCN [Pareja, 2020] (3.28±0.2845%).

[0121] (2) Calculation of model parameter size. The method for calculating the size of the calculation model is to implement the above method using the PyTorch programming framework, load the parameter layers of each method into the graphics processing unit (GPU), and then calculate the amount of video memory occupied. Experiments show that the GPU memory occupied by this method when running on the Bitcoin-Alpha dynamic social network is 252KB, which is lower than the 348KB occupied by the existing method ROLAND, reducing the space occupied by 27%, and is also much lower than the 2.6MB occupied by EvolveGCN.

[0122] The parameter-efficient method for predicting user relationships in dynamic social networks according to embodiments of the present invention can capture dynamic graph information across multiple time spans, thereby achieving efficient prediction of user relationships in dynamic social networks.

[0123] To achieve the above embodiments, such as Figure 7 As shown, this embodiment also provides a parameter-efficient device 10 for predicting user relationships in a dynamic social network. The device 10 includes a static subgraph construction module 100, a time window segmentation module 200, a network model training module 300, and a user relationship prediction module 400.

[0124] The static subgraph construction module 100 is used to obtain the dynamic social network and the corresponding user feature matrix, and to construct a static subgraph containing the training set and the test set based on the user feature matrix; wherein, the dynamic social network contains multiple node users and multiple relation edges;

[0125] The time window segmentation module 200 is used to segment a random time window generated from a static subgraph in the training set to obtain multiple time windows;

[0126] The network model training module 300 is used to input each static subgraph within multiple time windows into the graph neural network model to calculate frame-level loss and window-aware loss, and optimize the model parameters of the graph neural network model based on the aggregation results of frame-level loss gradient and window-aware loss gradient to obtain a trained neural network model.

[0127] The user relationship prediction module 400 is used to input the static subgraph of the test set into the trained neural network model to obtain the matching value of whether there is a relationship between any two user nodes in the dynamic social network, so as to obtain the relationship prediction result between users based on the matching value.

[0128] Furthermore, the aforementioned time window segmentation module 200 is also used for:

[0129] Random time windows are generated based on the number of static subgraphs in the training set;

[0130] A random time window sequence is obtained based on the starting position and size of the generated random time window;

[0131] The random time window sequence is segmented to obtain multiple time windows containing static subgraphs from the training set.

[0132] Furthermore, the graph neural network model, including GNN layers and MLP layers, and the aforementioned network model training module 300, are also used for:

[0133] For a static subgraph G t The GNN layer is represented as:

[0134]

[0135] in h represents the representation of node u at level l in the static subgraph t. 0 =X, where X is the user feature matrix, and the probability of an edge existing between nodes u and v is predicted using a multilayer perceptron (MLP) layer:

[0136]

[0137] Where || represents the aggregation operation. The relationship between u and v predicted by the neural network model in the static subgraph G t The probability that an edge exists in the array depends on the actual label. The training loss is obtained through cross-entropy loss:

[0138]

[0139] in Represents a sliding window i The training loss is expressed as the model parameters are... Frame-level loss gradient:

[0140]

[0141] The network parameters of the GNN and MLP layers in the next static subgraph are updated using the frame-level loss gradient, with a learning rate of τ.

[0142]

[0143] Furthermore, the current static subgraph is used in the GNN layer. t The training loss is used to update the network parameters to be added to the next static subgraph, and in the next static subgraph t+1 The additional loss generated is represented as:

[0144]

[0145] Furthermore, utilizing the aggregated data in the sliding window i Received w -1 loss gradients optimize network parameters, denoted as φ(τ), and expressed as:

[0146]

[0147] The preset sliding window has l w A static subgraph (1,…,t,…) w ), and assign an adaptive decay factor D to each gradient. t The calculation method is as follows:

[0148]

[0149]

[0150] Where τ is the learning rate, δ is a constant, and ⊙ is the element-wise dot product between vectors;

[0151] r t Represented as:

[0152]

[0153] Where ρ is the trade-off parameter;

[0154] The window-aware loss gradient is calculated as follows:

[0155]

[0156] Where M is a randomly generated 0-1 binary matrix;

[0157] Optimize network parameters of GNN and MLP layers using window-aware loss gradients and frame-level loss gradients:

[0158]

[0159] The parameter-efficient device for predicting user relationships in dynamic social networks according to embodiments of the present invention can capture dynamic graph information over multiple time spans, thereby achieving efficient prediction of user relationships in dynamic social networks.

[0160] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

Claims

1. A parameter-efficient method for predicting user relationships in a dynamic social network, characterized in that, Includes the following steps: Obtain a dynamic social network and its corresponding user feature matrix, and construct a static subgraph containing a training set and a test set based on the user feature matrix; wherein, the dynamic social network contains multiple user nodes and multiple relationship edges; Multiple time windows are obtained by segmenting the random time windows generated from the static subgraphs in the training set; Each static subgraph within the plurality of time windows is input into the graph neural network model to calculate frame-level loss and window-aware loss, and the model parameters of the graph neural network model are optimized based on the aggregation results of the frame-level loss gradient and the window-aware loss gradient to obtain a trained neural network model. The static subgraph in the test set is input into the trained neural network model to obtain a matching value indicating whether there is a relationship between any two node users in the dynamic social network, so as to obtain the relationship prediction result between users based on the matching value. The graph neural network model includes GNN layers and MLP layers for static subgraphs. The GNN layer is represented as: in This represents the representation of node u in the static subgraph t after the l-th layer. Let X be the user feature matrix. The probability that there is an edge between nodes u and v is predicted by a multilayer perceptron (MLP) layer. in Indicates aggregation operation, The relationship between u and v predicted by the neural network model in the static subgraph The probability that an edge exists in the array depends on the actual label. The frame-level training loss is obtained through cross-entropy loss: in The training loss of the sliding window is represented by the model parameters as follows. The frame-level loss gradient is: The network parameters of the GNN and MLP layers in the next static subgraph are updated using the frame-level loss gradient, with a learning rate of [missing information]. : For each static subgraph within the window, use the current static subgraph. The training loss is used to update the network parameters and added to the next static subgraph. The additional loss generated above is used as the window perception loss, and is expressed as: In the sliding window After training from the first static subgraph to the last static subgraph is completed, the loss gradients of each static subgraph are collected and aggregated, denoted as . , is represented as: Preset sliding window has A static subgraph, with an adaptive decay factor assigned to each gradient. The calculation method is as follows: in It is the learning rate during training. It is a constant. It is an element-wise dot product between vectors; Represented as: in To weigh parameters; Generate a random binary mask vector, sum the adjusted loss gradients element-wise, and then obtain the window-aware loss gradient: in, It is a randomly generated 0-1 binary matrix; Optimize the network parameters of GNN and MLP layers using both window-aware loss gradients and frame-level loss gradients: 。 2. The method according to claim 1, characterized in that, The step of segmenting the random time window generated based on the static subgraph in the training set to obtain multiple time windows includes: A random time window is generated based on the number of static subgraphs in the training set; A random time window sequence is obtained based on the starting position and size of the generated random time window; The random time window sequence is segmented to obtain multiple time windows that contain static subgraphs in the training set.

3. A parameter-efficient device for predicting user relationships in a dynamic social network, characterized in that, include: A static subgraph construction module is used to obtain a dynamic social network and its corresponding user feature matrix, and to construct a static subgraph containing a training set and a test set based on the user feature matrix; wherein, the dynamic social network contains multiple user nodes and multiple relationship edges; The time window segmentation module is used to segment a random time window generated based on a static subgraph in the training set to obtain multiple time windows; The network model training module is used to input each static subgraph within the multiple time windows into the graph neural network model to calculate frame-level loss and window-aware loss, and optimize the model parameters of the graph neural network model based on the aggregation results of frame-level loss gradient and window-aware loss gradient to obtain a trained neural network model. The user relationship prediction module is used to input the static subgraph of the test set into the trained neural network model to obtain a matching value for whether there is a relationship between any two node users in the dynamic social network, so as to obtain the relationship prediction result between users based on the matching value. The graph neural network model includes GNN layers and MLP layers for static subgraphs. The GNN layer is represented as: in This represents the representation of node u in the static subgraph t after the l-th layer. Let X be the user feature matrix. The probability that there is an edge between nodes u and v is predicted by a multilayer perceptron (MLP) layer. in Indicates aggregation operation, The relationship between u and v predicted by the neural network model in the static subgraph The probability that an edge exists in the array depends on the actual label. The frame-level training loss is obtained through cross-entropy loss: in The training loss of the sliding window is represented by the model parameters as follows. The frame-level loss gradient is: The network parameters of the GNN and MLP layers in the next static subgraph are updated using the frame-level loss gradient, with a learning rate of [missing information]. : For each static subgraph within the window, use the current static subgraph. The training loss is used to update the network parameters and added to the next static subgraph. The additional loss generated above is used as the window perception loss, and is expressed as: In the sliding window After training from the first static subgraph to the last static subgraph is completed, the loss gradients of each static subgraph are collected and aggregated, denoted as . , is represented as: Preset sliding window has A static subgraph, with an adaptive decay factor assigned to each gradient. The calculation method is as follows: in It is the learning rate during training. It is a constant. It is an element-wise dot product between vectors; Represented as: in To weigh parameters; Generate a random binary mask vector, sum the adjusted loss gradients element-wise, and then obtain the window-aware loss gradient: in, It is a randomly generated 0-1 binary matrix; Optimize the network parameters of GNN and MLP layers using both window-aware loss gradients and frame-level loss gradients: 。 4. The apparatus according to claim 3, characterized in that, The time window segmentation module is also used for: A random time window is generated based on the number of static subgraphs in the training set; A random time window sequence is obtained based on the starting position and size of the generated random time window; The random time window sequence is segmented to obtain multiple time windows that contain static subgraphs in the training set.