Training method and device for graph neural network
By dynamically updating the sampling probability, the graph neural network is updated for multiple rounds of iterations, which solves the problem of excessive computing resources and memory consumption in graph neural network training, and achieves highly accurate node embedding expression.
Patent Information
- Application Number
- CN202011009910.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-23
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2040-09-23
AI Technical Summary
When the existing graph neural network determines the node embedding expression, as the order increases, the number of neighbors increases exponentially, resulting in excessive consumption of computing resources and memory, making it difficult to ensure the accuracy of the node embedding expression.
Neighbor nodes are sampled through dynamically updated sampling probabilities, training samples are constructed, and the multi-round iterative update mechanism of the graph neural network is used to reduce memory usage and computing consumption while ensuring the accuracy of node embedding expression.
It effectively reduces the memory and computing consumption during the training process of graph neural network, and improves the accuracy of node embedding expression and model convergence speed.
Smart Images

Figure CN112085615B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of computer technology, and in particular, to a method and device for training a graph neural network. Background Art
[0002] A relational network diagram is a description of the relationship between entities in the real world. It is currently widely used in various computer information processing. Generally, a relational network diagram contains a set of nodes and a set of edges. Nodes represent entities in the real world, and edges represent the connections between entities in the real world. For example, in a social network, people are entities, and the relationships or connections between people are edges.
[0003] In many cases, we want to analyze the topological characteristics of nodes and edges in a relationship network graph and extract effective information from them. The computational method to achieve this process is called graph computing. Typically, we want to represent each node (entity) in the relationship network graph with a vector of the same dimension, that is, to generate a node vector for each node. In this way, the generated node vector can be used to calculate the similarity between nodes, discover the community structure in the graph, predict the edge connections that may be formed in the future, and visualize the graph.
[0004] The method of generating node vectors has become a basic algorithm for graph computing. According to one scheme, graph neural networks (GNNs) can be used to generate node vectors for nodes in a relational network graph. Usually, graph neural networks need to use the information of its multi-order neighbors when determining the embedding expression of a node. However, as the order increases, the number of neighbors will increase exponentially, which will bring a great burden on computing resources and memory usage. For example, the user-item bipartite graph commonly used in recommendations, if a user has seen some popular items, his second-order neighbors will almost cover the entire user group.
[0005] Therefore, an improved solution is needed that can effectively reduce the consumption of memory and computing resources in the process of determining node embedding expressions using graph neural networks, while ensuring that the node embedding expressions have a high degree of accuracy. Summary of the invention
[0006] In the graph neural network training method and device described in this specification, neighbor nodes are sampled based on dynamically updated sampling probabilities, and then training samples are constructed based on the sampled neighbor nodes to train the graph neural network, thereby effectively reducing memory usage and computing consumption while ensuring the accuracy of node embedding expression.
[0007] According to a first aspect, a method for training a graph neural network is provided, comprising:
[0008] A relationship network graph is obtained, including a plurality of object nodes corresponding to a plurality of business objects, and connection edges formed by association relationships between the object nodes; the plurality of object nodes include a plurality of label nodes with business labels; the plurality of object nodes each correspond to a sampling probability set, including a sampling probability of the corresponding object node for each of its first-order neighbor nodes; based on the relationship network graph, the graph neural network is iteratively updated for multiple rounds, wherein any round of iterative update includes:
[0009] Taking the first label node selected in this round as the center, M-order neighbor node sampling is performed, wherein any i-th order neighbor node sampling includes, for any first node among the sampled i-1-th order neighbor nodes, based on its current sampling probability set, sampling a number of neighbor nodes from its first-order neighbor node set and classifying them into the i-th order neighbor node; based on the sampled neighbor nodes within M orders, using the M hidden layers contained in the graph neural network, determining the embedding vector of the first label node; in any of the hidden layers, using the attention function of the current hidden layer, determining the attention weight corresponding to the neighbor node hidden vector output by the previous hidden layer; updating the graph neural network in this round according to the embedding vector and the first business label carried by the first label node; for the arbitrary first node, using the updated graph neural network in this round, determining a number of attention weights corresponding to the sampled number of neighbor nodes; determining a number of training feedbacks corresponding to the number of neighbor nodes, wherein each training feedback is positively correlated with the attention weight of the corresponding node and negatively correlated with the current sampling probability of the corresponding node; based on the number of training feedbacks, updating the current sampling probability set corresponding to the first node.
[0010] According to a second aspect, a training device for a graph neural network is provided, comprising:
[0011] A relationship graph acquisition unit is configured to acquire a relationship network graph, which includes a plurality of object nodes corresponding to a plurality of business objects, and connection edges formed by association relationships between the object nodes; the plurality of object nodes include a plurality of label nodes with business labels; the plurality of object nodes each correspond to a sampling probability set, which includes a sampling probability of the corresponding object node for each of its first-order neighbor nodes;
[0012] The iterative update unit is configured to perform multiple rounds of iterative updates on the graph neural network based on the relationship network diagram, wherein any round of iterative updates is implemented through the following modules: a neighbor sampling module is configured to perform M-order neighbor node sampling with the first label node selected in this round as the center, wherein any i-th order neighbor node sampling includes, for any first node among the sampled i-1-th order neighbor nodes, based on its current sampling probability set, sampling a number of neighbor nodes from its first-order neighbor node set and classifying them as i-th order neighbor nodes; a label node embedding module is configured to determine the embedding vector of the first label node based on the sampled neighbor nodes within M orders using the M hidden layers included in the graph neural network; in any of the hidden layers, using the attention function of the current hidden layer, The graph neural network update module is configured to perform this round of updates on the graph neural network according to the embedding vector and the first business label carried by the first label node; the neighbor weight determination module is configured to determine, for the arbitrary first node, a number of attention weights corresponding to a number of neighbor nodes sampled by it using the graph neural network after this round of update; the training feedback determination module is configured to determine a number of training feedbacks corresponding to the number of neighbor nodes, wherein each training feedback is positively correlated with the attention weight of the corresponding node and negatively correlated with the current sampling probability of the corresponding node; the probability update module is configured to update the current sampling probability set corresponding to the first node based on the several training feedbacks.
[0013] According to a third aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method described in the first aspect.
[0014] According to a fourth aspect, a computing device is provided, comprising a memory and a processor, wherein an executable code is stored in the memory, and when the processor executes the executable code, the method described in the first aspect is implemented.
[0015] In the graph neural network training method and device disclosed in the embodiments of this specification, neighbor nodes are sampled based on dynamically updated sampling probabilities, and then training samples are constructed based on the sampled neighbor nodes to train the graph neural network. This can effectively reduce memory usage and computing consumption while ensuring the accuracy of node embedding expression. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the multiple embodiments disclosed in this specification, the drawings required for the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only the multiple embodiments disclosed in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 A schematic diagram showing a relationship network diagram according to one embodiment;
[0018] Figure 2 A training algorithm framework diagram of a graph neural network according to one embodiment is shown;
[0019] Figure 3 A flowchart of a method for training a graph neural network according to one embodiment is shown;
[0020] Figure 4 A schematic diagram showing interval partitioning used for sampling without replacement according to one embodiment is shown;
[0021] Figure 5 A schematic diagram showing neighbor node sampling in a sample generation process according to an embodiment is shown;
[0022] Figure 6 A diagram showing the architecture of a training device for a graph neural network according to one embodiment. DETAILED DESCRIPTION
[0023] Several embodiments disclosed in this specification are described below in conjunction with the accompanying drawings.
[0024] As mentioned above, a relationship network graph can be abstracted as including a set of nodes and a set of edges, where nodes represent entities in the real world and edges represent the association relationships between entities. Figure 1 A schematic diagram of a relationship network diagram is shown, in which users are used as nodes for example. As shown in the figure, users with association relationships are connected through edges.
[0025] In recent years, graph neural network models (also called graph neural networks, GNN networks, GNN models) have developed rapidly, from the initial graph convolutional neural network (GCN) model to the graph neural network model with attention mechanism, the model effect has been greatly improved. However, the introduction of attention mechanism also brings new challenges to graph sampling.
[0026] In order to solve the problem of the expansion of the number of nodes, in one implementation, starting from a certain node, a portion of neighboring nodes can be randomly sampled, so that the size of the subgraph of each node can be controlled at an acceptable level. However, the introduction of the attention mechanism will cause the weights of the graph adjacency matrix to change all the time, and the neighbor information of the node will also change all the time, which will cause the model to converge more slowly. On the other hand, since the full amount of neighbor information cannot be used in each calculation, the accuracy and availability of node expression will be limited, for example, it will not be stable enough or the accuracy is not high enough.
[0027] Based on the above considerations, the inventors propose a training method for a graph neural network with an attention mechanism, which can accelerate the model convergence speed while ensuring that the node embedding vectors generated by the trained model have sufficiently high accuracy and availability. According to one embodiment, Figure 2 The training algorithm framework of the graph neural network is shown in Figure 2. In any round of iterative updates, the current round of training samples is first generated based on the current sampling probability, then the graph neural network is trained on the generated training samples, and then the current sampling probability is updated based on the graph neural network after this round of training. This cycle repeats until the model converges or the specified number of training iterations is reached.
[0028] The specific implementation steps of the above training method are described below in conjunction with specific embodiments. Figure 3 A flow chart of a graph neural network training method according to one embodiment is shown. The execution subject of the method can be any platform or server or device cluster with computing and processing capabilities.
[0029] like Figure 3 As shown, the method comprises the following steps:
[0030] Step S310, obtaining a relationship network diagram, which includes a plurality of object nodes corresponding to a plurality of business objects, and connection edges formed by association relationships between the object nodes; and the plurality of object nodes include a plurality of label nodes with business labels.
[0031] In one embodiment, the above-mentioned relationship network diagram can be a homogeneous diagram, that is, the above-mentioned multiple business objects can belong to the same category, such as users, merchants, commodities, services or events (such as login events, page access events, transaction events, etc.). In another embodiment, the above-mentioned relationship network diagram can be a heterogeneous diagram, that is, the above-mentioned multiple business objects include business objects belonging to different categories. On the other hand, in one embodiment, for the label object or the label carried by the label node, each label node can correspond to its own business label, or several label nodes (one or more label nodes) can correspond to one business label.
[0032] According to a specific embodiment, the acquired relationship network diagram can be a homogeneous user relationship network, in which the association relationship between user nodes can include one or more of the following: social relationship, kinship relationship, transaction relationship, etc.; wherein, in one example, if two users have a common focus object (for example, Weibo accounts follow the same person together), or they have contacts with each other, or join a common group (for example, QQ group, WeChat group, etc.), or interact in activities such as red envelopes and lotteries, then it can be considered that there is a social relationship between the two users; in one example, if two users have activated the intimate payment function on the payment platform, or their mobile phone numbers belong to the same family number combination, then it can be considered that there is a kinship relationship between the two users; in one example, if transaction events such as transfer or group purchase have occurred between the two users, then it can be considered that there is a transaction relationship between the two users; wherein the business label carried by the label node in multiple user nodes can be a risk category label, such as high risk, medium risk and low risk, or, such as fraudulent users and non-fraudulent users.
[0033] According to another specific embodiment, the acquired relationship network graph may be a user-product bipartite graph; it should be understood that the products therein may be products in a broad sense, including electronic products (such as e-books, application APPs, etc.) and physical products (such as clothing, food, etc.); the association relationship between user nodes and product nodes in the bipartite graph may be an interactive relationship, for example, a user is pushed a product, a user clicks on a promotional link for a product, a user purchases a product, etc.; regarding business tags, in one example, some or all of the user nodes carry user category tags, such as high-spending people, low-spending people, etc.; in another example, a user node and a product node jointly correspond to a behavior category tag, which indicates whether the corresponding user will perform a preset behavior (or specific behavior) on the product, such as purchasing behavior, usage behavior, clicking behavior, downloading behavior, etc.
[0034] The above introduces the acquired relationship network diagram and the business labels of the label nodes therein.
[0035] In addition, the above-mentioned multiple object nodes also correspond to sampling probability sets respectively. In other words, one object node corresponds to one sampling probability set, and the sampling probability set includes the sampling probability of the corresponding object node for each of its first-order neighbor nodes. In an example, the following Table 1 illustrates the sampling probability mapping relationship between a certain object node (node A) and its full (or all, all) first-order neighbor nodes (K), where the full first-order neighbor nodes constitute the full set of first-order neighbor nodes.
[0036] Table 1
[0037] <![CDATA[Neighbor node A1]]> <![CDATA[Neighbor node A2]]> ... <![CDATA[Neighbor node A k > Sampling probability <![CDATA[p1]]> <![CDATA[p2]]> ... <![CDATA[p k ]]>
[0038] It should be noted that the sampling probability set corresponding to each object node will be dynamically updated in subsequent steps, and its initial value can be determined in a variety of ways. It is advisable to represent the number of sampling probabilities in the sampling probability set as K. In one embodiment, the sum of the K sampling probabilities is set to 1, and accordingly, each of the sampling probabilities can be initialized to 1 / K, or, on the premise that the probability sum is 1, each of the sampling probabilities is randomly initialized. In another embodiment, the sum of the K sampling probabilities is set to q, where q is the number of neighbor nodes sampled from the K neighbor nodes corresponding to the K sampling probabilities, and accordingly, each of the sampling probabilities can be initialized to q / K, or, on the premise that the probability sum is q, each of the sampling probabilities is randomly initialized.
[0039] The above introduces the acquired relationship network diagram, the business labels corresponding to the label nodes, and the sampling probability sets corresponding to each object node.
[0040] Next, in step S320, based on the above-mentioned relationship network diagram, the above-mentioned graph neural network and sampling probability set are iteratively updated for multiple rounds, wherein any round of iterative update includes the following steps S321 to S326. It can be understood that the last round of iterative update may only include steps S321 and S322.
[0041] In step S321, with the first label node selected in this round as the center, M (a positive integer) order neighbor node sampling is performed, wherein any i-th (i≤M, i is a positive integer) order neighbor node sampling includes, for any first node among the sampled i-1-th order neighbor nodes, based on its current sampling probability set, sampling a number of neighbor nodes from its entire set of first-order neighbor nodes and including them in the i-th order neighbor node.
[0042] It should be noted that in each round of iteration, a batch size of label nodes can be selected from the above multiple label nodes as the root node, and M-order neighbor node sampling is performed to construct a batch size of training samples as the current round of training samples for this round of updates. For ease of description, any label node in the batch label nodes selected in this round is called the first label node. It should be understood that M is a positive integer, and its value can be set according to actual needs, for example, set to 2 or 3, etc.
[0043] For M-order neighbor node sampling, in one embodiment, the first label node has a self-loop edge, wherein the self-loop edge refers to a connection edge starting from the node itself and pointing to the node itself, so that when sampling the first-order neighbor node, the first label node itself may be sampled. When sampling the second-order neighbor node, if the sampled first-order neighbor node includes the first label node, it can be removed and then sampled to increase the receptive field of the node sampling, or it may not be removed. In another embodiment, the first label node does not have a self-loop edge.
[0044] On the other hand, in one embodiment, for the above-mentioned first node, the number of neighbor nodes sampled from the entire set of its first-order neighbor nodes can be preset, such as q. During sampling, if it is determined that the number of sampled neighbor nodes, that is, the number of elements in the entire set of first-order neighbor nodes, is less than or equal to q, then all the neighbor nodes in the entire set of first-order neighbor nodes can be directly sampled.
[0045] In one embodiment, for the above-mentioned first node, the method used to sample several neighbor nodes from the full set of its first-order neighbor nodes may be sampling without replacement. In a specific embodiment, K value intervals (without overlap) can be generated according to the K values in the sampling probability set. It should be understood that the greater the sampling probability, the greater the interval length of the corresponding generated value interval. Based on this, in the process of sampling without replacement, a random number that may fall into the K value intervals is first generated, and then the neighbor nodes corresponding to the first value interval in which it falls are included in the above-mentioned several neighbor nodes. Then, the first value interval is removed from the K value intervals, and a random number that may fall into the remaining K-1 value intervals is generated, and then the neighbor nodes corresponding to the second value interval in which it falls are included in the above-mentioned several neighbor nodes, and so on, until a predetermined number of q neighbor nodes (referring to the number of neighbor nodes as q) are sampled. In another specific embodiment, after sampling a neighbor node, its corresponding sampling probability can also be temporarily removed from the sampling probability set, and the value interval can be regenerated based on the remaining sampling probabilities, specifically K-1, and then the second neighbor node is sampled until a predetermined number of q neighbor nodes are sampled.
[0046] In a more specific embodiment, K value intervals can be generated according to the total interval length q, where neighbor node A u The corresponding value range can be where p s is the uth neighbor node A in the set of first-order neighbor nodes u The corresponding sampling probability. In an example, see Figure 4 The coordinate axes shown include value intervals (0, p1], (p1, p1+p2], etc.
[0047] In another embodiment, for the above-mentioned first node, the method used for sampling several neighbor nodes from the entire set of its first-order neighbor nodes can refer to the greedy-exploration balance strategy commonly used in reinforcement learning. Specifically, all the first-order neighbor nodes are first sorted based on the current sampling probability set, and the neighbor nodes ranked in the first t (<q) positions are sampled, and then the neighbor nodes ranked after the t position are randomly sampled, sampling qt neighbor nodes, thereby sampling a predetermined number of q neighbor nodes.
[0048] More intuitively, Figure 5 A schematic diagram of neighbor node sampling in a sample generation process according to an embodiment is shown, wherein M=2 is used as an example, starting from the root node, some nodes are sampled from all first-order neighbor nodes as first-order sampled neighbor points (or sampled first-order nodes), and then, based on each node in the first-order sampled neighbor points, neighbor node sampling is performed respectively to obtain second-order sampled neighbor points. Furthermore, in a specific embodiment, the connection edges between nodes can also be sampled, specifically, the connection edge between the i-1th order node and its sampled i-th order neighbor node can be directly used as the sampled edge.
[0049] From the above, it is possible to sample neighbor nodes of the first label node and sample neighbor nodes within the Mth order. Then, in step S322, based on the sampled neighbor nodes within the Mth order, the M hidden layers contained in the graph neural network are used to determine the embedding vector of the first label node. It should be understood that a graph neural network with an attention mechanism generally refers to the introduction of an attention mechanism in the multi-layer aggregation (or multi-level aggregation) of neighbor nodes. Specifically, the M hidden layers contained in the graph neural network each correspond to an attention function. In any of the hidden layers, the attention function of the current hidden layer and the first label node hidden vector output by the previous hidden layer are used to determine the attention weight corresponding to the neighbor node hidden vector output by the previous hidden layer, and then the attention weight is used to perform weighted summation on the neighbor node hidden vector to obtain the first label node hidden vector output by the current hidden layer. In this way, the first label node hidden vector output by the last hidden layer is used as the embedding vector of the first label node.
[0050] According to one embodiment, the multi-layer aggregation in which the attention mechanism is introduced can be implemented by iterative calculation of the following formula (1):
[0051]
[0052] in, represents the hidden vector output by the first label node (or node c) in the lth layer, with a total of L layers, L = M; N c represents the set of several neighbor nodes sampled from the first-order neighbor nodes of node c; v∈Nc Indicates that node v belongs to the set N c , that is, node v is the first-order sampling neighbor of node c; represents the hidden vector output by node v in the first layer; σ is the activation function, which can be sigmoid, tanh, etc.; b (l) is the model parameter in the lth layer; a(,) represents the attention function of the lth layer, The input of the attention function includes and The output is The corresponding attention weight. Need to understand, Represents the initial feature vector of node v, corresponding to the original features of node v itself. As the M hidden layers are iterated layer by layer, the features of neighboring nodes within the Mth order sampled from node c will be introduced layer by layer.
[0053] In one example, Where d represents the vector The dimension of needs to be understood. and have the same dimensions.
[0054] In another example, Among them, W1, W2 and v c are the model parameters in layer l.
[0055] In another embodiment, the node features of each node in the neighboring nodes within the Mth order and the edge features of the sampled connecting edges (such as edge weights, etc.) can be input into the graph neural network to obtain the embedding vector of the first label node.
[0056] From the above, the embedding vector of the first label node can be obtained. Then, in step S323, the graph neural network is updated in this round according to the embedding vector and the first business label of the first label node.
[0057] In one embodiment, the embedding vector of the first label node can be input into a business prediction model for the business object to obtain a corresponding business prediction result; then, based on the business prediction result and the first business label, the graph neural network and the business prediction model are trained.
[0058] For the business prediction model, it should be understood that the prediction task performed by the business prediction model corresponds to the business object and the business label. For example, if the business label is a risk category label, the corresponding business prediction model can be called a risk classification model or a risk assessment model, or if the targeted business object is a user, the corresponding business prediction model can be called a user classification model. In a specific embodiment, the business prediction model is used to predict the classification value or regression value of the business object. In a specific embodiment, the business prediction model can be implemented as a support vector machine, a logistic regression model, a deep neural network model, etc.
[0059] For the training of the graph neural network and the business prediction model, in a specific embodiment, the business prediction loss can be determined based on the business prediction result and the first business label, and then the graph neural network and the business prediction model are adjusted based on the business prediction loss by using the back propagation method. In a more specific embodiment, the business prediction loss can be calculated using a cross entropy loss function or a hinge loss function.
[0060] It should be noted that the above-mentioned first business label can only correspond to the first label node, and can also correspond to other nodes, that is, the same business label can correspond to one or more label nodes. In one embodiment, in the commodity recommendation scenario, the relationship network diagram can be a user-commodity bipartite graph, and the business label is a binary classification label, including 1 (indicating recommendation, or the user is interested in the commodity, etc.) and 0 (indicating not recommended, or the user is not interested in the commodity, etc.). Assuming that the first business label corresponds to both the first user node and the first commodity node (in this case, the first label node can be the first user node or the first commodity node), the features of each node in the neighboring nodes within the Mth order sampled for the first user node can be input into the graph neural network to obtain the first user embedding vector, and the features of each node in the neighboring nodes within the Mth order sampled for the first commodity node can be input into the graph neural network to obtain the first commodity embedding vector. In one example, the user features corresponding to the user node can include user portrait features, such as gender, age, occupation, hobbies, etc.; and can also include user behavior features, such as APP login frequency, transaction frequency, transaction amount, etc. In another example, the commodity features corresponding to the commodity node may include commodity category (such as fruit, snacks, etc.), commodity amount, commodity origin, etc.
[0061] Furthermore, after obtaining the first user embedding vector and the first product embedding vector, in a specific embodiment, the similarity between the first user embedding vector and the first product embedding vector is calculated, and the graph neural network is trained based on the similarity and the first business label. For the calculation of the similarity, in one example, the dot product of the first user embedding vector and the first product embedding vector can be calculated, and then input into the sigmoid function, and the obtained value is used as the similarity; in another example, the cosine similarity between the first user embedding vector and the first product embedding vector can be calculated.
[0062] In another specific embodiment, the first user embedding vector and the first product embedding vector may be concatenated, and the concatenated vector may be input into a classification network to obtain a classification prediction result, and then the graph neural network and the classification network may be trained based on the classification prediction result and the first business label.
[0063] Based on the above, this round of updates to the graph neural network can be implemented.
[0064] Then, the graph neural network after this round of updates is used to determine the training feedback of this round of updates, and then the current sampling probability set of the above-mentioned first node is updated according to the training feedback, which is specifically implemented through steps S324 to S325.
[0065] In step S324, for any first node, the graph neural network after this round of update is used to determine a number of attention weights corresponding to a number of neighboring nodes sampled by it.
[0066] The graph neural network includes L hidden layers, each of which corresponds to an attention function, which means that the L hidden layers correspond to L attention functions. Based on this, in this step, the attention weights corresponding to the neighboring nodes are determined, which can be achieved by using any one or more of the L attention functions.
[0067] In one embodiment, in order to minimize the amount of calculation, for any first neighbor node among the above-mentioned several neighbor nodes, the node features (original features) of the first neighbor node and the above-mentioned first node can be calculated through the attention function in the first hidden layer to obtain the corresponding first attention weight, thereby obtaining several attention weights corresponding to several neighbor nodes. In this way, there is no need to embed the several neighbor nodes and the first node, but to directly use the original node features to calculate the attention weights, thereby greatly reducing the amount of calculation.
[0068] In another embodiment, the attention weights for the above-mentioned several neighbor nodes calculated by the attention function in the Lth hidden layer can be used as the several attention weights determined in this step. In another embodiment, for any first neighbor node, L attention weights can be calculated using L attention functions in L hidden layers, and then the average value of the L attention weights is determined as the first attention weight, thereby corresponding to several attention weights of several neighbor nodes.
[0069] From the above, for any first node, several attention weights corresponding to several neighboring nodes sampled by it can be obtained.
[0070] Then in step S325, several training feedbacks corresponding to the several neighboring nodes are determined. It should be noted that the purpose of introducing training feedback is to speed up the convergence speed of model training. In one embodiment, the calculation formula of training feedback can be determined by pre-simulating: the variance of the attention weights of the neighboring nodes sampled in different update rounds, and making the variance as small as possible as the solution goal. Thus, the inventor found that the training feedback is positively correlated with the attention weight of the corresponding node, and negatively correlated with the current sampling probability of the corresponding node (the sampling probability before this round of update).
[0071] According to a specific embodiment, t represents the round of this iteration, and the training feedback obtained by node j (used to refer to any first node) sampling its first-order neighbor node v can be calculated by the following formula:
[0072]
[0073] Among them, a jv is the attention weight given to node v when encoding node j, q jv (t) is the current sampling probability of node j sampling neighbor node v.
[0074] In this way, a number of training feedbacks may be determined, and then, in step S326, based on the number of training feedbacks, the current sampling probability set corresponding to the first node is updated.
[0075] On the one hand, in this step, based on a number of training feedbacks, the current sampling weight set corresponding to the first node may be updated in this round, and then the current sampling probability set corresponding to the first node may be updated.
[0076] Specifically, the multiple object nodes in the above relationship network diagram each correspond to a sampling weight set, which includes a sampling weight of the corresponding object node for each of its first-order neighbor nodes. In one example, as shown in Table 2 below, the sampling probability and sampling weight corresponding to each node in the full amount of first-order neighbor nodes of object node A are shown.
[0077] Table 2
[0078]
[0079]
[0080] The initial value of the sampling weight can be determined in a variety of ways. In one example, each sampling weight in the sampling weight set can be initialized to 1. In another example, each sampling weight in the sampling weight set can be randomly initialized to a value in the interval (0, 1].
[0081] According to one embodiment, for the current sampling weight set corresponding to the first node, the sampling weights corresponding to the above-mentioned several neighbor nodes (the first-order sampling neighbor nodes of the first node) are updated, wherein each updated sampling weight is positively correlated with the sampling weight and training feedback of the corresponding node before the update. In a specific embodiment, each updated sampling weight is also negatively correlated with the total number of nodes in the first-order neighbor node set of the first node. In one example, the sampling weight of any neighbor node among the several neighbor nodes after this round of update can be calculated by the following formula:
[0082] w jv (t) = w jv (t-1)exp(δr jv (t) / |F j |) (3)
[0083] Among them, w jv (t-1) is the current sampling weight of node j sampling node v before this round of update; w jv (t) is the current sampling weight of node j sampling node v after this round of update; |F j | represents the number of nodes in the complete set of first-order neighbor nodes of node j; δ is a hyperparameter, for example, it can be set to 0.001; r jv represents the training feedback of node j sampling its first-order neighbor node v. It is necessary to understand that w jv (0) represents the initialization value of the sampling weight.
[0084] In this embodiment, for the current sampling weight set, only the weights of the neighbor nodes sampled in this round will be updated, and the weights of the remaining unsampled nodes will not be updated.
[0085] Furthermore, after obtaining the updated sampling weight set, all sampling probabilities in the sampling probability set can be updated. Specifically, based on the updated current sampling weight set, the current sampling probability set of the first node is updated, wherein each updated sampling probability is positively correlated with the sampling weight of the corresponding neighbor node.
[0086] In a specific embodiment, the updated current sampling probability can be determined based on the ratio between each sampling weight and the weight and value corresponding to the sampling weight set. In one example, each current sampling probability can be directly updated to the ratio between the current sampling weight of the corresponding neighbor node and the sum of the weights in the current sampling weight set. In another example, the updated current sampling probability can be determined by the following formula:
[0087]
[0088] Among them, F j represents the complete set of first-order neighbor nodes of node j, w ju (t) The weight of node j after sampling node u in this round (update if sampled, no update if not sampled); η is a hyperparameter and can be set to a value in the interval [0,1), such as 0.4.
[0089] In this way, the weights of several neighboring nodes corresponding to the current sampling weight set are updated, and then the current sampling probability set is updated using the updated current sampling weight set.
[0090] According to another embodiment, the inventors also consider that the above-mentioned method of directly updating the weights of the sampled neighbor nodes and then updating the current sampling probability set may cause a deviation between the probability of the neighbor nodes actually being sampled and their sampling probability in the current sampling probability set in an infinite number of samplings. In order to eliminate this deviation, thereby improving the accuracy and availability of the current sampling probability set, and thereby effectively and reliably accelerating the convergence speed of model training, and improving the accuracy of the model prediction results, the inventors propose another method for updating the current sampling weight set and the current sampling probability set.
[0091] First, based on a number of current sampling weights corresponding to a number of neighbor nodes and the number of sampled neighbors corresponding to a number of neighbor nodes, a weight threshold that satisfies a preset function is obtained. The preset function includes a first expression that is negatively correlated with the number of sampled neighbors, and a second expression that is equal to the first expression, the second expression is proportional to the weight threshold, and inversely proportional to the product of the number of weights of a number of first weights and the weight threshold and the weight sum of a number of second weights, the first weights being the weights of the current sampling weights that are not less than the weight threshold, and the second weights being the weights of the current sampling weights that are less than the weight threshold.
[0092] In a specific embodiment, the specific form of the preset function may be:
[0093]
[0094] Among them, a trepresents the weight threshold of the tth round; w jv (t-1) represents the current sampling weight of node v sampled by node j before the tth round of update; k represents the number corresponding to a number of neighbor nodes, that is, the number of sampled neighbors mentioned above; in formula (5), the right side of the equal sign is the first expression, and the left side of the equal sign is the second expression.
[0095] In a specific embodiment, the above-mentioned first expression is also negatively correlated with the total number of nodes in the entire set of first-order neighbor nodes of the first node and the first hyperparameter. The above-mentioned obtaining of the weight threshold that satisfies the preset function may include: determining the maximum value among several current sampling weights corresponding to several neighbor nodes, the weight sum value of the several current sampling weights, and the first numerical value of the above-mentioned first expression; and then obtaining the above-mentioned weight threshold when the ratio of the maximum value to the weight sum value is not less than the first numerical value.
[0096] In a more specific embodiment, the specific form of the above preset function can be:
[0097]
[0098] Among them, a t represents the weight threshold of the tth round; w jv (t-1) represents the current sampling weight of node v sampled by node j before the tth round of update; k represents the number of corresponding neighbor nodes, that is, the number of sampled neighbors mentioned above; F j represents the complete set of first-order neighbor nodes of node j, |F j | represents the set F j The number of elements in ; In formula (6), the right side of the equal sign is the first expression, and the left side of the equal sign is the second expression; η represents the first hyperparameter, which can be set to a value in the interval [0,1), such as 0.3.
[0099] The ratio of the above maximum value to the weight sum value is not less than the first value, which can be expressed as:
[0100]
[0101] Among them, N j represents the set of several neighbor nodes sampled from the first-order neighbor nodes of node j; v∈N j Indicates that node v belongs to the set N j ;w jv (t-1) represents the current sampling weight of node v sampled by node j before the tth round of update; k represents the number of corresponding neighbor nodes; F j represents the complete set of first-order neighbor nodes of node j, |F j | represents the set F jThe number of elements in ; η represents the first hyperparameter, which can be set to a value in the interval [0,1), such as 0.3.
[0102] It should be noted that when the ratio of the maximum value to the weight sum value is less than the first value, the current process can be terminated without updating the current sampling weight set, and there is no need to update the current sampling probability set.
[0103] After obtaining the weight threshold that satisfies the preset function, then, on the one hand, the first weights are updated, wherein each updated first weight is positively correlated with the pre-update sampling weight and training feedback of the corresponding node, while the second weights are not updated; on the other hand, each weight in the current sampling weight set except for the current sampling weights is updated to the weight threshold. In this regard, in a specific embodiment, the update of the current sampling weight set can be implemented based on the following formula.
[0104]
[0105] Where t represents the round number of this round; w ju (t) represents the current sampling weight of node j sampling node u after this round of update; w ju (t-1) represents the current sampling weight of node j before the current update of node u; δ is a hyperparameter, for example, it can be set to 0.001; r ju F represents the training feedback of node j sampling its first-order neighbor node v; j represents the complete set of first-order neighbor nodes of node j; U j (t) = {u:w ju (t-1)≥a t}, a t Represents the weight threshold; N j Indicates that from F j The set of several neighbor nodes sampled in ; N j \U j (t) represents N j U j (t) other than the aggregate part, F j \N j Indicates F j Divide N j Other than the collection part.
[0106] Furthermore, after obtaining the updated sampling weight set, all sampling probabilities in the sampling probability set can be updated. Specifically, the sum of the sampling probabilities in the current sampling probability set is equal to the number of sampling neighbors, that is, the number of neighbor nodes, and accordingly, each updated current sampling probability is positively correlated with the sampling weight of the corresponding neighbor node and the number of sampling neighbors.
[0107] In a specific embodiment, for each node in the first-order neighbor node set, the ratio between its current sampling weight and the sum of the weights in the current sampling weight set is determined, and an updated sampling probability positively correlated with the ratio and the number of sampled neighbors is determined. In one example, the current sampling probability of each node can be directly updated to the product of its corresponding ratio and the number of sampled neighbors. In another example, the updated current sampling probability can be determined by the following formula:
[0108]
[0109] Among them, t represents the round of this update; q ju (t) represents the probability of sampling node u for node j after this round of update; k represents the number of neighboring nodes sampled with node j as the center; η is a hyperparameter, which can be set to a value in the interval [0,1), such as 0.4; w ju (t) The weight of node u sampled by node j after this round of update; F j Represents the complete set of first-order neighbor nodes of node j.
[0110] In this embodiment, it is possible to eliminate the deviation between the actual probability of a neighbor node being sampled and its sampling probability in the current sampling probability set in infinite sampling, effectively improve the accuracy and availability of the current sampling probability set, thereby accelerating the convergence speed of model training and improving the accuracy of model prediction results.
[0111] On the other hand, this step can also be implemented as updating the sampling probabilities of the sampled neighbor nodes based on the training feedbacks corresponding to the sampled neighbor nodes, and not updating the sampling probabilities of the remaining nodes in the first-order neighbor node set. In a specific embodiment, the probability and value of the current sampling probabilities corresponding to the neighbor nodes are determined, the feedback proportion corresponding to each neighbor node is determined based on the training feedbacks, and then the updated current sampling probabilities corresponding to the neighbor nodes are obtained based on the product of the feedback proportion and the probability sum.
[0112] Based on the above, the current sampling probability set can be updated.
[0113] In summary, by adopting the graph neural network training method disclosed in the embodiments of this specification, sampling neighbor nodes based on dynamically updated sampling probabilities, and then constructing training samples based on the sampled neighbor nodes, and training the graph neural network, it is possible to effectively reduce memory usage and computing consumption while ensuring the accuracy of node embedding expression.
[0114] Corresponding to the above training method, the present specification also discloses a training device. Specifically, Figure 6The diagram shows the architecture of a training device for a graph neural network according to an embodiment. The device can be implemented as any server, device cluster, etc. with computing and processing capabilities. Figure 6 As shown, the device 600 includes:
[0115] The relationship graph acquisition unit 610 is configured to acquire a relationship network graph, which includes multiple object nodes corresponding to multiple business objects, and connection edges formed by association relationships between object nodes; the multiple object nodes include multiple label nodes with business labels; the multiple object nodes each correspond to a sampling probability set, which includes the sampling probability of the corresponding object node for each of its first-order neighbor nodes. The iterative update unit 620 is configured to perform multiple rounds of iterative updates on the graph neural network based on the relationship network graph, wherein any round of iterative updates is implemented by the following modules:
[0116] The neighbor sampling module 621 is configured to perform M-order neighbor node sampling with the first label node selected in this round as the center, wherein any i-th order neighbor node sampling includes, for any first node among the sampled i-1-th order neighbor nodes, sampling a number of neighbor nodes from its first-order neighbor node set based on its current sampling probability set and classifying them into the i-th order neighbor node. The label node embedding module 622 is configured to determine the embedding vector of the first label node based on the sampled neighbor nodes within the M order using the M hidden layers contained in the graph neural network; in any of the hidden layers, using the attention function of the current hidden layer, determine the attention weight corresponding to the neighbor node hidden vector output by the previous hidden layer. The graph neural network update module 623 is configured to perform this round of update on the graph neural network according to the embedding vector and the first business label carried by the first label node. The neighbor weight determination module 624 is configured to determine, for any first node, a number of attention weights corresponding to the number of sampled neighbor nodes using the updated graph neural network in this round. The training feedback determination module 625 is configured to determine a number of training feedbacks corresponding to the number of neighbor nodes, wherein each training feedback is positively correlated with the attention weight of the corresponding node and negatively correlated with the current sampling probability of the corresponding node. The probability update module 626 is configured to update the current sampling probability set corresponding to the first node based on the number of training feedbacks.
[0117] In one embodiment, the multiple business objects belong to at least one of the following categories: user, merchant, commodity, service, event.
[0118] In one embodiment, the neighbor sampling module 621 is specifically configured to: based on its current sampling probability set, perform sampling without replacement on the entire set of its first-order neighbor nodes to obtain the several neighbor nodes, and classify them into the i-th order neighbor nodes.
[0119] In one embodiment, the graph neural network update module 623 is specifically configured as follows: inputting the embedding vector into the business prediction model for the business object to obtain the corresponding business prediction result; and training the graph neural network and the business prediction model based on the business prediction result and the first business label.
[0120] In one embodiment, the neighbor weight determination module 624 is specifically configured as follows: for any first neighbor node among the several neighbor nodes, use the attention function corresponding to the first hidden layer among the M hidden layers to calculate the node features of the first neighbor node and the first node, obtain a first attention weight, and include it in the several attention weights.
[0121] In one embodiment, the multiple object nodes also each correspond to a sampling weight set, which includes the sampling weight of the corresponding object node for each of its first-order neighbor nodes; the probability update module 626 includes: a weight update submodule 6261, configured to update the current sampling weight set corresponding to the first node based on the plurality of training feedbacks; a probability update submodule 6262, configured to update the current sampling probability set based on the updated current sampling weight set, wherein each updated sampling probability is positively correlated with the sampling weight of the corresponding node.
[0122] In a specific embodiment, the weight updating submodule 6261 is specifically configured to: update the sampling weights corresponding to the several neighboring nodes in the current sampling weight set, wherein each updated sampling weight is positively correlated with the pre-update sampling weight and training feedback of the corresponding node.
[0123] In a more specific embodiment, each updated sampling weight is also negatively correlated with the total number of nodes in the entire set of first-order neighbor nodes.
[0124] In a more specific embodiment, the probability update submodule 6262 is specifically configured as follows: for each node in the entire set of first-order neighbor nodes, determine the ratio between its current sampling weight and the sum of the weights in the current sampling weight set, and determine an updated sampling weight that is positively correlated with the ratio.
[0125] In another specific embodiment, the weight updating submodule 6262 is specifically configured as follows: based on the current sampling weights corresponding to the neighbor nodes and the number of sampling neighbors corresponding to the neighbor nodes, a weight threshold satisfying a preset function is obtained; the preset function includes a first expression negatively correlated with the number of sampling neighbors, and a second expression having a value equal to the first expression, the second expression being proportional to the weight threshold and inversely proportional to the product of the number of weights of the first weights and the weight threshold and the weight sum of the second weights, the first weights being the weights in the current sampling weights that are not less than the weight threshold, and the second weights being the weights in the current sampling weights that are less than the weight threshold; updating the first weights and not updating the second weights; wherein each updated first weight is positively correlated with the pre-update weight and training feedback of the corresponding node; and updating each weight in the current sampling weight set except the current sampling weights to the weight threshold.
[0126] Further, in one example, the first expression is also negatively correlated with the total number of nodes in the first-order neighbor node set and the first hyperparameter; the weight updating submodule 6262 is configured to obtain a weight threshold that satisfies a predetermined function based on a number of current sampling weights corresponding to the number of neighbor nodes and the number of sampled neighbors corresponding to the number of neighbor nodes, including:
[0127] Determine the maximum value among the several current sampling weights, the weight sum value of the several current sampling weights, and the first value of the first expression; and obtain the weight threshold when the ratio of the maximum value to the weight sum value is not less than the first value.
[0128] In another example, the sum of the sampling probabilities in the current sampling probability set is equal to the number of sampling neighbors; the probability update submodule 6261 is configured to: for each node in the entire set of first-order neighbor nodes, determine the ratio between its current sampling weight and the sum of the weights in the current sampling weight set, and determine an updated sampling probability that is positively correlated with the ratio and the number of sampling neighbors.
[0129] As described above, according to another embodiment of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computer, the computer executes the combination of Figure 3 The method described.
[0130] According to another embodiment, a computing device is provided, including a memory and a processor, wherein the memory stores an executable code, and when the processor executes the executable code, the Figure 3 The method described.
[0131] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the multiple embodiments disclosed in this specification can be implemented by hardware, software, firmware, or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.
[0132] The specific implementation methods described above further illustrate in detail the purposes, technical solutions and beneficial effects of the multiple embodiments disclosed in this specification. It should be understood that the above description is only the specific implementation methods of the multiple embodiments disclosed in this specification, and is not used to limit the protection scope of the multiple embodiments disclosed in this specification. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the multiple embodiments disclosed in this specification should be included in the protection scope of the multiple embodiments disclosed in this specification.
Claims
1. A training method for a graph neural network, comprising: Obtaining a user relationship network diagram, which includes a plurality of user nodes and connection edges formed by association relationships between the user nodes, wherein the association relationships include at least one of social relationships, kinship relationships, and transaction relationships; user features corresponding to the user nodes include user portrait features and user behavior features; The multiple user nodes include multiple label nodes with risk category labels; the multiple user nodes each correspond to a sampling probability set, which includes a sampling probability of the corresponding user node for each of its first-order neighbor nodes; Based on the user relationship network graph, the graph neural network is iteratively updated for multiple rounds, wherein any round of iterative update includes: Taking the first label node selected in this round as the center, perform M-order neighbor node sampling, wherein any i-th order neighbor node sampling includes, for any first node among the sampled i-1-th order neighbor nodes, based on its current sampling probability set, sampling a number of neighbor nodes from its entire set of first-order neighbor nodes and assigning them to the i-th order neighbor node; Based on the sampled neighbor nodes within the Mth order, the embedding vector of the first label node is determined using the M hidden layers included in the graph neural network; in any of the hidden layers, the attention weight corresponding to the hidden vector of the neighbor node output by the previous hidden layer is determined using the attention function of the current hidden layer; Input the embedding vector into the risk assessment model for the user to obtain a corresponding risk prediction result, and based on the risk prediction result and the first risk category label of the first label node, perform this round of updating on the graph neural network and the risk assessment model; For the arbitrary first node, using the graph neural network after this round of update, determine a number of attention weights corresponding to a number of neighboring nodes sampled by it; Determine a number of training feedbacks corresponding to the number of neighbor nodes, wherein each training feedback is positively correlated with the attention weight of the corresponding node and negatively correlated with the current sampling probability of the corresponding node; Based on the plurality of training feedbacks, a current sampling probability set corresponding to the first node is updated.
2. The method according to claim 1, wherein: Based on its current sampling probability set, a number of neighbor nodes are sampled from the entire set of its first-order neighbor nodes and classified as the i-th order neighbor nodes, including: Based on its current sampling probability set, the whole set of its first-order neighbor nodes is sampled without replacement to obtain the several neighbor nodes, which are classified as the i-th order neighbor nodes.
3. The method according to claim 1, wherein: For the arbitrary first node, the graph neural network after this round of update is used to determine several attention weights corresponding to several sampled neighboring nodes, including: For any first neighbor node among the several neighbor nodes, the node features of the first neighbor node and the first node are calculated using the attention function corresponding to the first hidden layer among the M hidden layers to obtain a first attention weight, which is included in the several attention weights.
4. The method according to claim 1, wherein: The plurality of user nodes further each correspond to a sampling weight set, which includes a sampling weight of the corresponding user node for each of its first-order neighbor nodes; wherein, based on the plurality of training feedbacks, updating a current sampling probability set corresponding to the first node includes: Based on the plurality of training feedbacks, updating a current sampling weight set corresponding to the first node; Based on the updated current sampling weight set, the current sampling probability set is updated, wherein each updated sampling probability is positively correlated to the sampling weight of the corresponding node.
5. The method according to claim 4, wherein: Based on the plurality of training feedbacks, updating a current sampling weight set corresponding to the first node includes: The sampling weights corresponding to the plurality of neighboring nodes in the current sampling weight set are updated, wherein each updated sampling weight is positively correlated with the sampling weight and training feedback of the corresponding node before updating.
6. The method according to claim 5, wherein: The updated sampling weights are also negatively correlated with the total number of nodes in the first-order neighbor node set.
7. The method according to claim 5, wherein: Based on the updated current sampling weight set, updating the current sampling probability set includes: For each node in the first-order neighbor node set, the ratio between its current sampling weight and the sum of the weights in the current sampling weight set is determined, and an updated sampling weight positively correlated with the ratio is determined.
8. The method according to claim 4, wherein: Based on the plurality of training feedbacks, updating a current sampling weight set corresponding to the first node includes: Based on the current sampling weights corresponding to the neighbor nodes and the number of sampled neighbors corresponding to the neighbor nodes, a weight threshold satisfying a preset function is obtained; the preset function includes a first expression negatively correlated with the number of sampled neighbors, and a second expression having a value equal to the first expression, the second expression is proportional to the weight threshold, and inversely proportional to the product of the number of weights of the first weights and the weight threshold and the weight sum of the second weights, the first weights are the weights of the current sampling weights that are not less than the weight threshold, and the second weights are the weights of the current sampling weights that are less than the weight threshold; The plurality of first weights are updated, and the plurality of second weights are not updated; wherein each updated first weight is positively correlated with a corresponding node's pre-update weight and training feedback; Each weight in the current sampling weight set except the several current sampling weights is updated to the weight threshold.
9. The method according to claim 8, wherein: The first expression is also negatively correlated with the total number of nodes in the first-order neighbor node set and the first hyperparameter; wherein, based on the current sampling weights corresponding to the neighbor nodes and the number of sampled neighbors corresponding to the neighbor nodes, a weight threshold satisfying a predetermined function is obtained, including: Determine a maximum value among the plurality of current sampling weights, a weight sum value of the plurality of current sampling weights, and a first value of the first expression; When the ratio of the maximum value to the sum of the weights of the plurality of current sampling weights is not less than the first value, the weight threshold is obtained.
10. The method according to claim 9, wherein: The method further comprises: When the ratio of the maximum value to the sum of the weights of the plurality of current sampling weights is smaller than the first value, the current sampling weight set is not updated.
11. The method according to claim 8, wherein: The sum of the sampling probabilities in the current sampling probability set is equal to the number of sampling neighbors; wherein, based on the updated current sampling weight set, updating the current sampling probability set comprises: For each node in the first-order neighbor node set, determine the ratio between its current sampling weight and the sum of weights in the current sampling weight set, and determine an updated sampling probability that is positively correlated with the ratio and the number of sampled neighbors.
12. A training device for a graph neural network, comprising: A relationship graph acquisition unit is configured to acquire a user relationship network graph, which includes a plurality of user nodes and connection edges formed by association relationships between the user nodes, wherein the association relationships include at least one of social relationships, kinship relationships, and transaction relationships; user features corresponding to the user nodes include user portrait features and user behavior features; The multiple user nodes include multiple label nodes with risk category labels; the multiple user nodes each correspond to a sampling probability set, which includes a sampling probability of the corresponding user node for each of its first-order neighbor nodes; The iterative updating unit is configured to perform multiple rounds of iterative updates on the graph neural network based on the user relationship network graph, wherein any round of iterative updates is implemented by the following modules: The neighbor sampling module is configured to perform M-order neighbor node sampling with the first label node selected in this round as the center, wherein any i-th order neighbor node sampling includes, for any first node among the sampled i-1-th order neighbor nodes, based on its current sampling probability set, sampling a number of neighbor nodes from its entire set of first-order neighbor nodes and classifying them into the i-th order neighbor nodes; The label node embedding module is configured to determine the embedding vector of the first label node based on the sampled neighbor nodes within the Mth order using the M hidden layers included in the graph neural network; in any of the hidden layers, using the attention function of the current hidden layer, determine the attention weight corresponding to the hidden vector of the neighbor node output by the previous hidden layer; a graph neural network update module, configured to input the embedding vector into a risk assessment model for the user to obtain a corresponding risk prediction result, and perform a current round of updates on the graph neural network and the risk assessment model based on the risk prediction result and the first risk category label of the first label node; A neighbor weight determination module is configured to determine, for the arbitrary first node, a number of attention weights corresponding to a number of neighbor nodes sampled by the first node using the graph neural network after this round of update; A training feedback determination module is configured to determine a number of training feedbacks corresponding to the number of neighbor nodes, wherein each training feedback is positively correlated with the attention weight of the corresponding node and negatively correlated with the current sampling probability of the corresponding node; A probability updating module is configured to update a current sampling probability set corresponding to the first node based on the plurality of training feedbacks.
13. The device according to claim 12, wherein: The neighbor weight determination module is specifically configured as follows: For any first neighbor node among the several neighbor nodes, the node features of the first neighbor node and the first node are calculated using the attention function corresponding to the first hidden layer among the M hidden layers to obtain a first attention weight, which is included in the several attention weights.
14. The device according to claim 12, wherein: The plurality of user nodes also each correspond to a sampling weight set, which includes a sampling weight of the corresponding user node for each of its first-order neighbor nodes; The probability updating module comprises: A weight updating submodule, configured to update a current sampling weight set corresponding to the first node based on the plurality of training feedbacks; The probability updating submodule is configured to update the current sampling probability set based on the updated current sampling weight set, wherein each updated sampling probability is positively correlated with the sampling weight of the corresponding node.
15. The device according to claim 14, wherein: The weight updating submodule is specifically configured as follows: Based on the current sampling weights corresponding to the neighbor nodes and the number of sampled neighbors corresponding to the neighbor nodes, a weight threshold satisfying a preset function is obtained; the preset function includes a first expression negatively correlated with the number of sampled neighbors, and a second expression having a value equal to the first expression, the second expression is proportional to the weight threshold, and inversely proportional to the product of the number of weights of the first weights and the weight threshold and the weight sum of the second weights, the first weights are the weights of the current sampling weights that are not less than the weight threshold, and the second weights are the weights of the current sampling weights that are less than the weight threshold; The plurality of first weights are updated, and the plurality of second weights are not updated; wherein each updated first weight is positively correlated with a corresponding node's pre-update weight and training feedback; Each weight in the current sampling weight set except the several current sampling weights is updated to the weight threshold.
16. The device according to claim 15, wherein: The first expression is also negatively correlated with the total number of nodes in the first-order neighbor node set and the first hyperparameter; the weight updating submodule is configured to obtain a weight threshold that satisfies a predetermined function based on a number of current sampling weights corresponding to the number of neighbor nodes and the number of sampled neighbors corresponding to the number of neighbor nodes, including: Determine a maximum value among the plurality of current sampling weights, a weight sum value of the plurality of current sampling weights, and a first value of the first expression; When the ratio of the maximum value to the sum of the weights of the plurality of current sampling weights is not less than the first value, the weight threshold is obtained.
17. The device according to claim 15, wherein: The sum of the sampling probabilities in the current sampling probability set is equal to the number of sampling neighbors; the probability update submodule is configured as follows: For each node in the first-order neighbor node set, determine the ratio between its current sampling weight and the sum of weights in the current sampling weight set, and determine an updated sampling probability that is positively correlated with the ratio and the number of sampled neighbors.
18. A computer-readable storage medium having a computer program stored thereon, wherein: When the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 11.
19. A computing device comprising a memory and a processor, wherein: The memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 11 is implemented.
