Fair classification method and apparatus under data missing condition
Patent Information
- Application Number
- CN202410953062.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2044-07-16
AI Technical Summary
[0005]本发明提供一种数据缺失条件下的公平分类方法和装置,用以解决现有技术中缺乏对机器学习公平性与准确性的权衡,且没有考虑到数据缺失的缺陷,实现在有效处理缺失数据的同时保证公平性和准确度的数据分类
[0019]本发明提供的数据缺失条件下的公平分类方法和装置,通过获取样本数据集;将所述样本数据集输入至预先训练的目标分类模型,得到分类结果;其中,所述目标分类模型的训练步骤包括:S1:初始化决策树的样本分布权重;S2:利用预先设置的基分类器对样本数据集进行初步分类和缺失值处理,得到当前决策树;S3:基于所述当前决策树的预测值和公平约束指标计算所述基分类器的总错误率;S4:基于所述基分类器的线性组合利用所述总错误率对预先构建的指数损失函数进行最小化,得到下一棵树的样本分布权重,重复步骤S2-S4,直至达到预设结束条件;S5:基于多轮迭代的所述样本分布权重投票得到目标分类模型。本发明通过预先训练的目标分类模型将处理缺失值和公平机器学习联系起来,在训练过程中,利用基分类器进行初步分类以及缺失值处理,利用集成思想计算每棵树的分类错误率,并在错误率中引入了公平约束,通过计算更新基分类器中不同公平数据的权重分布,最终得到最优的目标分类模型,实现在有效处理缺失数据的同时保证公平性和准确度的数据分类。
Smart Images

Figure CN118965184B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine learning technology, and in particular to a fair classification method and apparatus under conditions of missing data. Background Technology
[0002] As machine learning algorithms are widely applied in public sectors such as finance, law, healthcare, insurance, and advertising, the fairness of these algorithms is receiving increasing attention. In the real world, machine learning classification models, whether intentionally or unintentionally, discriminate against minority groups or disadvantaged populations and other protected groups when allocating resources (also known as sensitive attributes), leading to inequalities in opportunity or treatment. This not only harms individual or collective interests but also raises new legal, ethical, and technological issues.
[0003] In recent years, numerous patents related to mitigating unfairness in machine learning have emerged, but most require a complete training dataset as input, with few studies focusing on the fairness of missing data. Data containing missing values is prevalent in practical applications, and current methods typically handle missing data by discarding entries with missing values before training the model or by imputing them. However, these methods may lead to incomplete information and introduce new biases, increasing the potential for unfairness.
[0004] In summary, current machine learning methods lack a balance between fairness and accuracy, and do not take into account situations where data is missing. Summary of the Invention
[0005] This invention provides a fair classification method and apparatus under conditions of missing data, which addresses the shortcomings of existing technologies that lack a balance between fairness and accuracy in machine learning and do not take into account the lack of data, thereby achieving data classification that ensures both fairness and accuracy while effectively handling missing data.
[0006] This invention provides a fair classification method under conditions of missing data, comprising the following steps: Obtain the sample dataset; The sample dataset is input into a pre-trained target classification model to obtain the classification result; The training steps of the target classification model include: S1: Initialize the sample distribution weights of the decision tree; S2: Use a pre-set base classifier to perform preliminary classification and missing value handling on the sample dataset to obtain the current decision tree; S3: Calculate the total error rate of the base classifier based on the predicted values of the current decision tree and the fairness constraint index; 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 weights of the next tree. Steps S2-S4 are repeated until the preset termination condition is met. S5: The target classification model is obtained based on the weighted voting of the sample distribution in multiple rounds of iteration.
[0007] According to the present invention, a fair classification method under data missing conditions is provided, wherein the base classifier uses the missing value itself as the splitting criterion in the decision tree, and a mixed integer programming algorithm is used to train the fair decision tree.
[0008] According to the fair classification method under missing data conditions provided by the present invention, a pre-set base classifier is used to perform preliminary classification and missing value processing on the sample dataset to obtain the current decision tree, specifically including: Determine the splitting features based on the sample dataset; For each sample data, if there is no missing value at the splitting feature, the branch splits according to a pre-set threshold to obtain a child node; if there is a missing value at the splitting feature, the branch splits according to the target splitting value at that node to obtain a child node; wherein, the target splitting value is calculated based on the missing attribute and the splitting node attribute. Repeat the splitting of the child node until the stopping condition is met; Predict the last layer of child nodes to obtain 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 the preset encoding value condition, it indicates that the data point has reached the leaf node, and the predicted value of the current leaf node is updated to the preset value.
[0009] According to the 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 predicted value of the current decision tree and the fairness constraint index, specifically including: The total error rate is calculated using the first preset formula based on the predicted value and the fairness constraint index. The first preset formula includes:
[0010]
[0011] in, μ The weight allocated to fairness constraints, f r To ensure fair constraints on indicators, e m The total error rate, e rFor sample error rate, y i For predicted values, This is the default value.
[0012] According to the 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 For predicted values, f r To ensure fair constraints on indicators, D This is the sample dataset.
[0014] According to the fair classification method under missing data conditions provided by the present invention, the sample distribution weights of the next tree are obtained by minimizing the pre-constructed exponential loss function based on the linear combination of the base classifiers using the total error rate. Specifically, the method includes: With the goal of minimizing the exponential loss function, a greedy algorithm is used to obtain the weight coefficient update formula based on the linear combination of the base classifiers; The sample distribution weights of the next tree are calculated based on the sample distribution weights 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 conditions of missing data, comprising the following modules: Data unit, used to acquire sample datasets; A classification unit is used to input the sample dataset into a pre-trained target classification model to obtain classification results; A training unit is used to train the target classification model; wherein the training steps of the target classification model include: S1: Initialize the sample distribution weights of the decision tree; S2: Use a pre-set base classifier to perform preliminary classification and missing value handling on the sample dataset to obtain the current decision tree; S3: Calculate the total error rate of the base classifier based on the predicted values of the current decision tree and the fairness constraint index; 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 weights of the next tree. Steps S2-S4 are repeated until the preset termination condition is met. S5: The target classification model is obtained based on the weighted voting of the sample distribution in multiple rounds of iteration.
[0016] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements a fair classification method under any of the above-described data missing conditions.
[0017] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a fair classification method under data missing conditions as described above.
[0018] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements a fair classification method under any of the above-described data missing conditions.
[0019] The present invention provides a fair classification method and apparatus under data missing conditions, which obtains a sample dataset; inputs the sample dataset 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 weights of the decision tree; S2: using a pre-set base classifier to perform preliminary classification and missing value processing on the sample dataset to obtain the current decision tree; S3: calculating the total error rate of the base classifier based on the predicted values of the current decision tree and the fairness constraint index; S4: minimizing the pre-constructed exponential loss function based on the linear combination of the base classifiers using the total error rate to obtain the sample distribution weights of the next tree, repeating steps S2-S4 until a preset termination condition is reached; S5: obtaining the target classification model based on voting of the sample distribution weights in multiple iterations. This invention links missing value handling and fair machine learning through a pre-trained target classification model. During the training process, base classifiers are used for preliminary classification and missing value handling. The classification error rate of each tree is calculated using the ensemble approach, and fairness constraints are introduced into the error rate. By calculating and updating the weight distribution of different fair data in the base classifiers, the optimal target classification model is finally obtained, achieving data classification that ensures both fairness and accuracy while effectively handling missing data. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0021] Figure 1 This is one of the flowcharts of the fair classification method under data missing conditions provided by the present invention.
[0022] Figure 2 This is the second flowchart of the fair classification method under data missing conditions provided by the present invention.
[0023] Figure 3 This is the third flowchart of the fair classification method under data missing conditions provided by the present invention.
[0024] Figure 4 This is a schematic diagram of the structure of the fair classification device under data missing conditions provided by the present invention.
[0025] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0027] The following is combined Figures 1-3 This invention describes a fair classification method under conditions of missing data. Figure 1 This is one of the flowcharts illustrating the fair classification method under missing data conditions provided by this invention, such as... Figure 1 As shown, the method includes the following steps: Step 110: Obtain the sample dataset.
[0028] It should be explained that this invention is applicable to any application scenario requiring classification, especially those involving fairness issues related to sensitive groups. Examples include: in the field of system recommendation, predicting product purchase categories and preferences for different groups; in the field of insurance assessment, ensuring fair pricing for sensitive groups, especially women and children, and reducing stereotypical classifications based on gender and related groups; and in the field of financial approval, ensuring fair classification and assessment of people from different regions and professions. The sample dataset includes multiple sample data points. The content and format of the sample data are related to the application scenario and the sensitive groups. The sample data may include text data, image data, audio data, or video data; this invention does not impose any limitations on this.
[0029] Furthermore, for example, in predicting the classification of product purchases by different groups, the sample data includes product purchase data from different groups, and the features used for splitting include the inherent characteristics of the product and promotional features, etc. The classification results can reflect that a certain group is more likely to purchase a certain type of product.
[0030] Step 120: Input the sample dataset into the pre-trained target classification model to obtain the classification result.
[0031] After obtaining the sample dataset, input it into the trained target classification model to directly obtain the classification result output by the model.
[0032] The training steps of the target classification model include: S1: Initialize the sample distribution weights of the decision tree.
[0033] In step S1, during the training of the target classification model, the sample distribution weights w(i) of each tree need to be initialized first.
[0034] S2: Use a pre-set base classifier to perform preliminary classification and missing value processing on the sample dataset to obtain the current decision tree.
[0035] In step S2, a decision tree is constructed using a base classifier. During the construction process, the sample dataset undergoes preliminary classification and missing value handling. The classification approach can be referenced from [reference needed]. Figure 2 It should be noted that the base classifier mentioned in this invention (denoted as Fair MIP Tree) is a base classifier that combines the ideas of Attribute Missing Component Allocation (MIA) and Mixed Integer Programming (MIP). The base classifier generates decision trees that do not require imputation and can merge missing attributes. At the same time, it also uses Boosting technology to improve the classification performance of each decision tree.
[0036] Based on the above embodiments, the base classifier uses the missing values themselves as the splitting criterion in the decision tree and uses a mixed-integer programming algorithm to train the fair decision tree. In other words, the base classifier uses the missing values themselves as the splitting criterion in the decision tree, and employs mixed-integer programming in the training of the fair decision tree to speed up the classifier's processing time for missing values.
[0037] S3: Calculate the total error rate of the base classifier based on the predicted values of the current decision tree and the fairness constraint index.
[0038] In step S3, after training the first tree, the total error rate of the classifier is calculated. It should be noted that the total error rate includes the sample error rate and a fairness constraint metric. This invention proposes a Fair MIA AdaBoost algorithm to achieve fair classification. Specifically, it uses an ensemble approach to calculate the classification error rate of each tree and introduces a fairness constraint into the error rate to obtain 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 weights of the next tree. Steps S2-S4 are repeated until the preset termination condition is met.
[0040] In step S4, the base classifier is optimized using an exponential loss function to obtain the sample distribution weights for the next tree. Then, the next decision tree is generated iteratively using the base classifiers. During the optimization process, the goal is to minimize the exponential loss function, and the update method for the sample distribution weights is calculated based on the linear combination of the base classifiers. Steps S2-S4 are repeated until a preset termination condition is reached. The preset termination condition can be any termination condition; for example, in one embodiment, the preset termination condition is set to the maximum number of iterations.
[0041] It should be noted that, such as Figure 3 As shown, during the iteration process, the error rate containing the fairness constraint index is continuously updated while misclassified samples are assigned higher weights. By calculating and updating the weight distribution of different fair data in the base classifier, the algorithm iteratively obtains the optimal fair classifier that satisfies the constraints, thus ensuring both fairness and accuracy in classification while effectively handling missing data.
[0042] S5: The target classification model is obtained based on the weighted voting of the sample distribution in multiple rounds of iteration.
[0043] In step S5, voting is performed based on the sample distribution weights of the base classifiers from multiple iterations to obtain the target classification model.
[0044] The greatest advantage of the fair classification method under missing data conditions provided by this invention is its ability to simultaneously handle missing data and improve fairness. Compared with existing methods for handling missing information that utilize imputation, substitution splitting, and block propagation, this invention ensures the integrity of the information. Furthermore, this invention guarantees the fairness of the algorithm. Therefore, this invention is universally applicable to the design of algorithms for handling missing data and ensuring fairness.
[0045] The following further explains step S2. In some embodiments, a pre-set base classifier is used to perform preliminary classification and missing value processing on the sample dataset to obtain the current decision tree, specifically including: Determine the splitting features based on the sample dataset; For each sample data, if there is no missing value at the splitting feature, the branch splits according to a pre-set threshold to obtain a child node; if there is a missing value at the splitting feature, the branch splits according to the target splitting value at that node to obtain a child node; wherein, the target splitting value is calculated based on the missing attribute and the splitting node attribute. Repeat the splitting of the child node until the stopping condition is met; Predict the last layer of child nodes to obtain 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 the preset encoding value condition, it indicates that the data point has reached the leaf node, and the predicted value of the current leaf node is updated to the preset value.
[0046] Specifically, for ease of explanation, we will use binary classification as an example, such as... Figure 2 As shown, this does not constitute a limitation of the present invention. First, it should be noted that a decision tree containing missing values mainly contains four variables: P , q , c , u .in, P Indicates the features that need to be split. q This represents the splitting threshold at the branch node. c This represents the value at the branch node that splits the missing value to the left or right. u This represents the predicted value at each leaf node. This represents the predicted output value.
[0047] Assuming that the training sample set exists n One sample, d It is the number of sample features. v Represents a branch node. l This represents a leaf node. For the... i Sample x i,j , j For nodes v Features at the location, if in the feature P j If there are no missing values, then the branch is determined according to a pre-set threshold. q Split, that is x i,j ≤ q v It will be placed on the left; x i,j > q v It will be placed on the right.
[0048] If in features P j Place x i,j If missing, the branch is based on the target split value at that node. c Split, c The value is calculated from the missing attribute and the split node attribute. If c v =1, then it goes to the left; if cv If the value is 0, then it is assigned to the right.
[0049] Repeat the splitting process until the penultimate level is reached, then predict the data for the current child node. For example... Figure 2 Based on the feature splitting results, for different data points, leaf nodes l Predicted value u l ∈ y i For any set of samples ( x i , y i A one-hot encoded value is computed using a mixed-integer programming algorithm. z i If it meets the preset encoding value conditions (e.g.) z i,l =1) indicates that the data point has reached the leaf node. l and allocation It should be noted that the splitting characteristics are related to the application field.
[0050] The following provides a further explanation of step S3. In some embodiments, the total error rate of the base classifier is calculated based on the predicted values of the current decision tree and the fairness constraint index, specifically including: The total error rate is calculated using the first preset formula based on the predicted value and the fairness constraint index. The first preset formula includes:
[0051]
[0052] in, μ The weight allocated to fairness constraints, f r To ensure fair constraints on indicators, e m The total error rate, e r For sample error rate, y i For predicted values, This is the default value.
[0053] Specifically, to ensure fairness, the overall error rate e m It includes two parts: sample error rate e r and fairness constraint indicators f r This can be expressed using the first preset formula.
[0054] The first preset formula includes:
[0055]
[0056] in, μ The weight of the fairness constraint is adjusted by changing μ Accuracy and fairness of value balancing algorithms. f r The selection of can be defined according to the fairness requirements in different scenarios, thus expanding the application scenarios of the algorithm.
[0057] In addition, it should be noted that hyperparameters u Introducing a ratio to balance 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 invention and enables it to classify data of different missing types, thus expanding the scope of application of the invention.
[0058] Based on the above embodiments, in some embodiments, the exponential loss function includes:
[0059] in, h ( i ) is the base classifier, i.e., Fair MIP Tree. y i For predicted values, f r To ensure fair constraints on indicators, D This is the sample dataset.
[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] The following further explains step S4. In some embodiments, the sample distribution weights of the next tree are obtained by minimizing the pre-constructed exponential loss function based on the linear combination of the base classifiers using the total error rate, specifically including: With the goal of minimizing the exponential loss function, a greedy algorithm is used to obtain the weight coefficient update formula based on the linear combination of the base classifiers; The sample distribution weights of the next tree are calculated based on the sample distribution weights of the current decision tree, the total error rate, and the weight coefficient update formula.
[0063] Specifically, after training the first tree, classifiers are generated iteratively. h k ( i ) and weighting coefficients α k Update the classifier weights using a greedy algorithm. α k Minimize the exponential loss function: .
[0064] It should be noted that the probability distribution of correctly classified samples includes two parts: the probability of the sample being correctly classified and the probability of fairly classified samples, i.e., 1- e m The probability of misclassification includes the probability of incorrect classification and the probability of unfairness, i.e. e m .
[0065] Based on this, consider the derivative of the exponential loss function: .
[0066] Setting the derivative of the exponential loss function to zero, we can solve for the Fair MIA AdaBoost algorithm in the th... k The formula for updating the weight coefficients of each decision tree is: .
[0067] The weight distribution weights of the samples in the next tree can be adjusted according to the weight coefficient update formula, making the algorithm more likely to correctly classify the samples while reducing unfairness: .
[0068] After multiple rounds of iteration, the final voting result yields the ideal output Fair MIA AdaBoost classifier, i.e., the target classification model, using the following formula: .
[0069] Based on the above embodiments, the overall design flow of the algorithm is shown in Table 1.
[0070] Table 1. Overall Design Flow of Fair MIA AdaBoost Algorithm
[0071] To provide a more detailed explanation of the fair classification method under data missing conditions provided by this invention, a specific embodiment of classification using the method provided by this invention is given.
[0072] In this embodiment, the specific experimental data and design are as follows: Data Implementation: The Adult dataset, commonly used in the field of fair machine learning, was selected. The Adult dataset contains statistical data from the 1994 US Census, comprising 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 individuals, marital status, occupation, and relationship were used. Gender was used as a group-sensitive attribute (0: female, 1: male), and income was used as the label (0: income ≤ 50K, 1: income > 50K).
[0073] First, due to the high imbalance of the original dataset, this embodiment balances the Adult dataset to generate a balanced dataset containing 7834 data points.
[0074] Secondly, based on the above work, datasets with different missing probabilities under different missing types were generated. Three different types of missing data were considered: completely random missing (MCAR Missingness), random missing (MARMissingness), and non-random missing (MNAR Missingness). Data generation for MCAR missing data is patternless and completely random. Data generation for MAR missing data references a patterned missing data structure; the missing data is spatially correlated but less random. MNAR missing data is generated as a censored missing data structure; the missing data is characterized by the absence of certain feature values. For example, variables are randomly selected from above or below the data for censorship, and the censorship level of each variable is iteratively updated until the target requirement is met.
[0075] Finally, this embodiment changed the proportion of missing values in the dataset to 2%, 5%, and 8%, respectively. Before training and testing, the data was preprocessed using one-hot encoding, normalization, and standardization to balance the different orders of magnitude of different numerical features. The performance of the proposed method was verified on datasets with different missing conditions and missing types.
[0076] Experimental Design: The mixed-integer processing in the Fair MIA AdaBoost algorithm is implemented using Gurobi software. This embodiment achieves a balance between accuracy and fairness by changing the algorithm's hyperparameters: tree depth D, number of trees Num_tree, and μ value. The method of this invention is compared with internationally advanced fair machine learning methods, including Jeong's FairMipForest algorithm and three fair learning methods combined with data imputation: exponential gradient gradation (Agarwal), different misclassification algorithm (Zafar), and balanced odds algorithm (Hardt). It should be noted that the latter three methods cannot handle missing data, so missing data imputation was performed.
[0077] Experimental Results: By changing hyperparameters, experimental data showcasing the optimal performance of different algorithms under various missing value conditions were selected. Each experiment was randomly run 10 times. Acc represents the average accuracy of different algorithms across 10 experiments, and FPR represents the average false positive rate (FPR) and fairness difference value across 10 experiments. To more intuitively compare the performance of these algorithms, simulation results for all hyperparameters are summarized in […]. Figure 3 The x-axis represents the FPR difference value of the algorithm, and the y-axis represents the accuracy (Acc) of the algorithm. Furthermore, Table 2 presents the optimal experimental results for different missing data conditions for cross-sectional comparison.
[0078] Table 2 Statistical Table of Experimental Results
[0079] As shown in Table 2, under balanced data conditions, when the missing data type is completely random missing (MCARMissingness), Fair MIA AdaBoost outperforms the other three algorithms in fair classification. At a missing data ratio of 2%, Fair MIA AdaBoost's accuracy remains consistently above 0.76, higher than the other algorithms. FPR The variance stability was as low as 0.018, indicating the best fairness. As the proportion of missing data increased, the accuracy and FPR variance of the Fair MIA AdaBoost algorithm decreased slightly, but compared with the Forest algorithm, the Fair MIA AdaBoost algorithm had better FPR variance performance, and outperformed Forest, Agarwal, and Hardt in accuracy.
[0080] When the missing data type is MAR Missingness, the accuracy difference between the Fair MIA AdaBoost method and the FairMIP Forest method is small, but the Fair MIA AdaBoost algorithm... FPRThe difference is lower, and both methods outperform Agarwal and Hardt / Zafar. As the proportion of missing data increases, the Fair MIA AdaBoost algorithm consistently achieves higher accuracy than other algorithms across different hyperparameters. FPR In terms of difference, the Fair MIA AdaBoost algorithm can achieve a minimum of 0.013, which is more fair than other algorithms.
[0081] When the missing data type is non-random missing (MNAR), the Fair MIA AdaBoost algorithm outperforms other methods in both accuracy and fairness at missing data ratios of 2% and 8%. When the missing data ratio is 5%, its accuracy is comparable to the Fair Mip Forest algorithm, but the Fair MIA AdaBoost algorithm exhibits better performance. FPR The difference lies in the fact that the Fair MIA AdaBoost algorithm outperforms other methods. It is evident that the Fair MIA AdaBoost algorithm exhibits better stability under different data missing percentages. As shown in Table 2, the optimal FPR value for Fair Mip Forest is 0.013 at a missing percentage of 2%, but this is achieved at the cost of significant accuracy; in this case, the Acc of Fair Mip Forest is only 0.712. Therefore, in most cases, choosing the MIA AdaBoost algorithm is more advantageous, while also providing higher accuracy.
[0082] The above analysis summarizes that, under the three data missing scenarios, the Fair MIA AdaBoost method proposed in this invention exhibits the best overall performance across all metrics, outperforming Fair MIP Forest, Agarwal, Zafar, and Hardt. To ensure better fairness and accuracy, Fair MIA AdaBoost is optimal for balancing most data missing scenarios. In conclusion, the method proposed in this invention demonstrates excellent accuracy and population fairness under various data missing scenarios.
[0083] The present invention provides a fair classification method under missing data conditions, which involves acquiring a sample dataset; inputting the sample dataset 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 weights of the decision tree; S2: using a pre-set base classifier to perform preliminary classification and missing value processing on the sample dataset to obtain the current decision tree; S3: calculating the total error rate of the base classifier based on the predicted values of the current decision tree and the fairness constraint index; S4: minimizing the pre-constructed exponential loss function based on the linear combination of the base classifiers using the total error rate to obtain the sample distribution weights of the next tree, repeating steps S2-S4 until a preset termination condition is reached; S5: obtaining the target classification model based on voting using the sample distribution weights in multiple iterations. This invention links missing value handling and fair machine learning through a pre-trained target classification model. During the training process, base classifiers are used for preliminary classification and missing value handling. The classification error rate of each tree is calculated using the ensemble approach, and fairness constraints are introduced into the error rate. By calculating and updating the weight distribution of different fair data in the base classifiers, the optimal target classification model is finally obtained, achieving data classification that ensures both fairness and accuracy while effectively handling missing data.
[0084] The following describes the fair classification apparatus under missing data conditions provided by the present invention. The fair classification apparatus under missing data conditions described below can be referred to in correspondence with the fair classification method under missing data conditions described above. For example... Figure 4 As shown, the device includes the following modules: Data unit 410 is used to acquire the sample dataset; Classification unit 420 is used to input the sample dataset into a pre-trained target classification model to obtain classification results; Training unit 430 is used to train the target classification model; wherein, the training steps of the target classification model include: S1: Initialize the sample distribution weights of the decision tree; S2: Use a pre-set base classifier to perform preliminary classification and missing value handling on the sample dataset to obtain the current decision tree; S3: Calculate the total error rate of the base classifier based on the predicted values of the current decision tree and the fairness constraint index; 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 weights of the next tree. Steps S2-S4 are repeated until the preset termination condition is met. S5: The target classification model is obtained based on the weighted voting of the sample distribution in multiple rounds of iteration.
[0085] According to the present invention, a fair classification device under data missing conditions is provided, wherein the base classifier uses the missing value itself as the splitting criterion in the decision tree and uses a mixed integer programming algorithm to train the fair decision tree.
[0086] According to the present invention, a fair classification device under data missing conditions utilizes a pre-set base classifier to perform preliminary classification and missing value processing on a sample dataset to obtain a current decision tree, specifically including: Determine the splitting features based on the sample dataset; For each sample data, if there is no missing value at the splitting feature, the branch splits according to a pre-set threshold to obtain a child node; if there is a missing value at the splitting feature, the branch splits according to the target splitting value at that node to obtain a child node; wherein, the target splitting value is calculated based on the missing attribute and the splitting node attribute. Repeat the splitting of the child node until the stopping condition is met; Predict the last layer of child nodes to obtain 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 the preset encoding value condition, it indicates that the data point has reached the leaf node, and the predicted value of the current leaf node is updated to the preset value.
[0087] According to the present invention, a fair classification device under data missing conditions calculates the total error rate of the base classifier based on the predicted value of the current decision tree and the fairness constraint index, specifically including: The total error rate is calculated using the first preset formula based on the predicted value and the fairness constraint index. The first preset formula includes:
[0088]
[0089] in, μ The weight allocated to fairness constraints, f r To ensure fair constraints on indicators, e m The total error rate, e r For sample error rate, y i For predicted values, This is the default value.
[0090] According to the present invention, a fair classification device under data missing conditions includes an exponential loss function comprising:
[0091] in, h ( i ) is the base classifier. y i For predicted values, f r To ensure fair constraints on indicators, D This is the sample dataset.
[0092] According to the present invention, a fair classification device under data missing conditions minimizes a pre-constructed exponential loss function based on a linear combination of the base classifiers using the total error rate to obtain the sample distribution weights of the next tree, specifically including: With the goal of minimizing the exponential loss function, a greedy algorithm is used to obtain the weight coefficient update formula based on the linear combination of the base classifiers; The sample distribution weights of the next tree are calculated based on the sample distribution weights of the current decision tree, the total error rate, and the weight coefficient update formula.
[0093] The present invention provides a fair classification device under data missing conditions, which acquires a sample dataset; inputs the sample dataset 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 weights of the decision tree; S2: using a pre-set base classifier to perform preliminary classification and missing value processing on the sample dataset 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 the pre-constructed exponential loss function based on the linear combination of the base classifiers using the total error rate to obtain the sample distribution weights of the next tree, repeating steps S2-S4 until a preset termination condition is reached; S5: obtaining the target classification model based on voting of the sample distribution weights in multiple iterations. This invention links missing value handling and fair machine learning through a pre-trained target classification model. During the training process, base classifiers are used for preliminary classification and missing value handling. The classification error rate of each tree is calculated using the ensemble approach, and fairness constraints are introduced into the error rate. By calculating and updating the weight distribution of different fair data in the base classifiers, the optimal target classification model is finally obtained, achieving data classification that ensures both fairness and accuracy while effectively handling missing data.
[0094] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5As shown, the electronic device may include: a processor 510, a communication interface 520, a 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 logical instructions in the memory 530 to execute a fair classification method under missing data conditions. This method includes: acquiring a sample dataset; inputting the sample dataset 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 weights of the decision tree; S2: using pre-set base classifiers to perform preliminary classification and missing value processing on the sample dataset to obtain the current decision tree; S3: calculating the total error rate of the base classifiers based on the predicted values of the current decision tree and the fairness constraint index; S4: minimizing a pre-constructed exponential loss function based on the linear combination of the base classifiers using the total error rate to obtain the sample distribution weights of the next tree, repeating steps S2-S4 until a preset termination condition is reached; S5: obtaining the target classification model based on voting using the sample distribution weights from multiple iterations.
[0095] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0096] On the other hand, the present invention also provides a computer program product, which includes a computer program that 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 the data missing conditions provided by the above methods. The method includes: acquiring a sample dataset; inputting the sample dataset 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 weights of the decision tree; S2: performing preliminary classification and missing value processing on the sample dataset using a pre-set base classifier 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 the pre-constructed exponential loss function based on the linear combination of the base classifiers using the total error rate to obtain the sample distribution weights of the next tree, repeating steps S2-S4 until a preset termination condition is reached; S5: obtaining the target classification model based on voting of the sample distribution weights in multiple iterations.
[0097] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a fair classification method under data missing conditions provided by the methods described above. The method includes: acquiring a sample dataset; inputting the sample dataset 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 weights of the decision tree; S2: performing preliminary classification and missing value processing on the sample dataset using a pre-set base classifier to obtain the current decision tree; S3: calculating the total error rate of the base classifier based on the predicted values of the current decision tree and the fairness constraint index; S4: minimizing a pre-constructed exponential loss function based on the linear combination of the base classifiers using the total error rate to obtain the sample distribution weights of the next tree, repeating steps S2-S4 until a preset termination condition is reached; S5: obtaining the target classification model based on voting of the sample distribution weights in multiple iterations.
[0098] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0099] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments 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, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A fair classification method under conditions of missing data, characterized in that, include: Obtain a sample dataset, which includes text data, image data, audio data, or video data; The sample dataset is input into a pre-trained target classification model to obtain the classification result; The training steps of the target classification model include: S1: Initialize the sample distribution weights of the decision tree; S2: Use a pre-set base classifier to perform preliminary classification and missing value handling on the sample dataset to obtain the current decision tree; S3: Calculate the total error rate of the base classifier based on the predicted values of the current decision tree and the fairness constraint index; 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 weights of the next tree. Steps S2-S4 are repeated until the preset termination condition is met. S5: The target classification model is obtained based on the weighted voting of the sample distribution in multiple rounds of iteration; The process of using a pre-set base classifier to perform preliminary classification and missing value processing on the sample dataset to obtain the current decision tree specifically includes: determining splitting features based on the sample dataset; for each sample data, if there are no missing values at the splitting feature, the branch splits according to a pre-set threshold to obtain a child node; if there are missing values at the splitting feature, the branch splits according to the target splitting value at that node to obtain a child node; wherein, the target splitting value is calculated based on the missing attribute and the splitting node attribute; repeating the splitting of the child node until a stopping condition is met; predicting the last layer of child nodes to obtain predicted values; encoding the predicted values using a mixed integer programming algorithm to obtain one-hot encoded values; if the one-hot encoded values meet a preset encoding value condition, it indicates that the data point has reached a leaf node, and the predicted value of the current leaf node is updated to the preset value; The step of calculating the total error rate of the base classifier based on the predicted value of the current decision tree and the fairness constraint index includes: calculating the total error rate using a first preset formula based on the predicted value and the fairness constraint index; wherein the first preset formula includes: , ,in, μ The weight allocated to fairness constraints, f r To ensure fair constraints on indicators, e m The total error rate, e r For sample error rate, y i For predicted values, This is the default value; The exponential loss function includes: ,in, h ( i ) is the base classifier. D This is the sample dataset.
2. The fair classification method under data missing conditions according to claim 1, characterized in that, The base classifier uses the missing values themselves as the splitting criterion in the decision tree and trains the fair decision tree using a mixed integer programming algorithm.
3. The fair classification method under data missing conditions according to claim 1, characterized in that, The linear combination of the base classifiers uses the total error rate to minimize the pre-constructed exponential loss function to obtain the sample distribution weights for the next tree, specifically including: With the goal of minimizing the exponential loss function, a greedy algorithm is used to obtain the weight coefficient update formula based on the linear combination of the base classifiers; The sample distribution weights of the next tree are calculated based on the sample distribution weights of the current decision tree, the total error rate, and the weight coefficient update formula.
4. A fair classification device under conditions of missing data, characterized in that, include: A data unit is used to acquire a sample dataset, which includes text data, image data, audio data, or video data. A classification unit is used to input the sample dataset into a pre-trained target classification model to obtain classification results; A training unit is used to train the target classification model; wherein the training steps of the target classification model include: S1: Initialize the sample distribution weights of the decision tree; S2: Use a pre-set base classifier to perform preliminary classification and missing value handling on the sample dataset to obtain the current decision tree; S3: Calculate the total error rate of the base classifier based on the predicted values of the current decision tree and the fairness constraint index; 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 weights of the next tree. Steps S2-S4 are repeated until the preset termination condition is met. S5: The target classification model is obtained based on the weighted voting of the sample distribution in multiple rounds of iteration; The process of using a pre-set base classifier to perform preliminary classification and missing value processing on the sample dataset to obtain the current decision tree specifically includes: determining splitting features based on the sample dataset; for each sample data, if there are no missing values at the splitting feature, the branch splits according to a pre-set threshold to obtain a child node; if there are missing values at the splitting feature, the branch splits according to the target splitting value at that node to obtain a child node; wherein, the target splitting value is calculated based on the missing attribute and the splitting node attribute; repeating the splitting of the child node until a stopping condition is met; predicting the last layer of child nodes to obtain predicted values; encoding the predicted values using a mixed integer programming algorithm to obtain one-hot encoded values; if the one-hot encoded values meet a preset encoding value condition, it indicates that the data point has reached a leaf node, and the predicted value of the current leaf node is updated to the preset value; The step of calculating the total error rate of the base classifier based on the predicted value of the current decision tree and the fairness constraint index includes: calculating the total error rate using a first preset formula based on the predicted value and the fairness constraint index; wherein the first preset formula includes: , ,in, μ The weight allocated to fairness constraints, f r To ensure fair constraints on indicators, e m The total error rate, e r For sample error rate, y i For predicted values, This is the default value; The exponential loss function includes: ,in, h ( i ) is the base classifier. D This is the sample dataset.
5. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the fair classification method under data missing conditions as described in any one of claims 1 to 3.
6. 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, it implements the fair classification method under data missing conditions as described in any one of claims 1 to 3.
7. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the fair classification method under data missing conditions as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Multi-classification model training method of adaptive weighting loss function
CN116010879A