Method and apparatus for training a user classification model

By dynamically calculating the probability threshold and weight of sample users, the problem of low recall caused by class imbalance in user classification models is solved, achieving high recall and accuracy under imbalanced data, especially improving performance in minority class business scenarios.

CN121052871BActive Publication Date: 2026-04-14QIANTANG CREDIT INFORMATION CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-03
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

When training user classification models, the problem of class imbalance is faced, which leads to low recall of the minority class. Existing techniques such as class weighting and Focal Loss methods lack adaptability and fine-grained discrimination.

Method used

By dynamically determining the probability threshold of a sample user belonging to a certain user category, calculating the sample weight, and determining the loss term based on the weight, the model is updated by combining the loss terms of each category, and the probability threshold is dynamically adjusted to focus on low-confidence correct samples and high-confidence incorrect samples.

Benefits of technology

It significantly improves the recall rate of the minority class in class imbalance scenarios while maintaining a high accuracy, and enhances the model's ability to handle boundary samples and correct errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121052871B_ABST
    Figure CN121052871B_ABST
Patent Text Reader

Abstract

Embodiments of the present specification provide a method for training a user classification model, comprising: inputting each sample user in a current batch into the user classification model to obtain N probabilities that each sample user belongs to N user categories. For any first category in the N user categories, a first probability threshold corresponding to the first category is determined according to each first probability that each sample user belongs to the first category. For any target sample user, a first sample weight corresponding to the first category of the target sample user is determined by comparing a target first probability that the target sample user belongs to the first category with the first probability threshold. A loss term corresponding to the first category of the target sample user is determined according to the first sample weight, the target first probability, and a target category label of the target sample user. The user classification model is updated according to a predicted loss, the predicted loss at least including a comprehensive result of each loss term corresponding to each sample user belonging to the N user categories.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of computer technology, and more particularly to a method and apparatus for training a user classification model. Background Technology

[0002] When training models for user classification tasks, a severe imbalance in the number of samples across different classes is a common problem. For example, in risk control scenarios, the number of fraudulent users is usually far less than the number of legitimate users. However, commonly used classification loss functions (such as cross-entropy loss) are easily dominated by the class with the larger sample size, causing the model to tend to predict all samples as belonging to the class with the larger sample size. In this case, the model performs poorly on the minority class (the class with fewer samples), which is often the focus of business operations, resulting in low recall for the minority class. Summary of the Invention

[0003] This specification describes one or more embodiments of a method and apparatus for training a user classification model, which can effectively improve the recall rate of the model for the minority class in class imbalance scenarios and maintain a high accuracy.

[0004] Firstly, a method for training a user classification model is provided, including:

[0005] Input each sample user in the current batch into the user classification model to obtain N probabilities that each sample user belongs to N user categories;

[0006] For any first category among the N user categories, a first probability threshold corresponding to the first category is determined based on the first probability of each sample user in the current batch belonging to the first category.

[0007] For any target sample user, the first sample weight corresponding to the first category is determined by comparing the target first probability of the target sample user belonging to the first category with the first probability threshold.

[0008] Based on the first sample weight, the first target probability, and the target category label of the target sample user, determine the loss term corresponding to the first category for the target sample user;

[0009] The user classification model is updated based on the predicted loss, wherein the predicted loss includes at least the combined result of each loss term corresponding to each of the N user categories for each sample user.

[0010] Secondly, an apparatus for training a user classification model is provided, comprising:

[0011] The input unit is used to input each sample user in the current batch into the user classification model to obtain N probabilities that each sample user belongs to N user categories.

[0012] The determining unit is used to determine a first probability threshold corresponding to any first category among the N user categories, based on the first probabilities of each sample user in the current batch belonging to the first category.

[0013] The comparison unit is used to determine the first sample weight of any target sample user corresponding to the first category by comparing the first probability of the target sample user belonging to the first category with the first probability threshold.

[0014] The determining unit is further configured to determine the loss term corresponding to the first category for the target sample user based on the first sample weight, the target first probability, and the target category label of the target sample user;

[0015] An update unit is used to update the user classification model based on the predicted loss, wherein the predicted loss includes at least the combined result of each loss term corresponding to each of the N user categories for each sample user.

[0016] Thirdly, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of the first aspect.

[0017] Fourthly, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and the processor executes the executable code to implement the method of the first aspect.

[0018] The method for training a user classification model provided in one or more embodiments of this specification determines the sample weight of a sample user relative to a user category by comparing the probability of the sample user belonging to a certain user category with a dynamically determined probability threshold for that user category. Then, based on this sample weight, a loss term for the sample user corresponding to that user category is determined. Finally, the predicted loss is obtained by combining the loss terms for each sample user corresponding to each user category, and the user classification model is updated based on this loss. In other words, this scheme determines the predicted loss and trains the user classification model based on the attention each sample user receives relative to each user category. This can improve the recall rate of the model for the minority class in class imbalance scenarios while maintaining a high accuracy. Attached Figure Description

[0019] To more clearly illustrate the technical solutions of the embodiments in this specification, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a schematic diagram illustrating an implementation scenario of one embodiment disclosed in this specification;

[0021] Figure 2 This diagram illustrates a method for training a user classification model according to one embodiment of the present specification.

[0022] Figure 3 This diagram illustrates a method for determining the sample weights of a sample user in one example of this specification.

[0023] Figure 4 This diagram illustrates the method for calculating the loss term for a sample user in one example of this specification.

[0024] Figure 5 A schematic diagram of an apparatus for training a user classification model according to an embodiment of this specification is shown. Detailed Implementation

[0025] The solution provided in this specification will now be described with reference to the accompanying drawings.

[0026] Currently, the problem of low recall rate for minority classes in class imbalance scenarios is mainly addressed through the following two approaches:

[0027] First, the class-weighted approach assigns different weights to samples of different classes when calculating the prediction loss, typically giving higher weights to samples in the minority class. However, this is a static, global adjustment method that treats all samples in the minority class equally, without distinguishing between easily classified and difficult-to-classify samples. Furthermore, the weights assigned to different classes rely on manual tuning, lacking adaptability.

[0028] Second, the Focal Loss-based approach introduces a modulation factor to reduce the contribution of easily classified samples to the total loss, allowing the model to focus more on difficult-to-classify samples. However, while this approach distinguishes between easily and difficult-to-classify samples, the granularity of the distinction remains relatively coarse.

[0029] To address this, this solution proposes that, during the training of the user classification model, for any given sample user, the sample weight relative to that user category is determined by comparing the probability of the sample user belonging to a certain user category with a dynamically determined probability threshold for that user category. Then, based on this sample weight, the loss term corresponding to that user category is determined. Finally, the predicted loss is obtained by combining the loss terms corresponding to each user category for each sample user, and the user classification model is updated based on this.

[0030] Figure 1 This is a schematic diagram illustrating an implementation scenario of one of the embodiments disclosed in this specification. Figure 1 In this process, after inputting each sample user from the current batch into the user classification model, the probability distribution of each sample user belonging to each user category (e.g., category 1, category 2, ...) can be obtained. Next, for any sample user i in the sample set, the sample weights for each user category are determined by comparing the probability of sample user i belonging to each user category with the corresponding probability thresholds for each user category. Finally, based on the sample weights of sample user i corresponding to each user category, the probability of sample user i belonging to each user category, and the category label of sample user i, multiple loss terms are determined, and the user classification model is updated based on the predicted losses determined by these multiple loss terms.

[0031] Figure 2 This diagram illustrates a method flowchart for training a user classification model according to an embodiment of this specification. This method can be executed by any device, apparatus, platform, or cluster of devices with computing and processing capabilities. It should be noted that the method includes multiple iterations. Figure 2 The diagram illustrates the steps involved in the t-th iteration (t is a positive integer). It can be understood that by repeatedly executing the steps shown, multiple updates to the user classification model can be achieved, with the user classification model updated in the last iteration becoming the final user classification model used. Figure 2 As shown, the method may include the following steps:

[0032] Step S202, select each sample user in the current batch. Input the user classification model to obtain the sample users They belong to N user categories respectively N probabilities (Also known as confidence level).

[0033] For simplicity and clarity, the i-th sample user mentioned above can be denoted as ( , ),in This represents the sample features of the i-th sample user, and these sample features can be user-related feature information; This represents the corresponding category label, which is selected from several user categories. Typically, in the scenario of identifying fraudulent sample users, these user categories are a first category corresponding to fraudulent sample users and a second category corresponding to normal sample users. In this case, two different category labels, such as 0 and 1, can be used to represent normal sample users and fraudulent sample users, respectively. In some scenarios, user-related classifications can also be multi-category. For example, in content recommendation scenarios, users can be classified into multiple groups to facilitate subsequent selection of recommended content based on these groups. In this case, these multiple groups can correspond to several user categories.

[0034] Typically, the aforementioned user-related features may include all or some of the following categories: user profile features, such as occupation, address (company address, residential address, logistics delivery address, real-time location, etc.), interests (such as sports, drawing, etc.), user behavior sequences, and user actions. Additionally, it may include user behavior features determined based on historical user behavior data, such as platform activity (such as average daily login frequency and average daily login duration) and transaction preference features (such as product category and transaction time). Depending on the specific scenario of the classification task, appropriate specific feature items can be selected as sample features.

[0035] The user classification model mentioned above can be a binary classification model or a multi-class classification model. It can be implemented as a traditional machine learning model (such as logistic regression, decision tree and random forest, support vector machine, etc.) or as a deep learning model (such as multilayer perceptron, recurrent neural network, pre-trained language model, etc.).

[0036] It should be understood that each sample user Belongs to any category N probabilities Composition Category The corresponding probability distribution.

[0037] Furthermore, based on any sample user Belongs to N user categories N probabilities This allows us to identify the sample user. The predicted category. For example, N probabilities The user category corresponding to the highest probability in the sample user is determined. The prediction category.

[0038] Step S204, for any one of the N user categories According to each sample user Belongs to this category The various probabilities Determine the category The corresponding probability threshold θ.

[0039] In one embodiment, the probability threshold θ is a probability range, where N probabilities can be selected. Two different quantiles are selected from the corresponding probability distribution to determine the probability range. Specifically, the smaller quantile (e.g., 20%) is used as the lower bound, and the larger quantile (e.g., 80%) is used as the upper bound to obtain the probability range.

[0040] Of course, in practice, the probability threshold θ mentioned above can also be a single value, in which case it can be selected from N probabilities. Alternatively, the target quantile (e.g., 80%) can be selected from the corresponding probability distribution as the probability threshold θ, or it can be based on N probabilities. The mean and standard deviation are used to determine the target calculated value, which is then used as the probability threshold θ. Similarly, the probability thresholds for each user category can be determined.

[0041] It should be noted that, in each iteration, the model predicts N probabilities for each batch of user samples. It is dynamic, and therefore the probability thresholds corresponding to each user category determined by it are also dynamic. In other words, the probability thresholds corresponding to each user category can be adaptively adjusted as the predictive ability of the model changes in each round of training.

[0042] Step S206, for any target sample user By comparing the target sample users Category Target probability Using a probability threshold θ, determine which target sample user corresponds to which category. Sample weights .

[0043] The following explanation addresses the case where the probability threshold θ is within a probability range:

[0044] Figure 3 This diagram illustrates a method for determining the sample weights of a sample user in one example of this specification. Figure 3 In the target sample users Target category label For category When determining the target probability If the result indicates that the value is less than the lower bound of the above probability range, then the first value is determined as the sample weight. If the judgment result indicates that the value is not less than the lower bound, then the second value will be determined as the sample weight. The first value is much larger than the second value.

[0045] It should be understood that the category label for a particular sample user is the category. The model predicts the category belonging to this sample user. When the probability is low (i.e. less than the lower bound of the probability range), it indicates that the model lacks confidence in the correct judgment of the sample user. In other words, the sample user is a low-confidence correct sample, which is usually a potential "missed fish". Therefore, this type of sample needs to be given extra attention and thus assigned a relatively high sample weight.

[0046] also, Figure 3 In the target sample users Target category label Not a category In this case, determine the target probability If the result indicates that the value is greater than the upper bound of the above probability range, then the third value will be determined as the sample weight. If the judgment result indicates that it is not greater than the upper bound value, then the second value will be determined as the sample weight. The third value is much larger than the second value.

[0047] In one example, the first, second, and third values ​​mentioned above are all fixed values, and the first and third values ​​are equal.

[0048] In another example, the first, second, and third values ​​mentioned above are all learnable parameters, or each of them is a function that changes as the training process progresses.

[0049] It should be understood that the category label for a particular sample user is not a category. The model predicts the category belonging to this sample user. When the probability is relatively high (i.e. greater than the upper bound of the probability range), it indicates that the model has made an incorrect prediction for the sample user. In other words, the sample user is a high-confidence error sample, which is usually a "filler" sample. Therefore, this type of sample also needs to be given extra attention and thus assigned a higher sample weight.

[0050] As can be seen, in this scheme, for any sample user, it is determined whether it is a sample requiring additional attention relative to each user category (including low-confidence correct samples and high-confidence incorrect samples), rather than simply classifying it as an easy-to-classify or difficult-to-classify sample. Furthermore, since the probability threshold θ corresponding to each user category changes dynamically, whether each sample user needs attention in each iteration also varies.

[0051] It should be noted that in this scheme, by assigning higher weights to low-confidence correct samples and high-confidence incorrect samples, the model can be strengthened to learn these samples that have the greatest impact on model performance first.

[0052] It should also be understood that in practice, in order to improve the efficiency of model training, it is also possible to focus only on the above-mentioned high-confidence error samples, and this specification does not limit this.

[0053] The following explanation addresses the case where the probability threshold θ is a single value:

[0054] Specifically, in the target sample users Target category label For category When determining the target probability If the result indicates that the value is less than the probability threshold θ, then the first value is determined as the sample weight. If the judgment result indicates that it is not less than the probability threshold θ, then the second value is determined as the sample weight. The first value is much larger than the second value.

[0055] In the target sample users Target category label Not a category In this case, determine the target probability If the result indicates that the probability is greater than the upper bound, then the third value is determined as the sample weight. If the judgment result indicates that it is not greater than the probability threshold θ, then the second value is determined as the sample weight. The third value is much larger than the second value.

[0056] Similarly, target sample users can be identified. The weights of each sample corresponding to each user category can be determined. Furthermore, the weights of other sample users corresponding to each user category can also be determined.

[0057] Step S208, based on sample weights Target probability and the target category labels of the target sample users Identify target sample users Corresponding to category Loss items .

[0058] In one embodiment, in the target category label For category In this case, the target probability can be negative logarithm and sample weights The product of these terms is determined as the loss term. ; in the target category label Not a category In this case, subtract the target probability from 1. The negative logarithm of the calculation result and the sample weights The product of these terms is determined as the loss term. .

[0059] In another embodiment, it can also be combined with target probability-based... The calculated values ​​are used to determine the loss term. The following is a detailed explanation.

[0060] Figure 4 This diagram illustrates the method for calculating the loss term for a sample user in one example of this specification. Figure 4 In the target category label For category In this case, subtract the target probability from 1. Using the result of the calculation as the base, and the preset modulation factor as the power, a power operation is performed to obtain the first calculated value. The target probability is then... The negative logarithm and the first operational value and sample weights Multiply them and determine the loss term based on the first product. ;

[0061] In the target category label Not a category In this case, the target probability Using the preset modulation factor as the base, an exponentiation operation is performed to obtain the second calculated value. The target probability is then subtracted from 1. The negative logarithm of the result of the operation, the second operation value, and the sample weights Multiply them and determine the loss term based on the resulting second product. .

[0062] In one example, the target sample users can be determined according to the following formula. Corresponding to category Loss items :

[0063] (Formula 1)

[0064]

[0065] in, , , See the definition above. For modulation factor, and Both are positive integers greater than 1, and they can be equal.

[0066] Of course, in practice, Formula 1 can be modified in various ways, and this manual does not limit this.

[0067] Additionally, this scheme can assign corresponding category weights to each user category. These category weights are inversely proportional to the number of samples corresponding to that user category in the sample set. In other words, categories with fewer samples (i.e., minority classes) have higher category weights, while categories with more samples (i.e., majority classes) have lower category weights. This results in a greater penalty for the model when it mispredicts minority class samples than when it mispredicts majority class samples, thereby strengthening the model's learning of minority class samples.

[0068] In one example, the value range of the above category weights is [0,1].

[0069] It should be noted that, since this scheme also sets corresponding category weights for each user category, the loss term can also be determined in conjunction with these category weights. For example, given the first product mentioned above, the categories... Corresponding category weights Multiply by the first product to obtain the loss term. ; and having obtained the second product mentioned above, subtract the class weight from 1. The result of the operation is multiplied by the second product to obtain the loss term. .

[0070] In other words, Formula 1 above can be transformed as follows:

[0071] (Formula 2)

[0072] It should be noted that Formula 2 above is actually a dual-focus loss function (that is, while focusing on hard-to-classify samples, it also focuses on low-confidence correct samples and high-confidence incorrect samples), which can more effectively adapt to severe class imbalance scenarios in machine learning.

[0073] Similarly, target sample users can be identified. Each loss term corresponds to a user category, and the loss terms for other sample users corresponding to each user category can be determined.

[0074] Step S210: Update the user classification model based on the predicted loss, which includes at least the combined result of each loss term corresponding to each of the N user categories for each sample user.

[0075] For example, it can target sample users For each user category, sum or weighted summation is performed on each loss term, and the summation or weighted summation result is used as the target sample user. The corresponding sub-losses are then calculated. Next, the sub-losses for each user sample are combined to obtain the predicted loss, and the update gradient of the user classification model's parameters is calculated using backpropagation based on this predicted loss. Furthermore, the Hessian matrix can be calculated; the update gradient and the Hessian matrix guide the direction and step size of the model parameter updates, respectively. Finally, the parameters of the user classification model are updated based on the update gradient and the Hessian matrix.

[0076] This completes one round of updates to the user classification model. After multiple iterations, the final user classification model can be obtained.

[0077] In summary, the method for training a user classification model provided in the embodiments of this specification not only considers the differences between categories, but more importantly, it also considers the attention each sample user pays relative to each user category, avoiding the coarse treatment of all minority class samples "equally". Furthermore, this scheme, in addition to focusing on "hard-to-classify samples", adds a dimension of "extreme error identification". Specifically, this scheme uses dynamic boundaries to accurately locate and severely penalize the predictions of "low-confidence correct samples" and "high-confidence incorrect samples". This "secondary focusing" mechanism makes the model training direction clearer and enables it to learn how to handle boundary samples and correct serious errors more quickly.

[0078] It should be understood that the user classification model trained using this approach can significantly improve recall for the minority class when dealing with highly imbalanced datasets, while maintaining a relatively high precision. In other words, this approach can significantly improve the model's classification performance on imbalanced data and has broad applicability across multiple scenarios. Furthermore, this approach effectively forces the model to learn more robust decision boundaries, especially in business scenarios where it is necessary to identify as many positive samples (minority class) as possible, where the improvement is particularly noticeable.

[0079] It is understood that before or during the use of the technical solutions of the various embodiments in this disclosure, users will be informed of the type, scope of use, and usage scenarios of the personal information involved in an appropriate manner in accordance with relevant laws and regulations, and user authorization will be obtained.

[0080] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose, based on the prompt message, whether to provide personal information to the software or hardware such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution.

[0081] As an optional but not limited implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0082] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.

[0083] Corresponding to the method for training a user classification model described above, one embodiment of this specification also provides an apparatus for training a user classification model, such as... Figure 5 As shown, the device may include:

[0084] Input unit 502 is used to input each sample user of the current batch into the user classification model to obtain N probabilities that each sample user belongs to N user categories.

[0085] The determining unit 504 is used to determine the first probability threshold corresponding to any first category among N user categories, based on the first probability of each sample user belonging to the first category.

[0086] The comparison unit 506 is used to determine the first sample weight of the target sample user corresponding to the first category by comparing the first probability of the target sample user belonging to the first category with the first probability threshold for any target sample user.

[0087] The determining unit 504 is further configured to determine the loss term corresponding to the first category of the target sample user based on the first sample weight, the target first probability, and the target category label of the target sample user;

[0088] The update unit 508 is used to update the user classification model according to the predicted loss, wherein the predicted loss includes at least the comprehensive result of each loss term corresponding to each of the N user categories for each sample user.

[0089] In one embodiment, the first probability threshold is a probability range, and the lower and upper bounds of the probability range are two different quantiles selected from the probability distributions corresponding to each first probability.

[0090] In one embodiment, the comparison unit 506 includes:

[0091] The judgment submodule 5062 is used to determine whether the first probability of the target is less than the lower bound when the target category label is the first category;

[0092] The determination submodule 5064 is used to determine the first value as the first sample weight if the judgment result indicates that it is less than the lower bound value; and to determine the second value as the first sample weight if the judgment result indicates that it is not less than the lower bound value, wherein the first value is much greater than the second value.

[0093] The judgment submodule 5062 is also used to determine whether the first probability of the target is greater than the upper bound value when the target category label is not the first category.

[0094] The determination submodule 5064 is also used to determine the third value as the first sample weight if the judgment result indicates that it is greater than the upper limit value; if the judgment result indicates that it is not greater than the upper limit value, the second value is determined as the first sample weight, and the third value is much greater than the second value.

[0095] Unit 504 is specifically used for:

[0096] The target calculated value, determined based on the mean and standard deviation corresponding to each first probability, is used as the first probability threshold.

[0097] In one embodiment, the judgment submodule 5062 is further configured to determine whether the target first probability is less than the first probability threshold when the target category label is the first category.

[0098] The determination submodule 5064 is also used to determine the first value as the first sample weight if the judgment result indicates that it is less than the first probability threshold; and to determine the second value as the first sample weight if the judgment result indicates that it is not less than the first probability threshold, wherein the first value is much greater than the second value.

[0099] The judgment submodule 5062 is also used to determine whether the first probability of the target is greater than the first probability threshold when the target category label is not the first category.

[0100] The determination submodule 5064 is also used to determine the third value as the first sample weight if the judgment result indicates that it is greater than the first probability threshold; and to determine the second value as the first sample weight if the judgment result indicates that it is not greater than the first probability threshold, and the third value is much greater than the second value.

[0101] In one embodiment, the updating unit 508 is further configured to update the first value, the second value, and the third value based on the predicted loss.

[0102] The determining unit 504 is also specifically used for:

[0103] When the target category label is the first category, the loss term corresponding to the first category for the target sample user is determined based on the negative logarithm of the target first probability and the first sample weight;

[0104] If the target category label is not the first category, the loss term corresponding to the first category for the target sample user is determined by subtracting the negative logarithm of the first probability from 1 and the weight of the first sample.

[0105] The determining unit 504 is also specifically used for:

[0106] When the target category label is the first category, the result of subtracting the target first probability from 1 is used as the base, and the preset modulation factor is used as the power to perform an exponentiation operation to obtain the first calculated value; the negative logarithm of the target first probability is multiplied by the first calculated value and the first sample weight, and the above loss term is determined based on the obtained first product;

[0107] If the target category label is not the first category, the target first probability is used as the base, and the preset modulation factor is used as the power to perform an exponentiation operation to obtain the second operation value; the negative logarithm of the operation result of subtracting the target first probability from 1 is multiplied by the second operation value and the first sample weight, and the above loss term is determined based on the obtained second product.

[0108] In one embodiment, each user category has a corresponding category weight, which is inversely proportional to the number of samples corresponding to the user category in the above sample set;

[0109] The determining unit 504 is also specifically used for:

[0110] Multiply the first category weight corresponding to the first category by the aforementioned first product to obtain the aforementioned loss term; or...

[0111] Multiply the result of subtracting the first category weight from 1 by the second product mentioned above to obtain the loss term.

[0112] In one embodiment, the update unit 508 is specifically used for:

[0113] Based on the prediction loss, the gradient and Hessian matrix corresponding to the parameters of the user classification model are calculated, and the parameters of the user classification model are updated based on the gradient and Hessian matrix.

[0114] The functions of each functional unit of the apparatus in the above embodiments of this specification can be implemented through the steps of the above method embodiments. Therefore, the specific working process of the apparatus provided in one embodiment of this specification will not be repeated here.

[0115] The apparatus for training a user classification model provided in one embodiment of this specification can effectively improve the recall rate of the model for the minority class in class imbalance scenarios, and can maintain a high accuracy.

[0116] According to another embodiment, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed in a computer, causes the computer to perform a combination Figure 2 The method described.

[0117] According to another embodiment, a computing device is also provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements a combination... Figure 2 The method described.

[0118] 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 medium or device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

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

[0120] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of this specification. It should be understood that the above description is only a specific embodiment of this specification and is not intended to limit the scope of protection of this specification. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solution of this specification should be included within the scope of protection of this specification.

Claims

1. A method for training a user classification model, comprising: Input each sample user in the current batch into the user classification model to obtain N probabilities that each sample user belongs to N user categories; Each sample user includes user-related characteristic information, such as platform activity and transaction preference characteristics; For any first category among the N user categories, a first probability threshold corresponding to the first category is determined based on the first probability of each sample user in the current batch belonging to the first category. For any target sample user, the first sample weight corresponding to the first category is determined by comparing the target sample user's first probability of belonging to the first category with the first probability threshold. Based on the first sample weight, the first target probability, and the target category label of the target sample user, determine the loss term corresponding to the first category for the target sample user; The user classification model is updated based on the predicted loss, wherein the predicted loss includes at least the combined result of each loss term corresponding to each of the N user categories for each sample user.

2. The method of claim 1, wherein, The first probability threshold is a probability range, and the lower and upper bounds of the probability range are two different quantiles selected from the probability distributions corresponding to each first probability.

3. The method of claim 2, wherein, Determining the first sample weight corresponding to the first category for the target sample user includes: When the target category label is the first category, it is determined whether the first probability of the target is less than the lower bound value; if the determination result indicates that it is less than the lower bound value, the first value is determined as the first sample weight; if the determination result indicates that it is not less than the lower bound value, the second value is determined as the first sample weight; the first value is much greater than the second value. If the target category label is not the first category, determine whether the target first probability is greater than the upper bound value; if the determination result indicates that it is greater than the upper bound value, then the third value is determined as the first sample weight; if the determination result indicates that it is not greater than the upper bound value, then the second value is determined as the first sample weight; the third value is much greater than the second value.

4. The method of claim 1, wherein, Determining the first probability threshold corresponding to the first category includes: The target calculated value, determined based on the mean and standard deviation corresponding to each of the first probabilities, is used as the first probability threshold.

5. The method of claim 4, wherein, Determining the first sample weight corresponding to the first category for the target sample user includes: When the target category label is the first category, it is determined whether the first probability of the target is less than the first probability threshold; if the determination result indicates that it is less than the first probability threshold, the first value is determined as the first sample weight; if the determination result indicates that it is not less than the first probability threshold, the second value is determined as the first sample weight; the first value is much greater than the second value. If the target category label is not the first category, determine whether the first probability of the target is greater than the first probability threshold; if the determination result indicates that it is greater than the first probability threshold, then the third value is determined as the first sample weight; if the determination result indicates that it is not greater than the first probability threshold, then the second value is determined as the first sample weight; the third value is much greater than the second value.

6. The method according to claim 3 or 5, further comprising: Based on the predicted loss, update the first, second, and third values.

7. The method according to claim 1, wherein, The step of determining the loss term corresponding to the target sample user in the first category includes: When the target category label is the first category, the loss term is determined based on the negative logarithm of the first probability of the target and the first sample weight; If the target category label is not the first category, the loss term is determined based on the negative logarithm of the result of subtracting the first probability of the target from 1 and the first sample weight.

8. The method according to claim 7, wherein, Determining the loss term based on the negative logarithm of the first probability of the target and the first sample weight includes: The result of subtracting the target first probability from 1 is used as the base, and the preset modulation factor is used as the power to perform an exponentiation operation to obtain the first calculated value; the negative logarithm of the target first probability is multiplied by the first calculated value and the first sample weight, and the loss term is determined based on the obtained first product; The step of determining the loss term based on the negative logarithm of the result of subtracting the first probability of the target from 1 and the sum of the first sample weights includes: Using the target first probability as the base and the preset modulation factor as the power, perform an exponentiation operation to obtain a second calculated value; multiply the negative logarithm of the calculated result by the second calculated value and the first sample weight, and determine the loss term based on the obtained second product.

9. The method according to claim 8, wherein, Each user category has a corresponding category weight, which is inversely proportional to the number of samples corresponding to the user category in the sample set; Determining the loss term based on the obtained first product includes: The loss term is obtained by multiplying the first category weight corresponding to the first category by the first product. Determining the loss term based on the obtained second product includes: The loss term is obtained by multiplying the result of subtracting the weight of the first category from 1 by the second product.

10. The method according to claim 1, wherein, The step of updating the user classification model based on the predicted loss includes: Based on the prediction loss, the gradient and Hessian matrix corresponding to the parameters of the user classification model are calculated respectively, and the parameters of the user classification model are updated based on the gradient and Hessian matrix.

11. An apparatus for training a user classification model, comprising: The input unit is used to input each sample user in the current batch into the user classification model to obtain N probabilities that each sample user belongs to N user categories. Each sample user includes user-related characteristic information, such as platform activity and transaction preference characteristics; The determining unit is used to determine a first probability threshold corresponding to any first category among the N user categories, based on the first probabilities of each sample user in the current batch belonging to the first category. The comparison unit is used to determine the first sample weight of any target sample user corresponding to the first category by comparing the first probability of the target sample user belonging to the first category with the first probability threshold. The determining unit is further configured to determine the loss term corresponding to the first category for the target sample user based on the first sample weight, the target first probability, and the target category label of the target sample user; An update unit is used to update the user classification model based on the predicted loss, wherein the predicted loss includes at least the combined result of each loss term corresponding to each of the N user categories for each sample user.

12. A computer-readable storage medium having a computer program stored thereon, wherein, When the computer program is executed in the computer, it causes the computer to perform the method according to any one of claims 1-10.

13. A computing device comprising a memory and a processor, wherein, The memory stores executable code, and when the processor executes the executable code, it implements the method of any one of claims 1-10.

Citation Information

Patent Citations

  • Confidence coefficient threshold determination method and device, electronic equipment and storage medium

    CN118171242A

  • Information classification method and device, electronic equipment, computer readable storage medium and computer program product

    CN120579085A