Model training method, user category identification method and device
By reducing the dimensionality at the user data samples and feature levels, the problem of insufficient user identity recognition efficiency and accuracy in the prior art is solved, and efficient model training and recognition under large-scale data sets are realized.
Patent Information
- Application Number
- CN202411793692.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-28
AI Technical Summary
The prior art does not perform well in terms of efficiency and accuracy of user identity identification, and it is difficult to meet complex business needs, especially when dealing with large-scale data sets.
The preset sampling algorithm is used to filter out samples that have a greater impact on model training from multiple user data samples to achieve sample dimensionality reduction; at the same time, the preset feature processing algorithm is used to filter and aggregate features to achieve dimensionality reduction in feature space.
It effectively reduces computational complexity and memory consumption, improves the efficiency of data processing and model training, and makes the model more efficient when processing large-scale data sets.
Smart Images

Figure CN119719982A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of big data analysis and recognition technology, and in particular, relates to a model training method, a user category recognition method and a device. Background Art
[0002] With the rapid growth of data volume and data types, traditional data mining methods have encountered challenges in user identity identification. The demand for large-scale data processing capabilities continues to increase, and relying on manual modeling has made it difficult to efficiently and accurately identify potential user groups, resulting in insufficient personalized services.
[0003] Existing technologies perform poorly in terms of efficiency and accuracy of user identity identification and are unable to meet complex business needs.
[0004] Therefore, how to design a method to quickly and accurately mine potential users is a problem that needs to be solved urgently. Summary of the invention
[0005] The embodiments of the present application provide a model training method, a user category identification method and a device, which can train a model that can quickly and accurately analyze the user's identity category.
[0006] In a first aspect, an embodiment of the present application provides a model training method, the method comprising:
[0007] Obtain multiple user data samples and a category label corresponding to each user data sample;
[0008] Using a preset sampling algorithm, multiple target samples are screened out from multiple user data samples, and the multiple target samples and the category labels corresponding to the multiple target samples are combined to obtain a target sample set;
[0009] Extract features from multiple target samples to obtain target features, and use a preset feature processing algorithm to identify and aggregate the target features to obtain a target feature set;
[0010] Input the target feature set corresponding to the multiple target samples into the recognition model to be trained to obtain the corresponding category prediction result;
[0011] For each target sample, a target gradient value is calculated according to the category prediction result and the category label, and model parameters of the recognition model are adjusted based on the target gradient value. The recognition model is used to determine the category of the user to be identified based on the user data of the user to be identified.
[0012] In a possible implementation manner of the first aspect, the target gradient value is a natural gradient value; for each target sample, the target gradient value is calculated according to the category prediction result and the category label, and the model parameters are adjusted based on the target gradient value pair identification, and the method includes:
[0013] For each target sample, the natural gradient value of each target sample is calculated based on the deviation between the category prediction result and the category label;
[0014] The distribution parameters of the recognition model are adjusted based on the natural gradient value.
[0015] In a possible implementation manner of the first aspect, the method further includes:
[0016] Obtain multiple test samples and actual classification results corresponding to the multiple test samples;
[0017] Inputting multiple test samples into the updated recognition model to obtain test classification results corresponding to the multiple test samples;
[0018] The test classification results of the multiple test samples are compared with the true classifications of the multiple test samples, and the recognition accuracy of the recognition model is calculated. When the recognition accuracy reaches a first preset threshold, the recognition model is output.
[0019] In a possible implementation manner of the first aspect, a preset sampling algorithm is used to screen out a plurality of target samples from a plurality of user data samples, and the plurality of target samples and category labels corresponding to the plurality of target samples are combined to obtain a target sample set, including:
[0020] Input multiple user data samples into the initialized recognition model to obtain an initial category prediction result corresponding to each user data sample;
[0021] For each user data sample, based on an initial category prediction result corresponding to the user data sample and a category label corresponding to the user data sample, determine an initial gradient value of the user data sample;
[0022] A preset number of user data samples are extracted from a plurality of user data samples according to the initial gradient value as target samples to form a target sample set.
[0023] In a possible implementation manner of the first aspect, extracting a preset number of user data samples from a plurality of user data samples as target samples according to an initial gradient value to form a target sample set includes:
[0024] According to the size of the initial gradient value, multiple user data samples are sorted in descending order, the first preset number of user data samples in the sequence are taken as large gradient samples, and the second preset number of user data samples are extracted from the remaining user data samples as small gradient samples, and the large gradient samples and the small gradient samples are combined to obtain a target sample set.
[0025] In a possible implementation manner of the first aspect, in a possible implementation manner of the first aspect, feature extraction is performed on multiple target samples to obtain target features, and a preset feature processing algorithm is used to identify and aggregate the target features to obtain a target feature set, including:
[0026] Extract features from multiple target samples to obtain an initial feature set;
[0027] Grouping the features in the initial feature set to obtain a plurality of feature combinations, wherein the number of feature conflicts in each of the plurality of feature combinations is determined based on a second preset threshold;
[0028] Integrate multiple feature combinations to obtain the target feature set.
[0029] In a possible implementation manner of the first aspect, features in the initial feature set are grouped to obtain multiple feature combinations, including:
[0030] Traversing each feature in the initial feature set in a preset order, and for each feature, determining whether the number of feature conflicts after adding the feature to the existing feature combination exceeds a second preset threshold;
[0031] When it does not exceed the second preset threshold, the feature is added to the existing feature combination, and the number of feature conflicts in the existing feature combination is updated;
[0032] When the second preset threshold is exceeded, a new feature combination is created based on the feature.
[0033] In a possible implementation manner of the first aspect, the method further includes:
[0034] Using the recognition model to process the user data of the user to be identified, and identifying the identity category of the user to be identified;
[0035] The user data of the user to be identified and the identity category of the user to be identified are used as new samples to continue training the recognition model.
[0036] In a second aspect, an embodiment of the present application provides a method for identifying a user category, the method comprising:
[0037] Obtain user data of the user to be identified;
[0038] Extracting user features corresponding to the user data of the user to be identified;
[0039] The category of the user to be identified is determined according to the user characteristics using the identification model, and the identification model is obtained by training using the method of any implementation method in the first aspect above.
[0040] In a third aspect, an embodiment of the present application provides a model training device, the device comprising:
[0041] An acquisition module, used to acquire multiple user data samples and a category label corresponding to each user data sample;
[0042] A sampling module, used to select multiple target samples from multiple user data samples using a preset sampling algorithm, and combine the multiple target samples and the category labels corresponding to the multiple target samples to obtain a target sample set;
[0043] A feature processing module is used to extract features from multiple target samples to obtain target features, and to identify and aggregate target features using a preset feature processing algorithm to obtain a target feature set;
[0044] A training module is used to input a target feature set corresponding to a plurality of target samples into a recognition model to be trained to obtain a category prediction result;
[0045] The training module is also used to calculate the target gradient value for each target sample according to the category prediction result and the category label, and train the recognition model based on the target gradient value.
[0046] In a fourth aspect, an embodiment of the present application provides a user category identification device, the device comprising:
[0047] An acquisition module, used to acquire user data of a user to be identified;
[0048] A feature extraction module, used to extract user features corresponding to the user data of the user to be identified;
[0049] The recognition module is used to determine the category of the user to be identified according to the user characteristics using the recognition model, and the recognition model is trained by the method described in any implementation method of the first aspect above.
[0050] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: a processor, and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement a method of any one of the first or second aspects above.
[0051] In a sixth aspect, an embodiment of the present application provides a computer storage medium having computer program instructions stored thereon, and when the computer program instructions are executed by a processor, the method of any one of the first aspect or the second aspect described above is implemented.
[0052] In a seventh aspect, an embodiment of the present application provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the method of any one of the above-mentioned first aspect or second aspect.
[0053] In the embodiments of the present application, samples with a greater impact on model training are screened out from multiple user data samples through a preset sampling algorithm to achieve sample dimensionality reduction, and features are screened and aggregated through a preset feature processing algorithm to achieve dimensionality reduction of the feature space. The combination of the two methods can effectively reduce computational complexity and memory consumption, improve the efficiency of data processing and model training, and make the model more efficient when processing large-scale data sets. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0055] Figure 1 It is a flowchart of a model training method provided in an embodiment of the present application;
[0056] Figure 2 It is a flowchart of a model training method provided in an embodiment of the present application;
[0057] Figure 3 It is a flowchart of a model training method provided in an embodiment of the present application;
[0058] Figure 4 It is a flowchart of a model training method provided in an embodiment of the present application;
[0059] Figure 5 It is a flowchart of a model training method provided in an embodiment of the present application;
[0060] Figure 6 It is a flowchart of a user category identification method provided in an embodiment of the present application;
[0061] Figure 7 It is a structural schematic diagram of a model training device provided in an embodiment of the present application;
[0062] Figure 8 is a structural diagram of a user category identification device provided in an embodiment of the present application;
[0063] Fig. 9 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0064] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0065] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0066] In order to solve the prior art problems introduced in the background technology, the embodiments of the present application provide a model training method, a user category identification method and a device.
[0067] The following first introduces a model training method provided in an embodiment of the present application.
[0068] Figure 1 FIG. 1 is a flow chart of a model training method provided by an embodiment of the present application. Figure 1 As shown, the method may include the following steps.
[0069] S110: Obtain multiple user data samples and a category label corresponding to each user data sample.
[0070] User data refers to a multi-dimensional information collection about a user, which is used to describe and analyze the user's basic attributes and behavioral characteristics.
[0071] As an example and not limitation, user data may include user's personal information, behavior data, preference data, etc.
[0072] The category label corresponding to the user data refers to the labeling of the user identity or category after analyzing the user data.
[0073] For example, when a telecommunications company identifies potential customers, it can use the users’ communication and consumption data to label users who meet certain conditions as “A” customers and those who do not meet the conditions as “B” customers.
[0074] For example, on an e-commerce platform, by analyzing data such as users' purchasing behavior, qualified users are screened out and marked as high-value customers.
[0075] In one implementation, multiple groups of user data samples may be screened out from a large amount of user data based on multiple preset rules, and a category label may be generated for each group of user data samples.
[0076] In one implementation, the category labels of a portion of the user data samples may be manually annotated.
[0077] S120: Filter out multiple target samples from multiple user data samples using a preset sampling algorithm, and combine the multiple target samples and the category labels corresponding to the multiple target samples to obtain a target sample set.
[0078] This step helps improve the training effect of the model by screening specific target samples to ensure that the sample set has higher representativeness and relevance.
[0079] The preset sampling algorithm is a pre-set sampling algorithm used to filter out target samples from multiple user data samples to achieve the effect of sample dimensionality reduction.
[0080] As an example but not limitation, the preset sampling algorithm may include a random under-sampling algorithm, a fixed ratio sampling algorithm, or a gradient single-side sampling algorithm.
[0081] Among them, the Gradient One-Sided Sampling (GOSS) algorithm is a technology used to efficiently train machine learning models, especially when dealing with large-scale data sets. The algorithm mainly screens samples, selects samples with larger gradient values (i.e., samples with a greater impact on the loss function), and randomly extracts a small number of samples from the remaining samples. Its effect is to significantly reduce the amount of calculation and memory consumption while ensuring the model training effect, thereby improving training efficiency and model performance.
[0082] In one implementation, multiple target samples can be screened from multiple user data samples based on a gradient unilateral sampling algorithm, and multiple target samples and their corresponding category labels can be combined to obtain a target sample set. This method is suitable for scenarios where it is necessary to efficiently extract samples that have a significant impact on model training from large-scale data, especially in the case of unbalanced data sets or large differences in sample importance. The algorithm is used to optimize sample selection and improve model training results.
[0083] In one implementation, a fixed ratio sampling algorithm can be used to select multiple target samples from multiple user data samples according to a preset ratio, and the multiple target samples and the category labels corresponding to the multiple target samples can be combined to obtain a target sample set. This method is suitable for scenarios where the rules are clear and easy to quantify.
[0084] S130, extracting features from multiple target samples to obtain target features, and using a preset feature processing algorithm to identify and aggregate the target features to obtain a target feature set.
[0085] It should be noted that the introduction to the gradient unilateral sampling algorithm is detailed below. Figure 2 Example.
[0086] By performing data cleaning and feature extraction on multiple target samples, a feature set of multiple target samples is obtained.
[0087] Exemplarily, the method of data cleaning can be to delete variables based on business experience, including variables that do not conform to the business, duplicate variables, and seriously missing variables; or it can be to supplement missing values. If important variables are missing some values, they need to be supplemented.
[0088] Then, the cleaned feature set is identified and aggregated to obtain the target feature set.
[0089] This process is used to identify the features that are influential in confirming the user's identity category and integrate them into one to form a target feature set.
[0090] The preset feature processing algorithm is a preset feature processing algorithm used to identify and aggregate target features to obtain a target feature set to achieve the effect of feature dimensionality reduction.
[0091] Exemplarily, the preset feature processing algorithm may be a machine learning algorithm, a mutually exclusive feature bundling algorithm, a feature importance screening algorithm, or the like.
[0092] In one implementation, a trained machine learning algorithm is used to automatically evaluate feature importance, identify features that have a greater impact on the performance of the recognition model, and aggregate these important features into a target feature set.
[0093] Exclusive Feature Bundling (EFB) is a technique for feature selection and dimensionality reduction. Its main purpose is to simplify the feature space by identifying and combining features that are mutually exclusive in some cases.
[0094] In one implementation, a mutually exclusive feature bundling algorithm is used to identify combinations of related features in target samples, extract features for distinguishing different categories, and aggregate these mutually exclusive features into a target feature set to enhance the classification ability of the model. S140: Input the target feature set corresponding to the multiple target samples into the recognition model to be trained to obtain a category prediction result.
[0095] S150. For each target sample, calculate the target gradient value according to the category prediction result and the category label, and adjust the model parameters of the recognition model based on the target gradient value.
[0096] For example, in actual operation, the target gradient value can be calculated according to the deviation between the category prediction result and the category label.
[0097] The target gradient value is used to reflect the prediction accuracy and directionality of the current recognition model on the target sample.
[0098] Based on the target gradient value, the recognition model is trained to optimize its parameters and reduce prediction errors. By calculating the target gradient value, the recognition model can effectively identify which features have a greater impact on the prediction results, so as to make more targeted parameter adjustments. By updating the parameters, the recognition model gradually approaches the true label, thereby improving the overall prediction accuracy.
[0099] It should be understood that the trained recognition model is used to determine the category of the user to be identified based on the user data of the user to be identified.
[0100] In one implementation, this step can be implemented based on standard gradient descent, that is, the loss function of the target sample is calculated, the gradient of the loss function to the model parameters is calculated by back propagation, and the model parameters are updated using the standard gradient descent algorithm.
[0101] In one implementation, this step can be implemented based on a natural gradient boosting algorithm, that is, the natural gradient value of the target sample is calculated, and based on the natural gradient value, the Fisher information matrix is used to adjust the gradient direction and update the model parameters.
[0102] In the embodiment of the present application, a preset sampling algorithm is used to screen out samples that have a greater impact on model training from multiple user data samples to achieve sample dimensionality reduction, and a preset feature processing algorithm is used to screen and aggregate features to achieve dimensionality reduction of the feature space. The combination of the two methods can effectively reduce computational complexity and memory consumption, improve the efficiency of data processing and model training, and make the model more efficient when processing large-scale data sets.
[0103] It is understandable that, as described in the background technology, as the amount of data increases, analyzing user data becomes increasingly difficult. Usually, it relies on the method of labeling sample sets multiple times, which not only requires a lot of manual intervention, but also consumes time and resources, resulting in a significant increase in the cost and complexity of data labeling, thereby affecting the overall efficiency. To address this problem, the embodiment of the present application proposes a solution based on a gradient unilateral sampling algorithm, which effectively improves the efficiency of data processing and analysis by reducing the dimension at the sample level.
[0104] Figure 2 A flow chart of a model training method provided in an embodiment of the present application is shown.
[0105] It should be understood that Figure 2 The illustrated embodiment may be regarded as an example of step S120 .
[0106] S210: Input multiple user data samples into the initialized recognition model to obtain an initial category prediction result corresponding to each user data sample.
[0107] S220: For each user data sample, determine an initial gradient value of the user data sample based on an initial category prediction result corresponding to the user data sample and a category label corresponding to the user data sample.
[0108] S230. Extract a preset number of user data samples from a plurality of user data samples as target samples according to the initial gradient value to form a target sample set.
[0109] In one implementation, multiple user data samples are sorted in descending order according to the size of the initial gradient value, the first preset number of user data samples in the front of the sequence are used as large gradient samples, and the second preset number of user data samples are extracted from the remaining user data samples as small gradient samples, and the large gradient samples and the small gradient samples are combined to obtain a target sample set.
[0110] This implementation selects samples by sorting the gradient values, thereby effectively improving the efficiency and accuracy of model training. By sorting according to the size of the initial gradient value, samples that have a greater impact on model training (large gradient samples) are prioritized to ensure that the model performs in-depth learning on key data. In the process of selecting small gradient samples, a certain number of random samples are selected from the remaining user data samples to introduce diversity. This allows the model to not only learn strong features (large gradient samples) during training, but also obtain a wider range of feature coverage through small gradient samples, reducing model bias.
[0111] The method of this embodiment is described below by using an example.
[0112] Assume that multiple user data samples constitute a sample data set. The corresponding feature space of sample data is The categorical variable is Y = {y1,y2,…,y m}.
[0113] Set basic parameters such as number of iterations, sample sampling ratio and loss function.
[0114] Set the number of iterations k, the sampling ratio of large gradient data a, the sampling ratio of small gradient data b, the loss function loss, the weak learner L, the initial model set M is empty, and the weight factor is set
[0115] According to the sampling ratio a of large gradient data, calculate the sampling number topN of large gradient samples:
[0116] topN=a*len(D); (1)
[0117] According to the sampling ratio b of small gradient data, the sampling number randN of small gradient samples is calculated:
[0118] randN=b*len(D); (2)
[0119] Use the current model set M to predict the training data D and get the output result P:
[0120] P = M.predict(D); (3)
[0121] Use the loss function loss to calculate the gradient g of the loss with respect to the output result P:
[0122] g=loss(D,P); (4)
[0123] Initialize the weight vector w to a vector of all 1s. This means that in the initial state, all samples contribute equally to model training;
[0124] Use the absolute value of the gradient abs(g) to sort the samples to determine which samples have the greatest impact on the model output:
[0125] sorted=GetSortedIndices(abs(g)); (5)
[0126] Select the topN samples from the sorted gradient data to form the topSet. These samples will be used to prioritize improving the performance of the model:
[0127] topSet=sorted[1:topN]; (6)
[0128] Randomly select randN samples from the remaining samples to form randSet. Although these samples have little impact on the model, they still help maintain the stability and diversity of the model:
[0129] randSet=RandomPick(sorted[topN:len(D)],randN); (7)
[0130] Merge the selected topSet and randSet to get a new sample set usedSet.
[0131] (usedSet is an example of the target sample set):
[0132] usedSet=topSet+randSet; (8)
[0133] Assign weights f to the samples in randSet; by setting weights for these samples, you can adjust their influence on model updates during training. The weight factor f = (1-a) / b here reflects the relative importance of large gradient samples and small gradient samples.
[0134] Use the samples in usedSet and the corresponding negative gradients to train a new recognition model newM:
[0135] newM=L(D[usedSet],-g[usedSet],w[usedSet]); (9)
[0136] Add the new recognition model newM to the model set M.
[0137] It is understandable that the increase in data dimensions may lead to an increase in model complexity, longer training time, and an increased risk of overfitting. Therefore, in addition to sample dimensionality reduction, the present application embodiment proposes a solution based on a mutually exclusive feature bundling feature algorithm. This solution effectively improves the training efficiency and accuracy of the model by reducing the dimensionality at the feature level, while reducing the impact of irrelevant features on model performance.
[0138] Figure 3 A flow chart of a model training method provided in an embodiment of the present application is shown.
[0139] It should be understood that Figure 3 The illustrated embodiment may be regarded as an example of step S130 .
[0140] like Figure 3 As shown, the method may include the following steps.
[0141] S310: Extract features from multiple target samples to obtain an initial feature set.
[0142] S320: Group the features in the initial feature set to obtain multiple feature combinations.
[0143] For example, the features may be grouped according to the correlation or mutual exclusivity between the features.
[0144] The number of feature conflicts of each feature combination in the plurality of feature combinations is determined based on a second preset threshold.
[0145] The embodiment of the present application does not limit the second preset threshold.
[0146] In one implementation, step S320 may include the following steps.
[0147] S321, traversing each feature in the initial feature set in a preset order, and for each feature, determining whether the number of feature conflicts after the feature is added to the existing feature combination exceeds a second preset threshold.
[0148] S322: When the second preset threshold is not exceeded, the feature is added to the existing feature combination, and the number of feature conflicts in the existing feature combination is updated.
[0149] S323: When the second preset threshold is exceeded, a new feature combination is created based on the feature.
[0150] This implementation method dynamically evaluates the number of conflicts in the feature combination to ensure that the selected features have good complementarity, thereby improving the effectiveness and accuracy of the model, while reducing redundant features, reducing the risk of overfitting, and improving the training efficiency and generalization ability of the model.
[0151] S330, integrating multiple feature combinations to obtain a target feature set.
[0152] This embodiment adopts a mutually exclusive feature bundling algorithm, which effectively reduces the redundancy and conflict of features, improves the efficiency of model training, reduces the risk of overfitting, and makes subsequent model construction and prediction more reliable.
[0153] The following is based on Figure 2 The example given in the embodiment continues to illustrate the method of this embodiment.
[0154] Use the output model set and prediction results to select the appropriate data subset usedSet;
[0155] Get the target sample set The corresponding feature space of sample data is The categorical variable is Y = {y1,y2,…,y m}:
[0156] Set the maximum number of conflicts K between features;
[0157] Construct a graph G based on the input feature set X. In this graph, nodes represent features and edges represent the relationship between features;
[0158] Sort the nodes in graph G according to their weights to get the search order of features;
[0159] Traverse each node in turn according to the search order, and check whether the conflict threshold K will be exceeded after adding the current node to the existing feature bundle group;
[0160] If the number of times a feature bundle is added does not exceed the conflict threshold K, it is added and the conflict count of the feature bundle is updated;
[0161] If joining each existing feature bundle exceeds the conflict threshold K, the current feature is used as a new bundle.
[0162] The final output result is the grouped feature X_b, and the number of conflicts between features in each group does not exceed the set threshold K;
[0163] By traversing each data point and feature of X_b, the data with mutually exclusive features are merged into a new feature. The value of the new feature is the cumulative sum of the original feature values, and finally the merged feature value list is output
[0164] It is understandable that the prior art adopts the method of averaging by multi-model classification, which may have the risk of overfitting when the sample size is insufficient or the data distribution is uneven, thereby affecting the generalization ability of the model. Based on this, the embodiment of the present application proposes a solution based on the Natural Gradient Boosting (NGBoost) algorithm. NGBoost is a gradient boosting method for probability prediction, which enables the gradient boosting algorithm to have probability prediction capabilities by using natural gradients. This solution adjusts the direction of the gradient by using the Fisher information matrix, thereby more accurately reflecting the geometric characteristics of the parameter space, converging faster, and improving the stability and generalization ability of the model.
[0165] exist Figure 4 In one implementation shown, this step can be implemented based on a natural gradient boosting algorithm. The implementation can include the following steps.
[0166] S410: For each target sample, calculate the natural gradient value of each target sample according to the deviation between the category prediction result and the category label.
[0167] In one implementation, step S410 may include the following steps:
[0168] First, use the following formula to initialize the distribution parameters.
[0169]
[0170] Among them, θ 0 is the initial distribution parameter, N is the number of sample features, θ is the distribution parameter, S is the scoring rule, and y i is the label value of the i-th sample;
[0171] The natural gradient is calculated for each training sample using the following formula:
[0172]
[0173] in, is the natural gradient of the rth iteration, I S is the Ferch information amount, is the distribution parameter of the previous iteration, is the gradient of S with respect to θ, and R is the number of iterations.
[0174] S420, adjusting the distribution parameters of the recognition model based on the natural gradient value fitting.
[0175] In one implementation, step S420 may include the following steps:
[0176] The natural gradient fitting base learner calculated in step S151 is:
[0177]
[0178] Among them, f r (x i ) is the rth base learner, x i is the i-th sample feature, is the natural gradient of the rth iteration, and N is the number of sample features;
[0179] The scaling factor is calculated using the following formula:
[0180]
[0181] Among them, ρ r is the scaling factor calculated in the rth iteration, argminρ is the ρ value that minimizes the expression, N is the number of sample features, S is the loss function, and θ r-1 is the distribution parameter of the r-1th iteration, f r (x i ) is the rth base learner, y i is the label value of the i-th sample.
[0182] Update the distribution parameters using the following formula:
[0183] θ r =θ r-1 -ηρ r f r (x i ); (14)
[0184] Among them, θ r is the distribution parameter of the rth iteration, θ r-1 is the distribution parameter of the r-1th iteration, η is the learning rate, and its value range is 0 to 1.
[0185] This implementation adopts the natural gradient boosting algorithm to realize model training. Compared with the traditional gradient boosting algorithm, the natural gradient can better handle the geometric structure of the parameter space, converge faster, improve the stability and generalization ability of the model, and output the uncertainty estimate of the prediction results.
[0186] It is understandable that in the process of training the recognition model, it is necessary to make real-time predictions on the training effect of the model to ensure that the model can effectively identify the user's identity. This process not only helps to evaluate the performance of the model on different data sets, but also timely discover potential problems such as overfitting or underfitting, so as to make necessary adjustments and optimizations.
[0187] Figure 5 A flow chart of a model training method provided in an embodiment of the present application is shown.
[0188] It should be understood that Figure 5 The illustrated embodiment can be viewed as Figure 1 An example of the illustrated embodiment.
[0189] like Figure 5 As shown, the method may include the following steps.
[0190] S510: Obtain feature sets of multiple test samples.
[0191] S520: Input the feature sets of the multiple test samples into the updated recognition model to obtain classification results corresponding to the multiple test samples.
[0192] S530, comparing the classification results of the multiple test samples with the category labels of the multiple test samples, calculating the recognition accuracy of the recognition model, and outputting the recognition model when the recognition accuracy reaches a first preset threshold.
[0193] The following is based on Figure 2 The example given in the embodiment continues to illustrate the method of this embodiment.
[0194] Through the above training, if the data of the test set is given, the probability prediction of the classification result can be obtained:
[0195]
[0196] Where P θ (x) is the conditional distribution function, P(y|x) is the conditional probability prediction for input x, θ (0) is the parameter of the initial distribution, f r (x) is the base learner, ρ r is the scaling factor.
[0197] The results of the probability prediction are compared with the actual data until the accuracy reaches the set threshold, and the final recognition model is output.
[0198] This embodiment provides a testing process for the recognition model. When the model prediction accuracy reaches a first preset threshold, it means that the model can better recognize user data, thereby enhancing the trust and effectiveness of user identity recognition.
[0199] In one embodiment, the solution of the present application also includes: using the recognition model to process the user data of the user to be identified to identify the identity category of the user to be identified; using the user data of the user to be identified and the identity category of the user to be identified as new samples to continue training the recognition model.
[0200] In this embodiment, the feature data of the user to be identified is input into the trained recognition model, and the recognition model outputs the user's identity category after inference. Subsequently, these user data and the identified identity category are combined into new samples for further training of the recognition model. This self-enhancement process enables the model to dynamically adapt to changes in user data, thereby improving the accuracy and efficiency of recognition.
[0201] Figure 6 A flow chart of a user category identification method provided in an embodiment of the present application is shown.
[0202] like Figure 6 As shown, the method may include the following steps.
[0203] S610: Obtain user data of the user to be identified.
[0204] S620: Extract user features corresponding to the user data of the user to be identified.
[0205] S630: Determine the category of the user to be identified according to the user characteristics using the identification model.
[0206] It should be understood that the recognition model is trained using the model training methods described in the above embodiments.
[0207] In this embodiment, the recognition model trained by the above solution is used to identify the identity category of the user to be identified, thereby improving the recognition accuracy.
[0208] Figure 7 Schematic diagram of a model training device provided in an embodiment of the present application. Figure 7 As shown, the apparatus 700 may include.
[0209] The acquisition module 710 is used to acquire multiple user data samples and a category label corresponding to each user data sample.
[0210] The sampling module 720 is used to use a preset sampling algorithm to filter out multiple target samples from multiple user data samples, and combine the multiple target samples and the category labels corresponding to the multiple target samples to obtain a target sample set.
[0211] The feature processing module 730 is used to extract features from multiple target samples to obtain target features, and to identify and aggregate the target features using a preset feature processing algorithm to obtain a target feature set;
[0212] The training module 740 is used to input the target feature set corresponding to the multiple target samples into the recognition model to be trained to obtain the category prediction result.
[0213] The training module 740 is also used to calculate the target gradient value for each target sample according to the category prediction result and the category label, and train the recognition model based on the target gradient value.
[0214] The recognition model is used to determine the category of the user to be identified based on the user data of the user to be identified.
[0215] Figure 8 Schematic diagram of a user category identification device provided in an embodiment of the present application. Figure 8 As shown, the apparatus 800 may include:
[0216] The acquisition module 810 is used to acquire user data of the user to be identified.
[0217] The feature extraction module 820 is used to extract user features corresponding to the user data of the user to be identified.
[0218] The identification module 830 is used to determine the category of the user to be identified based on the user characteristics using the identification model. The identification model is obtained by Figures 1 to 5 The method of the embodiment is used for training.
[0219] Fig. 9 A schematic diagram of the hardware structure of a computer device provided in an embodiment of the present application is shown.
[0220] The computer device may include a processor 2001 and a memory 2002 storing computer program instructions.
[0221] Specifically, the processor 2001 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0222] The memory 2002 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 2002 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In one example, the memory 2002 may include a removable or non-removable (or fixed) medium, or the memory 2002 is a non-volatile solid-state memory. The memory 2002 may be inside or outside the integrated gateway disaster recovery device.
[0223] In one example, the memory 2002 may be a read-only memory (ROM). In one example, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or a flash memory, or a combination of two or more of these.
[0224] The memory 2002 may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage media device, an optical storage media device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.
[0225] The processor 2001 reads and executes the computer program instructions stored in the memory 2002 to implement Figure 1 A method for determining parameters of the smart metasurface in the illustrated embodiment.
[0226] In addition, in combination with the method for determining parameters of the smart metasurface in the above embodiments, the embodiment of the present application may provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any method for determining parameters of the smart metasurface in the above embodiments is implemented.
[0227] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed, implements any one of the methods for determining parameters of the smart metasurface in the above embodiments.
[0228] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0229] The functional blocks shown in the structural block diagram described above can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), appropriate firmware, plug-in, function card, etc. When implemented in software, the elements of the present application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or communication link by a data signal carried in a carrier. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (Read-Only Memory, ROM), flash memory, erasable read-only memory (Erasable ReadOnly Memory, EROM), floppy disks, compact disc read-only memory (Compact Disc Read-Only Memory, CD-ROM), optical discs, hard disks, optical fiber media, radio frequency (Radio Frequency, RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0230] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0231] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0232] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A model training method, characterized in that: include: Obtain multiple user data samples and a category label corresponding to each user data sample; Using a preset sampling algorithm, a plurality of target samples are screened out from the plurality of user data samples, and the plurality of target samples and the category labels corresponding to the plurality of target samples are combined to obtain a target sample set; Extracting features from the multiple target samples to obtain target features, and using a preset feature processing algorithm to identify and aggregate the target features to obtain a target feature set; Inputting the target feature set corresponding to the multiple target samples into the recognition model to be trained to obtain a category prediction result; For each target sample, a target gradient value is calculated according to the category prediction result and the category label, and model parameters of the recognition model are adjusted based on the target gradient value.
2. The method according to claim 1, characterized in that The target gradient value is a natural gradient value; for each target sample, the target gradient value is calculated according to the category prediction result and the category label, and the recognition model parameters are adjusted based on the target gradient value, including: For each target sample, calculating the natural gradient value of each target sample according to the deviation between the category prediction result and the category label; A distribution parameter of the recognition model is adjusted based on the natural gradient value.
3. The method according to claim 2, characterized in that The method further comprises: Obtaining multiple test samples and true classification results corresponding to the multiple test samples; Inputting a plurality of test samples into the updated recognition model to obtain test classification results corresponding to the plurality of test samples; The test classification results of the multiple test samples are compared with the true classifications of the multiple test samples, and the recognition accuracy of the recognition model is calculated. When the recognition accuracy reaches a first preset threshold, the recognition model is output.
4. The method according to any one of claims 1 to 3, characterized in that The method of using a preset sampling algorithm to select a plurality of target samples from the plurality of user data samples, and combining the plurality of target samples and the category labels corresponding to the plurality of target samples to obtain a target sample set includes: Inputting the multiple user data samples into the initialized recognition model to obtain an initial category prediction result corresponding to each user data sample; For each user data sample, based on an initial category prediction result corresponding to the user data sample and a category label corresponding to the user data sample, determine an initial gradient value of the user data sample; A preset number of user data samples are extracted from the multiple user data samples according to the initial gradient value as the target samples to form the target sample set.
5. The method according to claim 4, characterized in that Extracting a preset number of user data samples from the plurality of user data samples as the target samples according to the initial gradient value to form the target sample set includes: The multiple user data samples are sorted in descending order according to the size of the initial gradient value, the first preset number of user data samples before the sequence are taken as large gradient samples, the second preset number of user data samples are extracted from the remaining user data samples as small gradient samples, and the large gradient samples and small gradient samples are combined to obtain a target sample set.
6. The method according to any one of claims 1 to 3, characterized in that The step of extracting features from the plurality of target samples to obtain target features, and using a preset feature processing algorithm to identify and aggregate the target features to obtain a target feature set includes: Extracting features from the multiple target samples to obtain an initial feature set; Grouping the features in the initial feature set to obtain a plurality of feature combinations, wherein the number of feature conflicts in each feature combination in the plurality of feature combinations is determined based on a second preset threshold; The multiple feature combinations are integrated to obtain the target feature set.
7. The method according to claim 6, characterized in that The features in the initial feature set are grouped to obtain a plurality of feature combinations, including: Traversing each feature in the initial feature set in a preset order, and for each feature, determining whether the number of feature conflicts after adding the feature to the existing feature combination exceeds the second preset threshold; When the second preset threshold is not exceeded, the feature is added to the existing feature combination, and the number of feature conflicts in the existing feature combination is updated; When the second preset threshold is exceeded, a new feature combination is created based on the feature.
8. The method according to any one of claims 1 to 3, characterized in that The method further comprises: Using the recognition model to process the user data of the user to be identified, and identifying the identity category of the user to be identified; The user data of the user to be identified and the identity category of the user to be identified are used as new samples to continue training the recognition model.
9. A method for identifying user categories, characterized in that: include: Obtain user data of the user to be identified; Extracting user features corresponding to the user data of the user to be identified; The category of the user to be identified is determined according to the user characteristics using a recognition model, wherein the recognition model is trained by the method described in any one of claims 1 to 8.
10. A model training device, characterized in that: include: An acquisition module, used to acquire multiple user data samples and a category label corresponding to each user data sample; A sampling module, configured to select a plurality of target samples from the plurality of user data samples by using a preset sampling algorithm, and combine the plurality of target samples and the category labels corresponding to the plurality of target samples to obtain a target sample set; A feature processing module is used to extract features from the multiple target samples to obtain target features, and to identify and aggregate the target features using a preset feature processing algorithm to obtain a target feature set; A training module, used for inputting the target feature set corresponding to the plurality of target samples into the recognition model to be trained to obtain a category prediction result; The training module is also used to calculate a target gradient value for each target sample according to the category prediction result and the category label, and train the recognition model based on the target gradient value.
11. A user category identification device, characterized in that: include: An acquisition module, used to acquire user data of a user to be identified; A feature extraction module, used to extract user features corresponding to the user data of the user to be identified; The identification module is used to determine the category of the user to be identified according to the user characteristics using a recognition model, wherein the recognition model is trained by the method described in any one of claims 1 to 8.
12. A computer device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement the method according to any one of claims 1 to 9.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Cited By
Malignant load identification method, apparatus and device, medium and program product
CN121959198A
Screening model training method, screening method, equipment, medium and product
CN122348081A