Model training method, device and electronic equipment

By labeling labelless samples based on label samples and using semi-supervised loss functions, the graph embedded model is generated, which solves the problem of manual labeling errors in graph structure model training, and improves the model training accuracy and efficiency.

CN115392335BActive Publication Date: 2025-08-26BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210509832.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-11
Publication Date
2025-08-26
Estimated Expiration
2042-05-11

AI Technical Summary

Technical Problem

In the prior art, label-free sample annotation relies on manual when training the graph structure model, resulting in a high label error rate and reducing the model training accuracy and accuracy.

Method used

Label-free samples are labeled based on label samples, combined with the semi-supervised loss function, by calculating the sample distance and weight ratio, updating the weight ratio until the loss value is less than the preset value, and a graph embedded model is generated.

Benefits of technology

The training accuracy and generation efficiency of graph embedding models are improved, manual labeling errors are avoided, and the application of graph embedding algorithm in semi-supervised learning tasks is realized.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115392335B_ABST
    Figure CN115392335B_ABST
Patent Text Reader

Abstract

The present disclosure provides a model training method, device and electronic device, which relate to the field of computer technology, and in particular to the field of deep learning. The specific implementation scheme is as follows: obtaining labeled samples and unlabeled samples, and labeling the unlabeled samples based on the labeled samples to obtain labeled unlabeled samples; combining the labeled samples and the labeled unlabeled samples to obtain initial labeled samples; calculating the loss value of the semi-supervised loss function based on the sample distance between multiple sample data in the initial labeled samples and the weight ratio between sample data of different label types; updating the weight ratio, and updating the initial labeled sample based on the updated weight ratio until the loss value is less than a preset value, obtaining a target labeled sample based on the updated initial labeled sample; training the preset model based on the target labeled sample to obtain a graph embedding model, which is used to determine the graph embedding features that characterize the risk level of the object to be analyzed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, in particular to the field of deep learning, and specifically to a model training method, device, and electronic device. Background Art

[0002] Graph structure is a mathematical model that uses nodes and edges to represent relationships. In reality, graph structure can be widely used in scenarios such as social networks, word coexistence networks, and communication networks. By analyzing graph structure, we can gain a deeper understanding of social structure, language, and different communication patterns. Therefore, Figure 1 It has always been a hot topic of research in academia.

[0003] However, in practical applications, when training graph embedding models corresponding to graph structures, training samples need to be labeled. Training samples typically include both unlabeled and labeled samples, with the majority of unlabeled data. Therefore, unlabeled data needs to be labeled. Existing techniques for labeling unlabeled data rely on manual labeling, which increases the workload for labelers and can also lead to errors.

[0004] It can be seen that the training samples annotated using the existing annotation method reduce the accuracy of model training, thereby reducing the accuracy of model analysis data. Summary of the Invention

[0005] The present disclosure provides a method, apparatus, and electronic device for model training.

[0006] According to one aspect of the present disclosure, a model training method is provided, including: obtaining labeled samples and unlabeled samples, and labeling the unlabeled samples based on the labeled samples to obtain labeled unlabeled samples; combining the labeled samples and the labeled unlabeled samples to obtain initial labeled samples; calculating a loss value of a semi-supervised loss function based on the sample distance between multiple sample data in the initial labeled samples and the weight ratio between sample data of different label types; updating the weight ratio, and updating the initial labeled samples based on the updated weight ratio until the loss value is less than a preset value, and obtaining a target labeled sample based on the updated initial labeled sample; training a preset model based on the target labeled sample to obtain a graph embedding model, wherein the graph embedding model is used to determine the graph embedding features of the object to be analyzed, and the graph embedding features represent the risk level of the object to be analyzed.

[0007] From the above content, it can be seen that the present disclosure adopts a method of data labeling for unlabeled samples based on labeled samples, which avoids the problems of mislabeling and missing labels existing in manual labeling in the prior art, thereby improving the accuracy of training samples and further improving the accuracy of model training. In addition, a semi-supervised loss function is adopted to realize the application of graph embedding algorithms in semi-supervised learning tasks. Generating a graph embedding model based on a semi-supervised loss function not only avoids the problem of high computing power requirements of the direct learning algorithm, but also improves the generation efficiency of the graph embedding model. Finally, since the weight ratio is determined based on the number of samples, the process of updating the weight ratio is actually the process of updating sample data of different label types, that is, in the present disclosure, by updating sample data of different label types, the positive and negative samples are balanced, thereby improving the training accuracy of the graph embedding model.

[0008] It can be seen that the solution provided by the present disclosure achieves the purpose of generating a graph embedding model, thereby achieving the effect of improving the training accuracy of the graph embedding model, and thus avoiding the problem of poor training accuracy of the graph embedding model existing in the prior art.

[0009] According to another aspect of the present disclosure, a model training device is provided, including: an acquisition module for acquiring labeled samples and unlabeled samples, and labeling the unlabeled samples based on the labeled samples to obtain labeled unlabeled samples; a combination module for combining the labeled samples and the labeled unlabeled samples to obtain initial labeled samples; a calculation module for calculating the loss value of a semi-supervised loss function based on the sample distance between multiple sample data in the initial labeled samples and the weight ratio between sample data of different label types; an update module for updating the weight ratio and updating the initial labeled samples based on the updated weight ratio until the loss value is less than a preset value, and obtaining a target labeled sample based on the updated initial labeled sample; a training module for training a preset model based on the target labeled sample to obtain a graph embedding model, wherein the graph embedding model is used to determine the graph embedding features of the object to be analyzed, and the graph embedding features represent the risk level of the object to be analyzed.

[0010] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the above-mentioned model training method.

[0011] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the above-mentioned model training method.

[0012] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, which implements the above-mentioned model training method when executed by a processor.

[0013] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.

[0015] Figure 1 is a flowchart of a model training method according to the first embodiment of the present disclosure;

[0016] Figure 2 is a flowchart of a model training method according to a second embodiment of the present disclosure;

[0017] Figure 3 is a block diagram of analyzing an object to be analyzed based on a graph embedding model according to a third embodiment of the present disclosure;

[0018] Figure 4 is a schematic diagram of a model training device according to a fourth embodiment of the present disclosure;

[0019] Figure 5 It is a block diagram of an electronic device used to implement the model training method of an embodiment of the present disclosure. DETAILED DESCRIPTION

[0020] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0021] It should be noted that the acquisition, storage and application of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0022] Example 1

[0023] According to an embodiment of the present disclosure, the present disclosure provides a model training method, wherein the terminal device can be used as the execution subject of the method provided by this embodiment, such as Figure 1 As shown, the method includes the following steps:

[0024] Step S102: Obtain labeled samples and unlabeled samples, and label the unlabeled samples based on the labeled samples to obtain labeled unlabeled samples.

[0025] In step S102, labeled samples represent labeled training samples, and unlabeled samples represent unlabeled training samples. Labeled samples can be divided into positive samples and negative samples. For example, in a risk control scenario, positive samples represent relevant information about objects that appear on the risk control list, while negative samples represent relevant information about objects that do not appear on the risk control list.

[0026] Optionally, the terminal device may read labeled samples and unlabeled samples from the data source, and calculate the similarity between each sample data in the labeled sample and each sample data in the unlabeled sample, and label each sample data in the unlabeled sample based on the similarity, thereby achieving labeling of the unlabeled samples. For example, in the process of labeling each sample data in the unlabeled sample, the terminal device reads the sample data to be labeled from the unlabeled sample, and then calculates the similarity between the sample data to be labeled and each sample data in the labeled sample, and determines the target sample data with the greatest similarity from the labeled sample, and then determines the label type corresponding to the target sample data, and labels the sample data to be labeled based on the label type, that is, the label type corresponding to the sample data to be labeled is the label type corresponding to the target sample data.

[0027] It should be noted that the method of labeling unlabeled samples based on labeled samples avoids the problems of mislabeling and missing labels in manual labeling in the existing technology, thereby improving the accuracy of training samples and further improving the accuracy of model training.

[0028] Step S104: Combine the labeled samples and the labeled unlabeled samples to obtain initial labeled samples.

[0029] In step S104, after labeling the unlabeled samples, the terminal device mixes the labeled samples and the labeled unlabeled samples in the same sample set to obtain initial labeled samples, that is, in the initial labeled samples, each sample data has a label.

[0030] It should be noted that by combining the labeled samples and the labeled unlabeled samples, it is possible to combine all the labeled sample data, and then use the combined labeled samples to train the graph embedding model.

[0031] Step S106 , based on the sample distances between multiple sample data in the initial label sample and the weight ratios between sample data of different label types, calculate the loss value of the semi-supervised loss function.

[0032] In step S106 , the terminal device may calculate the sample distances between the plurality of sample data based on the average distances between sample data with the same label type and the average distances between sample data with different label types in the initial label sample.

[0033] Optionally, the terminal device may calculate the distances between each sample data item with the same label type in the initial label sample, and perform a summed average calculation on these distances to obtain the average distance between the sample data items with the same label type. Regarding the average distance between sample data items with different label types, the terminal device may divide the initial label sample into multiple subsamples based on label type, with each subsample corresponding to a label type. The terminal device may then calculate the distances between each sample data item in the current subsample and each sample data item in the other subsamples, and perform a summed average calculation on these distances to obtain the aforementioned average distance between the sample data items with different label types.

[0034] It should be noted that determining the loss value of the semi-supervised loss function by sample distance can make the spatial distance between sample data of different label types farther, and the spatial distance between sample data of the same label type closer, which is more conducive to the training of the graph embedding model.

[0035] In addition, it should be noted that due to the imbalance in the number of positive and negative samples in practical applications, a weight ratio coefficient (i.e., weight ratio) needs to be set in the process of calculating the loss function to amplify the average distance corresponding to the positive samples. That is, the above-mentioned weight ratio needs to be multiplied by the average distance corresponding to the positive samples to obtain the above-mentioned loss value.

[0036] Furthermore, existing techniques typically employ either transductive learning or inductive graph embedding algorithms to train graph embedding models. However, transductive learning algorithms require high computing power. When the graph structure itself occupies a large amount of space, the training process of the graph embedding model becomes relatively slow, thereby reducing training efficiency. Inductive graph embedding algorithms are typically used for supervised learning tasks and cannot be applied to other learning tasks.

[0037] The solution provided by this disclosure uses a semi-supervised loss function when training graph embedding models, thereby enabling the application of graph embedding algorithms in semi-supervised learning tasks. Generating graph embedding models based on a semi-supervised loss function not only avoids the high computing power requirements of transductive learning algorithms, but also improves the efficiency of generating graph embedding models.

[0038] Step S108, updating the weight ratio, and updating the initial label sample based on the updated weight ratio until the loss value is less than a preset value, and obtaining the target label sample based on the updated initial label sample.

[0039] It can be seen from the scheme defined by step S106 that the weight ratio is determined based on the number of samples. Therefore, the process of updating the weight ratio is actually the process of updating sample data of different label types. That is, in the present disclosure, by updating sample data of different label types, the positive and negative samples can be balanced, thereby improving the training accuracy of the graph embedding model.

[0040] In addition, when the loss value is less than the preset value, it indicates that the initial label sample at this time is the optimal label sample, and using this target label sample can improve the training accuracy of the graph embedding model.

[0041] In step S110 , a preset model is trained based on target label samples to obtain a graph embedding model, wherein the graph embedding model is used to determine graph embedding features of the object to be analyzed, and the graph embedding features represent the risk level of the object to be analyzed.

[0042] It should be noted that the trained graph embedding model can be applied to risk control scenarios of banks or credit institutions. For example, in a risk control scenario of identifying whether the object to be analyzed is an object with fraudulent behavior, the labeled sample can be the feature data of objects that appear on the blacklist (i.e., the list of objects with fraudulent behavior) and the whitelist (i.e., the list of objects without fraudulent behavior), and the unlabeled sample can be the feature data of objects that do not appear on the blacklist or the whitelist, that is, the unlabeled sample is a sample that does not indicate the identity of the object. Among them, the positive sample can be the feature data of the object that appears on the blacklist, and the negative sample can be the feature data of the object that appears on the whitelist. The graph embedding model can be used to analyze the object to be analyzed and obtain the graph embedding features corresponding to the object to be analyzed. Then, the risk control system of the bank or credit institution can analyze the graph embedding features to determine whether the object to be analyzed has fraudulent behavior.

[0043] Optionally, when analyzing the object to be analyzed, the graph embedding model can first identify directly associated objects that have interactive relationships with the object to be analyzed on social platforms (e.g., likes, follows, favorites, etc.), as well as indirectly associated objects that have interactive relationships with the directly associated objects. Object features of the indirectly associated objects are then extracted and aggregated to obtain object features of the directly associated objects. The object features of the directly associated objects are then aggregated to obtain the graph embedding features corresponding to the object to be analyzed.

[0044] In addition, the trained graph embedding model can also be applied to product recommendation scenarios. For example, in the financial product recommendation scenario, the labeled samples can be feature data of objects that have an association with the financial product (for example, objects that have consulted about the financial product, objects that have purchased the financial product), and the unlabeled samples can be feature data of objects that have no association with the financial product. Among them, the positive samples are feature data of objects that have purchase intentions for the financial product (for example, the objects that have consulted about the financial product mentioned above), and the negative samples are feature data of objects that have no purchase intentions for the recommended product (for example, objects that directly reject the recommendation of the financial product). The graph embedding model can be used to analyze the object to be analyzed to determine whether the object to be analyzed intends to purchase the financial product.

[0045] It should be noted that in the recommendation scenario of financial products, the analysis process of the graph embedding model for the analysis object is similar to that in the risk control scenario, and will not be repeated here.

[0046] Based on the scheme defined in the above steps S102 to S110, it can be known that by training a graph embedding model based on a semi-supervised loss function, after obtaining labeled samples and unlabeled samples, the unlabeled samples are labeled based on the labeled samples to obtain labeled unlabeled samples, and the labeled samples and the labeled unlabeled samples are combined to obtain initial labeled samples. Then, based on the sample distance between multiple sample data in the initial labeled sample and the weight ratio between sample data of different label types, the loss value of the semi-supervised loss function is calculated, the weight ratio is updated, and the initial labeled sample is updated based on the updated weight ratio until the loss value is less than the preset value. The target labeled sample is obtained based on the updated initial labeled sample. Finally, the preset model is trained based on the target labeled sample to obtain a graph embedding model, wherein the graph embedding model is used to determine the graph embedding features of the object to be analyzed, and the graph embedding features represent the risk level of the object to be analyzed.

[0047] It is easy to notice that the method of labeling the unlabeled samples based on the labeled samples avoids the problems of mislabeling and missing labels in the manual labeling in the prior art, thereby improving the accuracy of the training samples and further improving the accuracy of the model training. In addition, the semi-supervised loss function is adopted to realize the application of the graph embedding algorithm in the semi-supervised learning task. Generating the graph embedding model based on the semi-supervised loss function not only avoids the problem of high computing power requirements of the direct learning algorithm, but also improves the generation efficiency of the graph embedding model. Finally, since the weight ratio is determined based on the number of samples, the process of updating the weight ratio is actually the process of updating sample data of different label types. That is, in the present disclosure, by updating the sample data of different label types, it is ensured that the positive and negative samples can be more balanced, thereby improving the training accuracy of the graph embedding model.

[0048] It can be seen that the solution provided by the present disclosure achieves the purpose of generating a graph embedding model, thereby achieving the effect of improving the training accuracy of the graph embedding model, and thus avoiding the problem of poor training accuracy of the graph embedding model existing in the prior art.

[0049] Example 2

[0050] According to an embodiment of the present disclosure, the present disclosure also provides a model training method, such as Figure 2 As shown, first, the terminal device labels the unlabeled samples based on the labeled samples to obtain the labeled unlabeled samples.

[0051] Specifically, the terminal device calculates the label similarity between at least one sample data in the unlabeled sample and at least one sample data in the labeled sample, and labels the sample data in the unlabeled sample based on the label similarity to obtain a labeled unlabeled sample.

[0052] Optionally, the terminal device may use a cosine similarity calculation method to calculate the label similarity between the sample data in the sample-free label and the sample data in the label sample. The label similarity can be achieved by the following formula:

[0053]

[0054] In the above formula, cosθ represents the label similarity, A i Represents the i-th sample data in the unlabeled sample, B i Represents the i-th sample data in the labeled sample, A represents the matrix corresponding to the unlabeled sample, and B represents the matrix corresponding to the labeled sample.

[0055] Optionally, the terminal device may divide the sample data in the labeled sample into multiple sub-label samples based on the label type, and at the same time, randomly divide the sample data in the unlabeled sample into multiple sub-unlabeled samples, wherein the number of sub-label samples may be different from the number of sub-unlabeled samples. The terminal device then calculates the similarity between each sub-label sample and each sub-unlabeled sample, and when the similarity is greater than a preset similarity, marks the sample data in the sub-unlabeled sample as the sample type corresponding to the corresponding sub-label sample. For example, if the similarity between sub-label sample A1 and sub-unlabeled sample B1 is the greatest, and the sample type corresponding to sub-label sample A1 is Q, then all sample data in sub-unlabeled sample B1 is marked as Q.

[0056] It should be noted that the method of labeling unlabeled samples based on labeled samples avoids the problems of mislabeling and missing labels in manual labeling in the existing technology, thereby improving the accuracy of training samples and further improving the accuracy of model training.

[0057] Further, such as Figure 2 As shown in the figure, after labeling the unlabeled samples to obtain the labeled unlabeled samples, the terminal device mixes the unlabeled samples with the labeled unlabeled samples to obtain the initial labeled samples, and then calculates the loss value corresponding to the semi-supervised loss function based on the initial labeled samples, wherein the loss value is calculated based on the sample distance between multiple sample data in the initial labeled samples and the weight ratio between sample data of different label types.

[0058] Specifically, in the process of calculating the sample distance between multiple sample data in the initial label sample, the terminal device calculates the average distance between the sample data with the same label in the initial label sample to obtain a first average distance, and calculates the average distance between the sample data with different labels in the initial label sample to obtain a second average distance. Finally, the sample distance is obtained based on the first average distance and the second average distance.

[0059] It should be noted that the first average distance represents the average distance between sample data with the same label, while the second average distance represents the average distance between sample data with different labels.

[0060] Optionally, the terminal device may calculate the distances between each sample data item with the same label type in the initial label sample, and perform a summed average calculation on these distances to obtain the average distance between the sample data items with the same label type. Regarding the average distance between sample data items with different label types, the terminal device may divide the initial label sample into multiple subsamples based on label type, with each subsample corresponding to a label type. The terminal device may then calculate the distances between each sample data item in the current subsample and each sample data item in the other subsamples, and perform a summed average calculation on these distances to obtain the aforementioned average distance between the sample data items with different label types.

[0061] In addition, it should be noted that determining the loss value of the semi-supervised loss function by sample distance can make the spatial distance between sample data of different label types farther, and the spatial distance between sample data of the same label type closer, which is more conducive to the training of the graph embedding model.

[0062] In an optional embodiment, after obtaining the initial label sample, the terminal device calculates the above-mentioned weight ratio based on the number of samples with different labels. Specifically, the terminal device obtains the number of sample data with a label type of positive sample type in the initial label sample to obtain a first sample number, and obtains the number of sample data with a label type of negative sample type in the initial label sample to obtain a second sample number. Then, the terminal device calculates the ratio between the second sample number and the first sample number to obtain the weight ratio. The label type of the initial label sample includes at least a positive sample type and a negative sample type.

[0063] From the above content, we can see that the weight ratio can satisfy the following formula:

[0064]

[0065] In the above formula, W represents the weight ratio, R - Indicates the second sample size, R + Indicates the first sample size.

[0066] It should be noted that due to the imbalance in the number of positive and negative samples in practical applications, a weight ratio coefficient (i.e., weight ratio) needs to be set in the process of calculating the loss function to amplify the average distance corresponding to the positive samples. That is, the above-mentioned weight ratio needs to be multiplied by the average distance corresponding to the positive samples to obtain the above-mentioned loss value.

[0067] Furthermore, after obtaining the sample distance and weight ratio, the terminal device may calculate a loss value of the semi-supervised loss function based on the sample distance and the weight ratio. Specifically, the terminal device calculates the ratio of the first average distance to the second average distance to obtain the target average distance, and calculates the product of the weight ratio and the target average distance to obtain the loss value.

[0068] Optionally, the calculation of the above loss value can be expressed as follows:

[0069]

[0070] In the above formula, Loss represents the loss value; W represents the weight ratio; S1 represents the average distance between samples with the same label, that is, the first average distance mentioned above; S2 represents the average distance between samples with different labels, that is, the second average distance mentioned above.

[0071] It should be noted that the loss value of the semi-supervised loss function is determined by the weight ratio and the average distance, which ensures the balance of the number of positive and negative samples.

[0072] Furthermore, after obtaining the loss value of the semi-supervised loss function, the terminal device updates the weight ratio and updates the initial labeled sample based on the updated weight ratio. Specifically, the terminal device updates the weight ratio to obtain an updated weight ratio, and adjusts the label corresponding to the sample data in the marked unlabeled sample based on the updated weight ratio to obtain an updated unlabeled sample. The initial labeled sample is then updated based on the updated unlabeled sample to obtain a target labeled sample.

[0073] Optionally, in the process of adjusting the label corresponding to the sample data in the labeled unlabeled sample, the terminal device may adjust the label of the sample data in the unlabeled sample according to the label similarity between at least one sample data in the unlabeled sample and at least one sample data in the labeled sample. Optionally, the terminal device may modify the label corresponding to the first sample data to a first label, wherein the first sample data is the sample data in the labeled unlabeled sample, the similarity corresponding to the first sample data is less than a first preset similarity, and the first label is different from the label of the first sample data. For example, if the similarity corresponding to sample data 1 in the labeled unlabeled sample is less than a preset similarity, the label 1 corresponding to the sample data 1 is modified to label 2, wherein label 2 is a label different from label 1 in the label type corresponding to the labeled sample.

[0074] In addition, the terminal device can also sort the sample data in the labeled unlabeled samples based on the label similarity between at least one sample data in the unlabeled samples and at least one sample data in the labeled samples, determine the target number of sample data whose labels need to be adjusted based on the updated weight ratio, and update the labels of the target number of sample data in order of similarity from small to large.

[0075] It should be noted that since the weight ratio is determined based on the number of samples, the process of updating the weight ratio is actually the process of updating sample data of different label types. That is, in the present disclosure, by updating sample data of different label types, the positive and negative samples can be balanced, thereby improving the training accuracy of the graph embedding model.

[0076] In addition, if Figure 2 As shown in the figure, when the loss value has not reached the minimum, the weight ratio is updated until the loss value reaches the minimum. At this time, it indicates that the initial label sample is the optimal label sample, and using the target label sample to train the graph embedding model can improve the training accuracy of the graph embedding model, that is, the model trained by the target label sample corresponding to the minimum loss value is the final graph embedding model.

[0077] Example 3

[0078] According to an embodiment of the present disclosure, the present disclosure also provides a model training method. In this embodiment, the application of a graph embedding model to a risk control scenario is used as an example for illustration.

[0079] Specifically, after obtaining the object information of the object to be analyzed, the terminal device analyzes the object information based on the graph embedding model, determines the graph embedding features corresponding to the object to be analyzed, and determines the object type of the object to be analyzed based on the graph embedding features, wherein the graph embedding model is composed of multiple nodes and multiple edges, multiple edges are connected between multiple nodes, multiple nodes store feature information of multiple objects, multiple edges represent the association relationship between multiple objects, and the object type represents the degree of risk of the object to be analyzed. For example, the object type may include but is not limited to low-risk objects, medium-risk objects, and high-risk objects.

[0080] Optionally, in risk control scenarios, the graph embedding model analyzes whether the subject being analyzed is engaging in fraudulent activity. The terminal device can input the object information of the subject being analyzed into the graph embedding model, which then analyzes the object information. The object information can include static information and dynamic information. Static information represents the inherent attributes of the subject being analyzed, such as name, age, date of birth, and hobbies. Dynamic information represents features of the subject being analyzed that change frequently, such as information about the subject being followed, liked, or commented on on social platforms.

[0081] In addition, in the process of training the graph embedding model, multiple objects are objects with fraudulent behavior, that is, in the risk control scenario, the terminal device uses the object information of objects with fraudulent behavior as training samples to train the preset model and obtain the graph embedding model.

[0082] Optional, Figure 3 A block diagram showing an optional analysis of the object to be analyzed based on a graph embedding model is shown. Figure 3 In the figure, New_id represents the object identifier corresponding to the object to be analyzed, wherein the subgraph where New_id is located is the Level2 subgraph; old_id1 and old_id2 represent the object identifiers of objects that have an association relationship with the object to be analyzed, for example, the objects corresponding to old_id1 and old_id2 are objects that the object to be analyzed likes, comments on, or follows on a social platform, wherein the subgraph where old_id1 and old_id2 are located is the Level1 subgraph; old_id3 and old_id4 represent the object identifiers of objects that have an association relationship with the object of old_id1, and old_id5 and old_id6 represent the object identifiers of objects that have an association relationship with the object of old_id2, wherein the subgraph where old_id3, old_id4, old_id5, and old_id6 are located is the Level0 subgraph.

[0083] Specifically, the terminal device first performs an adjacency sampling on the object information of the object to be analyzed, and determines the object associated with the object to be analyzed based on the adjacency sampling result, that is, obtains Figure 3 Then, the terminal device performs secondary adjacency sampling on the object information of the objects corresponding to old_id1 and old_id2, and determines the objects associated with the objects of old_id1 and old_id2 based on the secondary adjacency sampling results, that is, Figure 3 The objects corresponding to old_id3, old_id4, old_id5 and old_id6.

[0084] The terminal device then performs a feature aggregation on the features of the objects corresponding to old_id3, old_id4, old_id5, and old_id6 to obtain a first aggregated feature. The terminal device then performs a second feature aggregation on the first aggregated feature and the object features of the objects corresponding to old_id1 and old_id2 to obtain a second aggregated feature. This second aggregated feature is the object feature of the object to be analyzed.

[0085] It should be noted that in practical applications, when analyzing the object to be analyzed based on a graph embedding model, the number of subgraphs is not limited to the three subgraphs mentioned above, and a larger number of subgraphs can be used. In addition, in the above example, the positively labeled samples (samples corresponding to the positive label type) can be related data of objects that have an association relationship with the object to be analyzed, and the negatively labeled samples (samples corresponding to the negative label type) can be related data of objects that have no association relationship with the object to be analyzed.

[0086] It's easy to notice that in the prior art, when generating graph embedding models, the deepwalk method is used in multiple scenarios to embed each node. However, the embedding process does not take into account the characteristics of the node itself (for example, the static properties of the object to be analyzed), resulting in inaccurate analysis of the object by the graph embedding model.

[0087] In the present disclosure, since each node in the graph embedding model contains the characteristics of the objects in each subgraph, the solution provided by the present disclosure can effectively improve the analysis accuracy of the graph embedding model on the object to be analyzed.

[0088] In addition, during the graph embedding process, the solution provided by the present disclosure can use an unsupervised loss function (for example, the linkprediction method) to make the spatial distances corresponding to nodes that originally have an associated relationship closer; and to make the spatial distances between nodes that do not have an associated relationship farther, which is more conducive to the training of the graph embedding model.

[0089] In addition, on top of the unsupervised approach, this paper also uses a semi-supervised loss function. Compared to the linkprediction method, the embedding features obtained through training using the semi-supervised method are more accurate. This shows that the semi-supervised graph embedding model used in this paper can improve the analysis accuracy of the object to be analyzed.

[0090] Example 4

[0091] According to an embodiment of the present disclosure, the present disclosure provides a model training device, such as Figure 4 As shown, the apparatus includes: an acquisition module 401 , a combination module 403 , a calculation module 405 , an update module 407 and a training module 409 .

[0092] Among them, the acquisition module 401 is used to obtain labeled samples and unlabeled samples, and label the unlabeled samples based on the labeled samples to obtain labeled unlabeled samples; the combination module 403 is used to combine the labeled samples and the labeled unlabeled samples to obtain initial labeled samples; the calculation module 405 is used to calculate the loss value of the semi-supervised loss function based on the sample distance between multiple sample data in the initial labeled sample, and the weight ratio between sample data of different label types; the update module 407 is used to update the weight ratio, and update the initial labeled sample based on the updated weight ratio until the loss value is less than the preset value, and the target labeled sample is obtained based on the updated initial labeled sample; the training module 409 is used to train the preset model based on the target labeled sample to obtain a graph embedding model, wherein the graph embedding model is used to determine the graph embedding features of the object to be analyzed, and the graph embedding features represent the risk level of the object to be analyzed.

[0093] Optionally, the acquisition module includes: a first calculation module and a labeling module. The first calculation module is configured to calculate label similarity between at least one sample data in the unlabeled sample and at least one sample data in the labeled sample; and the labeling module is configured to label the sample data in the unlabeled sample based on the label similarity to obtain the labeled unlabeled sample.

[0094] Optionally, the model training device further includes: a second calculation module, a third calculation module, and a fourth calculation module. The second calculation module is configured to calculate the average distance between sample data with the same label in the initial label sample to obtain a first average distance; the third calculation module is configured to calculate the average distance between sample data with different labels in the initial label sample to obtain a second average distance; and the fourth calculation module is configured to obtain a sample distance based on the first average distance and the second average distance.

[0095] Optionally, the label types of the initial label samples include at least positive sample types and negative sample types, and the model training device further includes: a first acquisition module, a second acquisition module, and a fifth calculation module. The first acquisition module is configured to acquire the number of sample data in the initial label samples whose label types are positive sample types, thereby obtaining a first sample number; the second acquisition module is configured to acquire the number of sample data in the initial label samples whose label types are negative sample types, thereby obtaining a second sample number; and the fifth calculation module is configured to calculate the ratio of the second sample number to the first sample number, thereby obtaining a weight ratio.

[0096] Optionally, the calculation module includes: a sixth calculation module and a seventh calculation module. The sixth calculation module is used to calculate the ratio of the first average distance to the second average distance to obtain the target average distance; and the seventh calculation module is used to calculate the product of the weight ratio and the target average distance to obtain the loss value.

[0097] Optionally, the update module includes: a first update module, an adjustment module, and a second update module. The first update module is configured to update the weight ratio to obtain an updated weight ratio; the adjustment module is configured to adjust the labels corresponding to the sample data in the labeled unlabeled sample based on the updated weight ratio to obtain an updated unlabeled sample; and the second update module is configured to update the initial labeled sample based on the updated unlabeled sample to obtain a target labeled sample.

[0098] Optionally, the model training device further includes: a third acquisition module, an analysis module, and a determination module. The third acquisition module is configured to acquire object information of the object to be analyzed; the analysis module is configured to analyze the object information based on a graph embedding model to determine graph embedding features corresponding to the object to be analyzed, wherein the graph embedding model is composed of multiple nodes and multiple edges, the multiple edges connecting the multiple nodes, the multiple nodes storing feature information of multiple objects, and the multiple edges representing the association relationship between the multiple objects; and the determination module is configured to determine the object type of the object to be analyzed based on the graph embedding features, wherein the object type represents the degree of risk posed by the object to be analyzed.

[0099] Example 5

[0100] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0101] Figure 5A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are provided as examples only and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0102] like Figure 5 As shown, the device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. Various programs and data required for the operation of the device 500 can also be stored in the RAM 503. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0103] Various components in device 500 are connected to I / O interface 505, including: an input unit 506, such as a keyboard, mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a magnetic disk, optical disk, etc.; and a communication unit 509, such as a network card, modem, wireless communication transceiver, etc. The communication unit 509 allows device 500 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0104] The computing unit 501 can be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above, such as the model training method. For example, in some embodiments, the model training method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the model training method described above can be performed. Alternatively, in other embodiments, the computing unit 501 can be configured to perform the model training method in any other appropriate manner (e.g., by means of firmware).

[0105] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system comprising at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0106] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0107] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0108] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0109] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0110] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact through a communication network. The client-server relationship arises through computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, a server in a distributed system, or a server integrated with a blockchain.

[0111] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not a limitation herein.

[0112] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.

Claims

1. A model training method, comprising: Obtaining labeled samples and unlabeled samples, and labeling the unlabeled samples based on the labeled samples to obtain labeled unlabeled samples; Combining the labeled samples and the labeled unlabeled samples to obtain initial labeled samples, where the label types of the initial labeled samples include at least positive sample types and negative sample types; Calculate the ratio of the first average distance to the second average distance to obtain a target average distance, wherein the first average distance is the average distance between sample data with the same label in the initial label sample, and the second average distance is the average distance between sample data with different labels in the initial label sample; Calculate the product between the weight ratio and the target average distance to obtain a loss value of the semi-supervised loss function, wherein the weight ratio is the ratio of the first sample number to the second sample number, the first sample number is the number of sample data in the initial labeled sample whose label type is the positive sample type, and the second sample number is the number of sample data in the initial labeled sample whose label type is the negative sample type; Updating the weight ratio, and updating the initial label sample based on the updated weight ratio until the loss value is less than a preset value, and obtaining a target label sample based on the updated initial label sample; A preset model is trained based on the target label samples to obtain a graph embedding model, wherein the graph embedding model is used to determine the graph embedding features of the object to be analyzed, and the graph embedding features represent the risk level of the object to be analyzed.

2. The method according to claim 1, wherein The unlabeled sample is labeled based on the labeled sample to obtain a labeled unlabeled sample, including: Calculating label similarity between at least one sample data in the unlabeled sample and at least one sample data in the labeled sample; The sample data in the unlabeled samples are labeled based on the label similarity to obtain the labeled unlabeled samples.

3. The method according to claim 1, wherein Updating the weight ratio, and updating the initial label sample based on the updated weight ratio, including: Updating the weight ratio to obtain the updated weight ratio; Adjusting the labels corresponding to the sample data in the marked unlabeled samples based on the updated weight ratio to obtain updated unlabeled samples; The initial labeled sample is updated based on the updated unlabeled sample to obtain the target labeled sample.

4. The method according to claim 1, further comprising: Obtaining object information of the object to be analyzed; Analyzing the object information based on the graph embedding model to determine a graph embedding feature corresponding to the object to be analyzed, wherein the graph embedding model is composed of a plurality of nodes and a plurality of edges, the plurality of edges are connected between the plurality of nodes, the plurality of nodes store feature information of a plurality of objects, and the plurality of edges represent association relationships between the plurality of objects; An object type of the object to be analyzed is determined based on the graph embedding feature, wherein the object type represents a degree of risk of the object to be analyzed.

5. A model training device comprising: An acquisition module is used to acquire labeled samples and unlabeled samples, and mark the unlabeled samples based on the labeled samples to obtain marked unlabeled samples; A combination module is used to combine the labeled samples and the labeled unlabeled samples to obtain initial labeled samples, where the label types of the initial labeled samples include at least positive sample types and negative sample types; a calculation module, configured to calculate a ratio of a first average distance to a second average distance to obtain a target average distance, wherein the first average distance is the average distance between sample data with the same label in the initial label sample, and the second average distance is the average distance between sample data with different labels in the initial label sample; and calculate the product between the weight ratio and the target average distance to obtain a loss value of the semi-supervised loss function, wherein the weight ratio is the ratio between the first sample number and the second sample number, the first sample number is the number of sample data in the initial label sample whose label type is the positive sample type, and the second sample number is the number of sample data in the initial label sample whose label type is the negative sample type; An updating module, configured to update the weight ratio and update the initial label sample based on the updated weight ratio until the loss value is less than a preset value, and then obtain a target label sample based on the updated initial label sample; A training module is used to train a preset model based on the target label sample to obtain a graph embedding model, wherein the graph embedding model is used to determine the graph embedding features of the object to be analyzed, and the graph embedding features represent the risk level of the object to be analyzed.

6. The device according to claim 5, wherein The acquisition module includes: A first calculation module is used to calculate the label similarity between at least one sample data in the unlabeled sample and at least one sample data in the labeled sample; The labeling module is used to label the sample data in the unlabeled sample based on the label similarity to obtain the labeled unlabeled sample.

7. The device according to claim 5, wherein The update module includes: A first updating module is used to update the weight ratio to obtain the updated weight ratio; An adjustment module, configured to adjust the labels corresponding to the sample data in the marked unlabeled samples based on the updated weight ratios to obtain updated unlabeled samples; The second updating module is configured to update the initial labeled sample based on the updated unlabeled sample to obtain the target labeled sample.

8. The apparatus according to claim 5, further comprising: A third acquisition module is used to obtain object information of the object to be analyzed; an analysis module, configured to analyze the object information based on the graph embedding model to determine a graph embedding feature corresponding to the object to be analyzed, wherein the graph embedding model is composed of a plurality of nodes and a plurality of edges, the plurality of edges connecting the plurality of nodes, the plurality of nodes storing feature information of a plurality of objects, and the plurality of edges representing an association relationship between the plurality of objects; A determination module is configured to determine an object type of the object to be analyzed based on the graph embedding feature, wherein the object type represents a degree of risk of the object to be analyzed.

9. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the model training method described in any one of claims 1 to 4.

10. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to enable a computer to execute the model training method according to any one of claims 1 to 4.

11. A computer program product, comprising a computer program, which implements the model training method according to any one of claims 1 to 4 when executed by a processor.

Citation Information

Patent Citations

  • Semi-supervised machine learning optimization method, device and equipment and storage medium

    CN111222648A

  • Text classification method and device, model training method and device, equipment and storage medium

    CN113656581A