Machine learning model fairness optimization method and device and storage medium
By acquiring and adjusting the sensitive attributes of machine learning models, generating target training sets, and retraining the models, the discriminatory problem of machine learning models in socially sensitive areas is solved, and the predictive reliability and fairness of the models are improved.
Patent Information
- Application Number
- CN202511335591.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-18
- Publication Date
- 2026-01-23
AI Technical Summary
Machine learning models are prone to making subtle discriminatory decisions in socially sensitive areas, resulting in low predictive reliability.
By obtaining the sensitive attributes of the training samples in the initial training set, performing bias adjustment, generating the target training set, and using the latent space adjustment algorithm of generative adversarial networks to balance the distribution of sensitive attributes, the machine learning model is finally retrained to optimize its fairness.
It effectively solves the fairness problem of machine learning models in situations with multiple intertwined attributes, eliminates systematic discrimination against specific subgroups by the model, and improves the predictive effectiveness of the model.
Smart Images

Figure CN121390356A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of computers, and particularly relates to a fairness optimization method, device and storage medium of a machine learning model. BACKGROUND
[0002] With the wide application of artificial intelligence technology in social sensitive fields such as credit approval, recruitment screening and medical diagnosis, the fairness problem of machine learning models has become increasingly prominent. Data often contains multiple sensitive attributes (such as gender and age), and there is a complex correlation between the attributes, which leads to the model being prone to produce hidden discriminatory decisions, resulting in low prediction reliability of the model. SUMMARY
[0003] The embodiments of the application provide a fairness optimization method, device and storage medium of a machine learning model, which can improve the prediction reliability of the model.
[0004] In a first aspect, the embodiments of the application provide a fairness optimization method of a machine learning model, applied to an electronic device, the electronic device comprising a machine learning model, and the method comprising:
[0005] obtaining sensitive attributes of training samples in an initial training set of the machine learning model; wherein the sensitive attributes are attributes in the training samples that cause the machine learning model to produce discriminatory decisions; the category of the sensitive attributes of each training sample is configured as one of a plurality of selectable categories corresponding to the sensitive attributes; and the target attribute of each training sample is configured as one of a plurality of selectable categories corresponding to the target attribute, and the target attribute corresponds to the prediction target of the machine learning model;
[0006] performing debiasing adjustment on the training samples in the initial training set according to the sensitive attributes to obtain a target training set; wherein the plurality of selectable categories corresponding to the sensitive attributes are evenly distributed in each attribute training sample combination, the categories of the target attributes of the training samples in the same attribute training sample combination are the same, and the categories of the target attributes of the training samples in different attribute training sample combinations are different;
[0007] retraining the machine learning model according to the target training set to obtain a machine learning model optimized in fairness.
[0008] In a second aspect, the embodiments of the application provide a fairness optimization device of a machine learning model, the device comprising an electronic device comprising a machine learning model, and the device comprising:
[0009] An attribute obtaining module is configured to obtain sensitive attributes of training samples in an initial training set of the machine learning model, wherein the sensitive attributes are attributes in the training samples that cause the machine learning model to generate a discriminatory decision; a category of the sensitive attribute of each training sample is configured as one category of a plurality of selectable categories corresponding to the sensitive attribute; and a target attribute of each training sample is configured as one category of a plurality of selectable categories corresponding to the target attribute, wherein the target attribute corresponds to a prediction target of the machine learning model.
[0010] A debiasing module is configured to perform debiasing adjustment on the training samples in the initial training set according to the sensitive attributes to obtain a target training set, wherein the plurality of selectable categories corresponding to the sensitive attributes are evenly distributed in each attribute training sample combination, the categories of the target attributes of the training samples in the same attribute training sample combination are the same, and the categories of the target attributes of the training samples in different attribute training sample combinations are different.
[0011] A model optimization module is configured to retrain the machine learning model according to the target training set to obtain a machine learning model with optimized fairness.
[0012] In a third aspect, an electronic device is provided, and the electronic device includes a processor and a memory storing computer program instructions.
[0013] The processor, when executing the computer program instructions, implements the fairness optimization method of the machine learning model according to the first aspect.
[0014] In a fourth aspect, a computer readable storage medium is provided, and the computer readable storage medium stores computer program instructions. When the computer program instructions are executed by a processor, the fairness optimization method of the machine learning model according to the first aspect is implemented.
[0015] In a fifth aspect, a computer program product is provided, and instructions in the computer program product are executed by a processor of an electronic device, so that the electronic device executes the fairness optimization method of the machine learning model according to the first aspect.
[0016] The fairness optimization method, device, electronic equipment, computer readable storage medium and computer program product of the machine learning model provided in the embodiments of the present application can obtain the sensitive attributes of the initial training set, perform debiasing adjustment on the training samples of the initial training set according to the determined sensitive attributes, obtain the target training set after debiasing, retrain the model according to the target training set, and obtain the optimized model. In this way, the multiple sensitive attributes under multiple attributes can be debiased, the fairness problem of the machine learning model in the multiple attribute interweaving situation can be effectively solved, the complex discrimination problem caused by the interweaving of multiple sensitive attributes can be effectively handled, thereby eliminating the systematic discrimination of the model to a specific sub-group at a deeper level, and finally improving the prediction effectiveness of the model. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required to be used in the embodiments of the present application will be briefly introduced. Those skilled in the art can obtain other drawings according to these drawings without creating any creative labor.
[0018] Figure 1 is a flow diagram of the fairness optimization method of the machine learning model provided in the embodiments of the present application;
[0019] Figure 2 is a system overall architecture flow chart provided in the embodiments of the present application;
[0020] Figure 3 is a display interface corresponding to the data set selection module provided in the embodiments of the present application;
[0021] Figure 4 is a display interface corresponding to the attribute association exploration module provided in the embodiments of the present application;
[0022] Figure 5 is a display interface corresponding to the dynamic model debiasing module provided in the embodiments of the present application;
[0023] Figure 6 is a display interface corresponding to the multi-level fairness evaluation provided in the embodiments of the present application;
[0024] Figure 7 is a structural diagram of the fairness optimization device of the machine learning model provided in the embodiments of the present application;
[0025] Figure 8 is a structural diagram of the electronic equipment provided in the embodiments of the present application. DETAILED DESCRIPTION
[0026] The features and exemplary embodiments of the various aspects of the present application will be described in detail below with reference to the drawings. For the purpose of clarity, the description is divided into the following sections: technical field, brief description of the drawings, detailed description of the embodiments, and conclusion. It should be noted that the specific embodiments described herein are intended to explain the present application and are not intended to limit the present application. The present application can be implemented without some of the specific details described below. The following description of the embodiments is merely provided to give a better understanding of the present application by showing examples of the present application.
[0027] It should be noted that the relational terms herein, such as first and second, are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Also, the terms "comprises", "comprising", or any other variation thereof are intended to cover non-exclusive inclusions, so that a process, method, article, or apparatus that comprises a list of elements does not only include those elements, but also includes other elements not explicitly listed, or other elements inherent in such a process, method, article, or apparatus. Without more limitations, the elements defined by the statement "comprise" do not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the elements.
[0028] To solve the related technical problems, the embodiments of the present application provide a fairness optimization method, device, equipment, computer readable storage medium and computer program product of a machine learning model. First, the fairness optimization method of the machine learning model provided by the embodiments of the present application is introduced.
[0029] Figure 1 The flowchart of the fairness optimization method of the machine learning model provided by the embodiments of the present application is shown. The fairness optimization method of the machine learning model is applied to an electronic device, and the electronic device includes a machine learning model, such as Figure 1 As shown, the above method includes the following steps S101-S103:
[0030] Step S101, obtaining the sensitive attribute of the training sample in the initial training set of the machine learning model.
[0031] The initial training set is used to train the machine learning model to predict a target, and the initial training set includes a plurality of training samples, each of which includes a plurality of attributes, each of which can represent a feature corresponding to the training sample, wherein the plurality of attributes at least include a target attribute corresponding to the prediction target of the machine learning model. For example, the initial training set is used to train the machine learning model to predict whether a bank customer can pass a bank loan approval, and the target attribute can be the bank loan approval result. The training sample can include the name, gender, age, etc. of the bank customer, and the plurality of attributes can include the name, gender, age, etc.
[0032] The sensitive attribute is an attribute in the training sample that causes the machine learning model to make a discriminatory decision. The category of the sensitive attribute of each training sample is configured as one of a plurality of selectable categories corresponding to the sensitive attribute. The target attribute of each training sample is configured as one of a plurality of selectable categories corresponding to the target attribute, which corresponds to the prediction target of the machine learning model.
[0033] For example, the target attribute can be the bank loan approval result, and the possible bank loan approval results can be passing the bank loan approval or failing the bank loan approval, i.e., for the case where the target attribute is the bank loan approval result, the plurality of selectable categories of the target attribute can include passing the bank loan approval and failing the bank loan approval, and the sensitive attribute can be gender, i.e., for the case where the sensitive attribute is gender, the plurality of selectable categories of the sensitive attribute can include male and female.
[0034] In one embodiment, the sensitive attribute can be selected by the user from the plurality of attributes, and in another embodiment, the sensitive attribute can be determined by the electronic device from the plurality of attributes.
[0035] Specifically, the above step S101 can include the following steps:
[0036] Statistical correlation analysis is performed on each attribute of the training samples in the initial training set to obtain an attribute association analysis result.
[0037] According to the attribute association analysis result, the sensitive attribute of the training sample in the initial training set of the machine learning model is determined.
[0038] The attribute association analysis result includes at least one of an attribute correlation index and a fairness index. The attribute correlation index is used to quantify the association strength between different attributes, and the fairness index is used to quantify the difference in decision results of the machine learning model between different attribute groups. An attribute group includes at least one training sample, and the selected attributes of the training samples in the same attribute group have the same category, and the selected attributes of the training samples in different attribute groups have different categories. The selected attributes include at least one of the plurality of attributes.
[0039] For example, the initial training set includes 50 training samples, the selected attribute is gender, the initial training set has 28 male training samples and 22 female training samples, and for the gender attribute, the attribute group includes a female group A and a male group B, the female group A includes 22 female training samples, and the male group B includes 28 male training samples.
[0040] The attribute correlation index can include at least one of a Phi coefficient and an odds ratio, and the fairness index can include at least one of an attribute category proportion, an equal opportunity difference, and a bias amplification value. The Phi coefficient is used to measure the correlation between two attributes, the odds ratio is used to represent the positive and negative correlation between two attributes, the attribute category proportion represents the proportion of each category under the attribute appearing in the initial training set, the equal opportunity difference is used to measure the difference in false negative rate of the model on the attribute group, and the bias amplification value is used to measure the bias amplification of the model prediction result in the attribute group.
[0041] In an embodiment, the above-mentioned determining, according to the attribute correlation analysis result, the sensitive attribute of the training sample in the initial training set of the machine learning model can include the following steps:
[0042] Display the attribute correlation analysis result.
[0043] Receive the sensitive attribute selected by the user from the displayed attribute correlation analysis result to obtain the sensitive attribute of the training sample in the initial training set of the machine learning model.
[0044] In an embodiment, at least one sensitive attribute can be selected through graphical interface interaction, specifically, the electronic device provides an interactive visualization interface to the user, which simultaneously displays two panels, one panel displays the model fairness index, and the other panel displays the attribute correlation index. The user observes which attributes are strongly related to the target attribute and cause high model unfairness, and then selects one or more attributes as sensitive attributes.
[0045] Among them, different model fairness indexes can be displayed in the form of a column chart, and attribute correlation indexes can be displayed in the form of a heat map.
[0046] For example, in the recruitment model training set, the electronic device interface displays that the "postal code" attribute has a high correlation with the target attribute "whether to hire" (deep color in the heat map), and the equal opportunity difference DEO value of the model for the applicants in the regions with "postal code" codes A and B is as high as 0.25 (large difference in the column chart). The user specifies "postal code" as a sensitive attribute accordingly.
[0047] In another implementation, the electronic device automatically recommends at least one sensitive attribute, and the user selects at least one sensitive attribute from the recommended sensitive attributes.
[0048] Specifically, the electronic device is built-in with a recommendation logic, which automatically calculates the fairness index of all attributes and the correlation index with the target attribute, and filters out a list of high-risk candidate sensitive attributes according to a preset rule (such as DEO>0.1 and Phi coefficient>0.3), and prompts the user in the form of highlighting or pop-up window. The user confirms and selects according to the recommended list.
[0049] For example, after the electronic device analyzes the credit training set, it pops up a prompt: "It is detected that the'residential area' attribute may be related to 'age', and the opportunity equality difference DEO based on this attribute is 0.18, it is recommended to list it as a sensitive attribute for review.", the user accepts the suggestion and designates it as a sensitive attribute.
[0050] Step S102, according to the sensitive attribute, the training samples in the initial training set are adjusted to obtain the target training set.
[0051] The plurality of selectable categories corresponding to the sensitive attribute are evenly distributed in each attribute training sample combination, the categories of the sensitive attributes of the training samples in the same attribute training sample combination are the same, and the categories of the sensitive attributes of the training samples in different attribute training sample combinations are different.
[0052] The above-mentioned even distribution is not necessarily even distribution, but the number of training samples corresponding to each selectable category may differ by no more than a preset number threshold.
[0053] For example, for the initial training set, the sensitive attribute is gender, and the target attribute is the loan approval result, wherein the initial training set includes 50 training samples, wherein the initial training set has 28 training samples with loan approval and 22 training samples with loan approval, 10 female training samples, and 18 male training samples in the 28 training samples with loan approval, and 10 training samples with male attribute and 12 female training samples in the 22 training samples with loan approval, the first attribute training sample combination includes 28 training samples with loan approval, the second attribute training sample combination includes 22 training samples with loan approval, in the first attribute training sample combination, the number of training samples corresponding to the two selectable categories of the sensitive attribute differs by 8, in the second attribute training sample combination, the number of training samples corresponding to the two selectable categories of the sensitive attribute differs by 2, and assuming that the preset number threshold is 4, the plurality of selectable categories corresponding to the sensitive attribute are not evenly distributed in the first attribute training sample combination, and the plurality of selectable categories corresponding to the sensitive attribute are evenly distributed in the second attribute training sample combination.
[0054] In response to the unbalanced distribution of the plurality of selectable categories corresponding to the sensitive attribute in the attribute training sample combination, the training samples in the initial training set are adjusted according to the sensitive attribute to obtain a target training set.
[0055] In some embodiments, the step S102 can further include the following steps:
[0056] For each first training sample in the first training sample set of the initial training set, the first training sample is input into a preset generative adversarial network, and the first training sample is processed by a latent space adjustment algorithm of the generative adversarial network to generate a target training sample.
[0057] According to the target training sample corresponding to the first training sample set and the training sample in the initial training set, a target training set is obtained.
[0058] The category of the sensitive attribute of the first training sample is a first category, and the first category is a category with the largest proportion in the attribute training sample combination among the plurality of selectable categories corresponding to the sensitive attribute. The attribute training sample combination can be any one of the plurality of attribute training sample combinations corresponding to the initial training set.
[0059] For example, for the sensitive attribute being gender and the target attribute being loan approval result, the first attribute training sample combination includes training samples with the category of the target attribute being loan approval, and the second attribute training sample combination includes training samples with the category of the target attribute being loan disapproval. The number of training samples included in the first attribute training sample combination is 22, and the number of training samples included in the second attribute training sample combination is 28. The number of female training samples in the first attribute training sample combination is 8, and the number of male training samples is 14. The number of female training samples in the second attribute training sample combination is 18, and the number of male training samples is 10. Therefore, for the first attribute training sample combination, the first category is male, and for the second attribute training sample combination, the first category is female.
[0060] The number of first training samples included in the first training sample set is determined by the difference between the number of first training samples and the number of second training samples in the attribute training sample combination. The category of the target attribute of the second training sample is a second category other than the first category among the plurality of selectable categories corresponding to the target attribute. The category of the sensitive attribute of the target training sample changes from the first category to the second category, and the category of the target attribute remains unchanged.
[0061] The number of the first training samples included in the first training sample set is a number that can balance the sensitive attribute distribution in the training set in which the newly generated target training sample is combined with the training samples in the initial training set, such as the number of the first training samples included in the first training sample set can be a difference between the number of the first training samples and the number of the second training samples in the attribute training sample combination.
[0062] In an implementation, the above obtaining the target training set according to the target training sample corresponding to the first training sample set and the training sample in the initial training set can be obtaining the target training set according to the combination of the target training sample corresponding to the first training sample set and the training sample in the initial training set.
[0063] The generative adversarial network is a deep learning framework, in which a generator and a discriminator learn a data distribution through adversarial training, so as to generate new data samples.
[0064] The latent space adjustment algorithm is a technology for precisely controlling specific attributes of generated samples through vector operations in the latent space (a low-dimensional vector space) of the generative adversarial network.
[0065] In some embodiments, the above processing the first training sample through the latent space adjustment algorithm of the generative adversarial network to generate the target training sample can include the following steps:
[0066] Obtaining an original latent vector corresponding to the first training sample in the latent space of the generative adversarial network.
[0067] Determining a sensitive attribute adjustment direction based on a preset sensitive attribute classifier, the sensitive attribute adjustment direction being used to indicate a latent space moving direction in which the category of the sensitive attribute of the first training sample changes from a first category to a second category.
[0068] Determining a target attribute maintaining direction based on a preset target attribute classifier, the target attribute maintaining direction being used to indicate a latent space moving direction in which the category of the target attribute of the first training sample remains unchanged.
[0069] Obtaining a latent space adjustment direction according to a preset adjustment coefficient, the sensitive attribute adjustment direction, and the target attribute maintaining direction.
[0070] Determining a target latent vector according to the original latent vector and the latent space adjustment direction.
[0071] Inputting the target latent vector into the generator of the generative adversarial network to generate the target training sample.
[0072] The above preset adjustment coefficient is an adjustable hyperparameter, which is used to control the number of generated samples or the intensity of the generation process.
[0073] For example, a value λ between 0 and 1 is used to control the distance of latent space movement.
[0074] This step is the core debiasing operation, and a new sample is generated by a generative adversarial network (GAN) to balance the distribution of sensitive attributes.
[0075] In some embodiments, the above latent space adjustment algorithm can be as follows:
[0076]
[0077] where z' represents the target latent vector, z represents the original latent vector, W g , W t respectively represent the weight vector of the sensitive attribute classifier, the weight vector of the target attribute classifier, b g , b t are bias terms, and λ is an adjustment coefficient. represents the target attribute preservation direction, represents the sensitive attribute adjustment direction, represents the latent space adjustment direction.
[0078] This algorithm can effectively generate samples with invariant target attributes and controllable changes in sensitive attributes, thereby improving the group fairness of the dataset and observing the impact of generated samples on data distribution in real time. The platform supports user-defined λ values or system recommendations, provides functions such as random seed setting for generated samples, batch size for generated samples, and sample saving and preview.
[0079] Step S103: retrain the machine learning model according to the target training set to obtain a fairness-optimized machine learning model.
[0080] This step S103 uses the balanced new dataset to retrain the model to obtain a more fair model.
[0081] In one embodiment, the step S103 can include the following steps:
[0082] Mix the generated target training samples with the training samples in the initial training set to form a target training set.
[0083] Initialize the machine learning model.
[0084] Use the new training set to train the initialized machine learning model from scratch to obtain a fairness-optimized machine learning model.
[0085] For example, the generated 2500 target training samples are merged with the 10000 training samples in the initial training set to obtain a target training set containing 12500 samples. Then a brand new machine learning model is trained using the target training set for 50 iterations.
[0086] In another implementation, the step S103 can further include:
[0087] The generated target training samples are mixed with the training samples in the initial training set to form a target training set.
[0088] The existing weights of the machine learning model are used as initial parameters, and the target training set is used to perform additional training on the machine learning model.
[0089] The model parameters are fine-tuned through the additional training to obtain a fairness-optimized machine learning model.
[0090] Specifically, the generated target training samples are mixed with the training samples in the initial training set, and additional training (fine-tuning) is performed on the basis of the existing machine learning model. The existing weights of the machine learning model are used as initial parameters, which is equivalent to "correcting the deviation" of the model using the new training set.
[0091] In the embodiments of the present application, the sensitive attributes of the initial training set are obtained, the training samples of the initial training set are de-biased according to the determined sensitive attributes to obtain a de-biased target training set, and the model is retrained according to the target training set to obtain an optimized model. In this way, multiple sensitive attributes under multiple attributes can be de-biased, the fairness problem of the machine learning model in the multi-attribute interlaced scenario can be effectively solved, the complex discrimination problem caused by the interlacing of multiple sensitive attributes can be effectively handled, thereby eliminating the systematic discrimination of the model to a specific sub-group at a deeper level, and finally improving the prediction effectiveness of the model.
[0092] In some embodiments, the calculation formula of the Phi coefficient can be as follows:
[0093]
[0094] Wherein, φ represents the Phi coefficient, A represents the number of training samples in which the attribute and the target attribute are both the first value, B represents the number of training samples in which the attribute is the first value and the target attribute is the second value, C represents the number of training samples in which the attribute is the second value and the target attribute is the first value, and D represents the number of training samples in which the attribute and the target attribute are both the second value.
[0095] The attribute is any attribute other than the target attribute among the multiple attributes, the first value and the second value represent different categories among the multiple selectable categories of the attribute, and the attribute can be a binary category attribute.
[0096] The first value and the second value refer to two optional categories (i.e., two states after binarization) preset under each attribute, for example, for the gender attribute, the first value and the second value can represent female and male respectively.
[0097] In some embodiments, the calculation formula of the odds ratio can be as follows:
[0098]
[0099] Wherein, OR represents the odds ratio.
[0100] For example, assuming that there is a medical training set, and it is desired to analyze the correlation between "whether smoking" (attribute) and "whether suffering from lung cancer" (target attribute).
[0101] Attribute value definition:
[0102] For the "whether smoking" attribute: the first value is defined as "yes", and the second value is defined as "no";
[0103] For the "whether suffering from lung cancer" attribute: the first value is defined as "yes", and the second value is defined as "no";
[0104] Statistical training samples:
[0105] Assuming that 500 training samples are counted from the data, and their distribution is shown in Table 1 (i.e., confusion matrix) as follows:
[0106] Table 1
[0107] Has lung cancer (Yes) Does not have lung cancer (No) Total Smokes (Yes) A=90 B=60 150 Does not smoke (No) C=30 D=320 350 Total 120 380 500
[0108] Substitute the above values into the formula for calculation:
[0109]
[0110] The calculated Phi coefficient is about 0.552. The value is positive, indicating that there is a positive correlation between "smoking" and "suffering from lung cancer", and the absolute value of 0.552 is much greater than 0, indicating that the correlation is strong.
[0111]
[0112] The calculated odds ratio OR = 16.
[0113] This means that the "advantage" of smokers suffering from lung cancer is 16 times that of non-smokers suffering from lung cancer. More specifically, in this sample, the probability of smokers suffering from lung cancer is much higher than that of non-smokers.
[0114] In some embodiments, the calculation formula of the above attribute category ratio can be as follows:
[0115]
[0116] wherein p cat represents the target category ratio of the attribute, N cat represents the number of training samples belonging to the target category in the initial training set, and N total is the total number of training samples included in the initial training set.
[0117] The target category is any category in the multiple selectable categories under the attribute.
[0118] The above target category ratio p cat of the attribute is a value between 0 and 1, reflecting the frequency of occurrence of the target category in the total.
[0119] For example, there is a training set containing customer information, which has an attribute of “customer level”, and the attribute has three selectable categories: “bronze”, “silver” and “gold”. The training set has a total of 1000 samples (i.e. N total = 1000).
[0120] Now calculate the proportion of “gold” level customers in the total customers:
[0121] Define the attribute to be analyzed:
[0122] Attribute: customer level
[0123] Target category: gold
[0124] Count the number of samples: through query or counting, it is found that the number of samples with customer level “gold” is 150 (i.e. N cat = 150) in 1000 customer samples.
[0125] Calculate the gold category ratio:
[0126] Substitute the above values into the formula to calculate:
[0127]
[0128] The silver and gold category ratios can be calculated through the above steps.
[0129] In this embodiment, the category ratio of each attribute in the multiple attributes included in the initial training set can be included in the attribute category ratio.
[0130] In some embodiments, the target attribute can be a binary attribute, where the two selectable categories corresponding to the target attribute include a positive category and a negative category, and the calculation formula of the equal opportunity difference is as follows:
[0131] DEO = | FNR s=0 - FNR s=1 |;
[0132]
[0133] where DEO represents the equal opportunity difference, S = 0 and S = 1 represent the first attribute group and the second attribute group respectively, the first attribute group includes training samples with the attribute taking the first value, and the second attribute group includes training samples with the attribute taking the second value, FNR S=s represents the false negative rate of the attribute group s, TP S=s represents the number of true positives in the attribute group s, the true positives and the false negatives are training samples in the attribute group, the target attribute of the true positives and the corresponding prediction result in the historical prediction result are both the positive category under the target attribute, and the target attribute of the false negatives is the positive category but the corresponding prediction result in the historical prediction result is the negative category.
[0134] The closer the value of the equal opportunity difference is to 0, the more fair the model is, and the larger the value is, the less fair the model performs on the two groups.
[0135] The above historical prediction result can be the prediction result corresponding to each training sample obtained by the machine learning model based on the initial training set.
[0136] The equal opportunity difference and the bias amplification value can be calculated based on the initial training set and the corresponding historical prediction result.
[0137] For example, for the attribute of gender, the first value can be female, and the second value can be male, the first attribute group includes training samples with the attribute taking the value of female, and the second attribute group includes training samples with the attribute taking the value of male.
[0138] FNR S=s represents the false negative rate of the attribute group s, that is, the proportion of samples that are actually positive examples but are incorrectly predicted by the model as negative examples in the attribute group.
[0139] TP S=s (True Positive) represents the number of true positives in the attribute group s. The true positive refers to: the true target attribute (Ground Truth) of the training sample is the positive category (such as “should be granted a loan”), and the historical prediction result of the model is also the positive category (such as “predicted to be granted a loan”).
[0140] FN S=s False Negative (FN) represents the number of false negative cases in attribute group s. False negative case refers to the case where the true target attribute of the training sample is the positive class (e.g., "should be granted loan"), but the historical prediction result of the model is the negative class (e.g., "predicted to be rejected loan").
[0141] For example, a bank uses a machine learning model to predict whether a loan should be granted to a customer. It is necessary to evaluate whether the model is fair on the sensitive attribute "gender".
[0142] Define parameters:
[0143] Sensitive attribute (S): gender;
[0144] First attribute group (S = 0): "male" customer group;
[0145] Second attribute group (S = 1): "female" customer group;
[0146] Target attribute: whether the loan should be granted;
[0147] Positive class: "yes" (should be granted loan);
[0148] Negative class: "no" (rejected loan);
[0149] Collect the historical prediction results of the model and the true labels in the training samples, and count the data in the two groups:
[0150] For the male group (S = 0):
[0151] The number of customers who should be granted a loan and are correctly predicted by the model as "should be granted a loan" (TP S=0 ) = 450;
[0152] The number of customers who should be granted a loan but are incorrectly predicted by the model as "rejected loan" (FN S=0 ) = 50;
[0153] For the female group (S = 1):
[0154] The number of customers who should be granted a loan and are correctly predicted by the model as "should be granted a loan" (TP S=1 ) = 180;
[0155] The number of customers who should be granted a loan but are incorrectly predicted by the model as "rejected loan" (FN S=1 ) = 20;
[0156] Calculate the false negative rate (FNR) of each attribute group:
[0157] False negative rate of male group:
[0158]
[0159] False Negative Rate (FNR) for female group:
[0160]
[0161] Disparity in Equal Opportunity (DEO):
[0162] DEO = |FNR s=0 FNR s=1 | = |0.1 - 0.1| = 0;
[0163] In some embodiments, the calculation formula of the bias amplification value described above can be as follows:
[0164]
[0165] where BA denotes the bias amplification value, S denotes the category of the attribute, denotes the conditional probability predicted by the model, i.e., the predicted probability that the target attribute is the positive category given that the attribute takes the first value or the second value, P t|s denotes the true conditional probability, i.e., the actual probability that the target attribute is the positive category given that the attribute takes the first value or the second value, max s denotes the maximum value among all the bias amplification values corresponding to the attributes.
[0166] BA denotes the bias amplification value. The closer its value is to 0, the smaller the degree of amplification of inherent bias of the model, and the closer the behavior is to the true distribution; the larger the value, the greater the deviation between the prediction behavior of the model on some groups and the true situation, i.e., the more serious the degree of amplification (or reduction) of bias.
[0167] S denotes the category of the attribute (e.g., "male" and "female").
[0168] denotes the conditional probability predicted by the model. That is, given that the attribute takes a certain specific category s (e.g., S = "female"), the probability that the model predicts the target attribute to be the positive category (e.g., "grant a loan") is calculated. This is usually estimated by calculating the proportion of positive examples predicted by the model in this group on the training set.
[0169] P t|s denotes the true conditional probability. That is, given that the attribute takes a certain specific category s (e.g., S = "female"), the actual probability that the target attribute is the positive category is calculated. This is obtained by calculating the proportion of true positive examples in this group on the training set.
[0170] max sMax in S This ensures that what is being evaluated is the model's worst-case bias amplification performance.
[0171] For example, suppose we analyze a model for resume screening that predicts whether an interview opportunity should be given (target attribute). We focus on whether the model amplifies the bias in the historical data on the dimension of "gender" (attribute).
[0172] Define parameters:
[0173] Attribute (S): Gender;
[0174] Classes: S0 = "Male", S1 = "Female";
[0175] Target attribute (t): Whether an interview is given;
[0176] Positive class: "Yes";
[0177] True training set (initial training set, i.e., data used to train the model): Data from the company's recruitment data over the past year;
[0178] Calculate the true conditional probability P t|s (Inherent bias in data):
[0179] Total number of male applicants = 1000, of which the number who received an interview = 400.
[0180] True conditional probability
[0181] Total number of female applicants = 1000, of which the number who received an interview = 300.
[0182] True conditional probability
[0183] Analysis: The data itself has bias, with the probability of a female receiving an interview (0.3) lower than that of a male (0.4).
[0184] Calculate the model's predicted conditional probability (Model's behavior):
[0185] Statistical analysis of historical prediction results:
[0186] The number of times the model predicts "give an interview" for male applicants = 380;
[0187] Predicted conditional probability
[0188] The number of times the model predicts "give an interview" for female applicants = 250;
[0189] Predictive conditional probability
[0190] Calculate the bias value of each group and take the maximum value (BA):
[0191] For the male group:
[0192] For the female group:
[0193] Bias amplification value (BA) = max(0.02, 0.05) = 0.05.
[0194] The significance of the maximum value selection: taking the maximum value of BA means evaluating the model from the most serious bias amplification situation, which conforms to the fairness principle of "minimizing the maximum harm" and ensures that no group is treated unfairly.
[0195] As can be seen from the above examples, the BA index provided by the present application can effectively quantify the degree of deviation of the model relative to the training data distribution, especially its potential risk of amplifying inherent social bias, providing key insights for model auditing and optimization.
[0196] In some embodiments, the above step S103 can be followed by the following steps:
[0197] Obtaining key evaluation indicators of the optimized machine learning model, the key evaluation indicators including at least one of performance indicators and fairness indicators.
[0198] According to the comparison result of the key evaluation indicators and the historical key evaluation indicators of the machine learning model, determining target model parameters of the machine learning model from the current model parameters corresponding to the optimized machine learning model and the historical model parameters corresponding to the historical key evaluation indicators.
[0199] Updating the model parameters of the machine learning model from the current model parameters to the target model parameters.
[0200] The model parameters are parameters that affect the accuracy of the machine learning model.
[0201] The above key evaluation indicators are used to quantify the evaluation of the quality of the model.
[0202] The above performance indicators are used to measure the accuracy of the model, such as: accuracy, precision, recall, F1 score, AUC value, etc.
[0203] The fairness indicators are used to measure whether the prediction results of the model are fair and unbiased for different groups (such as gender, age), for example: group equality difference, opportunity equality difference, prediction parity difference, etc.
[0204] The historical key evaluation indicators can refer to the key evaluation indicators calculated by the machine learning model on the past iteration versions (i.e., the versions using the historical model parameters).
[0205] The model parameters can refer to configuration settings that affect the learning process and final prediction accuracy of the machine learning model. For example: learning rate, regularization strength, batch size, etc.
[0206] The target model parameters can refer to the set of model parameters that have the best overall performance determined from the current model parameters and the historical model parameters corresponding to the historical key evaluation indicators.
[0207] Updating the model parameters of the machine learning model from the current model parameters to the target model parameters can obtain a further optimized model.
[0208] In an embodiment, the target model parameters of the machine learning model can be determined from the current model parameters corresponding to the retrained machine learning model and the historical model parameters corresponding to the historical key evaluation indicators by assigning corresponding weights to the performance indicators and fairness indicators in the key evaluation indicators, performing weighted summation on the performance indicators, fairness indicators, weights corresponding to the performance indicators, and weights corresponding to the fairness indicators to obtain a first weighted value, performing weighted summation on the historical performance indicators and historical fairness indicators in the historical key evaluation indicators to obtain a second weighted value, and determining the model parameters corresponding to the maximum value between the first weighted value and the second weighted value as the target model parameters of the machine learning model.
[0209] For example, assume there are three historical models:
[0210] Model A: (accuracy = 92%, fairness difference = 5%)
[0211] Model B: (accuracy = 90%, fairness difference = 3%)
[0212] New model C: (accuracy = 91%, fairness difference = 2%)
[0213] The weights corresponding to the performance indicators and the weights corresponding to the fairness indicators are 0.3 and 0.7 respectively, then the weighted value of model A is: 92% x 0.3 + 5% x 0.7 = 0.311.
[0214] The weighted value of model B: 90% x 0.3 + 3% x 0.7 = 0.291;
[0215] The weighted value of new model C: 91% x 0.3 + 2% x 0.7 = 0.287;
[0216] Therefore, the weighted value of model A is the largest, and the historical model parameter corresponding to model A can be determined as the target model parameter.
[0217] In the embodiment, the performance and fairness are optimized by comparing the performance indicators and fairness indicators of the current model parameter and the historical model parameter. By comprehensively considering the performance indicators such as accuracy and recall rate and the fairness indicators such as group difference and equal opportunity, the problem of aggravating model discrimination caused by single pursuit of performance improvement is avoided, and it is ensured that the finally selected parameter can significantly improve the fairness of the multi-attribute sensitive group while maintaining the model prediction performance. In addition, the robustness and adaptability of the model in a complex multi-attribute environment are enhanced.
[0218] In some embodiments, the step S103 described above can further include the following steps:
[0219] The training result of the optimized machine learning model is evaluated to obtain at least one of a macro fairness analysis view and a micro model explainable view.
[0220] In response to determining that the training result of the optimized machine learning model does not meet the preset requirement based on at least one of the macro fairness analysis view and the micro model explainable view, the target training set is taken as a new initial training set, and the step of obtaining the sensitive attribute of the training sample in the initial training set of the machine learning model is executed until the training result of the optimized machine learning model meets the preset requirement based on at least one of the macro fairness analysis view and the micro model explainable view.
[0221] The macro fairness analysis view is used for statistical evaluation of the overall fairness indicator and exploration of the macro distribution of the initial training set, and the micro model explainable view is used for displaying the prediction and reasoning process of the machine learning model for the preset specific training sample.
[0222] The macroscopic fairness analysis view can be understood as a visual analysis interface for evaluating the fairness performance of the model between different groups from a whole level, usually through statistical charts, dimension reduction charts, etc. to display the group distribution and fairness indicators of the model or data. The statistical evaluation of the overall fairness indicators can be understood as using statistical methods to calculate, compare and display the fairness indicators to determine whether the model has systematic bias. The macroscopic distribution of the initial training set can refer to the distribution of data or model prediction results at the group level, such as the number of samples of different genders, ages, and prediction result proportions, etc.
[0223] The preset requirements can be according to the needs.
[0224] After the training result of the optimized machine learning model is evaluated to obtain at least one of the macroscopic fairness analysis view and the microscopic model explainable view, the target training set can be used as a new initial training set, and the macroscopic fairness analysis view and the microscopic model explainable view can be used as a guide to retrain the machine learning model based on the initial training set.
[0225] In this embodiment, by fusing the macroscopic fairness analysis view (such as group performance difference statistics) and the microscopic model explainable view (such as individual decision attribution analysis), a multi-level and verifiable model evaluation system is constructed. It can systematically diagnose the root cause of multi-dimensional bias - the macroscopic view reveals the systematic performance bias between different sensitive attribute combinations, and the microscopic view can locate the feature contribution that leads to specific discriminatory decisions, thereby guiding targeted retraining; this closed-loop mechanism of “evaluation-diagnosis-optimization” not only ensures that the model ultimately meets the preset fairness and performance requirements, but also significantly improves the targeting and efficiency of model optimization in complex multi-attribute scenarios, avoiding blind iteration.
[0226] To better understand the above method, the present embodiment provides a more detailed description as follows:
[0227] With the rapid development of artificial intelligence and machine learning technology, automated models are increasingly popular in social sensitive fields such as financial risk control, medical diagnosis, judicial adjudication, and recruitment screening. However, data in the real world often has characteristics such as high dimensionality, multiple attributes, and complex structure, and often contains multiple sensitive attributes (such as gender, age, etc.). During data collection and model training, affected by historical bias, uneven sample distribution, attribute correlation, etc., it is easy to cause the model to produce systematic unfairness between different groups, and even may exacerbate existing social bias and discrimination.
[0228] Machine learning fairness research mainly focuses on the following aspects: first, reducing the data distribution bias caused by sensitive attributes through data preprocessing methods such as resampling and reweighting; second, directly optimizing fairness indicators such as accuracy difference, opportunity equality, and group error difference by introducing regularization terms or using adversarial training methods during model training; third, adjusting model output results through post-processing methods such as adjusting decision thresholds to improve the prediction performance of disadvantaged groups. Although the above methods have achieved certain results in single sensitive attribute or low-dimensional data scenarios, there are still the following outstanding problems in multi-attribute high-dimensional data environments:
[0229] First, most current machine learning fairness optimization methods only analyze and correct bias for a single sensitive attribute such as gender or age, and are difficult to effectively deal with the complex interaction between multiple sensitive attributes in real high-dimensional, multi-attribute data environments. In actual application scenarios, there are significant statistical correlations or potential causal relationships between sensitive attributes. Correcting bias for a single attribute may lead to the deterioration of fairness for other attributes or ignore the generation and spread of collaborative bias. For example, in face recognition or credit approval scenarios, gender, age, and geographic location may jointly affect model decision results. Traditional single-attribute bias correction strategies cannot reveal and eliminate group unfairness caused by multi-attribute collaboration, limiting the fairness protection capabilities of models in complex real-world data.
[0230] Second, current fairness analysis and optimization tools lack multi-level, dynamic, and interactive visualization analysis capabilities, and cannot meet users' needs for in-depth understanding of model fairness and decision-making mechanisms throughout the entire process. Many tools can only provide static or single-level fairness indicator displays, and lack of linkage analysis and visualization support for data attribute association, bias correction optimization process, model performance changes, and decision explainability. Users have difficulty intuitively understanding key processes such as bias adjustment, attribute distribution, and group fairness evolution, and cannot flexibly participate in model optimization and risk control. The lack of analysis and interaction capabilities seriously restricts the practical promotion and application of artificial intelligence systems in high-risk and high-compliance fields.
[0231] In summary, there are obvious deficiencies in multi-attribute, multi-level model fairness analysis and explainability analysis, and it is urgent to develop a machine learning visualization platform that supports multi-attribute collaborative analysis, dynamic bias correction optimization, multi-level fairness evaluation, and decision explainability analysis to improve the fairness, explainability, and social adaptability of artificial intelligence systems in complex real-world scenarios.
[0232] Reference Figure 2 , Figure 2The system overall architecture flowchart provided by the embodiment of the application shows the overall architecture of the visualization platform involved in the application, which aims to solve the multi-attribute fairness and explainability problems. The platform is composed of five main modules, namely, a dataset selection module, an attribute association analysis module, a dynamic debiasing optimization module, a multi-level fairness evaluation module, and an explainable decision analysis module.
[0233] System overall architecture:
[0234] The interactive visual analysis framework of the application for group fairness problems adopts a hierarchical decoupling and end-to-end system architecture design. Overall, the system is composed of four main parts, namely, a data processing layer, a model training and generation layer, a visual analysis layer, and a user interaction layer. The system design emphasizes high scalability, modularity, and efficient data flow, supports multi-user collaboration and cross-platform deployment, and adapts to the needs of machine learning fairness research of different scales and scenarios.
[0235] The dataset selection module is used to load, switch, and manage high-dimensional multi-attribute datasets, and supports displaying the name, size, attribute number, category distribution, annotation situation, sensitive attribute statistics, and model structure and training parameters of the dataset. Referring to Figure 3 , Figure 3 The display interface corresponding to the dataset selection module provided by the embodiment of the application can display the name of the dataset (such as CelebA), the label (such as face), the number of samples (such as 200,000), and the number of attributes (such as 40), etc. The name of the model (such as ResNet50), the description information (such as ResNet50 is a 50-layer deep residual network, which effectively alleviates the gradient vanishing problem through residual connection, improves the model training stability and recognition performance, and is widely used in computer vision research), etc. and the model parameters (such as learning rate 0.01, training round number 100, optimizer Adam, and activation function ReLU, etc.) can also be displayed.
[0236] Attribute association exploration module:
[0237] Multi-attribute statistical index system;
[0238] To reveal the complex correlation between attributes in high-dimensional data, the system implements multiple statistical indicators, including Phi coefficient, odds ratio, difference of equal opportunity, bias amplification, etc. Among them, the Phi coefficient can measure the correlation between two binary attributes; the odds ratio measures the strength of positive and negative correlation between two binary attributes, and its core is to calculate the correlation degree through the frequency in the contingency table (four-fold table); the category proportion is used to quantify the proportion of the number of samples of a certain category in the total number of samples, reflecting the data distribution balance; the difference of equal opportunity reflects the difference in correct prediction opportunities obtained by different sensitive groups, and is used to measure the opportunity fairness of different sensitive groups; the bias amplification detects whether the inherent bias is amplified. Referring to Figure 4 , Figure 4 The display interface corresponding to the attribute correlation exploration module provided by the embodiment of the application can display the accuracy, average precision, phi, OR, DEO, BA and corresponding data volume of different attributes, Figure 4 The attribute names of different attributes are taken as examples in the correlation between different attributes and gender, such as glasses wearing, eyebrow shape, facial attractiveness, eye bags, hair loss, bangs, lip thickness, nose width, black hair and blond hair. The specific values of the accuracy, average precision, phi, OR, DEO, BA and data volume corresponding to different attributes can be shown as in Figure 4 .
[0239] Among them, the formulas of Phi coefficient and odds ratio are respectively:
[0240]
[0241] Among them, A represents the number of samples of attribute 1 = True and attribute 2 = True, B represents the number of samples of attribute 1 = True and attribute 2 = False, C represents the number of samples of attribute 1 = False and attribute 2 = True, and D represents the number of samples of attribute 1 = False and attribute 2 = False. The greater the absolute value of phi, the stronger the correlation between the two attributes; when it is 0, it means no correlation. If OR > 1, the two attributes are positively correlated; if OR < 1, the two attributes are negatively correlated; and if OR = 1, the two attributes are not correlated.
[0242] The formula of the category proportion is:
[0243]
[0244] Among them, p cat represents the proportion of a specific category, N cat is the number of samples of a certain category, and N total is the total number of samples.
[0245] The formulas for calculating the difference in equal opportunity (DEO) and the false negative rate (FNR) are as follows:
[0246] DEO=|FNR s=0 -FNR s=1 |;
[0247]
[0248] Here, DEO represents difference in equal opportunity, with a value ranging from 0 to 1. A smaller value indicates a more equal opportunity among different sensitive groups. S=0 and S=1 represent two sensitive groups (e.g., S=0 for women and S=1 for men). FNR S=s The false negative rate reflects the percentage of sensitive group s, that is, the proportion of "actually positive examples but predicted as negative examples by the model" in that group. TP S=s This reflects the true number of cases in the sensitive group s (those that are actually positive and correctly predicted as positive by the model). FN s=s This reflects the number of false negatives in the sensitive group s (those that are actually positive but are incorrectly predicted as negative by the model).
[0249] The formula for calculating deviation amplification is:
[0250]
[0251] Here, BA represents the bias amplification value, ranging from 0 to 1. The smaller the value, the lower the degree of bias amplification by the model. S refers to the value of the sensitive attribute (e.g., s=0 for "low-income group", s=1 for "high-income group"). P reflects the conditional probability predicted by the model, that is, the predicted probability of the target attribute t (such as "being hired") given the sensitive attribute s. t|s It reflects the true conditional probability, that is, the actual probability of the target attribute t occurring given a sensitive attribute s in the data. s The maximum value of the deviation is taken from all sensitive groups, reflecting the most severe amplification of the deviation.
[0252] Visualization and Human-Computer Interaction:
[0253] The table view in this module, combined with visualization techniques such as pie charts and confusion matrices, allows users to intuitively analyze complex relationships between attributes and filter potential proxy variables, laying the foundation for subsequent debiasing and optimization. Furthermore, the system displays the attribute correlation matrix in a heatmap format, with color intensity intuitively reflecting the strength of the correlation. Users can efficiently locate high-risk attribute pairs in the table through clicking, sorting, and filtering. The confusion matrix is used to display the joint distribution of sensitive and target attributes, helping users identify data imbalances or proxy variable issues. The pie chart displays the proportion of each attribute category, assisting users in judging the rationality of sample size configuration.
[0254] Intelligent recommendation and multi-attribute linkage:
[0255] The system automatically recommends other attributes that are highly correlated with sensitive attributes based on a correlation threshold, and supports multi-attribute combination analysis. Users can explore multiple sensitive attributes by checking, and the system automatically calculates the correlation and distribution of the combined attributes to provide more scientific decision-making basis for subsequent debiasing optimization. After determining the analysis target, users can switch to the dynamic model debiasing module with one key, and the system automatically transfers the current highly correlated attributes and distribution information to ensure smooth connection of the analysis process.
[0256] Dynamic model debiasing module:
[0257] Interactive data distribution adjustment:
[0258] The core of the dynamic debiasing module is real-time interactive adjustment of data distribution. The system uses a double confusion matrix to display the distribution of real data and generated data under the combination of sensitive attributes and target attributes. Users can flexibly adjust the proportion of generated data through sliders, numerical input, etc., and the system automatically calculates the sample size changes of each combination after adjustment and provides real-time feedback in color and numerical dual coding.
[0259] Generated adversarial network (GAN) latent space adjustment algorithm:
[0260] GAN latent space adjustment is one of the key technologies of this module, aiming to generate data samples with changed sensitive attributes and unchanged target attributes through GAN generator latent space adjustment, thereby improving the fairness performance of the model.
[0261] The core algorithm is that the original latent space of the GAN generator is z, W g W t are the weight vectors of the sensitive attribute and target attribute classifiers, respectively, and the latent space adjustment formula is as follows:
[0262]
[0263] where z is the original latent vector, W g , W t are the weight vectors of the sensitive attribute and target attribute classifiers, b g , b t are the bias terms, and λ is the adjustment coefficient. This algorithm can effectively generate samples with unchanged target attributes and controllable changes in sensitive attributes, thereby improving the group fairness of the dataset and observing the impact of generated samples on data distribution in real time. The platform supports user-defined λ values or system recommendations, provides functions such as random seed setting, generated sample batch size, generated sample saving and preview, etc.
[0264] Multi-dimensional index dynamic feedback:
[0265] After each data ratio adjustment, the system calculates and displays multiple key indicators in real time. All indicators are fed back in multiple forms such as radar charts, column charts, line charts, etc. to help users judge the impact of the debiasing optimization strategy on the overall distribution and fairness. In addition, the system supports multiple rounds of experimental parameter saving and backtracking, and users can compare the fairness and accuracy changes under different parameter combinations. The module provides automatic evaluation of debiasing effect, optimal result recommendation, and human-computer cooperation optimization process, significantly reducing the difficulty and trial and error cost of experiments.
[0266] To deal with extreme imbalance of samples, generation of distorted data and other abnormal situations, the system has built-in data distribution anomaly detection mechanism to automatically prompt users of potential risks. It supports multiple debiasing algorithms (such as resampling, SMOTE, adversarial perturbation, etc.) for extension to adapt to different data scenarios.
[0267] Reference Figure 5 , Figure 5 The display interface corresponding to the dynamic model debiasing module provided by the embodiments of the present application can include a data regulator and a performance detector. The data regulator can be used to adjust the generated matrix and the real matrix. The generated matrix is used to represent the distribution of the number of samples corresponding to the attribute true, attribute false, sensitive attribute true, and sensitive attribute false in the generated samples. The real matrix is used to represent the distribution of the number of samples corresponding to the attribute true, attribute false, sensitive attribute true, and sensitive attribute false in the real samples. The performance detector can be used to display the performance indicators or fairness indicators of the estimated model corresponding to the selected different real matrix or generated matrix in the form of a column chart. For example, the selected attribute proportion, sensitive attribute proportion, generated data proportion, phi, and OR, etc. The display interface corresponding to the dynamic model debiasing module can also display OR, selected attribute proportion, correlation coefficient, generated data proportion, and sensitive attribute proportion, etc. in the case of training the model only with the original data (original sample data) or the optimized data (sample data combined from the original sample data and newly generated sample data) in the form of a radar chart. The specific values can be as shown in the table in the Figure 5 .
[0268] Multi-level fairness evaluation and explanation module:
[0269] Macroscopic visual analysis:
[0270] The macro fairness analysis view includes dimension reduction projection analysis and model result statistics. A global analysis view is constructed through the design of the linkage between the data dimension reduction projection analysis and the model result statistics analysis. The dimension reduction data distribution panel integrates three mainstream dimension reduction algorithms, namely, t-SNE, PCA, and UMAP. A user can dynamically switch different projection methods through a pull-down option box to obtain data distribution insights from different perspectives. Data points are visually encoded by color and shape: color is used to map the real class label of data, and shape is used to distinguish sensitive attributes. When a user clicks any data point, the system will pop up a detailed information card to clearly show the file name and high-definition image thumbnail corresponding to the data point. In addition, the view provides semantic zooming and dragging functions to facilitate users to efficiently and finely interact and explore in large-scale data.
[0271] The model result statistics panel shows the overall performance of the model after debiasing optimization in terms of performance indicators (Accuracy) and fairness indicators (DEO, BA), and intuitively compares the corresponding indicators of the original unoptimized model to help users quickly judge the overall effect of debiasing optimization.
[0272] The accuracy Accuracy is as follows:
[0273]
[0274] Reference Figure 6 , Figure 6 The multi-level fairness evaluation provided by the embodiments of the present application corresponds to a display interface. The display interface corresponding to the multi-level fairness evaluation can display the performance indicators and fairness indicators corresponding to the retrained model, and can also display the differences between the performance indicators corresponding to the retrained model and the performance indicators corresponding to the model before retraining, the differences between the fairness indicators corresponding to the retrained model and the fairness indicators corresponding to the model before retraining, and can also display the differences between the performance indicators corresponding to the retrained model and the preset target performance indicators, the differences between the fairness indicators corresponding to the retrained model and the preset target fairness indicators, Figure 6 Taking the accuracy rate of 98.5% as an example, compared with the last increase of 2.4%, the opportunity equality difference takes 0.88 as an example, the distance from the fairness target (the preset target fairness) is -0.12, and the population balance takes 0.91 as an example, the distance from the fairness target is +0.05.
[0275] Microscopic explainability analysis:
[0276] The microscopic model can explain the view to support users to filter according to conditions, gallery display and the image area that the model focuses on when predicting a specific category. Through the closed-loop analysis process of "filtering-exploring-explaining", the user filters a specific attribute combination, views the sample data meeting the conditions in real time, and combines the high-fidelity thumbnail with the heat ring display model prediction result. This view adopts a three-column layout: the left column is a multi-condition filter, which supports filtering samples according to attribute, category, prediction result, etc. in combination; the middle column is a high-fidelity thumbnail gallery, which displays the prediction probability and category in suspension; and the right column is a sample explanation area.
[0277] The condition filtering column on the left is constructed based on the multi-dimensional attribute characteristics of the data set, including data source, image attribute, predicted category and other conditions. Users can perform combined condition filtering operations according to actual needs, and the system updates the data set subset meeting the conditions in real time. When the user sets the filtering conditions, the gallery view in the middle will be updated to display the image data meeting the conditions.
[0278] The gallery view adopts a grid layout to centrally display the images filtered. Each image is presented in the form of a high-fidelity thumbnail, and the prediction result heat ring is displayed in suspension in the upper left corner of the image card to intuitively express the prediction tendency of the model for the current image. When the user hovers the mouse over a certain image, the system automatically enlarges the image to improve the recognition, and the user can browse more images by scrolling. In addition, considering that the amount of image data is large, loading all at once may affect system performance. Therefore, this view uses dynamic loading technology to load image data gradually to ensure a smooth interactive experience.
[0279] The model explanation view on the right provides fine-grained explainability analysis. First, the view displays the name of the selected image and the prediction result given by the model; then, it clearly presents the high-definition original image of the image and the corresponding model explanation result, intuitively showing the image area that the model focuses on when making predictions, helping users accurately judge whether the model has reasonably focused on the feature information; finally, the view at the bottom displays a series of other images that are highly similar to the selected image in the embedding space, facilitating users to further understand and verify the reasoning process and decision basis of the model through intuitive comparison and analysis.
[0280] The platform supports similar sample comparison, and the system automatically retrieves a number of pictures that are most similar to the current sample in the embedding space and displays the explanation results side by side to facilitate the discovery of model reasoning consistency and potential bias.
[0281] This view integrates the GradCAM algorithm, which is used to locate the model focus area, and the formula is:
[0282]
[0283] wherein, Grad-CAM output heatmap for class c, shape consistent with input image, darker or brighter regions indicate greater contribution of that region to the model's prediction that the input belongs to class c. Importance weight of the k-th convolutional feature map for class c, calculated by global average pooling of the gradient of the model's output probability for class c with respect to this feature map. Larger values indicate that the feature map better represents the features of class c. k The k-th feature map of the last layer of the convolutional neural network, each feature map is an abstract visual feature such as edge, texture, object part extracted from the input image after multiple layers of convolution. k The sum of all feature maps A k Weighted sum by weight Weighted sum by weight
[0284] This view also has the integral gradient (IG) algorithm, which can measure the attribution of input features to the output. The formula is:
[0285]
[0286] IG i (x) represents the contribution of the i-th feature (such as the i-th pixel, the i-th word) in the input x to the model's output. Positive values indicate that the feature pushes the model towards the final prediction, and negative values indicate that it suppresses. x represents the original input sample, such as an image or a text sentence. ′ Baseline input, which represents a reference point with no features, such as a completely black image, a vector composed of zeros, or an empty sentence, used to measure the change from nothing to something. i -x′ i represents the difference between the i-th feature in the original input and the baseline input. For example, if x i is the brightness value of a pixel in the image, and x′ i is the brightness of the corresponding pixel in the baseline image (usually 0), then the difference represents the actual brightness of this pixel. The integral function accumulates the gradient along the entire path to obtain the average influence of the feature from nothing to something. The platform supports attribute attribution heatmap display to help users understand the model's discrimination logic.
[0287] Multi-view linkage and analysis path management:
[0288] Macro-distribution view and micro-explanation view are linked in real time, supporting users to drill down from global distribution to single-sample detailed explanation. The system automatically records user analysis path and all operations, supports analysis history backtracking, report automatic generation, team collaboration annotation, etc., and improves team research efficiency.
[0289] In some embodiments, the embodiments of the application can provide a global interface, which can be obtained by combining the display interface corresponding to the data set selection module, the display interface corresponding to the attribute association exploration module, the display interface corresponding to the dynamic model debiasing module, the display interface corresponding to the multi-level fairness evaluation, and the display interface corresponding to the explainability analysis, that is, the global interface displays information corresponding to the data set selection module, the attribute association exploration module, the dynamic model debiasing module, the multi-level fairness evaluation, and the explainability analysis.
[0290] System front and back end implementation details:
[0291] Front-end interface and visualization optimization:
[0292] The front end of the system adopts componentized development, supports data virtual scrolling, sharding rendering, SVG+Canvas hybrid rendering, and other optimization strategies to ensure smooth interaction in large data scenarios. The interface style is unified, the control layout is reasonable, and adaptive multi-screen display is supported. The front end also integrates common functions such as experiment management, user permissions, data export (CSV, Excel, PDF, etc.), etc.
[0293] Backend algorithms and concurrent processing:
[0294] The backend uses Flask+PyTorch as the main interface, with hierarchical management and separate scheduling of CPU and GPU. It supports multi-task concurrency, batch data processing, task queue and resource reuse. All model training and evaluation tasks can be executed asynchronously, supporting priority queues and progress callbacks.
[0295] The system automatically caches intermediate results, reduces repeated calculations, supports incremental training and online fine-tuning, and improves model response speed.
[0296] Data interface and communication security:
[0297] All front and back-end data interactions use RESTful API, and the interface supports identity verification, permission checking, data encryption, and exception alarm. The system supports operation logs, data traceability, error rollback, and other security mechanisms to meet the compliance requirements of scientific research and sensitive industries.
[0298] In summary, the specific embodiments of the present application cover the whole process from data preprocessing, attribute analysis, model training and debiasing, dynamic interactive visualization, multi-level evaluation, explainability analysis to engineering implementation, user interaction and performance optimization. It fully integrates technologies in multiple fields such as statistics, machine learning, deep generative model, visual analysis and human-computer interaction, and can effectively support the discovery, optimization and verification of group fairness problems in practical scenarios, with high innovation, practicality and promotion value.
[0299] The present application proposes an interactive visual analysis framework integrating attribute association exploration, dynamic debiasing optimization, multi-level fairness evaluation and explainability analysis for group fairness problems in high-dimensional multi-attribute data scenarios. Through in-depth case verification in typical applications such as computer vision (e.g. face recognition) and financial credit approval, the platform can help users discover and locate potential biases in training data and models, dynamically optimize data distribution and model parameters, achieve efficient trade-off between fairness and accuracy, and conduct comprehensive and explainable evaluation of optimization effects from macro and micro perspectives.
[0300] The modular design, extensible architecture and high-performance computing support of the platform make it not only suitable for mainstream structured data such as images and tables, but also applicable to complex task scenarios such as text, speech and multi-modal data. The system supports convenient integration of new debiasing methods, explainability tools and model structures, meeting the diverse needs of scientific research and industry. In the future, the platform will further expand intelligent attribute analysis, automated debiasing suggestions and cross-modal fairness analysis functions, and help the compliance and responsible AI construction in high-risk fields such as medical care, finance and justice.
[0301] In summary, the present application not only realizes innovative breakthroughs in fairness visual analysis methods, but also shows good scalability and practical value in engineering implementation and application. It provides strong technical support for fair and transparent decision-making of AI systems and socially credible applications, and has important significance for promoting the development of machine learning fairness analysis and optimization.
[0302] To better realize the above method, the embodiment of the present application provides a fairness optimization device of a machine learning model, which refers to Figure 7 , Figure 7 The structure diagram of the fairness optimization device of the machine learning model provided by the embodiment of the present application is shown in Figure 7 , and the fairness optimization device 700 of the machine learning model specifically includes:
[0303] The attribute obtaining module 701 is configured to obtain sensitive attributes of training samples in an initial training set of a machine learning model; the sensitive attribute is an attribute of the training sample that causes the machine learning model to generate a discriminatory decision; a category of the sensitive attribute of each training sample is configured as one of multiple selectable categories corresponding to the sensitive attribute; and a target attribute of each training sample is configured as one of multiple selectable categories corresponding to the target attribute, the target attribute corresponding to a prediction target of the machine learning model.
[0304] The debiasing module 702 is configured to perform debiasing adjustment on the training samples in the initial training set according to the sensitive attributes, to obtain a target training set; wherein the multiple selectable categories corresponding to the sensitive attribute are evenly distributed in each attribute training sample combination, the categories of the target attributes of the training samples in the same attribute training sample combination are the same, and the categories of the target attributes of the training samples in different attribute training sample combinations are different.
[0305] The model optimization module 703 is configured to retrain the machine learning model according to the target training set, to obtain a machine learning model with optimized fairness.
[0306] In some embodiments, the attribute obtaining module 701 is specifically configured to perform statistical correlation analysis on each attribute of the training samples in the initial training set, to obtain an attribute association analysis result; wherein the attribute association analysis result includes at least one of an attribute correlation index and a fairness index.
[0307] According to the attribute association analysis result, the sensitive attribute of the training samples in the initial training set of the machine learning model is determined.
[0308] In some embodiments, the attribute obtaining module 701 is specifically configured to display the attribute association analysis result; and receive a sensitive attribute selected by a user from the displayed attribute association analysis result, to obtain the sensitive attribute of the training samples in the initial training set of the machine learning model.
[0309] In some embodiments, the attribute correlation index includes at least one of a Phi coefficient and an odds ratio; the fairness index includes at least one of an attribute category proportion, an equal opportunity difference, and a bias amplification value; the Phi coefficient is used to measure the correlation between two attributes; the odds ratio is used to represent the positive and negative correlation between two attributes; the attribute category proportion represents the proportion of each category under the attribute appearing in the initial training set; the equal opportunity difference is used to measure the difference in false negative rate of the model on the attribute group; and the bias amplification value is used to measure the bias expansion of the prediction result of the model in the attribute group.
[0310] In some embodiments, the debiasing module 702 is specifically configured to: for each first training sample in a first set of training samples of an initial training set, input the first training sample into a preset generative adversarial network, process the first training sample through a latent space adjustment algorithm of the generative adversarial network to generate a target training sample; wherein a category of a sensitive attribute of the first training sample is a first category, the first category is a category with a largest proportion in an attribute training sample combination among multiple selectable categories corresponding to the sensitive attribute, a number of first training samples included in the first set of training samples is determined by a difference between a number of the first training samples and a number of second training samples in the attribute training sample combination, a category of a target attribute of the second training sample is a second category other than the first category among the multiple selectable categories corresponding to the target attribute, the category of the sensitive attribute of the target training sample changes from the first category to the second category, and the category of the target attribute remains unchanged; and obtain a target training set according to the target training samples corresponding to the first set of training samples and the training samples in the initial training set.
[0311] In some embodiments, the debiasing module 702 is specifically configured to: obtain an original latent vector corresponding to the first training sample in the latent space of the generative adversarial network; determine a sensitive attribute adjustment direction based on a preset sensitive attribute classifier, the sensitive attribute adjustment direction being used to indicate a latent space movement direction in which the category of the sensitive attribute of the first training sample changes from the first category to the second category; determine a target attribute retention direction based on a preset target attribute classifier, the target attribute retention direction being used to indicate a latent space movement direction in which the category of the target attribute of the first training sample remains unchanged; obtain a latent space adjustment direction according to a preset adjustment coefficient, the sensitive attribute adjustment direction, and the target attribute retention direction; determine a target latent vector according to the original latent vector and the latent space adjustment direction; and input the target latent vector into a generator of the generative adversarial network to generate the target training sample.
[0312] In some embodiments, the model optimization module 703 is specifically configured to: obtain a key evaluation index of the optimized machine learning model, the key evaluation index including at least one of a performance index and a fairness index; determine target model parameters of the machine learning model from current model parameters corresponding to the optimized machine learning model and historical model parameters corresponding to historical key evaluation indexes according to a comparison result of the key evaluation index and the historical key evaluation indexes; wherein the model parameters are parameters affecting the accuracy of the machine learning model; and update the model parameters of the machine learning model from the current model parameters to the target model parameters.
[0313] In some embodiments, the model optimization module 703 is specifically configured to: evaluate the training result of the optimized machine learning model to obtain at least one of a macro fairness analysis view and a micro model explainable view; wherein the macro fairness analysis view is used to statistically evaluate the overall fairness index and explore the macro distribution of the initial training set; the micro model explainable view is used to show the prediction reasoning process of the machine learning model for the preset specific training sample; in response to determining that the training result of the optimized machine learning model does not meet the preset requirement based on at least one of the macro fairness analysis view and the micro model explainable view, taking the target training set as a new initial training set, returning to execute the step of obtaining the sensitive attribute of the training sample in the initial training set of the machine learning model until it is determined that the training result of the optimized machine learning model meets the preset requirement based on at least one of the macro fairness analysis view and the micro model explainable view.
[0314] The fairness optimization apparatus 700 of the machine learning model provided by the embodiments of the present application can perform the technical solutions shown in the method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.
[0315] Figure 8 A hardware structure schematic diagram of an electronic device provided by an embodiment of the present application is shown.
[0316] The electronic device can include a processor 801 and a memory 802 storing computer program instructions.
[0317] Specifically, the processor 801 can include a central processing unit (CPU), or a specific integrated circuit (Application Specific Integrated Circuit, ASIC), or can be configured to implement one or more integrated circuits of the embodiments of the present application.
[0318] The memory 802 can include a mass storage for data or instructions. By way of example and not limitation, the memory 802 can include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory 802 can include removable or non-removable (or fixed) media. Where appropriate, the memory 802 can be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, the memory 802 is a non-volatile solid-state memory.
[0319] In some embodiments, the memory 802 can include read-only memory (ROM), random access memory (RAM), magnetic disk storage devices, optical storage devices, flash memory devices, electrical, optical, or other physical / tangible memory storage devices. Thus, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software that, when executed (e.g., by one or more processors), is operable to perform the operations described with reference to the methods according to an aspect of the present disclosure.
[0320] The processor 801 implements the fairness optimization method of any one of the machine learning models in the above-described embodiments by reading and executing computer program instructions stored in the memory 802.
[0321] In one example, the electronic device can further include a communication interface 803 and a bus 810. Wherein, as shown, the processor 801, the memory 802, the communication interface 803 are connected through the bus 810 and complete the communication between each other. Figure 8
[0322] The communication interface 803 is mainly used to realize the communication between the modules, devices, units and / or equipment in the embodiments of the present application.
[0323] The bus 810 includes hardware, software or both to couple components of the online data traffic billing device to each other in a known manner. By way of example and not limitation, the bus can include an accelerated graphics port (AGP) or other graphics bus, an enhanced industry standard architecture (EISA) bus, a front-side bus (FSB), a hypertransport (HT) interconnect, an industry standard architecture (ISA) bus, an infiniband interconnect, a low pin count (LPC) bus, a memory bus, a microchannel architecture (MCA) bus, a peripheral component interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a serial advanced technology attachment (SATA) bus, a video electronics standards association local (VLB) bus, or other suitable bus or combination of two or more of these. Where appropriate, the bus 810 can include one or more buses. Although the present application describes and illustrates a particular bus, the present application contemplates any suitable bus or interconnect.
[0324] The electronic device can perform the fairness optimization method of the machine learning model in the embodiments of the present application, so as to realize the fairness optimization method and device of the machine learning model described in combination Figure 1 and Figure 7 described.
[0325] In addition, in combination with the fairness optimization method of the machine learning model in the above embodiments, an embodiment of the present application can provide a computer readable storage medium for implementation. The computer readable storage medium stores computer program instructions; the computer program instructions are executed by a processor to implement any one of the fairness optimization methods of the machine learning model in the above embodiments.
[0326] In combination with the fairness optimization method of the machine learning model in the above embodiments, an embodiment of the present application provides a computer program product, instructions in the computer program product are executed by a processor of an electronic device to enable the electronic device to execute any one of the fairness optimization methods of the machine learning model in the above embodiments.
[0327] It should be noted that the present application is not limited to the specific configurations and processes described above and shown in the drawings. For the sake of brevity, detailed descriptions of well-known methods are omitted herein. In the above embodiments, several specific steps are described and shown as examples. However, the method processes of the present application are not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order of the steps, after understanding the spirit of the present application.
[0328] The functional blocks shown in the structural block diagrams described above can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a functional card, etc. When implemented in software, the elements of the present application are program or code segments used to perform the required tasks. The program or code segments can be stored in a machine readable medium or transmitted through a data signal carried in a carrier wave over a transmission medium or communication link. The "machine readable medium" can include any medium capable of storing or transmitting information. Examples of machine readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segments can be downloaded via a computer network such as the Internet, an intranet, etc.
[0329] It should also be noted that the exemplary embodiments mentioned in the present application describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the above steps, that is, the steps can be executed in the order mentioned in the embodiments, or in an order different from the embodiments, or several steps can be executed simultaneously.
[0330] The computer program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other processing device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other processing device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0331] The above only specifically describes the embodiments of the present application. For the convenience and brevity of description, the specific working processes of the above-described system, module and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be described herein. It should be understood that the protection scope of the present application is not limited in this way. Any person skilled in the art can easily think of various equivalent modifications or replacements within the technical range disclosed in the present application, and these modifications or replacements should be covered within the protection scope of the present application.
Claims
1. A fairness optimization method for a machine learning model, characterized in that, The method is applied to an electronic device comprising a machine learning model, and the method comprises: obtaining sensitive attributes of training samples in an initial training set of the machine learning model; wherein the sensitive attributes are attributes in the training samples that cause the machine learning model to make discriminatory decisions; the category of the sensitive attributes of each training sample is configured as one of a plurality of selectable categories corresponding to the sensitive attributes; the target attribute of each training sample is configured as one of a plurality of selectable categories corresponding to the target attribute, and the target attribute corresponds to a prediction target of the machine learning model; performing debiasing adjustment on the training samples in the initial training set according to the sensitive attributes to obtain a target training set; wherein the plurality of selectable categories corresponding to the sensitive attributes are evenly distributed in each attribute training sample combination, the categories of the target attributes of the training samples in the same attribute training sample combination are the same, and the categories of the target attributes of the training samples in different attribute training sample combinations are different; retraining the machine learning model according to the target training set to obtain a machine learning model optimized for fairness.
2. The method of claim 1, wherein, The obtaining of the sensitive attributes of the training samples in the initial training set of the machine learning model comprises: performing statistical correlation analysis on each attribute of the training samples in the initial training set to obtain an attribute association analysis result; wherein the attribute association analysis result comprises at least one of an attribute correlation index and a fairness index; determining the sensitive attributes of the training samples in the initial training set of the machine learning model according to the attribute association analysis result.
3. The method of claim 2, wherein, The determining of the sensitive attributes of the training samples in the initial training set of the machine learning model according to the attribute association analysis result comprises: displaying the attribute association analysis result; receiving a sensitive attribute selected by a user from the displayed attribute association analysis result to obtain the sensitive attributes of the training samples in the initial training set of the machine learning model.
4. The method of claim 2, wherein, The attribute correlation index comprises at least one of a Phi coefficient and an odds ratio; and the fairness index comprises at least one of an attribute category proportion, an equal opportunity difference, and a bias amplification value; The Phi coefficient is used to measure the correlation between two attributes; The odds ratio is used to represent the positive and negative correlation between two attributes; The attribute category proportion represents the proportion of each category of the attribute appearing in the initial training set; The equal opportunity difference is used to measure the difference in false negative rate of the model on the attribute group; The bias amplification value is used to measure the bias expansion of the prediction result of the model in the attribute group.
5. The method of claim 1, wherein, The debiasing adjustment of the training samples in the initial training set according to the sensitive attributes to obtain a target training set comprises: For each first training sample in a first training sample set of the initial training set, the first training sample is input into a preset generative adversarial network, the first training sample is processed by a latent space adjustment algorithm of the generative adversarial network to generate a target training sample; wherein the category of the sensitive attribute of the first training sample is a first category, the first category is the category with the largest proportion in the attribute training sample combination among multiple selectable categories corresponding to the sensitive attribute, the number of first training samples included in the first training sample set is determined by the difference between the number of first training samples and the number of second training samples in the attribute training sample combination, the category of the target attribute of the second training sample is a second category except the first category among multiple selectable categories corresponding to the target attribute, the category of the sensitive attribute of the target training sample changes from the first category to the second category, and the category of the target attribute remains unchanged; According to the target training sample corresponding to the first training sample set and the training sample in the initial training set, a target training set is obtained.
6. The method of claim 5, wherein, The first training sample is processed by the latent space adjustment algorithm of the generative adversarial network to generate a target training sample, including: Obtain the original latent vector corresponding to the first training sample in the latent space of the generative adversarial network; Determine the sensitive attribute adjustment direction based on the preset sensitive attribute classifier, the sensitive attribute adjustment direction is used to indicate the latent space moving direction of the category change of the sensitive attribute of the first training sample from the first category to the second category; Determine the target attribute retention direction based on the preset target attribute classifier, the target attribute retention direction is used to indicate the latent space moving direction of keeping the category of the target attribute of the first training sample unchanged; According to the preset adjustment coefficient, the sensitive attribute adjustment direction and the target attribute retention direction, the latent space adjustment direction is obtained; According to the original latent vector and the latent space adjustment direction, the target latent vector is determined; The target latent vector is input into the generator of the generative adversarial network to generate the target training sample.
7. The method of claim 1, wherein, After the machine learning model is retrained according to the target training set to obtain the fairness optimized machine learning model, the method further comprises: Obtain the key evaluation index of the optimized machine learning model, the key evaluation index includes at least one of the performance index and the fairness index; According to the comparison result of the key evaluation index and the historical key evaluation index of the machine learning model, the target model parameter of the machine learning model is determined from the current model parameter corresponding to the optimized machine learning model and the historical model parameter corresponding to the historical key evaluation index; wherein the model parameter is a parameter affecting the accuracy of the machine learning model; The model parameter of the machine learning model is updated from the current model parameter to the target model parameter.
8. The method of claim 1, wherein, After the machine learning model is retrained according to the target training set to obtain the fairness optimized machine learning model, the method further comprises: The training result of the optimized machine learning model is evaluated to obtain at least one of a macro fairness analysis view and a micro model explainable view; wherein the macro fairness analysis view is used for statistical evaluation of an overall fairness index and exploration of a macro distribution of the initial training set; and the micro model explainable view is used to show a prediction reasoning process of the machine learning model for a preset specific training sample; In response to determining that the training result of the optimized machine learning model does not meet the preset requirement based on at least one of the macro fairness analysis view and the micro model explainable view, the target training set is taken as a new initial training set, and the step of obtaining the sensitive attribute of the training sample in the initial training set of the machine learning model is returned to be executed until it is determined that the training result of the optimized machine learning model meets the preset requirement based on at least one of the macro fairness analysis view and the micro model explainable view.
9. An electronic device, comprising: The electronic device comprises a processor and a memory storing computer program instructions; The processor executes the computer program instructions to implement the fairness optimization method of the machine learning model according to any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, The computer program instructions are stored on the computer readable storage medium, and the computer program instructions are executed by the processor to implement the fairness optimization method of the machine learning model according to any one of claims 1-8.