Method and apparatus for determining a classification model, computer device and storage medium
Patent Information
- Application Number
- CN202310882547.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-18
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2043-07-18
AI Technical Summary
[0005]基于此,有必要针对上述分类模型存在平衡性较低的技术问题,提供一种分类模型的确定方法、装置、计算机设备、计算机可读存储介质和计算机程序产品
[0065]上述分类模型的确定方法、装置、计算机设备、存储介质和计算机程序产品,通过获取的样本数据集对待训练的分类模型进行训练得到第一分类模型,获取第一分类模型在各类别的金融数据上的敏感信息,从而确定第一分类模型在各类别金融数据上的平衡信息。在平衡信息不符合平衡条件的情况下对样本数据集进行均衡化处理得到新的样本数据集,并基于新的样本数据集对第一分类模型进行训练得到满足平衡条件的第二分类模型。该方法以平衡信息为衡量分类模型的平衡度的指标,在第一分类模型的平衡信息不符合平衡条件时,对样本数据集进行均衡化处理,以缩小样本数据集中各个类别的金融数据的数据量之间的差异,从而通过样本数据集的均衡来实现分类模型的平衡,提高训练得到的第二分类模型在各个类别上的分类准确性和平衡性。
Smart Images

Figure CN117113131B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method, apparatus, computer device, storage medium, and computer program product for determining a classification model. Background Technology
[0002] In recent years, machine learning algorithms have been increasingly used in the banking industry, with applications ranging from classification and clustering to association. From an application perspective, they can be broadly categorized into four areas: financial user management, precision marketing, intelligent risk control, and operational management. Among these, marketing timing is a crucial component of precision marketing. Determining the right marketing timing requires training a model using a large number of samples; the trained classification model then yields accurate marketing opportunities.
[0003] In existing technologies, classification models are generally trained using machine learning methods and decision trees. Specifically, this involves summarizing decision rules from a series of sample data with sample features and labels. Training ends when the classification model's prediction accuracy reaches a target. However, for classification models, in addition to overall prediction accuracy, the prediction accuracy for each category of data must also be considered. If the prediction accuracy of the classification model varies significantly across different categories, it cannot meet practical requirements.
[0004] Therefore, the classification model determined by the current method has the problem of low balance. Summary of the Invention
[0005] Therefore, it is necessary to provide a method, apparatus, computer device, computer-readable storage medium, and computer program product for determining a classification model, addressing the technical problem of low balance in the aforementioned classification models.
[0006] Firstly, this application provides a method for determining a classification model. The method includes:
[0007] Obtain a sample dataset; the sample dataset includes financial data from multiple categories;
[0008] The classification model to be trained is trained using the sample dataset to obtain the first classification model after training.
[0009] The sensitive information of the first classification model on financial data of each category is obtained respectively. Based on the sensitive information corresponding to each category, the balance information of the first classification model in processing financial data of each category is determined.
[0010] If the balance information does not meet the balance conditions, the sample dataset is subjected to equalization processing to obtain a new sample dataset;
[0011] The first classification model is retrained using the new sample dataset to obtain a second classification model whose balance information meets the balance condition.
[0012] In one embodiment, the financial data for each category in the sample dataset includes both positive and negative sample data; the step of obtaining sensitive information of the first classification model on the financial data of each category includes:
[0013] For each target category, the first classification model is used to predict the positive sample data under the target category to obtain the predicted category for the positive sample data.
[0014] Based on the matching results between the predicted category and the target category of the positive sample data, the recall rate of the first classification model on the financial data of the target category is obtained;
[0015] The recall rate is determined as sensitive information of the first classification model on the financial data of the target category.
[0016] In one embodiment, determining the balance information of the first classification model in processing the financial data of each category based on the sensitive information corresponding to each category includes:
[0017] The sensitive information corresponding to each category is multiplied to obtain the sensitive information product;
[0018] Based on the product of the sensitive information, the balance information of the first classification model in processing financial data of each category is obtained.
[0019] In one embodiment, the step of performing equalization processing on the sample dataset to obtain a new sample dataset when the balance information does not meet the balance conditions includes:
[0020] If the balance information does not meet the balance conditions, the sample proportion of each category of financial data in the sample dataset is obtained respectively.
[0021] With the goal of reducing the difference in the sample proportions of the financial data in each category, the quantity of financial data in each category is adjusted to obtain the adjusted financial data for each category.
[0022] The new sample dataset is obtained based on the adjusted financial data for each of the aforementioned categories.
[0023] In one embodiment, adjusting the quantity of financial data for each category to obtain adjusted financial data for each category includes:
[0024] Based on the sample proportion of each category of financial data, the financial data of each category is divided into a first category of financial data and a second category of financial data; the sample proportion of the first category of financial data is smaller than that of the second category of financial data.
[0025] Oversampling is performed on the financial data of the first category, and / or undersampling is performed on the financial data of the second category, to obtain the adjusted financial data for each category.
[0026] In one embodiment, the new sample dataset obtained based on the adjusted financial data of the various categories includes:
[0027] Obtain the category balance of the adjusted financial data for each category;
[0028] When the category balance is greater than the threshold, the adjusted financial data of each category are combined to form the new sample dataset.
[0029] In one embodiment, obtaining the category balance of the adjusted financial data for each category includes:
[0030] Obtain the total amount of adjusted financial data for each of the aforementioned categories;
[0031] Obtain the sample proportion of adjusted financial data for each category in the total data volume, and obtain the average category proportion based on the sample proportion corresponding to each category;
[0032] Based on the sample proportion corresponding to each category and the average category proportion, the adjusted category balance of the financial data for each category is obtained.
[0033] In one embodiment, obtaining the sample dataset includes:
[0034] Obtain an initial sample dataset; the initial sample dataset includes multiple sample financial data, each sample financial data having multiple financial features;
[0035] Determine the influencing factors of each financial feature on the classification results, and select the target financial feature from the multiple financial features based on the influencing factors;
[0036] Based on the target financial characteristics, the initial sample dataset is filtered, and category labels are set for each filtered sample financial data.
[0037] The sample dataset is obtained based on the filtered sample financial data and the category labels of the filtered sample financial data.
[0038] In one embodiment, after determining the balance information of the first classification model in processing the financial data of each category based on the sensitive information corresponding to each category, the method further includes:
[0039] If the balance information does not meet the balance condition, different weights are assigned to the financial data of each category in the sample dataset; the weights are negatively correlated with the amount of financial data in each category.
[0040] Based on the weights of the financial data in each category, the first classification model is trained again using the sample dataset to obtain a second classification model whose balanced information meets the balance condition.
[0041] Secondly, this application also provides a device for determining a classification model. The device includes:
[0042] The data acquisition module is used to acquire a sample dataset; the sample dataset includes financial data from multiple categories.
[0043] The first model training module is used to train the classification model to be trained using the sample dataset to obtain the first classification model after training.
[0044] The data calculation module is used to acquire the sensitive information of the first classification model on the financial data of each category, and to determine the balance information of the first classification model in processing the financial data of each category based on the sensitive information corresponding to each category.
[0045] The sample equalization module is used to perform equalization processing on the sample dataset when the balance information does not meet the balance conditions, so as to obtain a new sample dataset.
[0046] The second model training module is used to retrain the first classification model using the new sample dataset to obtain a second classification model whose balance information meets the balance condition.
[0047] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0048] Obtain a sample dataset; the sample dataset includes financial data from multiple categories;
[0049] The classification model to be trained is trained using the sample dataset to obtain the first classification model after training.
[0050] The sensitive information of the first classification model on financial data of each category is obtained respectively. Based on the sensitive information corresponding to each category, the balance information of the first classification model in processing financial data of each category is determined.
[0051] If the balance information does not meet the balance conditions, the sample dataset is subjected to equalization processing to obtain a new sample dataset;
[0052] The first classification model is retrained using the new sample dataset to obtain a second classification model whose balance information meets the balance condition.
[0053] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0054] Obtain a sample dataset; the sample dataset includes financial data from multiple categories;
[0055] The classification model to be trained is trained using the sample dataset to obtain the first classification model after training.
[0056] The sensitive information of the first classification model on financial data of each category is obtained respectively. Based on the sensitive information corresponding to each category, the balance information of the first classification model in processing financial data of each category is determined.
[0057] If the balance information does not meet the balance conditions, the sample dataset is subjected to equalization processing to obtain a new sample dataset;
[0058] The first classification model is retrained using the new sample dataset to obtain a second classification model whose balance information meets the balance condition.
[0059] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0060] Obtain a sample dataset; the sample dataset includes financial data from multiple categories;
[0061] The classification model to be trained is trained using the sample dataset to obtain the first classification model after training.
[0062] The sensitive information of the first classification model on financial data of each category is obtained respectively. Based on the sensitive information corresponding to each category, the balance information of the first classification model in processing financial data of each category is determined.
[0063] If the balance information does not meet the balance conditions, the sample dataset is subjected to equalization processing to obtain a new sample dataset;
[0064] The first classification model is retrained using the new sample dataset to obtain a second classification model whose balance information meets the balance condition.
[0065] The aforementioned method, apparatus, computer equipment, storage medium, and computer program product for determining the classification model train a first classification model using an acquired sample dataset. Sensitive information about the first classification model across various categories of financial data is then obtained to determine its balance information. If the balance information does not meet the balance conditions, the sample dataset is balanced to obtain a new sample dataset. The first classification model is then trained on this new dataset to obtain a second classification model that satisfies the balance conditions. This method uses balance information as an indicator of the classification model's balance. When the balance information of the first classification model does not meet the balance conditions, the sample dataset is balanced to reduce the differences in the amount of financial data across different categories. This balance of the sample dataset achieves the balance of the classification model, improving the classification accuracy and balance of the trained second classification model across all categories. Attached Figure Description
[0066] Figure 1 This is a diagram illustrating the application environment of a classification model determination method in one embodiment.
[0067] Figure 2 This is a flowchart illustrating a method for determining a classification model in one embodiment;
[0068] Figure 3 This is a flowchart illustrating the steps for obtaining a new sample dataset in one embodiment;
[0069] Figure 4 This is a flowchart illustrating the steps for obtaining class balance in one embodiment;
[0070] Figure 5 This is a structural block diagram of a device for determining a classification model in one embodiment;
[0071] Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0072] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0073] The classification model determination method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, terminal 102 collects multiple categories of financial data as sample data and transmits it to server 104 via the network. Server 104 acquires the sample data, integrates it into a sample dataset, and trains the classification model to be trained based on the sample dataset to obtain a first classification model. Server 104 acquires sensitive information on each category of financial data and determines the balance information on each category of financial data based on the corresponding sensitive information. If the balance information does not meet the balance condition, server 104 performs balance processing on the sample dataset to obtain a new sample dataset. Server 104 retrains the first classification model based on the new sample dataset to obtain a second classification model that meets the balance condition. The data storage system is used to store the multiple categories of financial data to be processed. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, and tablets. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0074] In one embodiment, such as Figure 2 As shown, a method for determining a classification model is provided, which is then applied to... Figure 1 Taking server 104 as an example, the following steps are included:
[0075] Step S202: Obtain the sample dataset; the sample dataset includes financial data from multiple categories.
[0076] Sample datasets are resources used by algorithm engineers to develop machine learning models. They train algorithms by providing them with comprehensive and unified information about a specific task. They typically consist of a large number of data points, each with a label and other metadata.
[0077] Among these, multiple categories of financial data can include information related to bank financial users, such as their identity information, investment information, and behavioral information.
[0078] Optionally, the server obtains a sample dataset for model training, which includes multiple categories of financial data such as financial user identity information, financial user investment information, and financial user behavior information.
[0079] Step S204: Train the classification model to be trained using the sample dataset to obtain the first classification model after training.
[0080] In this context, a classification model refers to learning from a sample dataset such as {(x1, y1), (x2, y2), ..., (xn, yn)} to establish a mapping f: X→Y from the input space X to the output space Y. Based on the different output categories, it can be divided into binary classification models, multi-class classification models, and multi-label classification models. Model training refers to configuring different parameters for different inputs, using large datasets to find the optimal parameter configuration to achieve a high recognition rate.
[0081] Optionally, the server uses a machine learning algorithm to train the classification model to be trained using the obtained sample dataset to obtain the first classification model after training.
[0082] Step S206: Obtain the sensitive information of the first classification model on the financial data of each category, and determine the balance information of the first classification model in processing the financial data of each category based on the sensitive information corresponding to each category.
[0083] Sensitive information refers to the evaluation metrics of the classification model, such as accuracy, precision, and recall, which may refer to recall in this application.
[0084] The balance information refers to the G-mean (geometric mean), which can be calculated by multiplying the recall rates of each category of financial data and then taking the square root of the product.
[0085] Optionally, the server obtains the recall rate of the first classification model on each category of financial data, and calculates and processes the recall rate corresponding to each category of financial data to obtain the balance information of the first classification model in processing each category of financial data.
[0086] Step S208: If the balance information does not meet the balance conditions, the sample dataset is balanced to obtain a new sample dataset.
[0087] Among them, the balance condition can be that the G-mean (geometric mean) is higher than a preset threshold, and the closer the balance information value is to 1, the better the model's balance is across different categories of financial data.
[0088] Among them, equalization processing refers to adopting strategies to optimize the sample ratios of each category of financial data and reduce the gap between the sample ratios. For example, adjusting the sample ratios through undersampling or oversampling can achieve equalization processing of the sample dataset.
[0089] Optionally, if the balance information is below a preset threshold, the size difference between the sample proportions of financial data of each category in the sample dataset is reduced to obtain an optimized new sample dataset.
[0090] Step S210: The first classification model is retrained using a new sample dataset to obtain a second classification model whose balance information meets the balance condition.
[0091] The retrained second classification model also needs to obtain sensitive information on financial data of each category, and determine the balance information of the second classification model in processing financial data of each category based on the sensitive information.
[0092] Optionally, the first classification model is retrained with the new sample dataset to obtain a new first classification model. It is then determined whether the balance information of the new first classification model meets the balance condition. If it does, the new first classification model is used as the second classification model. If it does not, the new first classification model is retrained until the balance information of the first classification model obtained in the last training meets the balance condition.
[0093] In the above method for determining the classification model, balance information is used as an indicator to measure the balance of the classification model. When the balance information of the first classification model does not meet the balance condition, the sample dataset is balanced to reduce the difference in the amount of financial data of each category in the sample dataset. Thus, the balance of the classification model is achieved through the balance of the sample dataset, thereby improving the classification accuracy and balance of the trained second classification model in each category.
[0094] In one embodiment, the financial data for each category in the sample dataset includes both positive and negative sample data. Step S206 involves obtaining the sensitive information of the first classification model for each category of financial data. Based on the sensitive information corresponding to each category, this includes:
[0095] Step S206a: For the target category in each category, the first classification model is used to predict the positive sample data under the target category to obtain the predicted category for the positive sample data.
[0096] In this context, prediction refers to the process of classifying sample data in machine learning.
[0097] Among them, the sample labels of positive sample data are consistent with the true sample labels, while the sample labels of negative sample data are inconsistent with the true sample labels.
[0098] The target category can be any one of the various categories.
[0099] Optionally, for each target category in the sample dataset, the server uses a first classification model to predict positive sample data under the target category. The model makes predictions about positive sample data, such as predicting whether a sample data belongs to the morning time period, and obtains the prediction result. For example, the sample dataset represents the time periods in a banking system where financial users open the banking system. The time periods correspond to the categories of morning, forenoon, afternoon, and evening, and each time period includes positive samples.
[0100] Step S206b: Based on the matching results between the predicted category and the target category of the positive sample data, obtain the recall rate of the first classification model on the financial data of the target category.
[0101] Recall rate refers to the proportion of samples that were predicted to be positive out of the samples that were actually positive.
[0102] The matching result is the result of whether the sample data category predicted by the model is consistent with the category to which the sample actually belongs.
[0103] Optionally, when the predicted category for positive sample data matches the target category, it indicates that the first classification model has made a correct prediction. The number of correctly predicted positive sample data can then be counted and denoted as the number of correct samples. Based on this number of correct samples and the total number of positive sample data, the recall rate of the first classification model on the target category of financial data can be obtained.
[0104] More specifically, the number of correct samples can be divided by the total number of positive samples, and the resulting ratio can be used as the recall rate of the first classification model on the target category of financial data.
[0105] Step S206c: The recall rate is determined as sensitive information of the first classification model on the financial data of the target category.
[0106] Among them, sensitive information refers to recall, an evaluation metric for machine learning models.
[0107] In practical applications, accuracy and precision can also be used as sensitive information.
[0108] Optionally, the server will use the calculated recall rate as the evaluation metric for the first classification model's performance on the target category of financial data.
[0109] In this embodiment, by limiting the sample dataset to include positive samples, the model predicts the positive samples and matches them with the target category, obtaining the recall rate based on the matching results. This achieves the calculation of recall rate, an evaluation metric for classification models.
[0110] In one embodiment, step S206, determining the balance information of the first classification model in processing financial data of each category based on the sensitive information corresponding to each category, includes:
[0111] Step S2061: Multiply the sensitive information corresponding to each category to obtain the sensitive information product.
[0112] The sensitive information refers to the recall rate of the first classification model for each category of financial data.
[0113] Optionally, the server multiplies the recall rates corresponding to each category to obtain a recall rate product.
[0114] Step S2062: Based on the product of sensitive information, obtain the balance information of the first classification model in processing financial data of each category.
[0115] The balance information refers to the G-mean (geometric mean), which is calculated by multiplying the recall rates of each category of financial data and then taking the square root of the product.
[0116] Optionally, the server squares the product of the recall rates corresponding to each category of financial data to obtain the geometric mean of the first classification model in processing each category of financial data, which serves as balancing information.
[0117] In this embodiment, the geometric mean of the new evaluation metric is obtained by multiplying the recall rates corresponding to each category of financial data, and then taking the square root of the product. The introduction of the new evaluation metric comprehensively considers the classification accuracy of the classification model in each category, making the evaluation of model training more reliable.
[0118] In one embodiment, such as Figure 3 As shown, step S208 involves equalizing the sample dataset when the balance information does not meet the balance conditions, resulting in a new sample dataset, including:
[0119] Step S302: If the balance information does not meet the balance conditions, obtain the sample proportion of each category of financial data in the sample dataset.
[0120] Among them, the closer the balance information G-mean (geometric mean) value is to 1, the better the classification model has in handling imbalanced classes.
[0121] The balance condition can be that the balance information is greater than a preset threshold. For example, if the preset balance information threshold is 0.7, and the calculated balance information is 0.65, then the balance condition is not met. The sample ratio refers to the ratio of the number of financial data samples in each category to the total number of samples in the dataset.
[0122] Optionally, when the calculated balance information is lower than a preset threshold, the balance information does not meet the balance condition, and the sample proportion of each category of financial data in the sample dataset is obtained respectively.
[0123] Step S304: With the goal of reducing the difference in the sample proportions of financial data in each category, the quantity of financial data in each category is adjusted to obtain the adjusted financial data for each category.
[0124] Among them, adjustment processing refers to optimizing the sample proportion of financial data in each category by adopting strategies, such as undersampling to reduce the number of samples in financial data categories with a large sample proportion, or oversampling to increase the number of samples in financial data categories with a small sample proportion.
[0125] Optionally, the server aims to reduce the difference in the sample proportions of financial data in each category by undersampling or oversampling the financial data in each category, thereby obtaining financial data with a more balanced sample proportion in each category after processing.
[0126] Step S306: Based on the adjusted financial data for each category, a new sample dataset is obtained.
[0127] The new sample dataset refers to the dataset composed of financial data from various categories after the sample proportions have been balanced.
[0128] Optionally, the server integrates the financial data from each category after equalization processing to obtain a new sample dataset.
[0129] In this embodiment, by balancing the sample proportions of financial data in each category, the difference in sample proportions between the different categories of financial data is reduced, thereby improving the balance of the sample dataset used to train the model and thus achieving the effect of improving accuracy.
[0130] In one embodiment, step S304 adjusts the quantity of financial data for each category to obtain adjusted financial data for each category, including:
[0131] Step S304a: Based on the sample proportion of each category of financial data, divide the financial data of each category into a first category of financial data and a second category of financial data; the sample proportion of the first category of financial data is smaller than that of the second category of financial data.
[0132] The distinction between the first and second categories of financial data can be made by sorting the sample proportions of each category of financial data by size and then dividing them from the middle of the sorted list.
[0133] Optionally, the server sorts the sample proportions of financial data in each category in ascending order, and divides the sorted data into the first category and the second category, with the sample proportion of the first category being smaller than that of the second category.
[0134] Step S304b: Oversample the financial data of the first category and / or undersample the financial data of the second category to obtain adjusted financial data for each category.
[0135] Oversampling refers to drawing samples multiple times from a small number of categories to make the number of positive and negative samples close.
[0136] Undersampling refers to selecting a number of samples from the majority class that are roughly equal in number to the minority class, and then combining them with the minority class samples to form a new dataset with a roughly equal ratio of positive to negative samples.
[0137] Optionally, multiple oversampling processes are performed on the samples of financial data in the first category, and / or undersampling processes are performed on the samples of financial data in the second category, with the number of samples being equivalent to that of the financial data in the first category, to obtain financial data with adjusted sample numbers.
[0138] In this embodiment, by dividing the financial data of each category into a first category of financial data and a second category of financial data according to the corresponding sample ratio, and performing undersampling and / or oversampling processing respectively, the financial data with adjusted sample ratio is obtained, thereby achieving the effect of solving the imbalance of sample ratio of each category of financial data.
[0139] In one embodiment, step S208, based on the adjusted financial data for each category, yields a new sample dataset, including:
[0140] Step S208a: Obtain the category balance of the adjusted financial data for each category.
[0141] Among them, category balance refers to the evaluation index of the balance of the model. It can be calculated according to the preset formula, based on the sample proportion of each category of financial data in the sample dataset, the average category proportion of each category of financial data, and the total number of categories.
[0142] Optionally, the server calculates the category balance of each category of financial data after undersampling and oversampling processing according to a preset formula.
[0143] Step S208b: When the class balance is greater than the threshold, the adjusted financial data of each class are combined to form a new sample dataset.
[0144] The closer the class balance value is to 1, the better the model's balance is when dealing with imbalanced classes. The threshold can be set according to the required standards for model balance.
[0145] Optionally, when the class balance of the financial data in each category after sample ratio adjustment is greater than a preset threshold, the adjusted financial data in each category are combined to form a new sample dataset.
[0146] In this embodiment, the class balance of each category of financial data after sample ratio adjustment is calculated. If the class balance is greater than a threshold, the adjusted financial data from each category are combined into a new sample dataset. This achieves the effect of introducing a new evaluation index to improve the balance of the classification model in handling imbalanced classes.
[0147] In one embodiment, such as Figure 4 As shown, step S208a above obtains the category balance of the adjusted financial data for each category, including:
[0148] Step S402: Obtain the total amount of adjusted financial data for each category.
[0149] The total data volume refers to the total number of adjusted financial data categories.
[0150] Optionally, the server obtains the total number of categories of adjusted financial data for each category.
[0151] Step S404: Obtain the sample proportion of adjusted financial data in the total data volume for each category, and obtain the average category proportion based on the sample proportion corresponding to each category.
[0152] The average category proportion refers to the sum of the category proportions corresponding to the financial data of each category, which is then divided by the total number of categories.
[0153] Optionally, the server obtains the sample proportion of the adjusted financial data in the total data volume for each category, adds up the category proportions corresponding to the financial data in each category to obtain the sum of the sample proportions corresponding to the financial data in each category, and then divides the sum by the total number of categories to obtain the average category proportion.
[0154] Step S406: Based on the sample proportion and average category proportion corresponding to each category, obtain the category balance of the adjusted financial data for each category.
[0155] The class balance is calculated by substituting the sample proportion of each class and the average class proportion into the formula:
[0156] CBD = 1 - ∑(p_i - p_mean)^2 / N
[0157] The calculation yields CBD, where CBD represents the class balance, p_i is the proportion of the i-th class in the new sample dataset, p_mean is the average class proportion, and N is the total number of classes.
[0158] Optionally, the server inputs the sample proportion and average category proportion corresponding to each category into the category balance calculation formula to obtain the adjusted category balance of the financial data.
[0159] In this embodiment, by obtaining the total number of adjusted financial data categories, the corresponding sample proportion of each category in the total data volume, and the average category proportion, the category balance of the adjusted financial data is obtained by substituting them into the calculation formula. A new evaluation index is introduced to indirectly improve the balance of the classification model.
[0160] In one embodiment, after obtaining the balance information for the financial data in step S206, the method further includes: setting different weights for the financial data of each category in the sample dataset if the balance information does not meet the balance condition; the weights are negatively correlated with the amount of financial data in each category; and retraining the first classification model using the sample dataset according to the weights of the financial data in each category to obtain a second classification model whose balance information meets the balance condition.
[0161] In this context, negative correlation means that the smaller the amount of financial data in a category, the greater the weight assigned to that category of financial data.
[0162] In this context, the role of weights in model training is to increase the attention paid to financial data categories with larger weights during the training process.
[0163] Optionally, if the balance information does not meet the balance condition, the server assigns different weights to the financial data of each category in the sample dataset. The smaller the amount of financial data in a category, the greater the weight assigned to that category. The server then retrains the first classification model using the sample dataset, giving different levels of attention to each category of financial data according to their respective weights, thus obtaining a second classification model where the balance information meets the balance condition.
[0164] In this embodiment, different weights are assigned to each category of financial data based on the amount of data, with the amount of data in each category being inversely proportional to its corresponding weight. The weighted financial data is then used as training data for the model, which increases the attention paid to the smaller categories of financial data during training, resulting in a higher balance of samples during the training of the classification model.
[0165] In one embodiment, step S202, obtaining the sample dataset, includes:
[0166] Step S202a: Obtain the initial sample dataset; the initial sample dataset includes multiple sample financial data, each sample financial data has multiple financial features.
[0167] Among these, financial characteristics can include the identity information of bank financial users, the financial user's investment information, and the financial user's behavioral information.
[0168] Optionally, the server obtains an initial sample dataset, which includes financial data from multiple samples. Each sample of financial data has financial characteristics such as bank financial user identity information, financial user investment information, and financial user behavior information.
[0169] Step S202b: Determine the influencing factors of each financial feature on the classification results, and select the target financial feature from multiple financial features based on the influencing factors.
[0170] Among them, the impact factor is the degree of contribution of each feature to the category classification after evaluation. Only financial features with a large contribution will be selected.
[0171] Optionally, the server evaluates the contribution of each financial feature to the classification results and selects the target financial feature with a greater contribution.
[0172] Step S202c: Based on the target financial features, the initial sample dataset is filtered, and category labels are set for each filtered sample financial data.
[0173] Among them, the screening process refers to selecting sample data with target financial characteristics from the initial sample dataset.
[0174] Category tags can enable financial users to access time-specific features on the banking system's user interface, such as morning, noon, afternoon, and evening periods.
[0175] Optionally, the server sets corresponding category labels for the sample data in the initial sample dataset that have the target financial features, based on the selected target financial features.
[0176] Step S202d: Based on the filtered financial data of each sample and the category labels of the filtered financial data of each sample, the sample dataset is obtained.
[0177] Each sample financial data in the sample dataset has a corresponding category label.
[0178] Optionally, the server categorizes the selected financial data samples according to the category labels set after filtering to obtain a sample dataset.
[0179] In this embodiment, by preprocessing the initial dataset through data filtering, feature extraction, and label encoding, a new sample dataset is obtained. This achieves the effect of using the sample data with the highest classification contribution for model training, thereby improving the accuracy of the classification model.
[0180] In another embodiment, a method for determining a classification model is provided, the specific steps of which are as follows:
[0181] Step S10: Obtain the initial sample dataset; the initial sample dataset includes multiple sample financial data, each sample financial data has multiple financial features.
[0182] Specifically, the server obtains an initial sample dataset, which includes financial data from multiple samples. Each sample of financial data has financial characteristics such as bank financial user identity information, financial user investment information, and financial user behavior information.
[0183] Step S11: Determine the influencing factors of each financial feature on the classification results, and select the target financial feature from multiple financial features based on the influencing factors.
[0184] Specifically, the server evaluates the contribution of each financial feature to the classification results and selects the target financial feature with the greater contribution.
[0185] Step S12: Based on the target financial features, the initial sample dataset is filtered, and category labels are set for each filtered sample financial data.
[0186] Specifically, the server sets corresponding category labels for each sample financial data in the initial sample dataset that has the target financial characteristics, based on the selected target financial characteristics.
[0187] Step S13: Obtain the sample dataset based on the filtered financial data of each sample and the category labels of the filtered financial data of each sample.
[0188] Specifically, the server categorizes the selected financial data samples according to the category labels set after filtering to obtain the sample dataset.
[0189] Step S14: Train the classification model to be trained using the sample dataset to obtain the first classification model after training.
[0190] Specifically, the server uses machine learning algorithms to train the classification model to be trained using the obtained sample dataset, and obtains the first classification model after training.
[0191] Step S15: For the target category in each category, the first classification model is used to predict the positive sample data under the target category to obtain the predicted category for the positive sample data.
[0192] Specifically, for the target category in each category of the sample dataset, the server uses the first classification model to predict the positive sample data under the target category. For example, the sample dataset is the time period when financial users in the banking system open the banking system as a marketing opportunity, and the positive sample data is the number of samples in several time periods such as morning, forenoon, afternoon and evening. The model makes predictions and judgments on the positive sample data, such as predicting whether a sample data belongs to the morning time period, and obtains the prediction result.
[0193] Step S16: Based on the matching results between the predicted category and the target category of the positive sample data, obtain the recall rate of the first classification model on the financial data of the target category.
[0194] Specifically, the positive sample data prediction results of the first classification model are matched with the target category to obtain the matching result, that is, the number of samples that the model correctly predicts as positive sample data. This number is divided by the total number of positive sample data to obtain the recall rate of the first classification model on the target category of financial data.
[0195] Step S17: The recall rate is determined as sensitive information for the first classification model on the financial data of the target category.
[0196] Specifically, the server will use the calculated recall rate as the evaluation metric for the first classification model's processing of financial data in the target category.
[0197] Step S18: Multiply the sensitive information corresponding to each category to obtain the sensitive information product.
[0198] Specifically, the server multiplies the recall rates corresponding to each category to obtain the recall rate product.
[0199] Step S19: Based on the product of sensitive information, obtain the balance information of the first classification model in processing financial data of each category.
[0200] Specifically, the server takes the square root of the product of the recall rates corresponding to each category of financial data to obtain the G-mean (geometric mean) of the first classification model in processing each category of financial data.
[0201] Step S20: If the balance information does not meet the balance conditions, obtain the sample proportion of each category of financial data in the sample dataset.
[0202] Specifically, when the calculated balance information is lower than a preset threshold, the balance information does not meet the balance condition, and the sample proportion of each category of financial data in the sample dataset is obtained respectively.
[0203] Step S21: Based on the sample proportion of each category of financial data, divide the financial data of each category into a first category of financial data and a second category of financial data; the sample proportion of the first category of financial data is smaller than that of the second category of financial data.
[0204] Specifically, the server sorts the sample proportions of financial data in each category in ascending order, and divides the sorted data into the first category and the second category. The sample proportion of the first category of financial data is smaller than that of the second category.
[0205] Step S22: Oversample the financial data of the first category and / or undersample the financial data of the second category to obtain the adjusted financial data for each category.
[0206] Specifically, the financial data is subjected to multiple oversampling processes from the first category of financial data samples, and / or undersampling processes are performed from the second category of financial data samples, selecting a number of samples equivalent to the number of samples from the first category of financial data. This yields financial data with adjusted sample sizes.
[0207] Step S23: Based on the adjusted financial data for each category, a new sample dataset is obtained.
[0208] Specifically, the server integrates the financial data from each category after equalization processing to obtain a new sample dataset.
[0209] Step S24: Obtain the total amount of adjusted financial data for each category. Specifically, the server obtains the total number of categories of adjusted financial data for each category.
[0210] Step S25: Obtain the sample proportion of the adjusted financial data for each category in the new sample dataset, and obtain the average category proportion based on the sample proportion corresponding to each category.
[0211] Specifically, the server obtains the proportion of the adjusted financial data for each category in the new sample dataset, adds up the proportions of the financial data for each category to get the sum of the proportions of the financial data for each category, and then divides the sum by the total number of categories to get the average proportion of the categories.
[0212] Step S26: Based on the sample proportions corresponding to each category and the average category proportion, obtain the class balance of the new sample dataset.
[0213] Specifically, the server inputs the sample proportion and average class proportion corresponding to each category into the formula for calculating class balance to obtain the class balance of the new sample dataset.
[0214] Step S27: When the class balance is greater than the threshold, the adjusted financial data of each class are combined to form a new sample dataset.
[0215] Optionally, when the class balance of the financial data in each category after sample ratio adjustment is greater than a preset threshold, the adjusted financial data in each category are combined to form a new sample dataset.
[0216] Step S28: The first classification model is retrained with the new sample dataset to obtain a second classification model whose balance information meets the balance condition.
[0217] Specifically, the first classification model is retrained with the new sample dataset to obtain the second classification model. Sensitive information for each category is obtained, and the balance information of the second classification model in processing financial data of each category is determined based on the sensitive information. It is then judged whether the balance information meets the balance condition.
[0218] In this embodiment, balance information is used as an indicator to measure the balance of the classification model. When the balance information of the first classification model does not meet the balance condition, the sample dataset is balanced to reduce the difference in the amount of financial data of each category in the sample dataset. Thus, the balance of the classification model is achieved through the balance of the sample dataset, thereby improving the classification accuracy and balance of the trained second classification model in each category.
[0219] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0220] Based on the same inventive concept, this application also provides a classification model determination apparatus for implementing the classification model determination method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations of the classification model determination apparatus embodiment provided below can be found in the limitations of the classification model determination method described above, and will not be repeated here.
[0221] In one embodiment, such as Figure 5 As shown, a device for determining a classification model is provided, comprising: a data acquisition module 502, a first model training module 504, a data calculation module 506, a sample balancing module 508, and a second model training module 510, wherein:
[0222] The data acquisition module 502 is used to acquire a sample dataset; the sample dataset includes financial data of multiple categories.
[0223] The first model training module 504 is used to train the classification model to be trained using the sample dataset to obtain the first classification model after training.
[0224] The data calculation module 506 is used to acquire the sensitive information of the first classification model on the financial data of each category, and to determine the balance information of the first classification model in processing the financial data of each category based on the sensitive information corresponding to each category.
[0225] The sample equalization module 508 is used to perform equalization processing on the sample dataset when the balance information does not meet the balance conditions, so as to obtain a new sample dataset.
[0226] The second model training module 510 is used to retrain the first classification model using the new sample dataset to obtain a second classification model whose balance information meets the balance condition.
[0227] Furthermore, in one embodiment, the data calculation module 506 is also configured to, for the target category in each category, predict the positive sample data under the target category using the first classification model to obtain the predicted category for the positive sample data; based on the matching result between the predicted category of the positive sample data and the target category, obtain the recall rate of the first classification model on the financial data of the target category; and determine the recall rate as the sensitive information of the first classification model on the financial data of the target category.
[0228] Furthermore, in one embodiment, the data calculation module 506 is also used to multiply the sensitive information corresponding to each category to obtain the sensitive information product; based on the sensitive information product, the balance information of the first classification model in processing financial data of each category is obtained.
[0229] Furthermore, in one embodiment, the data acquisition module 502 is also used to acquire the sample proportion of each category of financial data in the sample dataset when the balance information does not meet the balance conditions. With the goal of reducing the differences between the sample proportions of each category of financial data, the quantity of financial data in each category is adjusted to obtain adjusted financial data for each category. Based on the adjusted financial data for each category, a new sample dataset is obtained.
[0230] Furthermore, in one embodiment, the data module 506 is also configured to divide the financial data into a first category and a second category based on the sample proportions of each category; the sample proportion of the first category of financial data is smaller than that of the second category. Oversampling processing is performed on the first category of financial data, and / or undersampling processing is performed on the second category of financial data to obtain adjusted financial data for each category.
[0231] Furthermore, in one embodiment, the data calculation module 506 is also used to obtain the category balance of the adjusted financial data for each category. When the category balance is greater than a threshold, the adjusted financial data for each category are combined to form a new sample dataset.
[0232] Furthermore, in one embodiment, the data calculation module 506 is also used to obtain the total amount of adjusted financial data for each category. It obtains the sample proportion of adjusted financial data for each category in the new sample dataset, and based on the sample proportion for each category, obtains the average category proportion. Based on the sample proportion for each category and the average category proportion, it obtains the category balance of the new sample dataset.
[0233] Furthermore, in one embodiment, the data acquisition module 502 is also used to acquire an initial sample dataset; the initial sample dataset includes multiple sample financial data, each sample financial data having multiple financial features. The influence factors of each financial feature on the classification result are determined, and target financial features are selected from the multiple financial features based on the influence factors. Based on the target financial features, the initial sample dataset is filtered, and category labels are set for each filtered sample financial data. Based on the filtered sample financial data and their category labels, a sample dataset is obtained.
[0234] Furthermore, in one embodiment, the sample balancing module 508 is also used to set different weights for the financial data of each category in the sample dataset when the balancing information does not meet the balancing conditions; the weights are negatively correlated with the amount of financial data in each category.
[0235] In this embodiment, the second model training module is also used to retrain the first classification model using a sample dataset according to the weights of financial data of each category, so as to obtain a second classification model whose balance information meets the balance condition.
[0236] Each module in the above-mentioned classification model determination device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0237] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 6 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores various categories of financial data used for model training. The I / O interfaces allow the processor to exchange information with external devices. The communication interface allows communication with external terminals via a network connection. When executed by the processor, the computer program implements a method for determining a classification model.
[0238] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0239] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0240] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0241] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0242] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data shall comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0243] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0244] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0245] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for determining a classification model, characterized in that, The method includes: Obtain a sample dataset; the sample dataset includes financial data of multiple categories, and the sample dataset is obtained in the following way: determine the influence factors of each financial feature on the classification results, and select target financial features from the multiple financial features based on the influence factors; based on the target financial features, perform screening processing on the initial sample dataset, and set category labels for each of the screened sample financial data to obtain the sample dataset; The classification model to be trained is trained using the sample dataset to obtain the first classification model after training. The first classification model is obtained for each category of financial data. Based on the sensitive information corresponding to each category, the balance information of the first classification model in processing each category of financial data is determined, wherein the balance information refers to the geometric mean. If the balance information does not meet the balance condition, the sample dataset is subjected to equalization processing to obtain a new sample dataset, wherein the balance condition is that the geometric mean is higher than a preset threshold. The first classification model is trained again using the new sample dataset to obtain a second classification model whose balance information meets the balance condition. The step of determining the balance information of the first classification model in processing the financial data of each category based on the sensitive information corresponding to each category includes: multiplying the sensitive information corresponding to each category to obtain a sensitive information product; and obtaining the balance information of the first classification model in processing the financial data of each category based on the sensitive information product. The new sample dataset, derived from the adjusted financial data based on each of the aforementioned categories, includes: Obtain the category balance of the adjusted financial data for each category; When the category balance is greater than the threshold, the adjusted financial data of each category are combined to form the new sample dataset. After determining the balance information of the first classification model in processing the financial data of each category based on the sensitive information corresponding to each category, the method further includes: If the balance information does not meet the balance condition, different weights are assigned to the financial data of each category in the sample dataset; the weights are negatively correlated with the amount of financial data in each category. Based on the weights of the financial data in each category, the first classification model is trained again using the sample dataset to obtain a second classification model whose balanced information meets the balance condition.
2. The method according to claim 1, characterized in that, The sample dataset includes both positive and negative samples for each category of financial data; the acquisition of sensitive information of the first classification model on the financial data of each category includes: For each target category, the first classification model is used to predict the positive sample data under the target category to obtain the predicted category for the positive sample data. Based on the matching results between the predicted category and the target category of the positive sample data, the recall rate of the first classification model on the financial data of the target category is obtained; The recall rate is determined as sensitive information of the first classification model on the financial data of the target category.
3. The method according to claim 1, characterized in that, When the balance information does not meet the balance conditions, the sample dataset is subjected to equalization processing to obtain a new sample dataset, including: If the balance information does not meet the balance conditions, the sample proportion of each category of financial data in the sample dataset is obtained respectively. With the goal of reducing the difference in the sample proportions of the financial data in each category, the quantity of financial data in each category is adjusted to obtain the adjusted financial data for each category. The new sample dataset is obtained based on the adjusted financial data for each of the aforementioned categories.
4. The method according to claim 3, characterized in that, The adjustment process for the quantity of financial data in each category, to obtain the adjusted financial data for each category, includes: Based on the sample proportion of each category of financial data, the financial data of each category is divided into a first category of financial data and a second category of financial data; the sample proportion of the first category of financial data is smaller than that of the second category of financial data. Oversampling is performed on the financial data of the first category, and / or undersampling is performed on the financial data of the second category, to obtain the adjusted financial data for each category.
5. The method according to claim 1, characterized in that, Obtain the category balance of the adjusted financial data for each category, including: Obtain the total amount of adjusted financial data for each of the aforementioned categories; Obtain the sample proportion of adjusted financial data for each category in the total data volume, and obtain the average category proportion based on the sample proportion corresponding to each category; Based on the sample proportion corresponding to each category and the average category proportion, the adjusted category balance of the financial data for each category is obtained.
6. A device for determining a classification model applied to the method for determining a classification model according to claim 1, characterized in that, The device includes: The data acquisition module is used to acquire a sample dataset. The sample dataset includes financial data of multiple categories. The sample dataset is obtained by: determining the influence factors of each financial feature on the classification results; selecting target financial features from the multiple financial features based on the influence factors; and filtering the initial sample dataset based on the target financial features and setting category labels for each filtered sample financial data to obtain the sample dataset. The first model training module is used to train the classification model to be trained using the sample dataset to obtain the first classification model after training. The data calculation module is used to acquire the sensitive information of the first classification model on the financial data of each category, and to determine the balance information of the first classification model in processing the financial data of each category based on the sensitive information corresponding to each category. The sample equalization module is used to equalize the sample dataset when the balance information does not meet the balance conditions, so as to obtain a new sample dataset. The second model training module is used to retrain the first classification model using the new sample dataset to obtain a second classification model whose balance information meets the balance condition. The data calculation module is also used to obtain the category balance of the adjusted financial data for each category; when the category balance is greater than the threshold, the adjusted financial data for each category are combined into a new sample dataset. The sample balancing module is further configured to set different weights for each category of financial data in the sample dataset when the balancing information does not meet the balancing conditions; the weights are negatively correlated with the amount of financial data in each category; the second model training module is further configured to retrain the first classification model using the sample dataset according to the weights of the financial data in each category, so as to obtain a second classification model whose balancing information meets the balancing conditions.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Traffic data feature extraction method, malicious traffic identification method and network system
CN111786951A
Electricity utilization information acquisition equipment fault classification model training method and device
CN113792825A