Training method and device of graph neural network
By segmenting the user relationship network graph into subgraphs and jointly training the graph neural network and the prediction network, the problem of poor model generalization in traditional methods is solved, and higher business prediction accuracy is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
- Filing Date
- 2023-01-31
- Publication Date
- 2026-07-10
AI Technical Summary
Traditional graph neural network training methods suffer from overfitting to the training data, resulting in poor model generalization.
The user relationship network graph is divided into multiple subgraphs, and graph neural networks are used to perform graph embedding processing on each subgraph. The parameters of the graph neural network and the prediction network are adjusted by a prediction network to minimize the cost value and improve the generalization of the model.
By segmenting subgraphs and joint training, the generalization ability of graph neural networks is improved, thereby increasing the accuracy of business predictions.
Smart Images

Figure CN116090535B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to one or more embodiments in the field of computer technology, and more particularly to a training method and apparatus for graph neural networks. Background Technology
[0002] A relational network graph describes the relationships between entities in the real world and is widely used in various computer information processing applications. Generally, a relational network graph contains a set of nodes and a set of edges. Nodes represent entities in the real world, and edges represent the connections between entities. For example, in a user relational network graph, users are entities, and the relationships or connections between users are edges.
[0003] In many cases, it is desirable to analyze the topological characteristics of nodes, edges, etc., in a relational network graph to extract useful information. The computational methods used to achieve this process are called graph computation. Typically, it is desirable to represent each node (entity) in the relational network graph using a vector of the same dimension, that is, to generate a node vector for each node. In this way, the generated node vectors can be applied to transactions for risk detection, etc.
[0004] Node vector generation has become a fundamental algorithm in graph computation. One approach utilizes Graph Neural Networks (GNNs) to generate node vectors for nodes in a relational network graph. However, traditional GNN training methods often overfit the training data, thus failing to flexibly adapt to various types of downstream prediction tasks, resulting in poor model generalization. Summary of the Invention
[0005] This specification describes one or more embodiments of a graph neural network training method and apparatus, which can improve the generalization of the trained graph neural network and thus improve the accuracy of business prediction.
[0006] Firstly, a method for training graph neural networks is provided, including:
[0007] Obtain a user relationship network graph, which includes n user nodes, each user node having a business label representing the user's behavior towards the target business;
[0008] The user relationship network graph is divided into multiple subgraphs;
[0009] Based on the user relationships in each subgraph and the user characteristics of the user nodes therein, graph neural networks are used to perform graph embedding processing on each subgraph to obtain the user representation of each user node in each subgraph.
[0010] Using a prediction network, based on the user representations of each user node, prediction results for the target service are obtained;
[0011] Under the objective constraint, the first parameter of the graph neural network and the second parameter of the prediction network are adjusted with the goal of minimizing the cost value. The objective constraint is that for each subgraph, the subgraph loss obtained using the adjusted second parameters is minimized compared to the other second parameters. The subgraph loss is the sum of the user losses calculated using the prediction results and business labels of each user node in the subgraph using a preset loss function. The cost value is the sum of the subgraph losses of each subgraph obtained using the adjusted second parameters.
[0012] In one possible implementation, adjusting the first parameters of the graph neural network and the second parameters of the prediction network under the objective constraint, with the objective of minimizing the cost value, includes:
[0013] For any user node in any first subgraph, the gradient of the second parameter with respect to that user node is calculated according to the preset loss function;
[0014] For each participating gradient determined for each user node in the first subgraph, the product of each pairwise gradient is calculated and summed. The summation result is added as a perturbation to the subgraph loss corresponding to the first subgraph to obtain the corrected loss corresponding to the first subgraph.
[0015] The sum of the corrected losses corresponding to each subgraph is taken as the total loss. The first parameter and the second parameter are adjusted in the direction of decreasing total loss.
[0016] In one possible implementation, dividing the user relationship network graph into multiple subgraphs includes:
[0017] Clustering is performed on each user node in the user relationship network graph to obtain multiple clusters;
[0018] Based on the multiple clusters, the multiple subgraphs are determined.
[0019] In one possible implementation, clustering the user nodes in the user relationship network graph includes:
[0020] Obtain the adjacency matrix W and degree matrix D corresponding to the n user nodes;
[0021] The difference between the degree matrix D and the adjacency matrix W is used to obtain the Laplace matrix L;
[0022] Normalize each element of the Laplacian matrix L, and construct an n*k dimensional target matrix U based on the eigenvectors corresponding to the k smallest elements in each row of the normalized Laplacian matrix L.
[0023] Each row of the target matrix U is treated as a sample and clustered to obtain the multiple clusters.
[0024] In one possible implementation, the prediction network is a classification network, and the prediction result is a classification result; or...
[0025] The prediction network is a regression network, and the prediction result is a regression value.
[0026] In one possible implementation, the target business is a target transaction, the business tag is a transaction risk tag, and the user characteristics include transaction characteristics.
[0027] Secondly, a training device for a graph neural network is provided, comprising:
[0028] The acquisition unit is used to acquire a user relationship network graph, which includes n user nodes, each user node having a business label representing the user's behavior toward the target business;
[0029] A segmentation unit is used to segment the user relationship network graph into multiple subgraphs;
[0030] An embedding processing unit is used to perform graph embedding processing on each subgraph based on the user relationship in each subgraph and the user features of the user nodes therein, using a graph neural network to obtain the user representation of each user node in each subgraph.
[0031] The acquisition unit is also used to obtain prediction results for the target service based on the user representation of each user node using a prediction network.
[0032] An adjustment unit is configured to adjust the first parameters of the graph neural network and the second parameters of the prediction network under a target constraint, with the objective of minimizing the cost value; wherein the target constraint is that, for each subgraph, the subgraph loss obtained using the adjusted second parameters is minimized compared to the other second parameters, the subgraph loss is the sum of the user losses calculated using the prediction results and business labels of each user node in the subgraph using a preset loss function; and the cost value is the sum of the subgraph losses of each subgraph obtained using the adjusted second parameters.
[0033] In one possible implementation, the adjustment unit includes:
[0034] The calculation submodule is used to calculate the parameter gradient of the second parameter with respect to any user node in any first subgraph, based on the preset loss function.
[0035] A submodule is added to calculate the product of each participating gradient determined for each user node in the first subgraph and sum them up. The summation result is added as a perturbation to the subgraph loss corresponding to the first subgraph to obtain the corrected loss corresponding to the first subgraph.
[0036] The adjustment submodule is used to take the sum of the corrected losses corresponding to each subgraph as the total loss, and adjust the first parameter and the second parameter in the direction of decreasing total loss.
[0037] In one possible implementation, the segmentation unit includes:
[0038] The clustering submodule is used to cluster each user node in the user relationship network graph to obtain multiple clusters;
[0039] A submodule is defined to determine the multiple subgraphs based on the multiple class clusters.
[0040] In one possible implementation, the clustering submodule is specifically used for:
[0041] Obtain the adjacency matrix W and degree matrix D corresponding to the n user nodes;
[0042] The difference between the degree matrix D and the adjacency matrix W is used to obtain the Laplace matrix L;
[0043] Normalize each element of the Laplacian matrix L, and construct an n*k dimensional target matrix U based on the eigenvectors corresponding to the k smallest elements in each row of the normalized Laplacian matrix L.
[0044] Each row of the target matrix U is treated as a sample and clustered to obtain the multiple clusters.
[0045] In one possible implementation, the prediction network is a classification network, and the prediction result is a classification result; or...
[0046] The prediction network is a regression network, and the prediction result is a regression value.
[0047] In one possible implementation, the target business is a target transaction, the business tag is a transaction risk tag, and the user characteristics include transaction characteristics.
[0048] Thirdly, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of the first or second aspect.
[0049] Fourthly, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and the processor, when executing the executable code, implements the method of the first or second aspect.
[0050] The graph neural network training method and apparatus provided in one or more embodiments of this specification adjust the parameters of the neural network and the prediction network under objective constraints, with the goal of minimizing the cost value. Here, the objective constraints are used to limit the parameters of the prediction network. The minimum cost value is obtained by summing the losses of each subgraph obtained using the prediction network that is optimal for each subgraph. Therefore, in this scheme, the training of the graph neural network is affected by the parameters of the prediction network; that is, the prediction network is used to constrain the training of the graph neural network. This improves the generalization ability of the model, ensuring the accuracy of the model's business predictions even when the distributions of training data and prediction data are inconsistent. Attached Figure Description
[0051] To more clearly illustrate the technical solutions of the embodiments in this specification, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1 This is a schematic diagram illustrating an implementation scenario of one embodiment disclosed in this specification;
[0053] Figure 2 A flowchart illustrating a training method for a graph neural network according to one embodiment is shown.
[0054] Figure 3 A schematic diagram of a training apparatus for a graph neural network according to one embodiment is shown. Detailed Implementation
[0055] The solution provided in this specification will now be described with reference to the accompanying drawings.
[0056] As mentioned earlier, traditional graph neural network training methods suffer from overfitting to the training data, which leads to poor generalization of the trained model.
[0057] To improve the generalization performance of a model, it's necessary to refine the dataset during training to ignore spurious correlations caused by data collection. Spurious correlations refer to the phenomenon where labels appear to be related to factors that are not actually relevant, due to various reasons. For example, suppose we need to classify two animals, cows and camels. During data collection, cows often appear against green backgrounds (grassland), while camels often appear against yellow backgrounds (desert). Therefore, background color is a spurious correlation for this classification problem, as it has no inherent connection to cows or camels. A good classifier should be able to classify animals based on their outlines and shapes.
[0058] It should be noted that removing spurious correlations makes the model's decisions closer to causality and enhances robustness. Here, robustness specifically refers to out-of-distribution robustness. A model with out-of-distribution robustness means that even when the distribution of the predicted data differs from that of the training data, the model's predictions can still capture the essential correlations rather than spurious correlations.
[0059] Some renovation proposals suggest using the Invairant Risk Minimization (IRM) principle to remove spurious correlations. IRM utilizes multiple data sources to minimize the risk of falling into spurious correlation traps. Specifically, it seeks an invariant representation such that the optimal classifier for the label is consistent across different data sources. In the cow and camel example, the invariant representation is the information about the outline shape, not the background color.
[0060] This solution aims to improve the generalization ability of graph neural networks based on IRM. Specifically, in order to utilize IRM, the inventors of this application propose to divide the relational network graph into multiple subgraphs, and then construct multiple datasets based on these subgraphs, thereby adapting to the idea of IRM to remove spurious correlations using multiple data sources.
[0061] The reason why this approach can construct multiple datasets based on multiple subgraphs is as follows:
[0062] We often have reason to believe that data itself possesses heterogeneity, making it possible to separate different subgraphs from a larger graph. Each subgraph naturally forms a unique environment: for example, a network graph of relationships between movies might eventually form clusters, with each cluster representing a category, such as action, suspense, etc. Thus, each cluster can be treated as a subgraph, thereby constructing multiple datasets.
[0063] The following is a detailed explanation of this plan.
[0064] Figure 1 This is a schematic diagram illustrating an implementation scenario of one of the embodiments disclosed in this specification. Figure 1 First, a user relationship network graph can be obtained. This graph includes n user nodes and the edges connecting them, with each edge having a weight value to indicate the relationships between users. The user relationship network graph can then be divided into multiple subgraphs based on a pre-defined clustering algorithm. Then, for each subgraph, graph embedding processing can be performed using a graph neural network based on the user relationships and user features of the nodes within each subgraph, yielding user representations for each user node in each subgraph.
[0065] Then, the prediction network can be used to obtain the prediction results of the user represented by the user node for the target business for each subgraph based on the user representation of the user node.
[0066] Finally, under the objective constraint, the parameters of the neural network and the prediction network are adjusted with the goal of minimizing the cost. Here, the objective constraint limits the parameters of the prediction network. The minimum cost is obtained by summing the losses of each subgraph obtained using the prediction network that is optimal for each subgraph.
[0067] As can be seen, in this scheme, the training of the graph neural network is affected by the parameters of the prediction network. That is, the prediction network is used to constrain the training of the graph neural network, thereby improving the generalization of the model and thus improving the accuracy of business prediction.
[0068] It should be understood that in practical applications, other relational network graphs can also be used to train graph neural networks, such as corporate relational network graphs or film and television relational network graphs, and this specification does not limit this.
[0069] The following uses a user relationship network graph as an example to illustrate the training method of graph neural networks.
[0070] Figure 2 A flowchart illustrating a training method for a graph neural network according to one embodiment is shown. This method can be executed by any device, apparatus, platform, or cluster of devices with computing and processing capabilities. Figure 2 As shown, the method may include the following steps:
[0071] Step S202: Obtain a user relationship network graph, which includes n user nodes, each user node having a business label representing the user's behavior towards the target business.
[0072] Furthermore, the aforementioned user relationship network diagram may also include connecting edges formed by relationships between user nodes. These relationships can be, for example, transaction relationships, thus the target business is the target transaction. In a specific embodiment, if one user transfers funds to another user or initiates a payment request, a transaction relationship is considered to exist between them.
[0073] Of course, in practical applications, the above-mentioned relationships can also be social relationships, device relationships, and content interaction relationships, etc., and this manual does not limit them.
[0074] Regarding the aforementioned business tags, in one embodiment, in a node classification scenario (i.e., the prediction network is a classification network), the business tag can be a category tag. In one example, the category tag can be a transaction risk tag, such as high risk, medium risk, and low risk. The aforementioned user behavior could be, for example, fraudulent behavior. Alternatively, the category tag could be a tag indicating the existence of social relationships. The aforementioned user behavior could be following behavior on a social platform.
[0075] In one example, the user relationship network graph obtained above can be represented as: G = (V, E, X), where V is the set of user nodes, E is the set of connecting edges, and X is the user feature.
[0076] Step S204: Divide the user relationship network graph into multiple subgraphs.
[0077] Specifically, the user nodes in the user relationship network graph are clustered to obtain multiple clusters. Based on these multiple clusters, multiple subgraphs are determined.
[0078] For example, graph clustering methods such as Affinity Propagation (AP) clustering and spectral clustering can be used to cluster the aforementioned user nodes.
[0079] Taking spectral clustering as an example, the above clustering process may include:
[0080] Obtain the adjacency matrix W and degree matrix D corresponding to n user nodes. Calculate the difference between the degree matrix D and the adjacency matrix W to obtain the Laplacian matrix L. Normalize each element of the Laplacian matrix L, and construct an n*k dimensional target matrix U based on the eigenvectors corresponding to the k smallest elements in each row of the normalized Laplacian matrix L. Cluster each row of the target matrix U as a sample (e.g., using k-means clustering) to obtain multiple clusters.
[0081] The adjacency matrix W described above represents the connection relationships between user nodes. It is an n-order square matrix. For example, in an undirected graph, if two user nodes are connected, the corresponding matrix element has a value of 1; otherwise, it has a value of 0. In a directed graph, the directionality of the connecting edges also needs to be considered. The degree matrix D described above is a diagonal matrix, and the matrix elements on the diagonal are the degrees of each user node. The degree of any user node represents the number of connecting edges connected to that user node.
[0082] When the user relationship network graph is represented as G, any subgraph Gi obtained from the partitioning can be represented as: Gi = (Vi, Ei, Xi), where 1 ≤ i ≤ K, and K is the number of subgraphs.
[0083] It should be understood that the subgraphs obtained by the embodiments of this specification satisfy the following conditions: the number of connecting edges between subgraphs is small, and the number of connecting edges within a subgraph is large.
[0084] Step S206: Based on the user relationships in each subgraph and the user features of the user nodes therein, graph neural networks are used to perform graph embedding processing on each subgraph to obtain the user representation of each user node in each subgraph.
[0085] In one embodiment, the aforementioned user characteristics may include transaction characteristics, such as transaction time, transaction address, and transaction amount. It should be understood that when the aforementioned user characteristics include transaction characteristics, transaction risk prediction can be performed based on these user characteristics.
[0086] Furthermore, the aforementioned graph neural network can be implemented as a Graph Convolutional Network (GCN), a Graph Attention Network (GAT), a Graph Isomorphic Network (GIN), and a Graph Sample and Aggregate (SAGE) network. Accordingly, based on the aforementioned user relationships and user features, this graph neural network can perform graph embedding processing on the user relationship network graph to obtain the user representations corresponding to each user node.
[0087] In the example above, the user representation of any user node in a subgraph Gi can be represented as: hi = GNN(Xi,Ai), where Ai is the adjacency matrix of the subgraph Gi.
[0088] Step S208: Using the prediction network, based on the user representation of each user node, the prediction results for the target service are obtained.
[0089] In one embodiment, the prediction network can be a classification network, and the prediction result is a classification result. In a specific embodiment, the target business is a target transaction, the classification network is a risk prediction network, and the prediction result is whether the user has committed fraudulent behavior in the target transaction.
[0090] In another embodiment, the prediction network can be a regression network, and the prediction result can be a regression value, such as the probability that a user will commit fraudulent behavior against the target transaction.
[0091] Specifically, in the prediction network, the parameters of the prediction network can be used to perform linear transformation on the user representation to obtain the prediction results for the target service.
[0092] Step S210: Under the objective constraint, adjust the first parameter of the graph neural network and the second parameter of the prediction network with the objective of minimizing the cost value.
[0093] The objective constraint is that, for each subgraph, the subgraph loss obtained using the adjusted second parameter is minimized compared to other second parameters. This subgraph loss is the sum of the user losses calculated using the prediction results of each user node and the business label in the subgraph, based on a preset loss function. The cost value is the sum of the subgraph losses of each subgraph obtained using the adjusted second parameter.
[0094] In one example, the above objective constraint can be expressed as the following formula:
[0095]
[0096] Where N is the number of user nodes in subgraph Gi, φ is the adjusted second parameter of the prediction network, φ' is the other second parameters of the prediction network, l is the user loss calculated based on the preset loss function, and L φ To utilize the subgraph loss of subgraph Gi obtained by adjusting the second parameter, L φ 'To utilize the subgraph loss of subgraph Gi obtained from other second parameters, GNN θ (X i A i Let A be the user representation of the user node in subgraph Gi. i Let Y be the adjacency matrix of subgraph Gi. i Let θ be the business label of the user node in the subgraph Gi, and let θ be the first parameter of the graph neural network GNN.
[0097] In one embodiment, the user loss described above is determined using a preset loss function, based on the difference between the prediction results of each user node and the business label. This preset loss function can be a cross-entropy loss function, a hinge loss function, or the square of the second norm, etc.
[0098] In one embodiment, the aforementioned cost can be expressed as the following formula:
[0099]
[0100] Where K is the number of subgraphs, L φ The definitions of φ and θ can be found above and will not be repeated here.
[0101] As can be seen from Formulas 1 and 2 above, in this scheme, the graph neural network and the prediction network are trained jointly, and the training of the graph neural network is affected by the parameters of the prediction network. That is, the prediction network is used to constrain the training of the graph neural network, thereby improving the generalization of the model.
[0102] In one implementation, step 210 may specifically include: for any user node in any first subgraph, calculating the gradient of the second parameter with respect to that user node according to a preset loss function; multiplying and summing the product of each participating gradient determined for each user node in the first subgraph, and adding the summation result as a perturbation to the subgraph loss corresponding to the first subgraph to obtain the corrected loss corresponding to the first subgraph; using the sum of the corrected losses corresponding to each subgraph as the total loss, and adjusting the first and second parameters in the direction of decreasing the total loss.
[0103] The preset loss function here can be, for example, the loss function used to calculate the user's loss mentioned above.
[0104] In one example, the formula for calculating the above disturbance can be as follows:
[0105]
[0106] Where b is the number of parameter gradient products calculated for a certain subgraph, l is the user loss, the preceding ▽ is the value of the user loss calculated based on user node i in that subgraph with respect to the second parameter at φ = 1.0, which is also called the parameter gradient of the second parameter with respect to user node i, and the following ▽ is the value of the user loss calculated based on user node j in that subgraph with respect to the second parameter at φ = 1. .0 The value of is also called the second parameter, the gradient of the parameters for user node j.
[0107] It should be noted that after determining the total loss, the first training gradient can be obtained by differentiating the total loss with respect to the first parameter. Then, the product between the preset learning rate and the first training gradient is determined, and the first parameter in the graph neural network is updated to be the difference between it and this product. In a specific embodiment, the preset learning rate is a hyperparameter, which can be set to 0.1 or 0.2, etc.
[0108] Similarly, the second training gradient can be obtained by differentiating the total loss with respect to the second parameter. Then, the product between the preset learning rate and the second training gradient is determined, and the second parameter in the prediction network is updated to be the difference between this product and the second parameter.
[0109] The training process of the graph neural network is now complete.
[0110] It should be noted that, under the objective constraints, when adjusting the parameters of the neural network and the prediction network with the goal of minimizing the cost, the training of the graph neural network will be affected by the parameters of the prediction network. In other words, this solution uses the prediction network to constrain the training of the graph neural network, thereby improving the generalization of the model and thus improving the accuracy of business prediction.
[0111] Corresponding to the above-described graph neural network training method, one embodiment of this specification also provides a graph neural network training apparatus, such as... Figure 3 As shown, the device may include:
[0112] The acquisition unit 302 is used to acquire a user relationship network graph, which includes n user nodes, each user node having a business label representing the user's behavior toward the target business.
[0113] Segmentation unit 304 is used to segment the user relationship network graph into multiple subgraphs.
[0114] The embedding processing unit 306 is used to perform graph embedding processing on each subgraph based on the user relationship in each subgraph and the user features of the user nodes therein, using a graph neural network to obtain the user representation of each user node in each subgraph.
[0115] The acquisition unit 302 is also used to obtain prediction results for the target service based on the user representation of each user node using the prediction network.
[0116] Wherein, the prediction network mentioned above is a classification network, and the prediction result mentioned above is a classification result; or,
[0117] The prediction network described above is a regression network, and the prediction results described above are regression values.
[0118] The adjustment unit 308 is used to adjust the first parameters of the graph neural network and the second parameters of the prediction network under objective constraints, with the goal of minimizing the cost value. The objective constraint is that, for each subgraph, the subgraph loss obtained using the adjusted second parameters is minimized compared to the other second parameters. The subgraph loss is the sum of the user losses calculated using the prediction results of each user node in the subgraph and the business labels, using a preset loss function. The cost value is the sum of the subgraph losses of each subgraph obtained using the adjusted second parameters.
[0119] In some embodiments, the adjustment unit 308 includes:
[0120] The calculation submodule 3082 is used to calculate the parameter gradient of the second parameter with respect to any user node in any first subgraph, based on a preset loss function.
[0121] Add submodule 3084 to calculate the product of each participating gradient determined for each user node in the first subgraph and sum them. Add the summation result as a perturbation to the subgraph loss corresponding to the first subgraph to obtain the corrected loss corresponding to the first subgraph.
[0122] The adjustment submodule 3086 is used to take the sum of the corrected losses corresponding to each subgraph as the total loss, and adjust the first and second parameters in the direction of decreasing total loss.
[0123] In some embodiments, the segmentation unit 304 includes:
[0124] Clustering submodule 3042 is used to cluster each user node in the user relationship network graph to obtain multiple clusters;
[0125] Determine submodule 3044, which is used to determine multiple subgraphs based on multiple class clusters.
[0126] Specifically, clustering submodule 3042 is used for:
[0127] Obtain the adjacency matrix W and degree matrix D corresponding to n user nodes;
[0128] The difference between the degree matrix D and the adjacency matrix W is used to obtain the Laplace matrix L;
[0129] Normalize each element of the Laplacian matrix L, and construct an n*k dimensional target matrix U based on the eigenvectors corresponding to the smallest k elements in each row of the normalized Laplacian matrix L.
[0130] Each row of the target matrix U is treated as a sample and clustered to obtain multiple clusters.
[0131] In some embodiments, the target business is the target transaction, the business tag is the transaction risk tag, and the user characteristics include transaction characteristics.
[0132] The functions of each functional module of the apparatus in the above embodiments of this specification can be implemented through the steps of the above method embodiments. Therefore, the specific working process of the apparatus provided in one embodiment of this specification will not be repeated here.
[0133] The graph neural network training apparatus provided in one embodiment of this specification can improve the generalization of the trained graph neural network, thereby improving the accuracy of business prediction.
[0134] According to another embodiment, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed in a computer, causes the computer to perform a combination Figure 2 The method described.
[0135] According to another embodiment, a computing device is also provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements a combination... Figure 2 The method described.
[0136] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0137] The steps of the methods or algorithms described in conjunction with the disclosure in this specification can be implemented in hardware or by a processor executing software instructions. The software instructions can consist of corresponding software modules, which can be stored in RAM, flash memory, ROM, EPROM, EEPROM, registers, hard disk, external hard disk, CD-ROM, or any other form of storage medium well known in the art. An exemplary storage medium is coupled to the processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and storage medium can reside in an ASIC. Alternatively, the ASIC can reside in a server. Of course, the processor and storage medium can also exist as discrete components in the server.
[0138] Those skilled in the art will recognize that, in one or more of the examples above, the functions described in this invention can be implemented using hardware, software, firmware, or any combination thereof. When implemented in software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any medium that facilitates the transfer of a computer program from one place to another. Storage media can be any available medium accessible to a general-purpose or special-purpose computer.
[0139] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0140] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of this specification. It should be understood that the above description is only a specific embodiment of this specification and is not intended to limit the scope of protection of this specification. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solution of this specification should be included within the scope of protection of this specification.
Claims
1. A training method for a graph neural network for trading risk prediction, comprising: Obtain a user relationship network graph, which includes n user nodes and connecting edges representing transaction relationships between users. Each user node has a transaction risk label and transaction characteristics representing the user's fraudulent behavior towards the target transaction; the transaction characteristics include transaction time, transaction address, and transaction amount. The user relationship network graph is divided into multiple subgraphs; Based on the user transaction relationships in each subgraph and the transaction characteristics of the user nodes therein, graph neural networks are used to perform graph embedding processing on each subgraph to obtain the user representation of each user node in each subgraph. Using a risk prediction network, risk prediction results for the target transaction are obtained based on the user representations of each user node; Under the objective constraint, the first parameter of the graph neural network and the second parameter of the risk prediction network are adjusted with the goal of minimizing the cost value. The objective constraint is that for each subgraph, the subgraph loss obtained using the adjusted second parameter is minimized compared to the other second parameters. The subgraph loss is the sum of user losses calculated using a preset loss function for each user node in the subgraph based on the risk prediction results and transaction risk labels. The cost value is the sum of subgraph losses obtained using the adjusted second parameter.
2. The method according to claim 1, wherein, Under the objective constraint, adjusting the first parameter of the graph neural network and the second parameter of the risk prediction network with the objective of minimizing the cost value includes: For any user node in any first subgraph, the gradient of the second parameter with respect to that user node is calculated according to the preset loss function; For each parameter gradient determined for each user node in the first subgraph, calculate the product of each pairwise gradient and sum them up. Add the summation result as a perturbation to the subgraph loss corresponding to the first subgraph to obtain the corrected loss corresponding to the first subgraph. The sum of the corrected losses corresponding to each subgraph is taken as the total loss. The first parameter and the second parameter are adjusted in the direction of decreasing total loss.
3. The method according to claim 1, wherein, The step of dividing the user relationship network graph into multiple subgraphs includes: Clustering is performed on each user node in the user relationship network graph to obtain multiple clusters; Based on the multiple clusters, the multiple subgraphs are determined.
4. The method according to claim 3, wherein, The clustering of each user node in the user relationship network graph includes: Obtain the adjacency matrix W and degree matrix D corresponding to the n user nodes; The difference between the degree matrix D and the adjacency matrix W is used to obtain the Laplace matrix L; Normalize each element of the Laplacian matrix L, and construct an n*k dimensional target matrix U based on the eigenvectors corresponding to the k smallest elements in each row of the normalized Laplacian matrix L. Each row of the target matrix U is treated as a sample and clustered to obtain the multiple clusters.
5. The method according to claim 1, wherein, The risk prediction network is a classification network, and the risk prediction result is a classification result; or... The risk prediction network is a regression network, and the risk prediction result is a regression value.
6. A training device for a graph neural network for predicting trading risk, comprising: The acquisition unit is used to acquire a user relationship network graph, including n user nodes and connecting edges representing transaction relationships between users. Each user node has a transaction risk label and transaction characteristics representing fraudulent behavior by the user in a target transaction; the transaction characteristics include, Transaction time, transaction address, and transaction amount; A segmentation unit is used to segment the user relationship network graph into multiple subgraphs; The embedding processing unit is used to perform graph embedding processing on each subgraph based on the user transaction association relationship in each subgraph and the transaction characteristics of the user nodes therein, using a graph neural network to obtain the user representation of each user node in each subgraph. The acquisition unit is also used to obtain risk prediction results for the target transaction based on the user representation of each user node using a risk prediction network. An adjustment unit is configured to adjust the first parameters of the graph neural network and the second parameters of the risk prediction network under a target constraint, with the goal of minimizing the cost value; wherein the target constraint is that, for each subgraph, the subgraph loss obtained using the adjusted second parameters is minimized compared to the other second parameters, the subgraph loss is the sum of user losses calculated using a preset loss function for each user node in the subgraph based on the risk prediction results and transaction risk labels; and the cost value is the sum of subgraph losses for each subgraph obtained using the adjusted second parameters.
7. The apparatus according to claim 6, wherein, The adjustment unit includes: The calculation submodule is used to calculate the parameter gradient of the second parameter with respect to any user node in any first subgraph, based on the preset loss function. A submodule is added to calculate the product of each parameter gradient determined for each user node in the first subgraph and sum them. The summation result is added as a perturbation to the subgraph loss corresponding to the first subgraph to obtain the corrected loss corresponding to the first subgraph. The adjustment submodule is used to take the sum of the corrected losses corresponding to each subgraph as the total loss, and adjust the first parameter and the second parameter in the direction of decreasing total loss.
8. The apparatus according to claim 6, wherein, The segmentation unit includes: The clustering submodule is used to cluster each user node in the user relationship network graph to obtain multiple clusters; A submodule is defined to determine the multiple subgraphs based on the multiple class clusters.
9. The apparatus according to claim 8, wherein, The clustering submodule is specifically used for: Obtain the adjacency matrix W and degree matrix D corresponding to the n user nodes; The difference between the degree matrix D and the adjacency matrix W is used to obtain the Laplace matrix L; Normalize each element of the Laplacian matrix L, and construct an n*k dimensional target matrix U based on the eigenvectors corresponding to the k smallest elements in each row of the normalized Laplacian matrix L. Each row of the target matrix U is treated as a sample and clustered to obtain the multiple clusters.
10. The apparatus according to claim 6, wherein, The risk prediction network is a classification network, and the risk prediction result is a classification result; or... The risk prediction network is a regression network, and the risk prediction result is a regression value.
11. A computer-readable storage medium having a computer program stored thereon, wherein, When the computer program is executed in the computer, it causes the computer to perform the method of any one of claims 1-5.
12. A computing device comprising a memory and a processor, wherein, The memory stores executable code, and when the processor executes the executable code, it implements the method of any one of claims 1-5.
Citation Information
Patent Citations
Risk prediction method and device based on relationship network tagging and graph neural network
CN112508691A