A model processing method, apparatus and device
By training a graph structure data sampling model using a meta-learning method and optimizing the model parameters using a gradient descent algorithm, the problem of low efficiency in processing large-scale graph structure data is solved, achieving a reduction in data size and an improvement in processing efficiency without affecting the task performance.
Patent Information
- Application Number
- CN202310251059.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-10
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2043-03-10
AI Technical Summary
Existing technologies suffer from high computational complexity and long processing time when dealing with large-scale graph structure data, making it difficult to effectively reduce the scale without affecting the performance of downstream tasks.
A meta-learning approach is used to construct the target model. The sampling model of the graph structure data is trained by gradient descent algorithm and loss function optimization. The model parameters are updated and backpropagation is performed using the first and second sample sets to ensure the consistency of the results of the sampled graph structure data in subsequent tasks.
While ensuring that the downstream task results remain basically unchanged, the scale of graph structure data is significantly reduced, thereby improving data processing efficiency.
Smart Images

Figure CN116451802B_ABST
Abstract
Description
Technical Field
[0001] This document relates to the field of computer technology, and in particular to a method, apparatus and device for processing a model. Background Technology
[0002] Graph data structures are frequently used in practical applications, but sometimes they become excessively large, requiring extensive and complex calculations and resulting in lengthy processing times. Therefore, a task-independent graph data sampling technique is needed. This technique could significantly reduce the size of the graph structure while minimizing the impact on downstream tasks, thereby greatly improving the efficiency of graph data processing. Summary of the Invention
[0003] The purpose of the embodiments in this specification is to provide a sampling technique for graph structure data that is independent of specific tasks, thereby significantly reducing the size of the graph structure while minimizing the impact on the downstream specific task performance, thus greatly improving the efficiency of graph structure data processing.
[0004] To achieve the above technical solution, the embodiments in this specification are implemented as follows:
[0005] This specification provides a model processing method, comprising: acquiring a first sample set and a second sample set, wherein the sample data in the first sample set and the second sample set are graph-structured data; inputting the sample data in the first sample set into a target model to obtain a first output result corresponding to the sample data in the first sample set; determining loss information corresponding to the first output result based on the first output result and a loss function corresponding to the target model; the target model being used to sample the graph-structured data; determining first model parameters of the target model based on the loss information corresponding to the first output result using a gradient descent algorithm, and updating the target model using the first model parameters to obtain an updated target model; inputting the sample data in the second sample set into the updated target model to obtain a second output result corresponding to the sample data in the second sample set; determining loss information corresponding to the second output result based on the second output result and a loss function corresponding to the updated target model; performing backpropagation on the updated target model based on the loss information corresponding to the second output result to obtain corresponding gradient information; and updating the model parameters of the target model based on the obtained gradient information.
[0006] This specification provides a model processing apparatus, comprising: a sample set acquisition module for acquiring a first sample set and a second sample set, wherein the sample data in the first and second sample sets are graph-structured data; a first processing module for inputting the sample data from the first sample set into a target model to obtain a first output result corresponding to the sample data in the first sample set, and determining loss information corresponding to the first output result based on the first output result and a loss function corresponding to the target model, wherein the target model is used to sample the graph-structured data; a second processing module for determining first model parameters of the target model using a gradient descent algorithm based on the loss information corresponding to the first output result, updating the target model using the first model parameters to obtain an updated target model, inputting the sample data from the second sample set into the updated target model to obtain a second output result corresponding to the sample data in the second sample set, and determining loss information corresponding to the second output result based on the second output result and a loss function corresponding to the updated target model; and an update module for backpropagating the updated target model based on the loss information corresponding to the second output result to obtain corresponding gradient information, and updating the model parameters of the target model based on the obtained gradient information.
[0007] This specification provides a model processing device comprising: a processor; and a memory arranged to store computer-executable instructions, wherein the executable instructions, when executed, cause the processor to: acquire a first sample set and a second sample set, wherein the sample data in the first sample set and the second sample set are graph-structured data; input the sample data in the first sample set into a target model to obtain a first output result corresponding to the sample data in the first sample set; determine loss information corresponding to the first output result based on the first output result and a loss function corresponding to the target model, wherein the target model is used to sample the graph-structured data; determine first model parameters of the target model based on the loss information corresponding to the first output result using a gradient descent algorithm, and update the target model using the first model parameters to obtain an updated target model; input the sample data in the second sample set into the updated target model to obtain a second output result corresponding to the sample data in the second sample set; determine loss information corresponding to the second output result based on the second output result and a loss function corresponding to the updated target model; perform backpropagation on the updated target model based on the loss information corresponding to the second output result to obtain corresponding gradient information; and update the model parameters of the target model based on the obtained gradient information.
[0008] This specification also provides a storage medium for storing computer-executable instructions. When executed by a processor, these instructions implement the following process: acquiring a first sample set and a second sample set, wherein the sample data in the first and second sample sets is graph-structured data; inputting the sample data from the first sample set into a target model to obtain a first output result corresponding to the sample data in the first sample set; determining loss information corresponding to the first output result based on the first output result and a loss function corresponding to the target model, wherein the target model is used to sample the graph-structured data; determining first model parameters of the target model based on the loss information corresponding to the first output result using a gradient descent algorithm, and updating the target model using the first model parameters to obtain an updated target model; inputting the sample data from the second sample set into the updated target model to obtain a second output result corresponding to the sample data in the second sample set; determining loss information corresponding to the second output result based on the second output result and a loss function corresponding to the updated target model; performing backpropagation on the updated target model based on the loss information corresponding to the second output result to obtain corresponding gradient information; and updating the model parameters of the target model based on the obtained gradient information. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 This is an embodiment of a model processing method described in this specification;
[0011] Figure 2 This is an embodiment of another model processing method described in this specification;
[0012] Figure 3 This is a schematic diagram of the training process of a target model in this specification;
[0013] Figure 4 This is a schematic diagram of a sampling process described in this specification;
[0014] Figure 5 This is yet another embodiment of the model processing method described in this specification;
[0015] Figure 6 This is an embodiment of a processing device for a model described in this specification;
[0016] Figure 7 This is an embodiment of a processing device for one model in this specification. Detailed Implementation
[0017] This specification provides a method, apparatus, and device for processing a model.
[0018] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.
[0019] Example 1
[0020] like Figure 1 As shown in the embodiments of this specification, a method for processing a model is provided. The execution subject of this method can be a terminal device or a server, etc. The terminal device can be a mobile terminal device such as a mobile phone or tablet computer, a computer device such as a laptop or desktop computer, or an IoT device (specifically, a smartwatch, an in-vehicle device, etc.). The server can be a single server or a server cluster composed of multiple servers. The server can be a backend server for financial or online shopping services, or a backend server for an application. This embodiment uses a server as the execution subject for detailed explanation. For the case where the execution subject is a terminal device, please refer to the following server-side processing, which will not be repeated here. The method may specifically include the following steps:
[0021] In step S102, a first sample set and a second sample set are obtained, and the sample data in the first sample set and the second sample set are graph structure data.
[0022] The first sample set can consist of one or more different sample data sets. Furthermore, in practical applications, the first sample set can also include multiple different sub-sample sets. The sample data in the first sample set can be divided into multiple parts, and the sample data for each part can be set in a corresponding sub-sample set. Thus, each sub-sample set can include one or more different sample data sets. Similarly, the second sample set can also consist of one or more different sample data sets. In practical applications, the second sample set can also consist of multiple different sub-sample sets, each of which can include one or more different sample data sets. The sample data in this embodiment is mainly graph structure data. This graph structure data can be any data with a graph structure, such as graph data or knowledge graph data, etc. The specific settings can be determined according to actual conditions, and this embodiment does not limit this. The graph structure data can include nodes and edges. Moreover, the graph structure data can be graph structure data containing a large number of nodes and / or edges, that is, the number of nodes contained in the graph structure data exceeds a preset node number threshold, and / or the number of edges contained in the graph structure data exceeds a preset edge number threshold.
[0023] In practice, graph-structured data is frequently used in real-world business scenarios. However, sometimes the graph structure becomes excessively large, requiring extensive and complex calculations and resulting in lengthy data processing times. Therefore, a task-independent graph-structured data sampling technique is needed. This technique can significantly reduce the size of the graph structure while minimizing the impact on downstream tasks, thereby greatly improving the efficiency of graph-structured data processing. This specification provides an optional processing method, which may include the following:
[0024] Graph structure data can be obtained in various ways depending on the actual situation. For example, graph structure data can be purchased from different users, or public graph structure data can be obtained from a specified database, or graph structure data can be crawled from the Internet using a web crawler, or relevant business-related data can be obtained for a specific business. The relevant data can be used to construct the corresponding graph structure data, etc. The specific settings can be set according to the actual situation, and the embodiments in this specification do not limit this.
[0025] After obtaining the graph structure data using the above method, multiple graph structure data partitioning ratios can be preset, such as 1:2 or 1:1.5. Then, the multiple graph structure data can be divided into two parts according to the above partitioning ratio. One part can be set as the first sample set, and the other part can be set as the second sample set. If the first and second sample sets include sub-sample sets, the sample data in the first and second sample sets can be divided according to the number of sub-sample sets to obtain multiple sub-sample sets. Specifically, the sub-sample sets can be divided using a method of not replacing the sample data (i.e., each sub-sample set contains different sample data), or the sub-sample sets can be divided using a method of replacing the sample data (i.e., different sub-sample sets may contain the same sample data). The specific method can be set according to the actual situation, and this embodiment does not limit this.
[0026] It should be noted that graph sampling (or graph sampling) can be the process of sampling large graph sample data to obtain relatively small graph sample data. However, it is necessary to ensure that the final result of the sampled graph sample data is basically consistent with the result of the graph sample data before sampling when performing subsequent specific tasks (or to ensure that the final result is not affected when performing subsequent specific tasks).
[0027] In step S104, the sample data in the first sample set is input into the target model to obtain the first output result corresponding to the sample data in the first sample set. Based on the first output result and the loss function corresponding to the target model, the loss information corresponding to the first output result is determined. The target model is used to perform sampling processing on graph structure data.
[0028] The target model can be a model used for sampling and processing graph-structured data. The target model can be constructed using various algorithms, such as deep neural network algorithms (specifically graph neural network algorithms), or GraphSAGE or PinSAGE algorithms. The specific model can be determined based on actual conditions, and this specification does not limit its implementation. The loss function corresponding to the target model can include various types, such as L1 loss function, L2 loss function, MSE loss function, cross-entropy loss function, etc. The specific loss function can be determined based on actual conditions, and this specification does not limit its implementation.
[0029] In practice, sampling graph-structured data is typically strongly correlated with subsequent specific tasks (i.e., highly correlated, meaning that when one component changes, the corresponding component is highly likely to increase (or decrease) (or its probability exceeds a preset threshold, such as 99% or 98%)). To make the sampling of graph-structured data independent of subsequent specific tasks, meta-learning can be used. Meta-learning enables the model to learn and adjust its parameters, allowing it to quickly learn new tasks based on existing knowledge. Compared to machine learning, which involves manually adjusting model parameters before directly training a machine learning model for a specific task, meta-learning first trains a better hyperparameter through other tasks and then trains it on the specific task, ultimately obtaining better model parameters. In meta-learning, the unit of model training is the task, typically consisting of two tasks: training tasks (also known as across tasks) and test tasks (also known as within tasks). The training task involves preparing multiple sub-tasks for learning, with the aim of acquiring better hyperparameters. The testing task uses the hyperparameters learned in the training task to train on a specific task. The training task provides multiple sub-training tasks, each with a dataset divided into a support set and a validation set. First, the model is trained using the support set for each sub-task, training the model parameters for each sub-task. Then, the model's performance is tested using the validation sets from different sub-tasks, and the corresponding loss information is calculated. Finally, gradient descent is used to calculate the gradients and update the model parameters, thus finding the optimal hyperparameter settings. The testing task can be similar to a typical machine learning process. The dataset can be divided into training and testing sets, and the prior knowledge of the better hyperparameters obtained above can be used to train on a specific test task, ultimately yielding better results.
[0030] Based on the above, meta-learning allows the sampling and processing of graph structure data to be independent of subsequent specific tasks. Therefore, a first sample set can be used to train the target model. Specifically, sample data from the first sample set can be input into the target model. The target model then samples and processes the graph structure data corresponding to the sample data, ultimately obtaining the first output result corresponding to the sample data in the first sample set. This first output result can be the sampled graph structure data. A corresponding loss function can be set based on the principle that "the final result of the sampled graph structure data is basically consistent with the result of the graph structure data before sampling when performing subsequent specific tasks (or it is necessary to ensure that the final result is not affected when performing subsequent specific tasks, etc.)". This set loss function can be used as the loss function of the target model. After obtaining the first output result in the above way, the corresponding loss information can be calculated based on the first output result and the loss function corresponding to the target model, ultimately obtaining the loss information corresponding to the first output result.
[0031] It should be noted that there are various ways to sample graph structure data using the target model. The specific method depends on the structure of the target model. For example, the target model can be used to calculate the importance of each node in the graph structure data, obtaining a quantitative score for each node's importance. Based on these scores, nodes with scores greater than a preset threshold can be selected, and the unselected nodes and edges connected to them can be deleted. The remaining graph structure data can then be used as the sampled graph structure data. Alternatively, the target model can be used to calculate the importance of each node in the graph structure data, obtaining a quantitative score for each node's importance. In addition to the score, the importance of each edge in the graph structure data can be calculated through the target model to obtain a quantitative score for the importance of each edge. By combining the obtained quantitative scores for node importance and edge importance, nodes with quantitative scores for node importance greater than a first preset threshold and edges with quantitative scores for edge importance greater than a second preset threshold can be selected from the graph structure data. At the same time, the nodes and edges in the graph structure data can be further filtered based on the structure of the graph structure data. Finally, suitable graph structure data can be obtained as the sampled graph structure data. The above are only two optional processing methods. In practical applications, there can be many other different processing methods, which can be set according to the actual situation. They will not be elaborated here.
[0032] In step S106, based on the loss information corresponding to the first output result, the first model parameters of the target model are determined by the gradient descent algorithm, and the target model is updated using the first model parameters. The sample data in the second sample set is input into the updated target model to obtain the second output result corresponding to the sample data in the second sample set. Based on the second output result and the loss function corresponding to the updated target model, the loss information corresponding to the second output result is determined.
[0033] The loss function corresponding to the updated target model can include various types, such as L1 loss function, L2 loss function, MSE loss function, cross-entropy loss function, etc., which can be set according to the actual situation. The loss function corresponding to the updated target model can be the same as or different from the loss function corresponding to the target model mentioned above, which can be set according to the actual situation. This specification does not limit this in the embodiments.
[0034] In implementation, instead of directly backpropagating the target model to update its parameters, a copy of the original model (i.e., the target model) can be made. Based on the loss information corresponding to the first output result, the first model parameters of the target model are calculated using the gradient descent algorithm. These first model parameters can then be used to update the target model, resulting in the updated target model. Next, sample data from the second sample set can be input into the updated target model. The updated target model then samples the graph structure data corresponding to the sample data in the second sample set, ultimately yielding the second output result, which can be the sampled graph structure data. The loss function can be set based on the principle that "the final result of the sampled graph structure data is basically consistent with the result of the graph structure data before sampling when performing subsequent specific tasks (or it is necessary to ensure that the final result is not affected when performing subsequent specific tasks)," and can be used as the loss function corresponding to the updated target model. After obtaining the second output result in the above manner, the corresponding loss information can be calculated based on the second output result and the loss function corresponding to the updated target model, ultimately yielding the loss information corresponding to the second output result.
[0035] In step S108, the updated target model is backpropagated based on the loss information corresponding to the second output result to obtain the corresponding gradient information, and the model parameters of the target model are updated based on the obtained gradient information.
[0036] In implementation, the updated target model can be backpropagated based on the loss information corresponding to the second output result to obtain the corresponding gradient information. The obtained gradient information can be used to update the model parameters of the target model, thereby obtaining the final target model, which is the final trained target model. This target model can be deployed in a specified business to sample large-scale graph structure data to obtain sampled graph structure data.
[0037] This specification provides a method for processing a model. By inputting graph structure data from a first sample set into a target model, a first output result is obtained. Then, based on the first output result and the loss function corresponding to the target model, loss information corresponding to the first output result is determined. Based on this loss information, a gradient descent algorithm is used to determine the first model parameters of the target model, and the target model is updated using these first model parameters. Graph structure data from a second sample set is then input into the updated target model to obtain a second output result. Based on the second output result and the loss function corresponding to the updated target model, loss information corresponding to the second output result is determined. Finally, backpropagation is performed on the updated target model based on the loss information corresponding to the second output result to obtain the corresponding gradient information. The model parameters of the target model are updated based on the obtained gradient information, thus obtaining the trained target model. In this way, using meta-learning (i.e., the above processing procedure) to train a network model for graph structure data sampling not only enables generalization to data from various task scenarios, making graph structure data sampling and processing independent of specific tasks, but also significantly reduces the size of the graph structure while minimizing the impact on downstream specific task performance, thereby greatly improving the efficiency of graph structure data processing.
[0038] Example 2
[0039] like Figure 2 As shown in the embodiments of this specification, a method for processing a model is provided. The execution subject of this method can be a terminal device or a server, etc. The terminal device can be a mobile terminal device such as a mobile phone or tablet computer, a computer device such as a laptop or desktop computer, or an IoT device (specifically, a smartwatch, an in-vehicle device, etc.). The server can be a single server or a server cluster composed of multiple servers. The server can be a backend server for financial or online shopping services, or a backend server for an application. This embodiment uses a server as the execution subject for detailed explanation. For the case where the execution subject is a terminal device, please refer to the following server-side processing, which will not be repeated here. The method may specifically include the following steps:
[0040] In step S202, a first sample set and a second sample set are obtained, and the sample data in the first sample set and the second sample set are graph structure data.
[0041] In order to ensure that the sampling processing of graph structure data is independent of subsequent specific tasks, the sample data in the first and second sample sets can include data generated by various tasks in the application scenario corresponding to the sample data as much as possible. In this embodiment, the sample data in the first and second sample sets can be set to include data generated by various tasks in the application scenario corresponding to the sample data. In practical applications, for meta-learning, such as... Figure 3 As shown, the first sample set can be a support set, and the second sample set can be a query set. The number of sample data contained in the first sample set and the second sample set has a certain ratio. For example, the ratio of the number of sample data contained in the first sample set to the number of sample data contained in the second sample set is 1:1 or 1:2, etc. The specific ratio can be set according to the actual situation.
[0042] The specific processing of step S202 above can be found in the relevant content of Embodiment 1 above, and will not be repeated here.
[0043] In step S204, the sample data in the first sample set is input into the target model to obtain the first output result corresponding to the sample data in the first sample set. Based on the first output result and the loss function corresponding to the target model, the loss information corresponding to the first output result is determined. The target model is used to perform sampling processing on graph structure data.
[0044] The target model includes sub-models constructed using a Multilayer Perceptron (MLP). For example, a three-layer perceptron may consist of three network layers: an input layer, a hidden layer, and an output layer, connected by fully connected layers. A five-layer perceptron may consist of five network layers: an input layer, three hidden layers, and an output layer. The appropriate number of network layers can be selected based on the specific needs. The loss function for the target model varies depending on the type of target model. Specifically, if the target model is for classification, the loss function can be the Mean Squared Error (MSE) loss function. However, in practice, other loss functions can also be used for classification models, depending on the specific requirements. If the target model is based on regression, the loss function can be the cross-entropy loss function. Again, other loss functions can be used for regression-based target models, depending on the specific requirements. Among them, regression-based models can be defined by the type of output variable. That is, the process of predicting continuous variables is called the regression-based model prediction process. The final prediction result of the regression-based model is a quantitative value.
[0045] In implementation, such as Figure 4 As shown, sample data from the first sample set can be input into the target model through its input layer. The target model converts each edge in the graph structure data corresponding to the sample data into embedding features. These embedding features are then input into a sub-model built on a multilayer perceptron. This sub-model processes the data and outputs an importance score for each edge in the graph structure data. Edges with scores greater than a preset threshold are selected based on their importance scores, while unselected edges are removed from the graph structure data. This sampling process yields the first output result corresponding to the sample data from the first sample set. The loss function corresponding to the target model can be used to calculate the loss on the first output result, thus obtaining the loss information.
[0046] In step S206, based on the loss information corresponding to the first output result, the first model parameters of the target model are determined by the gradient descent algorithm, and the target model is updated using the first model parameters. The sample data in the second sample set is input into the updated target model to obtain the second output result corresponding to the sample data in the second sample set. Based on the second output result and the loss function corresponding to the updated target model, the loss information corresponding to the second output result is determined.
[0047] The loss function corresponding to the updated target model can also be set according to different types of models. For example, if the updated target model is a classification model, the loss function corresponding to the updated target model can be the MSE loss function. If the updated target model is a regression-based model, the loss function corresponding to the updated target model can be the cross-entropy loss function, etc. The specific settings can also be determined according to the actual situation.
[0048] In implementation, such as Figure 3 As shown, based on the loss information corresponding to the first output result, the first model parameters of the target model can be determined using the gradient descent algorithm, and the target model can be updated using the first model parameters. The specific processing procedure can be found in the relevant content of the above embodiments, and will not be repeated here. Then, the sample data in the second sample set (i.e., the validation set QuerySet) can be input into the updated target model for a forward propagation to obtain the second output result corresponding to the sample data in the second sample set. Based on the second output result and the loss function corresponding to the updated target model, the loss information corresponding to the second output result can be calculated. Afterwards, as... Figure 3 As shown, the processing procedure can be repeated N times (where N is a positive integer greater than or equal to 1) to finally obtain the loss information set corresponding to the sample data in the second sample set.
[0049] In step S208, the updated target model is backpropagated based on the loss information corresponding to the second output result to obtain the corresponding gradient information, and the model parameters of the target model are updated based on the obtained gradient information.
[0050] In implementation, such as Figure 3 As shown, after completing the above processing and obtaining the loss information set corresponding to the sample data in the second sample set, a second gradient update can be performed using a gradient-by-gradient approach. That is, the loss information calculated last time from the loss information set corresponding to the sample data in the second sample set can be used to backpropagate the updated target model to obtain the corresponding gradient information. The obtained gradient information can then be directly applied to the original target model through a pre-defined optimization program (Optimizer) to obtain the updated model parameters. For example... Figure 3As shown, if the target model does not converge at this point, steps S202 to S208 can be repeated until the target model converges, thereby obtaining the final model parameters and the final trained target model. The final trained model can sample graph structure data and ensure that the final result of the sampled graph structure data is basically consistent with the result of the graph structure data before sampling when performing subsequent specific tasks (or that the final result is not affected when performing subsequent specific tasks, etc.).
[0051] After obtaining the trained target model through the above method, the graph structure data to be processed can be sampled based on the trained target model. For details, please refer to the processing steps S210 and S212 below.
[0052] In step S210, the target graph structure data to be processed is obtained, which includes nodes and edges.
[0053] In step S212, the target graph structure data is input into the pre-trained target model. The target model determines the importance score of each edge in the target graph structure data. Based on the importance score of each edge in the target graph structure data, the target graph structure data is sampled to obtain the sampled graph structure data corresponding to the target graph structure data. The similarity between the business processing result based on the sampled graph structure data and the business processing result based on the target graph structure data is greater than a preset threshold.
[0054] The preset threshold can be set according to the actual situation, such as 99% or 90%.
[0055] In implementation, such as Figure 4 As shown, the target graph structure data is input into a pre-trained target model. The target model converts each edge in the target graph structure data into an embedding feature. Then, the embedding feature corresponding to each edge is input into a sub-model built based on a multilayer perceptron. Through the processing of this sub-model, the importance score of each edge in the target graph structure data can be output. Then, by using a pre-set selection threshold, edges with scores greater than the selection threshold are selected. The graph structure data formed by the above edges can be used as the sampled graph structure data obtained after sampling the target graph structure data. Alternatively, a certain number of edges can be further selected from the above edges (such as randomly selecting a certain number of edges or selecting edges with larger scores again based on the size of the score value, etc.). The graph structure data formed by the finally selected edges can be used as the sampled graph structure data obtained after sampling the target graph structure data.
[0056] In step S212 above, the sampling processing of the target graph structure data based on the importance score of each edge in the target graph structure data can be performed in various ways to obtain the sampled graph structure data corresponding to the target graph structure data. The following provides another optional processing method, which may include the following: Based on the importance score of each edge in the target graph structure data, the target graph structure data is sampled using a reparameterization algorithm based on Gumbel-Softmax to obtain the sampled graph structure data corresponding to the target graph structure data.
[0057] Among them, the reparameterization algorithm based on Gumbel-Softmax can be used to reduce the difference between forward propagation and backward propagation. The reparameterization algorithm based on Gumbel-Softmax can introduce Gumbel noise into the original data distribution so that the data distribution can be approximated to a one-hot distribution after passing through Softmax. At the same time, the Gumbel noise also maintains the same sampling probability as the original data distribution.
[0058] In implementation, based on the importance score of each edge in the target graph structure data, multiple edges can be sampled from the target graph structure data according to probability using the techniques in the Gumbel-Softmax-based reparameterization algorithm. This allows for the sampling processing of the target graph structure data to obtain the sampled graph structure data corresponding to the target graph structure data.
[0059] The sampled graph structure data obtained through the above sampling method can be applied to subsequent business processing. For example, risk detection can be performed based on the sampled graph structure data, as detailed in step S214 below.
[0060] In step S214, the sampled graph structure data is input into the risk detection model to obtain a first node group in the sampled graph structure data that contains a preset risk. The first node group is the same as the second node group obtained by inputting the target graph structure data into the risk detection model.
[0061] The preset risks can include a variety of factors, such as fraud risk or illegal transactions. The specific risks can be set according to the actual situation, and the embodiments in this specification do not limit them.
[0062] In implementation, the sampled graph structure data can be input into the risk detection model to obtain the first node group with preset risks in the sampled graph structure data. If the target graph structure data is input into the risk detection model to obtain the second node group with preset risks in the sampled graph structure data, then the first node group should be the same as the second node group. This ensures that the final result of the sampled graph structure data is basically consistent with the result of the graph structure data before sampling when performing subsequent specific tasks (or ensures that the final result is not affected when performing subsequent specific tasks, etc.).
[0063] This specification provides a method for processing a model. By inputting graph structure data from a first sample set into a target model, a first output result is obtained. Then, based on the first output result and the loss function corresponding to the target model, loss information corresponding to the first output result is determined. Based on this loss information, a gradient descent algorithm is used to determine the first model parameters of the target model, and the target model is updated using these first model parameters. Graph structure data from a second sample set is then input into the updated target model to obtain a second output result. Based on the second output result and the loss function corresponding to the updated target model, loss information corresponding to the second output result is determined. Finally, backpropagation is performed on the updated target model based on the loss information corresponding to the second output result to obtain the corresponding gradient information. The model parameters of the target model are updated based on the obtained gradient information, thus obtaining the trained target model. In this way, using meta-learning (i.e., the above processing procedure) to train a network model for graph structure data sampling not only enables generalization to data from various task scenarios, making graph structure data sampling and processing independent of specific tasks, but also significantly reduces the size of the graph structure while minimizing the impact on downstream specific task performance, thereby greatly improving the efficiency of graph structure data processing.
[0064] Example 3
[0065] like Figure 5As shown in the embodiments of this specification, a method for processing a model is provided. The execution subject of this method can be a terminal device or a server, etc. The terminal device can be a mobile terminal device such as a mobile phone or tablet computer, a computer device such as a laptop or desktop computer, or an IoT device (specifically, a smartwatch, an in-vehicle device, etc.). The server can be a single server or a server cluster composed of multiple servers. The server can be a backend server for financial or online shopping services, or a backend server for an application. This embodiment uses a server as the execution subject for detailed explanation. For the case where the execution subject is a terminal device, please refer to the following server-side processing, which will not be repeated here. The method may specifically include the following steps:
[0066] In step S502, a first sample set and a second sample set are obtained. The sample data in the first sample set and the second sample set are graph structure data. The nodes in the graph structure data are constructed from the account information of the transactions. The edges in the graph structure data are constructed from the information of the transaction data generated between two different accounts. The weights of the edges in the graph structure data are determined based on the resource information in the transaction data generated between two different accounts.
[0067] In order to ensure that the sampling and processing of graph structure data is independent of subsequent specific tasks, the graph structure data in the first and second sample sets can include as much data as possible generated by various tasks in the application scenarios corresponding to the sample data.
[0068] The specific processing of step S502 can be found in the relevant content of the above embodiments, and will not be repeated here.
[0069] In step S504, the graph structure data in the first sample set is input into the target model to obtain the first sampling result corresponding to the graph structure data in the first sample set. Based on the first sampling result and the loss function corresponding to the target model, the loss information corresponding to the first sampling result is determined. The target model is used to perform sampling processing on the graph structure data.
[0070] The target model includes sub-models constructed using a multilayer perceptron (MLP). If the target model is for classification, the loss function can be the mean squared error (MSE) loss function; if the target model is a regression-based model, the loss function can be the cross-entropy loss function.
[0071] In step S506, based on the loss information corresponding to the first sampling result, the first model parameters of the target model are determined by the gradient descent algorithm, and the target model is updated using the first model parameters. The graph structure data in the second sample set is input into the updated target model to obtain the second sampling result corresponding to the graph structure data in the second sample set. Based on the second sampling result and the loss function corresponding to the updated target model, the loss information corresponding to the second sampling result is determined.
[0072] In step S508, the updated target model is backpropagated based on the loss information corresponding to the second sampling result to obtain the corresponding gradient information, and the model parameters of the target model are updated based on the obtained gradient information.
[0073] If the target model does not converge at this point, the above steps S502 to S508 can be repeated until the target model converges, thereby obtaining the final model parameters and the final trained target model.
[0074] After obtaining the trained target model through the above method, the graph structure data to be processed can be sampled based on the trained target model. For details, please refer to the processing steps S510 and S512 below.
[0075] In step S510, the target graph structure data to be processed is obtained. The target graph structure data includes nodes and edges. The nodes in the target graph structure data are constructed from the account information of the transactions. The edges in the target graph structure data are constructed from the information of the transaction data generated between two different accounts. The weight of the edges in the target graph structure data is determined based on the resource information in the transaction data generated between two different accounts.
[0076] In step S512, the target graph structure data is input into the pre-trained target model. The target model determines the importance score of each edge in the target graph structure data. Based on the importance score of each edge in the target graph structure data, the target graph structure data is sampled using a Gumbel-Softmax reparameterization algorithm to obtain the sampled graph structure data corresponding to the target graph structure data. The similarity between the business processing result based on the sampled graph structure data and the business processing result based on the target graph structure data is greater than a preset threshold.
[0077] The sampled graph structure data obtained by sampling in the above manner can be applied to subsequent business processing. For details, please refer to step S514 below.
[0078] In step S514, the sampled graph structure data is input into the risk detection model to obtain a first node group in the sampled graph structure data that contains a preset transaction risk. The first node group is the same as the second node group obtained by inputting the target graph structure data into the risk detection model.
[0079] This specification provides a method for processing a model. By inputting graph structure data from a first sample set into a target model, a first output result is obtained. Then, based on the first output result and the loss function corresponding to the target model, loss information corresponding to the first output result is determined. Based on this loss information, a gradient descent algorithm is used to determine the first model parameters of the target model, and the target model is updated using these first model parameters. Graph structure data from a second sample set is then input into the updated target model to obtain a second output result. Based on the second output result and the loss function corresponding to the updated target model, loss information corresponding to the second output result is determined. Finally, backpropagation is performed on the updated target model based on the loss information corresponding to the second output result to obtain the corresponding gradient information. The model parameters of the target model are updated based on the obtained gradient information, thus obtaining the trained target model. In this way, using meta-learning (i.e., the above processing procedure) to train a network model for graph structure data sampling not only enables generalization to data from various task scenarios, making graph structure data sampling and processing independent of specific tasks, but also significantly reduces the size of the graph structure while minimizing the impact on downstream specific task performance, thereby greatly improving the efficiency of graph structure data processing.
[0080] Example 4
[0081] The above describes the model processing method provided in the embodiments of this specification. Based on the same idea, the embodiments of this specification also provide a model processing device, such as... Figure 6 As shown.
[0082] The processing device for this model includes: a sample set acquisition module 601, a first processing module 602, a second processing module 603, and an update module 604, wherein:
[0083] The sample set acquisition module 601 acquires a first sample set and a second sample set, wherein the sample data in the first sample set and the second sample set are graph structure data;
[0084] The first processing module 602 inputs the sample data from the first sample set into the target model to obtain the first output result corresponding to the sample data in the first sample set. Based on the first output result and the loss function corresponding to the target model, it determines the loss information corresponding to the first output result. The target model is used to perform sampling processing on graph structure data.
[0085] The second processing module 603 determines the first model parameters of the target model based on the loss information corresponding to the first output result using a gradient descent algorithm, updates the target model using the first model parameters to obtain an updated target model, inputs the sample data from the second sample set into the updated target model to obtain a second output result corresponding to the sample data from the second sample set, and determines the loss information corresponding to the second output result based on the second output result and the loss function corresponding to the updated target model.
[0086] The update module 604 performs backpropagation on the updated target model based on the loss information corresponding to the second output result to obtain the corresponding gradient information, and updates the model parameters of the target model based on the obtained gradient information.
[0087] In the embodiments described in this specification, the device further includes:
[0088] The data acquisition module acquires the target graph structure data to be processed, which includes nodes and edges;
[0089] The sampling module inputs the target graph structure data into a pre-trained target model, determines the importance score of each edge in the target graph structure data through the target model, and performs sampling processing on the target graph structure data based on the importance score of each edge in the target graph structure data to obtain sampled graph structure data corresponding to the target graph structure data. The similarity between the business processing result based on the sampled graph structure data and the business processing result based on the target graph structure data is greater than a preset threshold.
[0090] In the embodiments of this specification, the sampling module, based on the importance score of each edge in the target graph structure data, performs sampling processing on the target graph structure data using a reparameterization algorithm based on Gumbel-Softmax to obtain the sampled graph structure data corresponding to the target graph structure data.
[0091] In the embodiments of this specification, the nodes in the graph structure data are constructed from the account information of the transactions, the edges in the graph structure data are constructed from the information of the transaction data generated between two different accounts, and the weights of the edges in the graph structure data are determined based on the resource information in the transaction data generated between two different accounts.
[0092] In the embodiments described in this specification, the device further includes:
[0093] The risk detection module inputs the sampled graph structure data into the risk detection model to obtain a first node group in the sampled graph structure data that contains a preset risk. The first node group is the same as the second node group obtained by inputting the target graph structure data into the risk detection model.
[0094] In the embodiments described in this specification, the target model includes a sub-model constructed by a multilayer perceptron.
[0095] In the embodiments of this specification, if the target model is a model for classification, the loss function corresponding to the target model is the MSE loss function; if the target model is a regression-based model, the loss function corresponding to the target model is the cross-entropy loss function.
[0096] In the embodiments of this specification, the sample data in the first sample set and the second sample set includes data generated by various tasks in the application scenarios corresponding to the sample data.
[0097] This specification provides a model processing apparatus that inputs graph structure data from a first sample set into a target model to obtain a first output result. Then, based on the first output result and the loss function corresponding to the target model, loss information corresponding to the first output result is determined. Based on the loss information corresponding to the first output result, a gradient descent algorithm is used to determine the first model parameters of the target model, and the target model is updated using the first model parameters. Graph structure data from a second sample set is input into the updated target model to obtain a second output result. Based on the second output result and the loss function corresponding to the updated target model, loss information corresponding to the second output result is determined. Finally, backpropagation is performed on the updated target model based on the loss information corresponding to the second output result to obtain the corresponding gradient information. The model parameters of the target model are updated based on the obtained gradient information, thereby obtaining the trained target model. In this way, by using the meta-learning processing method (i.e., the above processing procedure) to train a network model for graph structure data sampling, it is possible to generalize to data from various task scenarios, making the sampling and processing of graph structure data independent of specific tasks. This allows for a significant reduction in the size of the graph structure while minimizing the impact on the downstream specific task performance, thus greatly improving the efficiency of graph structure data processing.
[0098] Example 5
[0099] The above describes the model processing apparatus provided in the embodiments of this specification. Based on the same idea, the embodiments of this specification also provide a model processing device, such as... Figure 7 As shown.
[0100] The processing device for the model can be a terminal device or a server, as described in the above embodiments.
[0101] The processing device of the model can vary considerably due to differences in configuration or performance, and may include one or more processors 701 and memory 702. Memory 702 may store one or more application programs or data. Memory 702 may be temporary or persistent storage. The application programs stored in memory 702 may include one or more modules (not shown in the figures), each module including a series of computer-executable instructions for the model's processing device. Furthermore, processor 701 may be configured to communicate with memory 702 and execute the series of computer-executable instructions in memory 702 on the model's processing device. The model's processing device may also include one or more power supplies 703, one or more wired or wireless network interfaces 704, one or more input / output interfaces 705, and one or more keyboards 706.
[0102] Specifically, in this embodiment, the processing device for the model includes a memory and one or more programs, wherein one or more programs are stored in the memory, and one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the processing device of the model, and is configured to be executed by one or more processors. The one or more programs include computer-executable instructions for performing the following:
[0103] Obtain a first sample set and a second sample set, wherein the sample data in the first sample set and the second sample set are graph structure data;
[0104] The sample data in the first sample set is input into the target model to obtain the first output result corresponding to the sample data in the first sample set. Based on the first output result and the loss function corresponding to the target model, the loss information corresponding to the first output result is determined. The target model is used to perform sampling processing on graph structure data.
[0105] Based on the loss information corresponding to the first output result, the first model parameters of the target model are determined by the gradient descent algorithm, and the target model is updated using the first model parameters to obtain the updated target model. The sample data in the second sample set is input into the updated target model to obtain the second output result corresponding to the sample data in the second sample set. Based on the second output result and the loss function corresponding to the updated target model, the loss information corresponding to the second output result is determined.
[0106] Based on the loss information corresponding to the second output result, backpropagation is performed on the updated target model to obtain the corresponding gradient information, and the model parameters of the target model are updated based on the obtained gradient information.
[0107] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments for processing the model are relatively simple in description because they are fundamentally similar to the method embodiments; relevant parts can be referred to the descriptions in the method embodiments.
[0108] This specification provides a model processing device that inputs graph structure data from a first sample set into a target model to obtain a first output result. Then, based on the first output result and the loss function corresponding to the target model, loss information corresponding to the first output result is determined. Based on the loss information corresponding to the first output result, a gradient descent algorithm is used to determine the first model parameters of the target model, and the target model is updated using the first model parameters. Graph structure data from a second sample set is input into the updated target model to obtain a second output result. Based on the second output result and the loss function corresponding to the updated target model, loss information corresponding to the second output result is determined. Finally, backpropagation is performed on the updated target model based on the loss information corresponding to the second output result to obtain the corresponding gradient information. The model parameters of the target model are updated based on the obtained gradient information, thereby obtaining the trained target model. In this way, by using the meta-learning processing method (i.e., the above processing procedure) to train a network model for graph structure data sampling, it is possible to generalize to data from various task scenarios, making the sampling and processing of graph structure data independent of specific tasks. This allows for a significant reduction in the size of the graph structure while ensuring that the downstream specific task performance is minimally affected, thereby greatly improving the efficiency of graph structure data processing.
[0109] Example 6
[0110] Furthermore, based on the above Figures 1 to 5 The method shown in this specification, along with one or more embodiments, also provides a storage medium for storing computer-executable instruction information. In one specific embodiment, the storage medium can be a USB flash drive, optical disc, hard disk, etc. When the computer-executable instruction information stored in the storage medium is executed by a processor, it can achieve the following process:
[0111] Obtain a first sample set and a second sample set, wherein the sample data in the first sample set and the second sample set are graph structure data;
[0112] The sample data in the first sample set is input into the target model to obtain the first output result corresponding to the sample data in the first sample set. Based on the first output result and the loss function corresponding to the target model, the loss information corresponding to the first output result is determined. The target model is used to perform sampling processing on graph structure data.
[0113] Based on the loss information corresponding to the first output result, the first model parameters of the target model are determined by the gradient descent algorithm, and the target model is updated using the first model parameters to obtain the updated target model. The sample data in the second sample set is input into the updated target model to obtain the second output result corresponding to the sample data in the second sample set. Based on the second output result and the loss function corresponding to the updated target model, the loss information corresponding to the second output result is determined.
[0114] Based on the loss information corresponding to the second output result, backpropagation is performed on the updated target model to obtain the corresponding gradient information, and the model parameters of the target model are updated based on the obtained gradient information.
[0115] 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 above-described storage medium embodiment is basically similar to the method embodiment, so the description is relatively simple; relevant parts can be referred to the description of the method embodiment.
[0116] This specification provides a storage medium that inputs graph structure data from a first sample set into a target model to obtain a first output result. Then, based on the first output result and the loss function corresponding to the target model, loss information corresponding to the first output result is determined. Based on the loss information corresponding to the first output result, a gradient descent algorithm is used to determine the first model parameters of the target model, and the target model is updated using the first model parameters. Graph structure data from a second sample set is input into the updated target model to obtain a second output result. Based on the second output result and the loss function corresponding to the updated target model, loss information corresponding to the second output result is determined. Finally, backpropagation is performed on the updated target model based on the loss information corresponding to the second output result to obtain the corresponding gradient information. The model parameters of the target model are updated based on the obtained gradient information, thereby obtaining the trained target model. In this way, by using the meta-learning processing method (i.e., the above processing procedure) to train a network model for graph structure data sampling, it is possible to generalize to data from various task scenarios, making the sampling and processing of graph structure data independent of specific tasks. This allows for a significant reduction in the size of the graph structure while ensuring that the performance of downstream specific tasks is minimally affected, thereby greatly improving the efficiency of graph structure data processing.
[0117] 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.
[0118] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must also be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0119] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0120] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0121] For ease of description, the above apparatus is described by dividing it into various functional units. Of course, when implementing one or more embodiments of this specification, the functions of each unit can be implemented in one or more software and / or hardware.
[0122] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, one or more embodiments of this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0123] Embodiments in this specification are described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this specification. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable parallel device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable parallel device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0124] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable fraud device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0125] These computer program instructions can also be loaded onto a computer or other programmable device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0126] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0127] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0128] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0129] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0130] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, one or more embodiments of this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0131] One or more embodiments of this specification can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a particular task or implement a particular abstract data type. One or more embodiments of this specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0132] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0133] The above description is merely an embodiment of this specification and is not intended to limit this application. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this specification.
Claims
1. A method for processing a model, the method comprising: Obtain a first sample set and a second sample set. The sample data in the first sample set and the second sample set are graph structure data. The first sample set is the support set and the second sample set is the validation set. The sample data in the first sample set is input into the target model to obtain the first output result corresponding to the sample data in the first sample set. Based on the first output result and the loss function corresponding to the target model, the loss information corresponding to the first output result is determined. The target model is used to perform sampling processing on graph structure data. Based on the loss information corresponding to the first output result, the first model parameters of the target model are determined by the gradient descent algorithm, and the target model is updated using the first model parameters to obtain the updated target model. The sample data in the second sample set is input into the updated target model to obtain the second output result corresponding to the sample data in the second sample set. Based on the second output result and the loss function corresponding to the updated target model, the loss information corresponding to the second output result is determined. Based on the loss information corresponding to the second output result, backpropagation is performed on the updated target model to obtain the corresponding gradient information, and the model parameters of the target model are updated based on the obtained gradient information.
2. The method according to claim 1, further comprising: Obtain the target graph structure data to be processed, wherein the target graph structure data includes nodes and edges; The target graph structure data is input into a pre-trained target model. The target model determines the importance score of each edge in the target graph structure data. Based on the importance score of each edge in the target graph structure data, the target graph structure data is sampled to obtain sampled graph structure data corresponding to the target graph structure data. The similarity between the business processing result based on the sampled graph structure data and the business processing result based on the target graph structure data is greater than a preset threshold.
3. The method according to claim 2, wherein sampling the target graph structure data based on the importance score of each edge in the target graph structure data to obtain sampled graph structure data corresponding to the target graph structure data includes: Based on the importance score of each edge in the target graph structure data, the target graph structure data is sampled using a Gumbel-Softmax-based reparameterization algorithm to obtain the sampled graph structure data corresponding to the target graph structure data.
4. The method according to claim 2, wherein the nodes in the graph structure data are constructed from the account information of the transactions, the edges in the graph structure data are constructed from the information of the transaction data generated between two different accounts, and the weights of the edges in the graph structure data are determined based on the resource information in the transaction data generated between two different accounts.
5. The method according to claim 4, further comprising: The sampled graph structure data is input into the risk detection model to obtain a first node group in the sampled graph structure data that contains a preset risk. The first node group is the same as the second node group obtained by inputting the target graph structure data into the risk detection model.
6. The method according to claim 1, wherein the target model includes a sub-model constructed by a multilayer perceptron.
7. The method according to claim 1, wherein if the target model is a model for classification, the loss function corresponding to the target model is the MSE loss function; and if the target model is a regression-based model, the loss function corresponding to the target model is the cross-entropy loss function.
8. The method according to claim 1, wherein the sample data in the first sample set and the second sample set includes data generated by various tasks in the application scenario corresponding to the sample data.
9. A model processing apparatus, the apparatus comprising: The sample set acquisition module acquires a first sample set and a second sample set. The sample data in the first sample set and the second sample set are graph structure data. The first sample set is the support set, and the second sample set is the validation set. The first processing module inputs the sample data from the first sample set into the target model to obtain the first output result corresponding to the sample data in the first sample set. Based on the first output result and the loss function corresponding to the target model, it determines the loss information corresponding to the first output result. The target model is used to perform sampling processing on graph structure data. The second processing module determines the first model parameters of the target model based on the loss information corresponding to the first output result using the gradient descent algorithm, updates the target model using the first model parameters to obtain the updated target model, inputs the sample data from the second sample set into the updated target model to obtain the second output result corresponding to the sample data from the second sample set, and determines the loss information corresponding to the second output result based on the second output result and the loss function corresponding to the updated target model. The update module performs backpropagation on the updated target model based on the loss information corresponding to the second output result to obtain the corresponding gradient information, and updates the model parameters of the target model based on the obtained gradient information.
10. A model processing apparatus, the model processing apparatus comprising: processor; as well as A memory configured to store computer-executable instructions, which, when executed, cause the processor to: Obtain a first sample set and a second sample set. The sample data in the first sample set and the second sample set are graph structure data. The first sample set is the support set and the second sample set is the validation set. The sample data in the first sample set is input into the target model to obtain the first output result corresponding to the sample data in the first sample set. Based on the first output result and the loss function corresponding to the target model, the loss information corresponding to the first output result is determined. The target model is used to perform sampling processing on graph structure data. Based on the loss information corresponding to the first output result, the first model parameters of the target model are determined by the gradient descent algorithm, and the target model is updated using the first model parameters to obtain the updated target model. The sample data in the second sample set is input into the updated target model to obtain the second output result corresponding to the sample data in the second sample set. Based on the second output result and the loss function corresponding to the updated target model, the loss information corresponding to the second output result is determined. Based on the loss information corresponding to the second output result, backpropagation is performed on the updated target model to obtain the corresponding gradient information, and the model parameters of the target model are updated based on the obtained gradient information.
Citation Information
Patent Citations
Classification method and device based on graph structure evolution
CN114021619A
Data processing method and device, equipment and medium
CN115358411A
Medical field question and answer algorithm based on graph attention mechanism
CN115757717A