Fair classification method and device under data missing condition
By introducing iterative optimization methods of fair constraints and exponential loss functions in machine learning, the fairness and accuracy trade-offs are solved when data is missing, and the fairness and accuracy are taken into account when processing missing data is processed, which is suitable for multiple A kind of application scenario.
Patent Information
- Application Number
- CN202410953062.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-07-16
AI Technical Summary
Existing machine learning methods lack the trade-off between fairness and accuracy when dealing with data missing, and failing to effectively consider data missing, may lead to incomplete information and increase bias, which in turn aggravates the inequity problem.
A fair classification method under the condition of data loss is adopted. Through a pre-trained target classification model, the basic classifier is used to perform preliminary classification and missing value processing, and the model is trained based on the decision tree and mixed integer programming algorithm, and fair constraint indicators and exponential losses are introduced. Functions, iteratively optimize sample distribution weights to ensure fairness and accuracy.
Effectively dealing with missing data while ensuring fairness and accuracy, avoiding the occurrence of incomplete information and deviations, and is suitable for a variety of application scenarios, especially fairness issues involving sensitive groups.
Smart Images

Figure CN118965184A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of machine learning, and in particular to a fair classification method and device under data missing conditions. Background Art
[0002] As machine learning algorithms are widely used in public fields such as finance, justice, medicine, insurance, and advertising, the fairness of algorithms has attracted increasing attention. In the real world, machine learning classification models intentionally or unintentionally discriminate against minority racial groups or disadvantaged populations and other protected groups (also known as sensitive attributes) when allocating resources, leading to unequal opportunities or treatment. This not only causes damage to individual or collective interests, but also raises new legal, ethical, and technical issues.
[0003] In recent years, patents related to machine learning that alleviate unfairness have continued to emerge, but most require a complete training data set as input, and few studies focus on the fairness of missing data. In practical applications, data with missing values are common, and current methods generally deal with missing data by discarding entries with missing values or interpolating before training the model. However, these processing methods may cause incomplete information and introduce new biases, increasing the possibility of unfairness.
[0004] In summary, current machine learning methods lack the trade-off between fairness and accuracy and do not take into account the situation of missing data. Summary of the invention
[0005] The present invention provides a fair classification method and device under data missing conditions, so as to solve the problem that the prior art lacks a trade-off between fairness and accuracy in machine learning and does not take data missing into consideration, thereby achieving data classification that ensures fairness and accuracy while effectively processing missing data.
[0006] The present invention provides a fair classification method under data missing conditions, comprising the following steps: Get a sample dataset; Inputting the sample data set into a pre-trained target classification model to obtain a classification result; The training steps of the target classification model include: S1: Initialize the sample distribution weight of the decision tree; S2: Use the preset base classifier to perform preliminary classification and missing value processing on the sample data set to obtain the current decision tree; S3: Calculating the total error rate of the base classifier based on the prediction value of the current decision tree and the fairness constraint index; S4: Based on the linear combination of the base classifiers, the pre-constructed exponential loss function is minimized using the total error rate to obtain the sample distribution weight of the next tree, and steps S2-S4 are repeated until a preset end condition is reached; S5: Obtain a target classification model based on the sample distribution weight voting of multiple rounds of iterations.
[0007] According to a fair classification method under data missing conditions provided by the present invention, the base classifier uses the missing value itself as a segmentation criterion in the decision tree, and uses a mixed integer programming algorithm to train the fair decision tree.
[0008] According to a fair classification method under data missing conditions provided by the present invention, a sample data set is preliminarily classified and missing value processed using a preset base classifier to obtain a current decision tree, specifically including: determining a split feature based on the sample data set; For each sample data, if there is no missing value at the split feature, the branch is split according to a preset threshold to obtain a child node; if there is a missing value at the split feature, the branch is split according to the target split value at the node to obtain a child node; wherein the target split value is calculated based on the missing attribute and the split node attribute; Repeat splitting the child nodes until a stop condition is met; Predict the last layer of child nodes and get the predicted value; The predicted value is encoded using a mixed integer programming algorithm to obtain a one-hot encoded value. If the one-hot encoded value meets a preset encoding value condition, it indicates that the data point reaches a leaf node, and the predicted value of the current leaf node is updated to a preset value.
[0009] According to a fair classification method under data missing conditions provided by the present invention, the total error rate of the base classifier is calculated based on the prediction value of the current decision tree and the fairness constraint index, specifically including: Calculating the total error rate using a first preset formula according to the predicted value and the fairness constraint index; Wherein, the first preset formula includes:
[0010]
[0011] in, μ is the weight of the fairness constraint, f r is a fairness constraint indicator, e m is the total error rate, e ris the sample error rate, y i is the predicted value, is the default value.
[0012] According to a fair classification method under data missing conditions provided by the present invention, the exponential loss function includes:
[0013] in, h ( i ) is the base classifier, y i is the predicted value, f r is a fairness constraint indicator, D is a sample data set.
[0014] According to a fair classification method under data missing conditions provided by the present invention, based on the linear combination of the base classifiers, the total error rate is used to minimize the pre-constructed exponential loss function to obtain the sample distribution weight of the next tree, which specifically includes: Taking minimization of the exponential loss function as the goal, a weight coefficient update formula is obtained using a greedy algorithm based on a linear combination of the base classifiers; The sample distribution weight of the next tree is calculated based on the sample distribution weight of the current decision tree, the total error rate and the weight coefficient update formula.
[0015] The present invention also provides a fair classification device under data missing conditions, comprising the following modules: Data unit, used to obtain sample data sets; A classification unit, used to input the sample data set into a pre-trained target classification model to obtain a classification result; A training unit is used to train the target classification model; wherein the training step of the target classification model includes: S1: Initialize the sample distribution weight of the decision tree; S2: Use the preset base classifier to perform preliminary classification and missing value processing on the sample data set to obtain the current decision tree; S3: Calculating the total error rate of the base classifier based on the prediction value of the current decision tree and the fairness constraint index; S4: Based on the linear combination of the base classifiers, the pre-constructed exponential loss function is minimized using the total error rate to obtain the sample distribution weight of the next tree, and steps S2-S4 are repeated until a preset end condition is reached; S5: Obtain a target classification model based on the sample distribution weight voting of multiple rounds of iterations.
[0016] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a fair classification method under any of the above-mentioned data missing conditions is implemented.
[0017] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the fair classification method under any of the above-mentioned data missing conditions is implemented.
[0018] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the fair classification method under any of the above-mentioned data missing conditions is implemented.
[0019] The fair classification method and device under data missing conditions provided by the present invention obtain a sample data set; input the sample data set into a pre-trained target classification model to obtain a classification result; wherein the training steps of the target classification model include: S1: initializing the sample distribution weight of the decision tree; S2: using a pre-set base classifier to perform preliminary classification and missing value processing on the sample data set to obtain the current decision tree; S3: calculating the total error rate of the base classifier based on the predicted value and the fairness constraint index of the current decision tree; S4: based on the linear combination of the base classifier, using the total error rate to minimize the pre-constructed exponential loss function to obtain the sample distribution weight of the next tree, and repeating steps S2-S4 until the preset end condition is reached; S5: voting based on the sample distribution weights of multiple rounds of iterations to obtain the target classification model. The present invention links the processing of missing values with fair machine learning through a pre-trained target classification model. During the training process, a base classifier is used for preliminary classification and missing value processing. The classification error rate of each tree is calculated using the integration idea, and a fairness constraint is introduced into the error rate. The weight distribution of different fair data in the base classifier is updated by calculation, and finally the optimal target classification model is obtained, which realizes data classification that ensures fairness and accuracy while effectively processing missing data. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 This is one of the flow charts of the fair classification method under data missing conditions provided by the present invention.
[0022] Figure 2 This is the second flow chart of the fair classification method under data missing conditions provided by the present invention.
[0023] Figure 3 This is the third flow chart of the fair classification method under data missing conditions provided by the present invention.
[0024] Figure 4 It is a structural schematic diagram of a fair classification device under data missing conditions provided by the present invention.
[0025] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0027] Combine the following Figure 1-Figure 3 The fair classification method under missing data conditions of the present invention is described. Figure 1 This is one of the flow charts of the fair classification method under data missing conditions provided by the present invention, such as Figure 1 As shown, the method comprises the following steps: Step 110: Obtain a sample data set.
[0028] It should be explained that the present invention is applicable to any application scenario that requires classification, especially fairness issues involving sensitive groups, such as application in the field of system recommendation, prediction of commodity purchase classification and preference of different groups; application in the field of insurance assessment, fair pricing for sensitive groups, especially women and children, and reduction of stereotyped classification of gender and related groups; application in the field of financial approval, fair classification and evaluation of different regions and occupations, etc. The sample data set includes multiple sample data, the content and form of the sample data are related to the application scenario and sensitive groups, and the sample data may include text data, image data, voice data or video data, which is not limited by the present invention.
[0029] Furthermore, for example, for the prediction of commodity purchase classification of different groups, the sample data includes commodity purchase data of different groups, and the features used for splitting include inherent features of the commodity and promotional features, etc. The classification result can reflect that a certain group is more likely to purchase a certain type of commodity.
[0030] Step 120: Input the sample data set into a pre-trained target classification model to obtain a classification result.
[0031] After obtaining the sample data set, input it into the trained target classification model to directly obtain the classification results output by the model.
[0032] The training steps of the target classification model include: S1: Initialize the sample distribution weight of the decision tree.
[0033] In step S1, during the training of the target classification model, the sample distribution weight w(i) of each tree needs to be initialized first.
[0034] S2: Use the preset base classifier to perform preliminary classification and missing value processing on the sample data set to obtain the current decision tree.
[0035] In step S2, the decision tree is constructed using the base classifier. During the construction process, the sample data set is preliminarily classified and missing values are processed. The classification idea can be referred to Figure 2 It should be noted that the base classifier (denoted as Fair MIP Tree) mentioned in the present invention is a base classifier that combines the two ideas of missing attribute merging (MIA) and mixed integer programming (MIP). The base classifier generates a decision tree that does not require interpolation and can merge missing attributes. At the same time, the Boosting technology is used to improve the classification performance of each decision tree.
[0036] Based on the above embodiment, the base classifier uses the missing value itself as the segmentation criterion in the decision tree, and uses the mixed integer programming algorithm to train the fair decision tree. That is to say, the base classifier mentioned, on the one hand, uses the missing value itself as the segmentation criterion in the decision tree; on the other hand, mixed integer programming is used in the training of the fair decision tree to speed up the time for the classifier to process the missing value.
[0037] S3: Calculate the total error rate of the base classifier based on the prediction value of the current decision tree and the fairness constraint index.
[0038] In step S3, after the first tree is trained, the total error rate of the classifier is calculated. It should be noted that the total error rate includes the sample error rate and the fairness constraint index. The present invention proposes a Fair MIA AdaBoost algorithm, which implements fair classification based on the Fair MIA AdaBoost algorithm. Specifically, the classification error rate of each tree is calculated using the integration idea, and the fairness constraint is introduced into the error rate, thereby obtaining the total error rate.
[0039] S4: Based on the linear combination of the base classifiers, the total error rate is used to minimize the pre-constructed exponential loss function to obtain the sample distribution weight of the next tree, and steps S2-S4 are repeated until the preset end condition is reached.
[0040] In step S4, the base classifier is optimized using the exponential loss function to obtain the sample distribution weight of the next tree, and then the base classifier is iteratively used to generate the next decision tree. In the optimization process, the exponential loss function is minimized as the goal, and the update method of the sample distribution weight is obtained according to the linear combination calculation of the base classifier. Repeat steps S2-S4 until the preset end condition is reached. The preset end condition can be any end condition. For example, in one embodiment, the preset end condition is set to the maximum number of iterations.
[0041] It needs to be explained that if Figure 3 As shown in the figure, during the iteration process, the error rate containing the fairness constraint index is continuously updated and the misclassified samples are given higher weights. By calculating and updating the weight distribution of different fair data in the base classifier, the optimal fair classifier that meets the constraint conditions is finally obtained through continuous iteration, so as to ensure the fairness and accuracy of the algorithm classification while effectively processing the missing data.
[0042] S5: Obtain a target classification model based on the sample distribution weight voting of multiple rounds of iterations.
[0043] In step S5, voting is performed according to the sample distribution weights of the base classifiers after multiple rounds of iterations, and the target classification model is obtained by fusion.
[0044] The greatest advantage of the fair classification method under data missing conditions provided by the present invention is that it can simultaneously process missing data and improve fairness. Compared with the existing missing information processing methods using interpolation, substitution splitting, and block propagation, the present invention can ensure the integrity of information. In addition, the present invention ensures the fairness of the algorithm. Therefore, the present invention can be generally applicable to the field of designing data missing and fairness algorithms.
[0045] Step S2 is further described below. In some embodiments, the sample data set is preliminarily classified and missing value processed using a pre-set base classifier to obtain a current decision tree, specifically including: determining a split feature based on the sample data set; For each sample data, if there is no missing value at the split feature, the branch is split according to a preset threshold to obtain a child node; if there is a missing value at the split feature, the branch is split according to the target split value at the node to obtain a child node; wherein the target split value is calculated based on the missing attribute and the split node attribute; Repeat splitting the child nodes until a stop condition is met; Predict the last layer of child nodes and get the predicted value; The predicted value is encoded using a mixed integer programming algorithm to obtain a one-hot encoded value. If the one-hot encoded value meets a preset encoding value condition, it indicates that the data point reaches a leaf node, and the predicted value of the current leaf node is updated to a preset value.
[0046] Specifically, for the convenience of description, we take binary classification as an example. Figure 2 As shown, but this does not represent a limitation of the present invention. First of all, it should be pointed out that the decision tree with missing values mainly includes four variables: P , q , c , u .in, P Indicates the features that need to be split. q represents the split threshold on the branch node, c Indicates the value of splitting the missing value to the left or right on the branch node. u Represents the predicted value on each leaf node, Represents the predicted output value.
[0047] Assume that there is n samples, d is the number of sample features, v represents a branch node, l represents a leaf node. i Samples x i,j , j For Node v If the feature P j If there is no missing value, the branch is based on the preset threshold q Split, that is x i,j ≤ q v will be divided on the left; x i,j > q v Will be divided on the right.
[0048] If in the feature P j Department x i,j Missing, the branch is split according to the target value at the node c Split, c The value is calculated from the missing attribute and the split node attribute. If c v =1, then divide to the left; if cv =0, then divide it to the right.
[0049] Repeat the splitting until the penultimate layer is reached, and the data of the current child node is predicted. Figure 2 , according to the result of feature splitting, for different data points, leaf nodes l The predicted value of u l ∈ y i For any set of samples ( x i , y i ), using the mixed integer programming algorithm to calculate a one-hot encoding value z i , if it meets the preset coding value conditions (e.g. z i,l =1) indicates that the data point reaches the leaf node l , and distribute It should be pointed out that the splitting characteristics are related to the application field.
[0050] Step S3 is further described below. In some embodiments, the total error rate of the base classifier is calculated based on the predicted value of the current decision tree and the fairness constraint index, specifically including: Calculating the total error rate using a first preset formula according to the predicted value and the fairness constraint index; Wherein, the first preset formula includes:
[0051]
[0052] in, μ is the weight of the fairness constraint, f r is a fairness constraint indicator, e m is the total error rate, e r is the sample error rate, y i is the predicted value, is the default value.
[0053] Specifically, in order to ensure fairness, the total error rate e m It consists of two parts: sample error rate e r and fairness constraint index f r . It can be expressed by the first preset formula.
[0054] The first preset formula includes:
[0055]
[0056] in, μ is the weight of the fairness constraint, by changing μ The accuracy and fairness of the value balancing algorithm. f r The selection of can be defined according to the fairness requirements in different scenarios, which expands the usage scenarios of the algorithm.
[0057] In addition, it should be noted that the hyperparameter u Introduced to balance the ratio of accuracy and fairness, when u When the value is large, the classification model will emphasize fairness rather than accuracy, which increases the flexibility of the present invention, thereby being able to classify data of different missing types and expanding the scope of application of the present invention.
[0058] Based on the above embodiments, in some embodiments, the exponential loss function includes:
[0059] in, h ( i ) is the base classifier, namely Fair MIP Tree, y i is the predicted value, f r is a fairness constraint indicator, D is a sample data set.
[0060] In addition, the exponential loss function can be extended to various fairness definitions, such as FNR, FDR, FOR, etc.
[0061] False Negative Rate (FNR): ; False Discovery Rate (FDR): ; False Alarm Rate (FOR): .
[0062] In some embodiments, the total error rate is used to minimize the pre-constructed exponential loss function based on the linear combination of the base classifiers to obtain the sample distribution weight of the next tree, specifically including: Taking minimization of the exponential loss function as the goal, a weight coefficient update formula is obtained using a greedy algorithm based on a linear combination of the base classifiers; The sample distribution weight of the next tree is calculated based on the sample distribution weight of the current decision tree, the total error rate and the weight coefficient update formula.
[0063] Specifically, after training the first tree, the classifiers are iteratively generated h k ( i ) and weight coefficient α k ; Update the classifier weights using a greedy algorithm α k Minimize the exponential loss function: .
[0064] It should be noted that the distribution probability of the paired samples includes the probability of the sample being correctly classified and the probability of the sample being fairly classified, that is, 1- e m ; The probability of misclassified samples includes the probability of misclassification and the probability of unfairness, that is e m .
[0065] Based on this, consider the derivative of the exponential loss function: .
[0066] Let the derivative of the exponential loss function be zero, and we can solve the Fair MIA AdaBoost algorithm in the k The weight coefficient update formula of a decision tree is: .
[0067] According to the weight coefficient update formula, the sample distribution weight of the next tree can be adjusted, making the algorithm more likely to correctly classify samples while reducing unfairness: .
[0068] After multiple rounds of iterations, the final vote is the Fair MIA AdaBoost classifier with the ideal output, which is the target classification model: .
[0069] Based on the above embodiment, the overall design process of the algorithm is shown in Table 1.
[0070] Table 1 Overall design process of the Fair MIA AdaBoost algorithm
[0071] In order to more specifically illustrate the fair classification method under data missing conditions provided by the present invention, a specific embodiment of classification using the method provided by the present invention is given.
[0072] In this embodiment, the specific experimental data and design are as follows: Implementation data: The Adult dataset commonly used in the field of fair machine learning is selected. The Adult dataset is a statistical data of the 1994 US census, containing a total of 48,842 samples, and is widely used in experiments and tests of fair machine learning. For the Adult dataset, features such as age, class, education level, number of educated people, marital status, occupation, and relationship are used. Gender is used as a group-sensitive attribute (0: female, 1: male), and income is used as a label (0: income ≤ 50K, 1: income > 50K).
[0073] First, since the original data set is highly unbalanced, this embodiment balances the Adult data set to generate a balanced data set containing 7834 data points.
[0074] Secondly, based on the above work, data sets with different missing probabilities under different missing types were generated. Three different types of missingness were considered: completely random missingness (MCAR Missingness), random missingness (MARMissingness), and non-random missingness (MNAR Missingness). The data generation of MCAR missingness type is patternless and completely random. The data generation of MAR missingness type refers to a patterned missingness, and the data missingness is spatially correlated, but not so random. The generation of MNAR missingness type is a censored missingness, and the data missingness is manifested as missing values of certain characteristics. For example, variables are randomly selected from the top or bottom of the data for censoring, and then the censoring level of each variable is iteratively updated until the target requirement is met.
[0075] Finally, this example changes the proportion of missing values in the data set to 2%, 5%, and 8%, respectively. Before training and testing, the data is preprocessed using one-hot encoding, normalization, and standardization to balance the different orders of magnitude of different numerical features, and the performance of the method proposed in the present invention is verified in data sets with different missing conditions and different missing types.
[0076] Experimental design: The processing of mixed integer programs in the Fair MIA AdaBoost algorithm is implemented by Gurobi software. This embodiment achieves a balance between accuracy and fairness by changing the hyperparameters of the algorithm: tree depth D, number of trees Num_tree, μ value, etc. The method of the present invention is compared with internationally advanced fair machine learning methods: including the FairMipForest algorithm proposed by Jeong and three fair learning methods combined with data interpolation: exponential gradient algorithm (Agarwal), different misjudgment algorithm (Zafar), balanced odds algorithm (Hardt). It should be noted that the latter three methods cannot handle missing data, so missing data interpolation processing is performed.
[0077] Experimental results: By changing the hyperparameters, we selected the experimental data with the best performance of different algorithms under different missing conditions. Each experiment was randomly performed 10 times. Acc is used to represent the average accuracy of different algorithms in 10 experiments, and FPR is used to represent the average false positive rate fair difference value of different algorithms in 10 experiments. In order to compare the performance of these algorithms more intuitively, the simulation results of all hyperparameters are summarized in Figure 3 The horizontal axis is the FPR difference value of the algorithm, and the vertical axis is the accuracy rate Acc of the algorithm. In addition, the optimal experimental results of different missing conditions are statistically analyzed in Table 2 for horizontal comparison.
[0078] Table 2 Experimental results statistics
[0079] As can be seen from Table 2, under balanced data conditions, when the missing type is completely random missing (MCARMissingness), the fair classification performance of Fair MIA AdaBoost is better than the other three algorithms. When the missing ratio is 2%, the accuracy of Fair MIA AdaBoost is stable at above 0.76, which is higher than other algorithms; FPR The lowest stable difference is 0.018, and the fairness is the best. As the proportion of missing data increases, the accuracy and FPR difference of the Fair MIA AdaBoost algorithm decrease slightly, but compared with the Forest algorithm, the Fair MIA AdaBoost algorithm has a better FPR difference performance, and is better than Forest, Agarwal and Hardt in accuracy.
[0080] When the missing type is missing at random (MAR Missingness), the accuracy of the Fair MIA AdaBoost method and the FairMIP Forest method is slightly different, but the Fair MIA AdaBoost algorithm FPRThe difference is lower, and both methods are better than Agarwal and Hardt, Zafar. As the proportion of missing data increases, the accuracy of the Fair MIA AdaBoost algorithm under different hyperparameters is higher than that of other algorithms. FPR In terms of differences, the Fair MIA AdaBoost algorithm can reach a minimum of 0.013, which has better fairness compared to other algorithms.
[0081] When the missing type is non-random missingness (MNAR Missingness), the Fair MIA AdaBoost algorithm outperforms other methods in both accuracy and fairness at 2% and 8% missing data ratios. When the missing data ratio is 5%, the accuracy is comparable to that of the Fair Mip Forest algorithm, but the Fair MIA AdaBoost algorithm has better FPR The difference is better than other methods. It can be seen that the Fair MIA AdaBoost algorithm has better stability under different data missing ratios. As shown in Table 2, the optimal FPR value of Fair Mip Forest is 0.013 under the missing ratio of 2%, but this is obtained at the expense of greater accuracy. At this time, the Acc of Fair Mip Forest is only 0.712. Therefore, in most cases, it is more advantageous to choose the MIAAdaBoost algorithm, which can also provide higher accuracy.
[0082] By summarizing the above analysis, it can be seen that in the three data missing situations, the comprehensive analysis of various indicators of the Fair MIA AdaBoost method proposed in the present invention is the best, and it is better than Fair MIP Forest, Agarwal, Zafar and Hardt. In order to ensure better fairness and accuracy of the algorithm, Fair MIA AdaBoost is selected as the best under most conditions of balanced data missing situations. In summary, the method proposed in the present invention has excellent accuracy and group fairness performance in different data missing situations.
[0083] The fair classification method under data missing conditions provided by the present invention is achieved by obtaining a sample data set; inputting the sample data set into a pre-trained target classification model to obtain a classification result; wherein the training steps of the target classification model include: S1: initializing the sample distribution weight of the decision tree; S2: using a pre-set base classifier to perform preliminary classification and missing value processing on the sample data set to obtain the current decision tree; S3: calculating the total error rate of the base classifier based on the predicted value of the current decision tree and the fairness constraint index; S4: minimizing a pre-constructed exponential loss function based on the total error rate based on a linear combination of the base classifier to obtain the sample distribution weight of the next tree, and repeating steps S2-S4 until a preset end condition is reached; S5: obtaining the target classification model based on multiple rounds of iterative sample distribution weight voting. The present invention links the processing of missing values with fair machine learning through a pre-trained target classification model. During the training process, a base classifier is used for preliminary classification and missing value processing. The classification error rate of each tree is calculated using the integration idea, and a fairness constraint is introduced into the error rate. The weight distribution of different fair data in the base classifier is updated by calculation, and finally the optimal target classification model is obtained, which realizes data classification that ensures fairness and accuracy while effectively processing missing data.
[0084] The fair classification device under data missing conditions provided by the present invention is described below. The fair classification device under data missing conditions described below and the fair classification method under data missing conditions described above can be referred to each other. Figure 4 As shown, the device includes the following modules: A data unit 410 is used to obtain a sample data set; The classification unit 420 is used to input the sample data set into a pre-trained target classification model to obtain a classification result; The training unit 430 is used to train the target classification model; wherein the training step of the target classification model includes: S1: Initialize the sample distribution weight of the decision tree; S2: Use the preset base classifier to perform preliminary classification and missing value processing on the sample data set to obtain the current decision tree; S3: Calculating the total error rate of the base classifier based on the prediction value of the current decision tree and the fairness constraint index; S4: Based on the linear combination of the base classifiers, the pre-constructed exponential loss function is minimized using the total error rate to obtain the sample distribution weight of the next tree, and steps S2-S4 are repeated until a preset end condition is reached; S5: Obtain a target classification model based on the sample distribution weight voting of multiple rounds of iterations.
[0085] According to a fair classification device under data missing conditions provided by the present invention, the base classifier uses the missing value itself as a segmentation criterion in the decision tree, and uses a mixed integer programming algorithm to train the fair decision tree.
[0086] According to a fair classification device under data missing conditions provided by the present invention, a sample data set is preliminarily classified and missing value processed using a preset base classifier to obtain a current decision tree, specifically including: determining a split feature based on the sample data set; For each sample data, if there is no missing value at the split feature, the branch is split according to a preset threshold to obtain a child node; if there is a missing value at the split feature, the branch is split according to the target split value at the node to obtain a child node; wherein the target split value is calculated based on the missing attribute and the split node attribute; Repeat splitting the child nodes until a stop condition is met; Predict the last layer of child nodes and get the predicted value; The predicted value is encoded using a mixed integer programming algorithm to obtain a one-hot encoded value. If the one-hot encoded value meets a preset encoding value condition, it indicates that the data point reaches a leaf node, and the predicted value of the current leaf node is updated to a preset value.
[0087] According to a fair classification device under data missing conditions provided by the present invention, the total error rate of the base classifier is calculated based on the prediction value of the current decision tree and the fairness constraint index, specifically including: Calculating the total error rate using a first preset formula according to the predicted value and the fairness constraint index; Wherein, the first preset formula includes:
[0088]
[0089] in, μ is the weight of the fairness constraint, f r is a fairness constraint indicator, e m is the total error rate, e r is the sample error rate, y i is the predicted value, is the default value.
[0090] According to a fair classification device under data missing conditions provided by the present invention, the exponential loss function includes:
[0091] in, h ( i ) is the base classifier, y i is the predicted value, f r is a fairness constraint indicator, D is a sample data set.
[0092] According to a fair classification device under data missing conditions provided by the present invention, the pre-constructed exponential loss function is minimized using the total error rate based on the linear combination of the base classifiers to obtain the sample distribution weight of the next tree, specifically including: Taking minimization of the exponential loss function as the goal, a weight coefficient update formula is obtained using a greedy algorithm based on a linear combination of the base classifiers; The sample distribution weight of the next tree is calculated based on the sample distribution weight of the current decision tree, the total error rate and the weight coefficient update formula.
[0093] The fair classification device under data missing conditions provided by the present invention obtains a sample data set; inputs the sample data set into a pre-trained target classification model to obtain a classification result; wherein the training steps of the target classification model include: S1: initializing the sample distribution weight of the decision tree; S2: using a pre-set base classifier to perform preliminary classification and missing value processing on the sample data set to obtain the current decision tree; S3: calculating the total error rate of the base classifier based on the predicted value and the fairness constraint index of the current decision tree; S4: based on the linear combination of the base classifier, using the total error rate to minimize the pre-constructed exponential loss function to obtain the sample distribution weight of the next tree, and repeating steps S2-S4 until the preset end condition is reached; S5: voting based on the sample distribution weights of multiple rounds of iterations to obtain the target classification model. The present invention links the processing of missing values with fair machine learning through a pre-trained target classification model. During the training process, a base classifier is used for preliminary classification and missing value processing. The classification error rate of each tree is calculated using the integration idea, and a fairness constraint is introduced into the error rate. The weight distribution of different fair data in the base classifier is updated by calculation, and finally the optimal target classification model is obtained, which realizes data classification that ensures fairness and accuracy while effectively processing missing data.
[0094] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5As shown, the electronic device may include: a processor (processor) 510, a communication interface (Communications Interface) 520, a memory (memory) 530 and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call the logic instructions in the memory 530 to execute a fair classification method under data missing conditions, the method comprising: obtaining a sample data set; inputting the sample data set into a pre-trained target classification model to obtain a classification result; wherein the training steps of the target classification model comprise: S1: initializing the sample distribution weight of the decision tree; S2: using a pre-set base classifier to perform preliminary classification and missing value processing on the sample data set to obtain the current decision tree; S3: calculating the total error rate of the base classifier based on the predicted value and the fairness constraint index of the current decision tree; S4: minimizing a pre-constructed exponential loss function using the total error rate based on a linear combination of the base classifiers to obtain the sample distribution weight of the next tree, and repeating steps S2-S4 until a preset end condition is reached; S5: obtaining the target classification model based on voting of the sample distribution weights after multiple rounds of iterations.
[0095] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0096] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the fair classification method under data missing conditions provided by the above methods, the method including: obtaining a sample data set; inputting the sample data set into a pre-trained target classification model to obtain a classification result; wherein the training step of the target classification model includes: S1: initializing the sample distribution weight of the decision tree; S2: using a pre-set base classifier to perform preliminary classification and missing value processing on the sample data set to obtain the current decision tree; S3: calculating the total error rate of the base classifier based on the predicted value and fairness constraint index of the current decision tree; S4: minimizing the pre-constructed exponential loss function based on the linear combination of the base classifier using the total error rate to obtain the sample distribution weight of the next tree, and repeating steps S2-S4 until the preset end condition is reached; S5: obtaining the target classification model based on the sample distribution weight voting of multiple rounds of iterations.
[0097] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the fair classification method under data missing conditions provided by the above-mentioned methods, the method comprising: obtaining a sample data set; inputting the sample data set into a pre-trained target classification model to obtain a classification result; wherein the training step of the target classification model comprises: S1: initializing the sample distribution weight of the decision tree; S2: using a pre-set base classifier to perform preliminary classification and missing value processing on the sample data set to obtain the current decision tree; S3: calculating the total error rate of the base classifier based on the predicted value and fairness constraint index of the current decision tree; S4: minimizing a pre-constructed exponential loss function using the total error rate based on a linear combination of the base classifiers to obtain the sample distribution weight of the next tree, and repeating steps S2-S4 until a preset end condition is reached; S5: obtaining the target classification model based on multiple rounds of iterations of the sample distribution weight voting.
[0098] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0099] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0100] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A fair classification method under data missing conditions, characterized in that: include: Get a sample dataset; Inputting the sample data set into a pre-trained target classification model to obtain a classification result; The training steps of the target classification model include: S1: Initialize the sample distribution weight of the decision tree; S2: Use the preset base classifier to perform preliminary classification and missing value processing on the sample data set to obtain the current decision tree; S3: Calculating the total error rate of the base classifier based on the prediction value of the current decision tree and the fairness constraint index; S4: Based on the linear combination of the base classifiers, the pre-constructed exponential loss function is minimized using the total error rate to obtain the sample distribution weight of the next tree, and steps S2-S4 are repeated until a preset end condition is reached; S5: Obtain a target classification model based on the sample distribution weight voting of multiple rounds of iterations.
2. The fair classification method under data missing conditions according to claim 1, characterized in that: The base classifier uses the missing value itself as a segmentation criterion in the decision tree, and a mixed integer programming algorithm is used to train a fair decision tree.
3. The fair classification method under data missing conditions according to claim 2, characterized in that: Use the preset base classifier to perform preliminary classification and missing value processing on the sample data set to obtain the current decision tree, which includes: determining a split feature based on the sample data set; For each sample data, if there is no missing value at the split feature, the branch is split according to a preset threshold to obtain a child node; if there is a missing value at the split feature, the branch is split according to the target split value at the node to obtain a child node; wherein the target split value is calculated based on the missing attribute and the split node attribute; Repeat splitting the child nodes until a stop condition is met; Predict the last layer of child nodes and get the predicted value; The predicted value is encoded using a mixed integer programming algorithm to obtain a one-hot encoded value. If the one-hot encoded value meets a preset encoding value condition, it indicates that the data point reaches a leaf node, and the predicted value of the current leaf node is updated to a preset value.
4. The fair classification method under data missing conditions according to claim 3, characterized in that: Calculating the total error rate of the base classifier based on the prediction value of the current decision tree and the fairness constraint index specifically includes: Calculating the total error rate using a first preset formula according to the predicted value and the fairness constraint index; Wherein, the first preset formula includes: , , in, μ is the weight of the fairness constraint, f r is a fairness constraint indicator, e m is the total error rate, e r is the sample error rate, y i is the predicted value, is the default value.
5. The fair classification method under data missing conditions according to claim 1, characterized in that: The exponential loss function includes: , in, h ( i ) is the base classifier, y i is the predicted value, f r is a fairness constraint indicator, D is a sample data set.
6. The fair classification method under data missing conditions according to claim 1, characterized in that: Based on the linear combination of the base classifiers, the pre-constructed exponential loss function is minimized using the total error rate to obtain the sample distribution weight of the next tree, specifically including: Taking minimization of the exponential loss function as the goal, a weight coefficient update formula is obtained using a greedy algorithm based on a linear combination of the base classifiers; The sample distribution weight of the next tree is calculated based on the sample distribution weight of the current decision tree, the total error rate and the weight coefficient update formula.
7. A fair classification device under data missing conditions, characterized in that: include: Data unit, used to obtain sample data sets; A classification unit, used to input the sample data set into a pre-trained target classification model to obtain a classification result; A training unit is used to train the target classification model; wherein the training step of the target classification model includes: S1: Initialize the sample distribution weight of the decision tree; S2: Use the preset base classifier to perform preliminary classification and missing value processing on the sample data set to obtain the current decision tree; S3: Calculating the total error rate of the base classifier based on the prediction value of the current decision tree and the fairness constraint index; S4: Based on the linear combination of the base classifiers, the pre-constructed exponential loss function is minimized using the total error rate to obtain the sample distribution weight of the next tree, and steps S2-S4 are repeated until a preset end condition is reached; S5: Obtain a target classification model based on the sample distribution weight voting of multiple rounds of iterations.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the fair classification method under data missing conditions as described in any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the fair classification method under data missing conditions as described in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the fair classification method under data missing conditions as described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Multi-classification model training method of adaptive weighting loss function
CN116010879A
