Method and device for training graph encoder

By designing a method for training graph encoders in risk control scenarios, using pseudo-supervision tasks of business data and automatic positive sample determination, the problem of risk label lag and low coverage in the risk control model is solved, and graph encoding is realized Efficient training of the machine and improved accuracy of risk prediction.

CN118709747APending Publication Date: 2024-09-27ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410712782.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-03
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

In risk control scenarios, it is difficult for existing technologies to effectively obtain accurate and timely risk labels, resulting in reduced robustness and accuracy of risk control models and affecting the security of electronic platforms.

Method used

Design a method to train a graph encoder, using the unique attributes of the business data of the business system, replacing the high-cost manual annotation of risk labels through pseudo-supervised tasks, and automatically determining positive samples for comparative learning, training the graph encoder to obtain Risk representation for risk prediction avoids reliance on graph-structured data augmentation and negative samples.

Benefits of technology

Without relying on graph structure data enhancement and negative samples, the training efficiency and generalization ability of the graph encoder are improved, a risk representation with strong expressiveness is obtained, and the robustness and accuracy of the risk control model are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118709747A
    Figure CN118709747A
Patent Text Reader

Abstract

The embodiment of the invention provides a method and device for training a graph encoder. The method comprises the following steps of: respectively inputting a service relation graph into a first graph encoder and a second graph encoder to obtain a first representation and a second representation of each service main body represented by each node in the first graph encoder and the second graph encoder; for any target subject, in each second representation, determining K neighbor subjects corresponding to K second representations closest to the first representation of the target subject; based on the K neighbor subjects, determining a similar subject set of the target subject; based on the similarity between the subjects in the similar subject set, obtaining prediction loss corresponding to the similar subject set; and according to the prediction loss, the first graph encoder is updated, and the obtained first representation is used for carrying out risk prediction on the business main body.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of machine learning technology, and more particularly, to a method and apparatus for training a graph encoder. Background Art

[0002] With the development of computer technology, various electronic platforms can provide users with a wide variety of services, such as electronic payment services provided by payment platforms, social services provided by social networking platforms, commodity trading services provided by e-commerce platforms, and so on.

[0003] With the rapid development of electronic platforms, users are paying more and more attention to the privacy protection and data security of these platforms. In order to improve the security of electronic platforms and prevent illegal groups / individuals from using electronic platforms to commit illegal acts, service providers of electronic platforms often deploy risk control models (such as risk control products based on graph-structured business data analysis) to predict risks for business entities in daily business activities.

[0004] In traditional risk control scenarios, the risk labels of business entities that risk control models rely on are often manually labeled based on user feedback. For example, in one scenario, risk labels come from user complaints and reports against illegal gangs / individuals. However, for cold-start businesses and immature business scenarios, the risk patterns and illegal behavior methods are not yet clear. The risk labels obtained in this scenario have lags and a high proportion of hidden cases. In another scenario, user feedback is collected through questionnaires and other methods to manually label risk labels. However, such methods are inefficient and not very credible. In the process of responding to the ever-changing risk patterns, the risk labels obtained by manual labeling have defects such as lags and low coverage, which will reduce the robustness of the risk control model, thereby affecting the accuracy of risk prediction and endangering the security of the electronic platform.

[0005] Therefore, it is hoped that there will be a technical solution that can improve the characterization capabilities for business entities, thereby improving the robustness and accuracy of downstream risk control models. Summary of the invention

[0006] One or more embodiments of the present specification describe a method and apparatus for training a graph encoder, which can utilize the unique attributes of the business data already available in the business system to design pseudo-supervision tasks to replace high-cost manual annotation of risk labels, and can automatically determine positive samples for comparative learning, thereby training the graph encoder without relying on graph structure data enhancement and negative samples, and obtaining valuable risk representations that can be used for downstream risk prediction tasks.

[0007] According to a first aspect, there is provided a method for training a graph encoder, comprising:

[0008] The business relationship graph is input into a first graph encoder and a second graph encoder respectively to obtain a first representation and a second representation of each business subject represented by each node therein.

[0009] For any target subject, in each second representation, K neighboring subjects corresponding to the K second representations closest to the first representation of the target subject are determined.

[0010] Based on the K neighboring entities, a similar entity set of the target entity is determined.

[0011] Based on the similarity between the subjects in the similar subject set, the prediction loss corresponding to the similar subject set is obtained.

[0012] The first graph encoder is updated according to the predicted loss, and the obtained first representation is used to predict the risk of the business entity.

[0013] According to one implementation, the business subject is a user, a merchant or a mini-program; the business relationship graph further includes edges representing business relationships between the various business subjects, and the business relationships are transactions, transfers, social interactions or shared devices.

[0014] According to one embodiment, determining K neighboring entities corresponding to K second representations closest to the first representation of the target entity includes:

[0015] The cosine similarity between the first representation of the target subject and the second representation of each business subject is calculated respectively.

[0016] According to the order of cosine similarity, K nearest neighbor entities corresponding to the first K second representations similar to the first representation are determined.

[0017] According to one embodiment, determining a similar subject set of the target subject based on the K nearest neighbor subjects includes:

[0018] In the business relationship graph, a plurality of direct neighbors connected to the target entity by edges are determined.

[0019] A first intersection between the K nearest neighbor entities and the plurality of direct neighbors is determined as the similar entity set.

[0020] According to one embodiment, determining a similar subject set of the target subject based on the K nearest neighbor subjects includes:

[0021] Determine a number of similar subjects included in a target cluster to which the target subject belongs among a plurality of clusters; wherein the plurality of clusters are obtained by clustering the respective second representations.

[0022] A second intersection between the K neighboring subjects and the plurality of similar subjects is determined as the similar subject set.

[0023] According to one embodiment, determining a similar subject set of the target subject based on the K nearest neighbor subjects includes:

[0024] In the business relationship graph, a number of direct neighbors connected to the target subject by edges are determined, and a first intersection between the K neighboring subjects and the number of direct neighbors is determined.

[0025] Determine a number of similar subjects included in the target cluster to which the target subject belongs among the multiple clusters, and determine a second intersection between the K neighboring subjects and the number of similar subjects; wherein the multiple clusters are obtained by clustering the respective second representations.

[0026] The union of the first intersection and the second intersection is used as the similar subject set.

[0027] According to an implementation of the above embodiment, clustering the second representations includes:

[0028] Multiple rounds of K-Means are used to perform clustering on the second representations.

[0029] According to one implementation, the similar subject set includes a subject pair consisting of a first subject and a second subject; and obtaining the prediction loss corresponding to the similar subject set includes:

[0030] The first representation of the first subject is input into a mapping network to obtain a first mapping vector.

[0031] Based on the first mapping vector and a second representation of the second subject, a first similarity of the subject pair is determined and included in the prediction loss.

[0032] According to one implementation manner, obtaining the prediction loss corresponding to the similar subject set further includes:

[0033] The first representation of the second subject is input into the mapping network to obtain a second mapping vector.

[0034] Based on the second mapping vector and a second representation of the first subject, a second similarity of the subject pair is determined and included in the prediction loss.

[0035] According to an implementation of the above embodiment, updating the first image encoder includes:

[0036] The parameters of the first graph encoder and the mapping network are updated in a direction to reduce the prediction loss.

[0037] According to an embodiment, the first image encoder and the second image encoder have the same model structure; after updating the first image encoder, the method further includes:

[0038] The second image encoder is updated according to the parameter update of the first image encoder.

[0039] According to one embodiment, updating the second graph encoder includes:

[0040] Perform exponential moving average on the parameters of the first image encoder and the parameters of the second image encoder to obtain updated parameters of the second image encoder.

[0041] According to a second aspect, there is provided a device for training a graph encoder, comprising:

[0042] The encoding module is configured to input the business relationship graph into a first graph encoder and a second graph encoder respectively, to obtain a first representation and a second representation of each business subject represented by each node therein.

[0043] The neighbor search module is configured to determine, for any target subject, in each second representation, K neighbor subjects corresponding to the K second representations that are closest to the first representation of the target subject.

[0044] A similar subject determination module is configured to determine a similar subject set of the target subject based on the K neighboring subjects.

[0045] The loss calculation module is configured to obtain the predicted loss corresponding to the similar subject set based on the similarity between the subjects in the similar subject set.

[0046] Update module: configured to update the first graph encoder according to the predicted loss, and the first representation obtained is used to predict the risk of the business entity.

[0047] According to a third aspect, a computer program product is provided, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method described in the first aspect.

[0048] 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.

[0049] In the embodiments of this specification, a scheme for training a graph encoder is proposed. On the graph structure data constructed based on business data, a simple and effective self-supervised graph encoder training method is designed to generate risk representations for business entities represented by nodes in the graph structure data. During the training process, the node connection relationship in the graph structure data and the global semantics of the graph structure data are simultaneously considered. Using the above method and device provided in the embodiments of this specification, the graph encoder can be trained relying only on positive samples without data augmentation of the graph structure data. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0051] Figure 1 A schematic diagram of a method flow for training a graph encoder according to an embodiment of this specification;

[0052] Figure 2 A schematic diagram of an implementation framework of an embodiment disclosed in this specification;

[0053] Figure 3 A schematic diagram of screening a positive sample set according to an embodiment of this specification;

[0054] Figure 4 A device for training a graph encoder is provided according to an embodiment of the present specification. DETAILED DESCRIPTION

[0055] In risk control scenarios, the risk control system first needs to accurately characterize the business subject, and then predict its risk based on the subject characterization. Considering that the various risk types in risk control scenarios are all related to the interactive behaviors of business subjects, some recent solutions characterize business subjects based on graph data in order to obtain more comprehensive information, rather than characterizing based on the isolated features of a single business subject.

[0056] A graph is a data structure (for the sake of clarity, it is referred to as graph structure data below), in which the nodes contained in it can have zero or more adjacent nodes, and the connection between two adjacent nodes is called an edge. A complete graph structure data consists of a node set and an edge set, denoted as in is a finite non-empty set, called a node set, is called a node; ε is a finite set, called an edge set, and e∈ε is called an edge. By modeling things and the relationships between things, graph structured data can be used to represent naturally occurring connected data.

[0057] In actual business systems, a business relationship graph can be constructed based on actual business data, and the nodes in the graph structure data can represent various types of business entities. In one scenario, the payment business is modeled, and the business entity represented by the node in the business relationship graph can be identified by an account number. An account can represent a user (in some cases, it can also distinguish between Class C individual users and Class B merchant users), and the business relationship represented by the edge can be a transaction, transfer, etc. In another scenario, the social network platform is modeled, and the business entity represented by the node in the business relationship graph can be a user, a social organization, etc., and the business relationship represented by the edge can be a friend relationship, a member relationship, a follow-up relationship, a shared device, etc. In another scenario, the e-commerce platform is modeled, and the business entity represented by the node in the business relationship graph can be a user, a merchant, a commodity, etc., and the business relationship represented by the edge can be a purchase, logistics, etc. In another scenario, the mini program platform is modeled, and the business entity represented by the node in the business relationship graph can be a mini program, a program module, etc., and the business relationship represented by the edge can be a call, jump, etc. It should be noted that the above scenario examples do not represent a limitation on the embodiments in this specification. In actual scenarios, it is necessary to construct graph structure data based on specific business, and the nodes and edges in the resulting graph structure data can represent the business entities and business relationships in the corresponding scenarios.

[0058] Since graph structured data can carry a large amount of business information, a graph encoder can be used to extract representations of graph structured data. The obtained node representations, edge representations, or graph representations can be directly applied to downstream tasks, such as risk prediction of business entities.

[0059] In order to better predict risks for business entities, it is necessary to train the graph encoder to improve its feature extraction performance so that its output has a highly expressive representation. However, as mentioned earlier, there are various problems in actual scenarios, such as inaccurate, untimely or insufficient risk labels, which makes conventional supervised training ineffective. For this reason, in some schemes, some encoders are trained in a self-supervised manner. However, there are still some difficulties and problems when applying these existing self-supervised encoder training methods to the encoding of graph structured data for risk detection purposes.

[0060] Specifically, in some contrastive learning methods, two graph structure data are generated by using a data augmentation method that randomly perturbs the edges and their features. During the training process, the node pairs corresponding to the same node in the two graph structure data are regarded as positive samples, and the node pairs corresponding to different nodes are regarded as negative samples. The graph encoder is trained based on the positive and negative sample pairs. However, such a method of constructing positive and negative sample pairs will bring about the sampling bias problem unique to graph structure data, that is, the negative sample and the target node may represent the same semantics (for example, in the risk prediction scenario, the same risk type or risk pattern). This is because, in graph structure data, the method of treating all nodes other than a certain node as negative samples ignores the graph structure information. A certain node may have the same semantics as other nodes in global semantics or local semantics. Summarizing such nodes as negative samples will have a negative impact on the training of the model. At the same time, during the training process of contrastive learning, a large number of negative sample pairs need to be generated. Compared with other data types, the computational cost of generating negative samples for graph structure data is high, resulting in high modeling costs.

[0061] In the related art, a BYOL (Bootstrap Your Own Latent) training method for self-supervised learning of image data is also proposed. This method adopts a self-mining method and only uses positive sample pairs for representation learning during the training process. However, due to the irregularity and non-Euclidean space characteristics of graph structured data, the encoder training method for image structured data cannot be directly applied to the training of graph encoders. Specifically, graph structured data has arbitrary size and complex topological structure, which makes it lack spatial locality, which makes it impossible for graph encoders to use the training method of structured data encoders for model tuning. In addition, image data has fixed pixel positions, which is different from the randomness of node ordering in graph structured data. For example, the node array {A, B, C, D} and the node array {B, C, A, D} can both express the same topological graph with four nodes, but the node data element ordering of the two can be different. In this way, the matrix input in the encoder will change, and the graph encoder needs to use a specific training method so that when it inputs graph structured data with different expressions, the output of the representation is idempotent.

[0062] In addition, whether it is conventional comparative learning or BYOL, data enhancement is required for the input data. For example, in comparative learning, data enhancement is required for the input graph structure data to expand or reduce the graph structure data, such as attribute masking, attribute perturbation, edge deletion, node discarding, and so on. Due to the diversity of graph structure data, it is difficult to determine the data enhancement strategy suitable for different graph structure data. Therefore, it is necessary to select a suitable data enhancement strategy for each graph structure data set based on domain prior knowledge or trial and error, which greatly limits the efficiency and generalization ability of the graph encoder training method. In addition, the inventors also found that during the training of the graph encoder, the quality of the inferred representation depends on the selection of the data enhancement scheme, and the effectiveness of the data enhancement of the graph structure data depends on the selection and control of the parameters. The selection of different hyperparameters has a large fluctuation in the impact on the downstream task effect. At the same time, the selection of hyperparameters needs to be carefully tuned according to different graph structure data, and different graph structure data have different requirements for hyperparameters. Therefore, the cost of data enhancement and modeling of graph structure data is high.

[0063] In view of this, the inventors have proposed a method for training a graph encoder in one or more embodiments of the present invention. This method can effectively train the graph encoder without augmenting the input graph structure data or constructing negative samples, thereby obtaining a representation vector with strong expressiveness that can be used for risk prediction.

[0064] Specifically, in the embodiments of the present specification, for graph structure data, two graph encoders are used to extract features simultaneously, one of which is used as an online graph encoder, and its output is the characterization vector that needs to be provided to risk prediction in the end. During the training process of the graph encoder, the output of another graph encoder (target graph encoder) is used as the prediction target, and the online graph encoder parameters are iteratively updated to output a characterization vector similar to the prediction target. In terms of the selection of prediction targets, the embodiments of the present specification provide a method for automatically defining positive samples in a bootstrap manner, thereby avoiding the negative impact of using graph structure data augmentation on model training efficiency and generalization ability, and also avoiding the sampling bias problem caused by using negative samples. Furthermore, during the training of the model, in order to avoid model collapse, while the online graph encoder updates the parameters in a gradient descent manner, the exponential moving average (EMA) method is used to update the parameters of the target graph encoder, and the parameters of the online graph encoder and its own parameters are weighted averaged. When updating the parameters, the target graph encoder not only considers the direction of the current gradient, but also the direction of the previous gradient. This allows the target graph encoder to maintain a certain inertia when updating the parameters, so that the two graph encoders can learn different representations on the same graph structure data input. In the process of iterative learning representations, more and more information can be encoded while keeping the memory of the old representations. In this way, the online graph encoder can avoid falling into the local optimal solution and causing the model to collapse when predicting the output of the target graph encoder.

[0065] The above is a general description of a method for training a graph encoder provided by an embodiment of this specification. The following will describe in detail the solutions provided by one or more embodiments of this specification in conjunction with the accompanying drawings.

[0066] Figure 1 A flow chart of a method for training a graph encoder according to an embodiment of the present specification is shown. It is understood that the method can be executed by any device, equipment, platform, or device cluster with computing and processing capabilities. Figure 1As shown, in this embodiment, the training process of the graph encoder includes at least the following steps: Step S101: Input the business relationship graph into the first graph encoder and the second graph encoder respectively to obtain the first representation and the second representation of each business subject represented by each node. Step S103: For any target subject, in each second representation, determine the K neighboring subjects corresponding to the K second representations closest to the first representation of the target subject. Step S105: Based on the K neighboring subjects, determine the similar subject set of the target subject. Step S107: Based on the similarity between each subject in the similar subject set, obtain the predicted loss corresponding to the similar subject set. Step S109: According to the predicted loss, update the first graph encoder, and the first representation obtained is used to predict the risk of the business subject.

[0067] The specific implementation method of each of the above steps will be described in detail below.

[0068] First, in step S101, the business relationship graph is input into a first graph encoder (online graph encoder) and a second graph encoder (target graph encoder) respectively.

[0069] The business relationship graph is a graph structure data obtained by constructing a graph based on the business data in the business system according to business needs. The nodes, edges, and different business entities and business relationships represented by each element in different business scenarios contained in the graph structure data have been introduced in the previous text and will not be repeated here. in Represents all N nodes in the business relationship graph, In order to make the business relationship graph easier to be processed by the model, the nodes in the business relationship graph can be used as the rows and columns of the matrix, and the edge connection information between the nodes can be used as the matrix element data to obtain the adjacency matrix corresponding to the business relationship graph to represent the connection relationship between the nodes. is the adjacency matrix. In addition, based on the basic attributes of a single business entity i, the basic characterization vector X of the node corresponding to the business entity can be obtained: i (For example, F dimensions), the basic representations of N nodes can constitute the node feature matrix

[0070] In the example where the business relationship graph is a transaction relationship graph, assume that there are N account nodes. Then the adjacency matrix A represents the transfer / transaction relationship between the N account nodes, and the basic representation vector X of the i-th account i Obtained based on the basic attributes of the account, such as account opening time, user basic information, credit limit, etc.

[0071] Figure 2 A schematic diagram of an implementation scenario according to an embodiment disclosed in this specification is shown. In this implementation scenario, the business relationship diagram ( Figure 2 Each node in the leftmost dotted box has a node basic representation X i , the node feature matrix X and adjacency matrix A of the business relationship graph are used as the input of the two graph encoders [ Figure 2

[0063] The first representation and the second representation of each business subject represented by each node in the business relationship graph are obtained by processing.

[0072] exist Figure 2 In the θ Denotes the first image encoder, with f ξ represents the second graph encoder, where f represents the graph encoding algorithm, and θ, ξ represent the parameters of the two encoders. Here, f can be various graph encoding algorithms, which can be implemented through neural networks, where the information of neighbor nodes is aggregated based on the basic representation and adjacency relationship of each node, and the aggregated representation is output. The node representation and adjacency relationship of each first representation can be expressed as the feature matrix H θ =f θ (X, A), each second representation can be expressed as a feature matrix H ξ =f ξ (X,A), where the i-th row vector Respectively represent the node v i The first and second representations.

[0073] Next, we can use the feature matrix H θ , H ξ To find and construct positive samples. That is to say, after the representation of the business relationship graph is obtained by the first graph encoder and the second graph encoder, for any business subject, it is necessary to find a business subject with the same / similar semantics from the business relationship graph as a positive sample, compare the representations, and use the similarity between them as a benchmark to train the first graph encoder.

[0074] Therefore, in step S103, for any target subject, in each second representation, K neighboring subjects corresponding to the K second representations closest to the first representation of the target subject are determined.

[0075] For any business entity, use its first representation and feature matrix H ξThe similarity is calculated for each second representation in the vector similarity measurement, and the vector similarity measurement can be based on distance calculation, or can be based on vector correlation coefficient calculation, or can be other calculations that can indicate the similarity between vectors. This is not listed one by one in the embodiments of this specification.

[0076] In an exemplary embodiment, cosine similarity and KNN (K-Nearest-Neighbors) algorithm are used to determine K nearest neighbor entities of the target entity. Specifically, first, the cosine similarity is calculated for the first representation of the target entity and the second representation of each business entity. Then, according to the order of cosine similarity, the K nearest neighbor entities corresponding to the first K second representations similar to the first representation are determined.

[0077] The above steps are as follows: for a given target subject, the corresponding node is marked as v i , calculate its first representation and all other nodes v j The cosine similarity between the second representations is calculated as follows:

[0078]

[0079] Next, based on the cosine similarity between node representations, the target subject v is searched through the KNN method. i The K nearest neighbors of the subject form the positive sample set B i

exist Figure 2 In the k-NN (B i )

[0080] The above is for any given target subject v i , an exemplary method for searching for neighboring entities, for any business entity in the business relationship graph, the corresponding neighboring entity can be searched by executing this method to find the positive sample set.

[0081] Figure 3 FIG. 2 shows a schematic diagram of positive sample set screening according to an embodiment. Figure 3 In the figure, the nodes enclosed by dotted circles ( Figure 3 The set (represented by a solid circle in the figure) exemplarily shows the target subject v determined by the above method. i The positive sample set B (shown as triangles) i .

[0082] The inventors further discovered that in the task of determining a positive sample set for a target subject, what is expected is a neighboring subject with the same semantics as the target subject in the representation space, and the positive sample set B determined by the above method is i , although it can be used as the target subject v iIt is a relatively reasonable set of positive samples, but there may be some noise, or the real connection relationship in the graph structure is not fully utilized.

[0083] In view of this, in multiple embodiments of this specification, the inventors further proposed a positive sample construction method combining local graph structure or global graph semantics. The relevant method will be described in detail below in conjunction with the accompanying drawings and embodiments.

[0084] In one implementation of the above embodiment, based on step S103 described above, for the target subject v i , determine the positive sample set B corresponding to its neighboring subjects i In order to filter out the noise samples (false positive samples) in the positive sample set and increase local knowledge, the adjacency matrix A can be used to provide the target subject v i local structural information.

[0085] Specifically, in the graph structure data, for any node v i , the direct neighbor nodes with edge connections can be regarded as nodes with similar semantics. Therefore, the positive sample set B can be i With v i The set of direct neighbor nodes N i Find the intersection to determine the positive sample set after removing the false positive samples.

[0086] According to the above description, in step S105: based on the K nearest neighbor entities, determine the similar entity set of the target entity, which can be specifically implemented as follows: first, determine a number of direct neighbors with edges connected to the target entity in the business relationship graph. Then, determine the first intersection between the K nearest neighbor entities and the several direct neighbors as the similar entity set. The direct neighbors of the target entity can be determined by the edge connection information between the nodes in the adjacency matrix. Figure 3 , target subject v i (shown as a solid triangle in the figure) has a set of direct neighbors N connected by edges (shown as a double-arrow solid line in the figure) i

【exist Figure 2 In the Adj.(N i ) shows], and the positive sample set B determined in the previous step i Take the intersection and get the positive sample set P of the target subject after removing the false positive samples i (exist Figure 3 The lower right corner is outlined by a dotted line). It is represented as:

[0087] P i =(B i ∩N i ) (2)

[0088] In another implementation of the above embodiment, based on step S103 described above, for the target subject v i , determine the positive sample set B corresponding to its neighboring subjects i In the positive sample set B i In the above, the global semantics of graph structure data is considered to include subjects with globally identical / similar semantics to the target subject into the positive sample set (or, remove nodes that do not have global semantic similarity from Bi). In order to find these subjects, clustering processing is used to obtain the global semantic information of the nodes of the target subject.

[0089] Specifically, in the graph structure data, a clustering algorithm is used to cluster the second representation of each node, and M clusters G = {G1, G2, ..., G M},in Indicates the cluster number to which the target subject belongs. Similarly, Each node in the same cluster as the target subject can be regarded as having the same / similar semantics as the target subject from a global perspective. The set of these nodes is marked as C i , Therefore, in order to take into account the global semantics in the positive sample set, the positive sample set B can be i With the target subject v i The same global semantic node set C i Find the intersection to obtain a set of positive samples with the same global semantics.

[0090] According to the above description, in step S105: based on the K nearest neighbor subjects, determine the similar subject set of the target subject, which can be specifically implemented as follows: first, determine a number of similar subjects contained in the target cluster to which the target subject belongs among multiple clusters, wherein the multiple clusters are obtained by clustering the respective second representations. Then, determine the second intersection between the K nearest neighbor subjects and the number of similar subjects as the similar subject set. Figure 3 , and the target subject v i (Shown as solid triangles in the figure) A set of nodes C with the same / similar semantics from a global perspective i (shown as “Cluster 1” in the figure), and the positive sample set B determined in the previous step i Taking the intersection, we get the positive sample set P with the same global semantics i (Outlined with a dotted line in the upper left corner of the figure). It is expressed as:

[0091] P i =(B i ∩C i ) (3)

[0092] In another implementation of the above embodiment, based on step S103 described above, for the target subject v i , determine the positive sample set B corresponding to its neighboring subjects i In the positive sample set B i In other words, the adjacency matrix A can be used to provide the target subject v i In addition to local structural information, clustering processing is used to obtain the global semantic information of the target subject. The set of positive samples determined in this way takes into account both the node connection relationship in the graph structure data and the global semantics of the graph structure data.

[0093] According to the above description, in step S105: based on the K neighboring entities, determine the similar entity set of the target entity, which is specifically implemented as follows: first, determine a number of direct neighbors connected to the target entity by edges in the business relationship graph, and determine the first intersection between the K neighboring entities and the several direct neighbors. Then, determine a number of similar entities contained in the target cluster to which the target entity belongs in multiple clusters, and determine the second intersection between the K neighboring entities and the several similar entities, wherein the multiple clusters are obtained by clustering the respective second representations. Finally, the union of the first intersection and the second intersection is taken as the similar entity set.

[0094] See also Figure 3 , target subject v i The set of direct neighbors N connected by edges i , and the positive sample set B determined in the previous step i Take the intersection and get the positive sample set B of the target subject after removing the false positive samples i ∩N i (marked with a dotted line in the lower right corner of the figure). i A set of nodes C with the same semantics from a global perspective i , and the positive sample set B determined in the previous step i Taking the intersection, we get the positive sample set B with the same global semantics i ∩C i (marked by a dotted line in the upper left corner of the figure). Taking the union of the above two sets, we get i , which considers both the node connection relationship and the global semantic positive sample set P i (In the figure, it is shown as the dark black solid circle contained in the upper left dotted box and the lower right dotted box), and is defined as follows:

[0095] P i =(B i ∩Ni )∪(B i ∩C i ) (4)

[0096] The method of determining the first intersection based on the direct neighbors of the target subject and the method of obtaining the globally identical semantic nodes with the target subject based on its cluster and then determining the second intersection have been introduced in the previous article and will not be repeated here.

[0097] In one scenario of the above implementation, K-Means is used to perform clustering processing on each of the second representations. Considering that the result of K-Means is related to the initialization of the cluster center, in order to ensure the robustness of the clustering processing, multiple rounds of K-Means clustering processing are performed on each of the second representations. Figure 2 In the K-means (C i )】.

[0098] It should be understood that the K-Means clustering process shown in this scenario does not represent a limitation on the embodiments of this specification. The clustering algorithm used in various implementations of the above embodiments is any algorithm that can divide a group of data objects into multiple clusters, so that the similarity between objects in the same cluster is high, while the similarity between objects in different clusters is low. Regarding the clustering algorithm, the embodiments of this specification do not list them one by one.

[0099] Through the above steps, for any target subject v i , we can get its similar subject set, that is, the positive sample set P i In the next step, the target subject v is calculated i With the positive sample set P i The representation similarity of each subject in is calculated, and the prediction loss is obtained accordingly, and the first image encoder is adjusted according to the prediction loss. The steps of this part will be explained in detail below.

[0100] Back to Figure 1 , in step S107: based on the similarity between each subject in the similar subject set, the prediction loss corresponding to the similar subject set is obtained.

[0101] In one embodiment, in order to compare the similarity between each first representation output by the first image encoder and each second representation output by the second image encoder, a mapping network q(·) is connected to the output end of the first image encoder. The mapping network can convert the feature matrix H composed of the first representation output by the first image encoder into θ , mapped to the output vector space of the second image encoder, and the mapping vector matrix obtained by the mapping network is recorded as Z θ The output of the mapping network is Figure 2 In (Zθ ,A) shows】, where any mapping vector is recorded as It is expressed as:

[0102] where the vector Represents any node v i The first sign of. (5)

[0103] It should be noted that the subscript θ of the mapping network q shown above is used to indicate that the mapping network is used to map the output of the first graph encoder of the parameter θ.

[0104] In one scenario of this embodiment, for any target subject v i , its first characterization The mapping vector obtained by processing the mapping network q And the corresponding positive sample set P i The second representation of each subject j in Calculate the cosine similarity and sum it to get the prediction loss. This step is to calculate the prediction loss for any target subject in the business relationship graph. For a business relationship graph containing N business subjects, the same processing method is used to calculate the corresponding prediction loss for all N business subjects and sum them. The prediction loss is used as the objective function of the first graph encoder training and can be expressed as follows:

[0105]

[0106] Among them, the vector It means that any target subject v i Any positive sample v j ∈P i , through the second image encoder f ξ After processing, the second representation is obtained.

[0107] In another scenario of this embodiment, based on the above prediction loss, a symmetrical prediction loss is calculated. Specifically, the positive sample set P i The first representation of any positive sample j in is used as the similarity calculation object, and it is passed through the mapping network q θ (·) The processed mapping vector With the target subject v i The second sign of Perform cosine similarity calculation to obtain a prediction loss that is symmetrical to the above prediction loss. The final prediction loss is obtained by summing up, which can be expressed as the objective function of the first image encoder as follows:

[0108]

[0109] The prediction loss introduced above can be used as the objective function for training the first graph encoder to train the first graph encoder. The training goal is to minimize the prediction loss between any target subject and its positive sample. Therefore, in step S109: according to the prediction loss, the first graph encoder is updated, and the first representation obtained is used to predict the risk of the business subject.

[0110] In one embodiment, the parameters θ of the first image encoder are set to minimize the prediction loss Update in the direction of . It can be expressed as:

[0111]

[0112] Wherein, η represents the learning rate of the first graph encoder. optimizer is the optimization algorithm of the first graph encoder, which can be any algorithm that can optimize the performance and training efficiency of the graph encoder according to the feedback of the objective function, for example, the stochastic gradient descent algorithm, the Adam optimization algorithm, etc., which is not specifically limited in the embodiments of this specification.

[0113] It is not difficult to know that if the same network parameters θ as those of the first image encoder are used in the mapping network, during the training of the first image encoder, the parameters of the mapping network will also be synchronously updated with the training of the first image encoder.

[0114] Finally, each first representation of the business relationship graph obtained by training the first graph encoder, that is, the expected business subject representation, can be applied to risk prediction.

[0115] In one scenario of the above embodiment, the second image encoder and the first image encoder have the same model structure, and after the parameters of the first image encoder are updated, the parameters of the second image encoder are also updated.

[0116] According to one implementation, the parameter update of the second image encoder is obtained by performing exponential moving average on the parameter θ of the first image encoder and the parameter ξ of the second image encoder, which is expressed as the following formula:

[0117] ξ←τξ+(1-τ)θ,τ∈[0,1](9)

[0118] In the process of updating the parameters of the second image encoder, the parameter τ is used to perform a weighted average of the updated parameters of the first image encoder and the current parameters of the second image encoder. When updating the parameters, the second image encoder not only considers the direction of the current gradient, but also considers the direction of the previous gradient, so that a certain inertia is maintained when the parameters are updated. In this way, the first image encoder avoids falling into a local optimal solution and causing model collapse when predicting the output of the second image encoder.

[0119] It should be understood that the role of the second graph encoder is to provide a reference training target for the first graph encoder. Therefore, in other scenarios of the above embodiments, the second graph encoder can also be a pre-trained graph encoder, or a preferred graph encoder for the current business relationship graph, with its output used as a reference for the first graph encoder during the training process, without the need to iteratively update its parameters as the first graph encoder is trained. This specification does not specifically limit the selection of the second graph encoder.

[0120] In this specification, the word "first" in the terms such as the first image encoder and the first representation, as well as the corresponding "second" (if any) in the text, are merely for the convenience of distinction and description and do not have any limiting meaning.

[0121] The foregoing describes certain embodiments of the present specification, and other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims may be performed in an order different from that in the embodiments, and the desired results may still be achieved. In addition, the processes depicted in the accompanying drawings do not necessarily have to be performed in the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0122] Figure 4 Schematic diagram of a training graph encoder according to an embodiment of the present specification. The apparatus 400 is deployed in a computing device, which can be implemented by any device, equipment, platform, device cluster, etc. with computing and processing capabilities. Figure 1 The device 400 includes:

[0123] The encoding module 401 is configured to input the business relationship graph into a first graph encoder and a second graph encoder respectively, to obtain a first representation and a second representation of each business subject represented by each node therein.

[0124] The neighbor search module 402 is configured to determine, for any target subject, in each second representation, K neighbor subjects corresponding to the K second representations that are closest to the first representation of the target subject.

[0125] The similar subject determination module 403 is configured to determine a similar subject set of the target subject based on the K neighboring subjects.

[0126] The loss calculation module 404 is configured to obtain the predicted loss corresponding to the similar subject set based on the similarity between the subjects in the similar subject set.

[0127] Update module 405: is configured to update the first graph encoder according to the predicted loss, and the first representation obtained is used to predict the risk of the business entity.

[0128] According to another embodiment of the present specification, there is also provided a computer program product, including a computer program / instruction, which implements the aforementioned combination when executed by a processor. Figure 1 The steps of the method.

[0129] According to another embodiment, the present specification further provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the aforementioned combination is implemented. Figure 1 The steps of the method.

[0130] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present invention may be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions may be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

[0131] The specific implementation methods described above further describe the purpose, technical solutions and beneficial effects of the embodiments of the present invention in detail. It should be understood that the above description is only a specific implementation method of the embodiments of the present invention and is not intended to limit the scope of protection of the present invention. Any modification, equivalent replacement, improvement, etc. made on the basis of the technical solution of the present invention shall be included in the scope of protection of the present invention.

Claims

1. A method for training a graph encoder, comprising: Inputting the business relationship graph into a first graph encoder and a second graph encoder respectively, to obtain a first representation and a second representation of each business subject represented by each node therein; For any target subject, in each second representation, determine K neighboring subjects corresponding to the K second representations closest to the first representation of the target subject; Based on the K neighboring entities, determine a similar entity set of the target entity; Based on the similarity between each subject in the similar subject set, obtaining the prediction loss corresponding to the similar subject set; The first graph encoder is updated according to the predicted loss, and the first representation obtained is used to predict the risk of the business entity.

2. The method according to claim 1, wherein: The business subject is a user, a merchant or a mini-program; the business relationship graph also includes edges representing business relationships between various business subjects, and the business relationships are transactions, transfers, social interactions or shared devices.

3. The method according to claim 1, wherein: The step of determining K neighboring entities corresponding to K second representations closest to the first representation of the target entity includes: For the first representation of the target subject, calculate the cosine similarity with the second representation of each business subject respectively; According to the order of cosine similarity, K neighbor entities corresponding to the first K second representations similar to the first representation are determined.

4. The method according to claim 1, wherein: The determining of a similar subject set of the target subject based on the K nearest neighbor subjects includes: Determining in the business relationship graph a number of direct neighbors connected to the target subject by edges; A first intersection between the K nearest neighbor entities and the plurality of direct neighbors is determined as the similar entity set.

5. The method according to claim 1, wherein: The determining of a similar subject set of the target subject based on the K nearest neighbor subjects includes: Determine a number of similar subjects included in a target cluster to which the target subject belongs among a plurality of clusters; wherein the plurality of clusters are obtained by clustering the respective second representations; A second intersection between the K neighboring subjects and the plurality of similar subjects is determined as the similar subject set.

6. The method according to claim 1, wherein: The determining of a similar subject set of the target subject based on the K neighboring subjects includes: Determine in the business relationship graph a number of direct neighbors connected to the target subject by edges, and determine a first intersection between the K neighboring subjects and the number of direct neighbors; Determine a number of similar subjects included in the target cluster to which the target subject belongs among the multiple clusters, and determine a second intersection between the K nearest neighbor subjects and the number of similar subjects; wherein the multiple clusters are obtained by clustering the respective second representations; The union of the first intersection and the second intersection is used as the similar subject set.

7. The method according to claim 5 or 6, wherein: The clustering of the second representations comprises: Multiple rounds of K-Means are used to perform clustering on the second representations.

8. The method according to claim 1, wherein: The similar subject set includes a subject pair consisting of a first subject and a second subject; and obtaining the prediction loss corresponding to the similar subject set includes: Inputting the first representation of the first subject into a mapping network to obtain a first mapping vector; Based on the first mapping vector and a second representation of the second subject, a first similarity of the subject pair is determined and included in the prediction loss.

9. The method according to claim 8, wherein: The obtaining of the prediction loss corresponding to the similar subject set also includes: Inputting the first representation of the second subject into the mapping network to obtain a second mapping vector; Based on the second mapping vector and a second representation of the first subject, a second similarity of the subject pair is determined and included in the prediction loss.

10. The method according to claim 8 or 9, wherein: The updating of the first graph encoder comprises: The parameters of the first graph encoder and the mapping network are updated in a direction to reduce the prediction loss.

11. The method according to claim 1, wherein: The first image encoder and the second image encoder have the same model structure; After the updating of the first image encoder, the method further comprises: The second image encoder is updated according to the parameter update of the first image encoder.

12. The method according to claim 11, wherein: The updating of the second graph encoder comprises: Perform exponential moving average on the parameters of the first image encoder and the parameters of the second image encoder to obtain updated parameters of the second image encoder.

13. A device for training a graph encoder, comprising: An encoding module: configured to input the business relationship graph into a first graph encoder and a second graph encoder respectively, to obtain a first representation and a second representation of each business subject represented by each node therein; A neighbor search module: configured to, for any target subject, determine, in each second representation, K neighbor subjects corresponding to the K second representations closest to the first representation of the target subject; A similar subject determination module: configured to determine a similar subject set of the target subject based on the K neighboring subjects; Loss calculation module: configured to obtain the predicted loss corresponding to the similar subject set based on the similarity between each subject in the similar subject set; Update module: configured to update the first graph encoder according to the predicted loss, and the first representation obtained is used to predict the risk of the business entity.

14. A computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 12.

15. A computing device comprising a memory and a processor, characterized in that: The memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 12 is implemented.