CORRECTING A CLASSIFICATION MODEL

Provided are techniques for correcting a classification model. For each original record of a plurality of original records that are processed by a classification model: the original record is perturbed; for the original record, an original confidence value is obtained for each class of a plurality of classes; for the perturbed record, a perturbed confidence value is obtained for each class of the plurality of classes; a final confidence value is determined using each original confidence value, each perturbed confidence value, and a direction of distance travelled; and a determination is made of whether the original record is biased based on the final confidence value. Then, it is determined whether the classification model is biased based on the original records that are determined to be biased. In response to determining that the classification model is biased, the classification model is corrected, otherwise, the classification model is deployed.

BACKGROUND

Embodiments of the invention relate to correcting a classification model. In particular, embodiments of the invention relate to measuring fairness of the classification model and correcting the classification model to improve fairness.

A classification model may be described as machine learning techniques that emulate logical decision-making based on data. Fairness of a classification model may be described as an indication of whether different groups are treated similarly under similar conditions.

There are several metrics to measure the fairness of classification models. They are classified into the following categories: a parity metric, an equality of opportunity metric, an equality of odds metric, and a bounded error loss metric. The parity metric is more commonly used and may be implemented as a disparate impact ratio metric or a statistical parity difference metric. These metrics are used to look at the model behavior and convert that into either a favorable outcome or an unfavorable outcome. The metrics are then used to determine whether the classification model is biased (“unfair”). However, existing metrics may not be accurate across difference scenarios.

SUMMARY

In accordance with certain embodiments, a computer-implemented method is provided for correcting a classification model by performing operations. For each original record of a plurality of original records of a data set that are processed by a classification model: the original record is perturbed to generate a perturbed record; for the original record, an original confidence value is obtained for each class of a plurality of classes for an outcome; for the perturbed record, a perturbed confidence value is obtained for each class of the plurality of classes for the outcome; a final confidence value is determined using each original confidence value, using each perturbed confidence value, and using a direction of distance travelled; and it is determined whether the original record is biased based on the final confidence value. Then, it is determined whether the classification model is biased based on how many original records are determined to be biased. In response to determining that the classification model is biased, the classification model is corrected. In response to determining that the classification model is not biased, the classification model is deployed.

In accordance with other embodiments, a computer program product is provided for correcting a classification model. The computer program product comprises a computer readable storage medium having program code embodied therewith, the program code executable by at least one processor to perform operations. For each original record of a plurality of original records of a data set that are processed by a classification model: the original record is perturbed to generate a perturbed record; for the original record, an original confidence value is obtained for each class of a plurality of classes for an outcome; for the perturbed record, a perturbed confidence value is obtained for each class of the plurality of classes for the outcome; a final confidence value is determined using each original confidence value, using each perturbed confidence value, and using a direction of distance travelled; and it is determined whether the original record is biased based on the final confidence value. Then, it is determined whether the classification model is biased based on how many original records are determined to be biased. In response to determining that the classification model is biased, the classification model is corrected. In response to determining that the classification model is not biased, the classification model is deployed.

In accordance with yet other embodiments, a computer system is provided for correcting a classification model. The computer system comprises one or more processors, one or more computer-readable memories and one or more computer-readable, tangible storage devices; and program instructions, stored on at least one of the one or more computer-readable, tangible storage devices for execution by at least one of the one or more processors via at least one of the one or more memories, to perform operations. For each original record of a plurality of original records of a data set that are processed by a classification model: the original record is perturbed to generate a perturbed record; for the original record, an original confidence value is obtained for each class of a plurality of classes for an outcome; for the perturbed record, a perturbed confidence value is obtained for each class of the plurality of classes for the outcome; a final confidence value is determined using each original confidence value, using each perturbed confidence value, and using a direction of distance travelled; and it is determined whether the original record is biased based on the final confidence value. Then, it is determined whether the classification model is biased based on how many original records are determined to be biased. In response to determining that the classification model is biased, the classification model is corrected. In response to determining that the classification model is not biased, the classification model is deployed.

Thus, embodiments advantageously provide a new technique for determining the bias of a classification model using confidence values and direction of distance travelled. This provides for a more accurate determination of whether the classification model is biased. In addition, embodiments re-train the classification model to avoid bias.

In accordance with some embodiments, for each original record and each perturbed record, a confidence change between the original record and the perturbed record for a class is determined. In response to determining that bias is increasing, the confidence change is treated as a positive value. In response to determining that the bias is decreasing, the confidence change is treated as a negative value. Embodiments advantageously use the direction of change to determine whether the confidence change is treated as positive or negative.

In accordance with some embodiments, the original record is determined to be biased when the final confidence value is equal to or below a record confidence threshold. Embodiments advantageously use the record confidence threshold, which may be modified.

In accordance with some embodiments, the classification model is determined to be biased when a number of the original records exceeds a model bias threshold. Embodiments advantageously use the model bias threshold, which may be modified.

In accordance with some embodiments, in response to determining whether the original record is biased, the original record is labelled as biased. Embodiments advantageously label biased records to enable them to be identified for re-training the classification model.

In accordance with some embodiments, the classification model is re-trained using each original record labelled as biased. Embodiments advantageously use the biased records to perform re-training of the classification model, and this focuses the re-training.

In accordance with some embodiments, the classification model is one of a binary classification model and a multi-class classification model. Embodiments advantageously apply to binary and multi-class classification models.

DETAILED DESCRIPTION

FIG.1illustrates, in a block diagram, a computing environment in accordance with certain embodiments. InFIG.1, a computing device100is connected to a data store150. The computing device100includes a model corrector110, one or more classification models120, a user interface130, and a scoring Application Programming Interface (API)140. The data store150stores training data sets160, model data170, and outcomes and associated confidence values180. A training data set160may be said to have records with features (e.g., education level, gender, age, etc.).

An outcome may also be referred to as a prediction, a predicted outcome, a model outcome or a model predicted outcome. With embodiments, the possible values of the outcome may be described as classes, outcome values or outcomes (e.g., first outcome, second outcome, etc.). The confidence values are associated with the classes (“outcome values”) of the outcome.

The classification model120may also be referred to as an Artificial Intelligence (AI) model, a machine learning model, a neural network, etc. With embodiments, the classification model120is a binary classification model or a multi-class classification model. With embodiments, since classes refer to possible values of an outcome, a binary classification model may have two classes for the outcome, while a multi-class classification model has more than two classes for the outcome. For example, for a binary classification model, the outcome may be loan approved or loan rejected, where loan approved and loan rejected are the two (binary) classes. As another example, for a multi-class classification model, the outcome may be loan approved, loan partially approved or loan rejected, where loan approved, loan partially approved or loan rejected are the multiple classes. Continuing with these examples, out of these classes, loan approved and loan partially approved may be considered to be a favorable class, while loan rejected may be considered to be an unfavorable class. With various embodiments, the favorable and unfavorable classes change based on the outcome that the classification model is predicting.

The model corrector110determines the fairness score of a classification model120and, based on the fairness score being below a fairness threshold, corrects the classification model120. The fairness score is calculated by comparing a reference group (also referred to as a first group, a majority group or a baseline group) to a compare group (also referred to as a second group, a minority group or a monitored group).

In certain embodiments, the confidence value describes how confidently the classification model120predicts the outcome. For example, for a given loan application, if the classification model120predicted the outcome as loan approved with a confidence value of 90%, then, the classification model120is 90% confident in predicting the outcome as loan approved.

In certain embodiments, the fairness score describes how well the classification model120is making fair (unbiased) decisions between various groups of the features selected for comparison. For example, consider a case in which the classification model120has received100loan applications by 60 first entity types (e.g., college graduates) and 40 second entity types (e.g., high school graduates). For the 60 first entity types, the classification model120predicted a favorable outcome for 55 first entity types, while the classification model120predicted a favorable outcome for 40 second entity types. In certain embodiments, the model corrector110determines the fairness score using disparate impact ratio using the following ratio: ratio of favorable outcomes of compare group/ratio of favorable outcomes for reference group. Continuing with this example, the model corrector110compares fairness for second entity types (the compare group) with reference to first entity types (the reference group). The model corrector110determines the confidence value ratio of 20/40 for the compare (second entity type) group and determines the confidence value ratio of 55/60 for the reference (first entity type) group. Then, the model corrector110generates the fairness score using these confidence value ratios as follows:

That is, the fairness score is 54%.

In certain embodiments, the model corrector110may be provided as a model corrector API that may be invoked to generate a fairness score for a classification model120and correct that classification model120based on the fairness score. In certain embodiments, correcting the classification model120refers to re-training the classification model120so that the fairness score exceeds a fairness threshold (also referred to as a fairness alert threshold). For example, if the fairness score is 54%, and the fairness threshold is 80% (meaning that at least 80% of the second entity types get a favorable outcome as compared to first entity types), then the model corrector110re-trains the classification model120so that the fairness score exceeds the fairness threshold, so that the classification model120behaves in a fair manner.

In certain embodiments, the model corrector110calls the scoring API140to generate a confidence value.

In certain embodiments, the model data170includes features to be used in determining fairness, a reference group and a compare group, a fairness threshold, favorable and unfavorable outcomes, etc.

The model corrector110measures fairness of classification models using confidence values (also referred to as “model confidence values”). The model corrector110, for a binary classification model, perturbs the input data and the sum of the different in the confidence values is used as a measure of the fairness of the classification model. The model corrector110uses a direction of the distance travelled approach for a binary classification model, where, if direction increases bias, the confidence change (absolute difference of confidence values) is treated as positive, and, if the direction decreases bias, the confidence change is treated as negative. The model corrector110uses a direction of the distance travelled approach for a multi-class classification model, where the sum of distance travelled for confidence values for the classes is used as a measure of fairness of the classification model. The model corrector110uses the direction of the change in confidence values to decide whether the confidence change is to be treated as positive or negative.

FIGS.2A,2B,2C,2Dillustrate example user interfaces that receive model data in accordance with certain embodiments. The user interface ofFIGS.2A and2Bis an example of user interface130. InFIG.2A, user interface200receives selection of the features: education level (e.g., first entity type or second entity type) and age. In various embodiments, any combination of features may be selected. For each feature selected, the model corrector110determines a model's propensity for a favorable outcome for one feature over the other feature. With embodiments, the features may be monitored individually, and debiasing may correct issues for the features together. These are the features of a training data set160that the model corrector110is using to train a classification model120.

InFIG.2B, user interface210receives reference group selection of first entity type and compare group selection of second entity type. With embodiments, the values of the training data set160are divided into two groups— the reference group and the compare group. The reference group values are used to calculate disparities of outcomes between the groups. The compare group values are compared with the reference group values to check for potential bias of the classification model120.

InFIG.2C, user interface220receives selection of the fairness threshold of 95%. The model corrector110may correct the classification model120when the fairness score of the classification model120falls below the fairness threshold. The model corrector110may also send (or display) an indication (e.g., to a system administrator) when the fairness score of the classification model120falls below the fairness threshold.

InFIG.2D, user interface230receives selection of a favorable outcome of no risk and an unfavorable outcome of risk. The model corrector110calculates the percentage of records in the training data set160that receive the predicted outcomes specified.

Merely to enhance understanding, examples of classification models that predict whether a person is to get a loan or not will be discussed.

In one example, 30% of second entity types get home loans approved, whereas 65% of first entity types get home loans approved, resulting in a disparate impact ratio of 0.46 which is less than the fairness threshold of 0.8. Continuing with this example, if the ratio of the home loans given to people with age <25 is very different from that for age >=25, then the disparate impact ratio may be higher than the fairness threshold.FIG.3illustrates the disparate impact ratio300in accordance with certain embodiments. InFIG.3, the disparate impact ratio300is the ratio of the favorable outcomes for the compare group (second entity type) to the favorable outcomes for the reference group (first entity type). In this example, 80% of second entity types should get loans with reference to first entity types.

FIG.4illustrates an example scenario400with perturbation410in accordance with certain embodiments. InFIG.4, for each original record, the age is changed (perturbed). In the example scenario400, the disparate impact ratio is zero (“0”), which indicates that the classification model is biased. In perturbation410, the “Prediction” is the outcome and indicates a class of Loan Denied or a class of Loan Approved.

FIG.5illustrates additional example scenarios510,520to show how use of confidence values impact model fairness in accordance with certain embodiments. The model data500provides the groups and outcomes. In the first example scenario510, confidence values are not included for the original record and the perturbed record, the disparate impact ratio is low, and the classification model is considered biased. In the second example scenario520, confidence values of 0.9 and 0.51 are included for the original record and the perturbed record. In this case, the disparate impact ratio is not impacted, and the classification model is considered to be fair.

The confidence values may be described as a probability that the classification model predicted the correct outcome. For example, the confidence value of 0.9 indicates a 90% probability that the predicted outcome is correct, while the confidence value of 0.51 indicates a 51% probability that the predicted outcome is correct.

In the example scenario510, a first entity type applicant applies for a loan, and the classification model outputs that the loan is approved. Next, the record for the first entity type is perturbed by switching the education level from first entity type to second entity type and sending the record back to the classification model. If the classification model predicts that the loan is denied, then the classification model may be flagged as being biased. In the example scenario520, in which the classification model predicted outcome does not change from that of example scenario510, however, the confidence value for the class Loan approved changes from 0.95 (for first entity type) to 0.51 (for second entity type), then, the classification model is susceptible to bias, but is not flagged as being biased because the confidence value did not drop below 0.5 (with 0.5 being the fairness threshold).

FIG.6illustrates example cases600,610,620with ratios of approved/denied in accordance with certain embodimentsCase_1600is an example of hidden bias, case_2610is an example of overt bias, and case_3620is an example of no bias.

In case_1600, for a second entity type, the ratio is approved/denied 0.2/0.8=0.25, while for a first entity type, the ratio is approved/denied 0.4/0.6=0.67. In case_1600, the classification model has a higher confidence value to approve a loan for a first entity type (0.4 confidence value) than a second entity type (0.2 confidence value), however, the confidence value of 0.4 for the first entity type is below 0.5. Therefore, the classification model is biased, but is not reported as biased based on standard metrics, such as the disparate impact ratio metric. In case_2610, for a second entity type, the ratio is 02/0.8, while for a first entity type, the ratio is 0.6/0.4. In case2610, the classification model is more biased than in case_1and is reported as biased based on standard metrics, such as the disparate impact ratio metric. In case_3620, for a second entity type, the ratio is 0.2/0.8, while for a first entity type, the ratio is 0.1/0.9. In case_3620, the classification model is reported as fair based on standard metrics, such as the disparate impact ratio metric.

FIG.7illustrates a change in distance approach in accordance with certain embodiments. The change in distance approach measures a change in distance between confidence values of the approved (favorable) and denied (unfavorable) outcomes using absolute values. In particular, the change in distance approach determines a first absolute distance with the approved confidence value and the denied confidence value for a second entity type, determines a second absolute distance with the approved confidence value and the denied confidence value for a first entity type, and determines the change in distance by subtracting the second distance from the first distance. For example, with reference to case_1700, the change in distance is: 0.6−0.2=0.4, where the first distance is 0.8−0.2=0.6, and the second distance is 0.6−0.4=0.2. With reference to case_2710, the change in distance is: 0.6−0.2=0.4, where second entity type/first distance is 0.8−0.2=0.6, and the first entity type/second distance is the absolute value of 0.6−0.4=0.2. Thus, even though the classification model of case_2710is more biased than the classification model of case_1700, both have the same distance of 0.2.

FIG.8illustrates a distance travelled approach in accordance with certain embodiments. The distance travelled approach measures determines a first value with the confidence value for approved for a second entity type and the confidence value for approved for a first entity type, determines a second value with the confidence value for denied for the second entity type and the confidence value for denied for the first entity type, and determines the distance travelled by adding the first value and the second value. For example, with reference to case_1800, the distance traveled is zero, and with reference to case_2810, the distance travelled is also zero. Thus, even though the classification model of case_2810is more biased than the classification model of case_1800, both have the same distance traveled of 0.

FIG.9illustrates an absolute distance travelled approach in accordance with certain embodiments. The absolute distance travelled approach uses absolute values. The absolute distance travelled approach determines a first absolute value with the confidence value for approved for a second entity type and the confidence value for approved for a first entity type, determines a second absolute value with the confidence value for denied for the second entity type and the confidence value for denied for the first entity type, and determines the absolute distance travelled by adding the first value and the second value. For example, with reference to case_2910, the absolute distance traveled is 0.8 and indicates bias, and with reference to case_3912, the absolute distance travelled is 0.2. This shows that the classification model of case_3920is biased, even though it is not biased.

FIG.10illustrates a direction of distance travelled approach in accordance with certain embodiments. The direction of distance travelled approach determines a first absolute value with the confidence value for approved for a second entity type and the confidence value for approved for a first entity type, determines a second absolute value with the confidence value for denied for the second entity type and the confidence value for denied for the first entity type, and determines the direction of distance travelled by adding the first value and the second value. If the direction of travel is leading to an increase in bias, the model corrector110considers the direction to be positive, otherwise, the model corrector110considers the direction to be negative. For example, with reference to case_11000, the direction of distance travelled has a result of 0.4, which indicates bias. With reference to case_21010, the direction of distance travelled has a result of 0.8, which indicates more bias than case_11010. With reference to case_31020, the direction of distance travelled has a result of −.02, and a negative value means there is no bias. With reference to case_41030, the direction of distance travelled has a result of 0.8, which indicates that there is bias. Thus, the direction of distance travelled approach best determined bias in the cases discussed.

Thus, the model corrector110provides a new mechanism to detect whether the classification model is predicting biased outcomes or not. In particular, the model corrector110uses the direction of distance travelled approach using the confidence of the predicted outcomes that the classification model has made. In certain embodiments, once the model corrector110obtains an indication of whether each of the records is biased, the model corrector110labels these records to indicate the bias. In certain embodiments, the model corrector110re-trains the classification mode using these labelled records. In certain other embodiments, the model corrector110re-trains the classification mode using these labelled records that are biased, as well as, other records (which may not be labelled (e.g., because they have not been used to train the classification model yet or because they are biased).

For example, consider a case in which the classification model120has received100loan application records, with 60 records for first entity types and 40 records for second entity types. Using the direction of distance travelled approach using confidence of the predicted outcomes, the model corrector110determines that the classification model has made20unfair or biased predicted outcomes for 5 first entity types and 15 second entity types. These 20 records are then labelled as “biased”. Then, the model corrector110re-trains the classification model using these biased records so that the classification model becomes trained to make more fair predicted outcomes.

FIG.11illustrates a multi-class classification approach in accordance with certain embodiments. The multi-class classification approach looks at the maximum confidence values of favorable (approved) and unfavorable (denied) outcomes. The problem of multi-class classification is similar the problem of binary classification. With reference to example scenario1100, there is a confidence value change of class C2and C4. C2(favorable) dropped from 0.2 to 0.01, while C4(unfavorable) increased from 0.05 to 0.24. This indicates that the classification model is increasing the confidence value of giving an unfavorable outcome to the compare group. However, there is no change in the maximum confidence values from the set of confidence values of favorable (0.5) and unfavorable (0.25). Thus, the multi-class classification approach does not align with the bias indication.

FIG.12illustrates multi-class classification with direction of distance approach in accordance with certain embodiments. In the example scenario1200, the direction based distance for the multiple classes is 0.38, which indicates bias. This factors in changes in the classes and measures bias in the classification model.

As another example of confidence value based model fairness for multi-class classification models, consider a classification model that may make one of the following predicted outcomes:Loan approved (favorable outcome)Loan partially approved (favorable outcome)Loan rejected (unfavorable outcome)

In this example, a classification model has been built (e.g., by a data scientist), and the fairness of the classification model is measured using confidence value based model fairness. The model corrector110receives a training data set (test data), the model scoring API, and the model data (e.g., favorable/unfavorable outcomes, fairness attributes, etc.). In this example, the goal is to make sure the classification model is being fair to the compare group (second entity type) as compared to the reference group (first entity type).

In certain embodiments, to compute the confidence values, the model corrector110uses the scoring API140to score the classification model against the test data set to generate the confidence value. The model corrector110returns the confidence value of the predicted outcome for each of the three classes (loan approved, loan partially approved, and loan rejected). The model corrector110perturbs each record in the test data. In particular, if the record is for a first entity type, the model corrector110changes the education level from first entity type to second entity type and send the perturbed record to the classification model. The model corrector110receives and stores the predicted outcome and the confidence value for each of the three classes for the perturbed record. If the record is for a second entity type, the model corrector110changes the education level to a random reference group education level and sends the perturbed record to the model. The model corrector110stores the predicted outcome and the confidence value for each of the three classes for the perturbed record. The model corrector110computes the change in confidence values of the classes using a direction of distance approach to find the fairness.

The distance traveled based approach takes into account the total distance travelled with reference to the confidence values. For example, for the original record predicted outcome, the favorable class C1has a confidence value of 0.7, and the confidence values of the other classes are: C2(0.15), C3(0.1) and C4(0.05). For the perturbed record predicted outcome, there are two possible scenarios. In one scenario for the perturbed record, the predicted outcome is still favorable C1with a confidence value of 0.6. In this example, the unfavorable class with the maximum (highest) confidence values is class C4with a confidence value of 0.25. Continuing with this example, class C1travels from 0.7 to 0.6=0.1. Class C4travels from 0.05 to 0.25=0.2. Then, the total distance travelled is 0.3, which is a measure of fairness of the classification model. In the other scenario for the perturbed record, the predicted outcome changes to unfavorable. In this other example, class C3has confidence value 0.9, and class C1is the favorable class with max confidence value of 0.05. Continuing with this other example, class C3travels from 0.1 to 0.9=0.8. Class C1travels from 0.7 to 0.05=0.65. Then, the total distance travelled is: 0.8+0.65=1.45, which is a measure of fairness of the classification model.

With another approach, class C3and class C4are both unfavorable classes. The original record has confidence values of: C30.2, C40.01. The perturbed record has confidence values of: C30.1, C40.25. The unfavorable max confidence changed from 0.2 to 0.25. However, class C4changed from 0.01 to 0.25 in distance, which indicates that the classification model is susceptible to bias.

Another approach to measure fairness is to look at how close the favorable and unfavorable classes are in terms of confidence values in the original data and how that distance changed in the perturbed record. For example, the original record as confidence values of: C10.7, C20.2, C3, 0.05, C40.05, and the distance is: 0.7−0.05=0.65. The perturbed record has confidence values of: C10.05 C20.05 C30.7 C40.2, and the new distance is: 0.7−0.05=0.65. This results in a change of distance of zero.

Embodiments factor in the direction in which the confidence value is changing. For example, before perturbation for a first entity type, the confidence value is C1=0.8 (favorabl— loan approved) and C2=0.2 (unfavorable), then, after perturbation to second entity type, the confidence value is C1=0.9 and C2=0.1. The distance travelled, using absolute confidence values, is 0.1+0.1=0.2, and bias has been decreased. On the other hand. If, after perturbation, the confidence values are C1=0.7, C2=0.3, the distance travelled is still 0.2, but bias has been increased.

With embodiments, if the distance traveled is towards the opposite class, then the distance traveled is considered negative. If the distance travelled is away from the opposite class (favorable/unfavorable), then the distance traveled is considered positive. In certain embodiments, the model corrector110finds the distance travelled for each class and then averages the distance across the data points to find an overall directional confidence value based fairness metric.

In certain embodiments, the model corrector110uses a non-perturbation confidence value based metric. The number of records in the test data may be very large. In that case, the model corrector110may not perturb and score the records. Instead, the model corrector110measure confidence value based fairness in a different manner. In particular, the model corrector110scores each record in the test data and finds the confidence value for each class. In this example, the confidence values for the classes are: C1=0.7, C2=0.2, C3=0.1. For multi-class classification, the model corrector110finds the difference in confidence values of the top class and the class belonging to the opposite category. For example, if the class having the highest confidence value is favorable outcome, then the model corrector finds the class belonging to the unfavorable class with the highest confidence value and finds the difference between these two highest confidence values. This difference may be described as the measure of uncertainty of the classification model to decide between the favorable and unfavorable classes.

In certain embodiments, for a binary classification model, the model corrector110finds two values: the distance of the winning class confidence value from the fairness threshold (e.g., 0.5) and the distance of the other class from the fairness threshold. The minimum of the two values is used as measure of the fairness based on confidence values.

In certain embodiments, the model corrector110finds the average confidence value across the records in the test data and uses that as the non-perturbation confidence value for the classification model.

In certain embodiments, the model corrector110computes the average distance travelled by the classes to compute the confidence value (which indicates fairness) of the classification model. In certain embodiments, the model corrector110the direction of the change in confidence values is used to identify the fairness of the classification model. In certain embodiments, the model corrector110finds the difference in confidence values and the fairness threshold to compute the non-perturbation based fairness based on confidence values.

FIG.13illustrates, in a flowchart, operations for correcting a classification model in accordance with certain embodiments. Control begins at block1300with the model corrector110retrieving a training data set with records. In block1302, the model corrector110trains the classification model using the records to generate outcomes and associated confidence values. In particular, the classification model generates a class of the outcome, and a confidence value is associated with that class. In block1304, the model corrector110determines whether each of the records is biased using the confidence values and a direction of distance travelled. With embodiments, the direction of distance travelled indicates whether to treat a confidence change (absolute difference of confidence values) as positive or negative. In particular, if direction of distance traveled increases bias, the confidence change is treated as positive, and, if the direction of distance traveled decreases bias, the confidence change is treated as negative.

In block1306, the model corrector110labels any records that are found to be biased as “biased”. In block1308, the model corrector110determines whether the classification model is biased based on the number of records labelled as biased. If so, processing continues to block1310, otherwise, processing continues to block1314. In certain embodiments, the model corrector110determines that the classification model is biased based on the number of records labelled biased exceeding a model bias threshold. In certain embodiments, the model corrector110determines that the classification model is not biased based on the number of records labelled biased being equal to or below the model bias threshold. The model bias threshold may be modified (e.g., by a system administrator). A classification model that is biased is considered to be not fair, while a classification model that is not biased is considered to be fair.

In block1310, the model corrector110determines whether attempts to correct the classification model exceed a pre-determined number of times. If so, processing continues to block1316, otherwise, processing continues to block1312.

In block1312, the model corrector110obtains another training data set, and processing continues to block1302to re-train the classification model. The training set obtained in block1312, includes the records labelled as biased and may, optionally, include the other records from the previous training set that are not labelled as biased and/or may include new records not already used to train the classification model.

In block1314, the model corrector110deploys the classification model and processing ends.

In block1316, the model corrector110sends notification that the classification model could not be corrected (e.g., to a system administrator) and processing ends.

FIG.14illustrates, in a flowchart, operations for determining a final confidence value for a classification model in accordance with certain embodiments. Control begins at block1400with the model corrector110retrieving a first record (an “original” record) with a feature and an outcome having a first outcome (i.e., a first class) and a second outcome (i.e., a second class), where a first confidence value is associated with the first outcome and a second confidence value is associated with the second outcome.

In block1402, the model corrector110perturbs the first record to generate a second record (a “perturbed” record), where a value of the feature of the first record is modified in the second record, and where the second record has a third confidence value associated with the first outcome and a fourth confidence value associated with the second outcome.

In block1404, the model corrector110determines an absolute difference of the first confidence value and the third confidence value of the first outcome to generate a first addend; if the first confidence value and the third confidence value indicate that bias is increasing, treat the first addend as a positive vale; and, if the first confidence value and the third confidence value indicate that bias is decreasing, treat the first addend as a negative value.

In block1406, the model corrector110determines an absolute difference of the second confidence value and the fourth confidence value of the second outcome to generate a second addend; if the second confidence value and the fourth confidence value indicate that bias is increasing, treat the second addend as a positive vale; and, if the second confidence value and the fourth confidence value indicate that bias is decreasing, treat the second addend as a negative value.

In block1408, the model corrector110adds the first addend and the second addend to generate a final confidence value based on the direction of distance traveled.

In block1410, the model corrector110identifies the record as biased or not biased based on the final confidence value. In certain embodiments, the model corrector110identifies the record as not biased if the final confidence value exceeds a record confidence threshold. In such embodiments, the model corrector110identifies the record as biased if the final confidence value is equal to or below the record confidence threshold. The record confidence threshold may be modified (e.g., by a system administrator). In additional embodiments, the model corrector100identifies the record as not biased (i.e., fair) if the final confidence value is negative.

In certain embodiments, the processing ofFIG.14is performed for each record in the training data set used to train the classification model.

The first addend and the second addend may also be referred to as confidence changes.

In certain embodiments for each original record and each perturbed record, the model corrector110determines a confidence change between the original record and the perturbed record for a class; in response to determining that bias is increasing, the model corrector110treats the confidence change as a positive value; and, in response to determining that the bias is decreasing, the model corrector110treats the confidence change as a negative value.

In certain embodiments, the original record is determined to be biased when the final confidence value is equal to or below a record confidence threshold. In certain embodiments, the classification model is determined to be biased when a number of the original records exceeds a model bias threshold.

In certain embodiments, in response to determining whether the original record is biased, the model corrector110labels the original record as biased.

In certain embodiments, the model corrector110re-trains the classification model using each original record labelled as biased.

In certain embodiments, the model corrector110determines a fairness for a classification model by obtaining, for each record of a data set and each record of a perturbed data set corresponding to the data set, a predicted outcome of the classification model and a corresponding confidence value for each class of two or more classes. The model corrector110calculates a sum of distance travelled for the corresponding confidence value by the classes from the data set to the perturbed data set. The model corrector110determines the fairness for the classification model based on the sum.

In certain embodiments, calculating the sum includes determining a sign of each distance travelled for the corresponding confidence value by each class based on a direction of a change in the confidence value for each class and whether the class is favorable or unfavorable.

In certain embodiments, the classification model is a binary classification model (with two classes). In certain other embodiments, the classification model is a multi-class classification model (with more than two classes).

With embodiments of a binary classification model, the model corrector110obtains, for each record of a data set and each record of a perturbed data set corresponding to the data set, a predicted outcome of the binary classification model and a corresponding confidence value for each of two classes. The model corrector110calculates a sum of difference in the corresponding confidence value between the two classes over the data set and the perturbed data set, where a sign of the difference for the perturbed data set is determined based on the predicted outcome of the binary classification model. The model corrector110determines the fairness for the classification model based on the sum.

With embodiments, the model corrector110makes use of the confidence values to find the change in confidence values and use that to compute the fairness of the classification model.

FIG.15illustrates, in a flowchart, operations for determining fairness of a model and correcting the classification model in accordance with certain embodiments. Control begins at block1500with the model corrector110, for each original record of a plurality of original records of a data set that are processed by a classification model: perturbing the original record to generate a perturbed record; for the original record, obtaining an original confidence value for each class of a plurality of classes for an outcome; for the perturbed record, obtaining a perturbed confidence value for each class of the plurality of classes for the outcome; determining a final confidence value using each original confidence value, using each perturbed confidence value, and using a direction of distance travelled; and determining whether the original record is biased based on the final confidence value.

In block1502, the model corrector110determines whether the classification model is biased based on how many original records are determined to be biased and based on a model bias threshold. In block1504, in response to determining that the classification model is biased, the model corrector110corrects the classification model. In block1506, in response to determining that the classification model is not biased, the model corrector110deploys the classification model.

In certain embodiments, for each original record of a plurality of original records of a data set, the model corrector110: perturbs the original record to generate a perturbed record; for the original record, obtains an original outcome, using a classification model, and obtains an original confidence value for each class of a plurality of classes; for the perturbed record, obtains a perturbed outcome, using the classification model, and obtains a perturbed confidence value for each class of the plurality of classes; determines a final confidence value using each original confidence value, using each perturbed confidence value, and using a direction of distance travelled; and determines whether the original record is biased based on the final confidence value and based on a record confidence threshold. Then, the model corrector110determines whether the classification model is biased based on how many original records are determined to be biased and based on a model bias threshold.

FIG.16illustrates a computing environment1600in accordance with certain embodiments. Computing environment1600contains an example of an environment for the execution of at least some of the computer code involved in performing the inventive methods, such as code for the model corrector110. In addition to block110, computing environment1600includes, for example, computer1601, wide area network (WAN)1602, end user device (EUD)1603, remote server1604, public cloud1605, and private cloud1606. In this embodiment, computer1601includes processor set1610(including processing circuitry1620and cache1621), communication fabric1611, volatile memory1612, persistent storage1613(including operating system1622and block110, as identified above), peripheral device set1614(including user interface (UI) device set1623, storage1624, and Internet of Things (IOT) sensor set1625), and network module1615. Remote server1604includes remote database1630.

Public cloud1605includes gateway1640, cloud orchestration module1641, host physical machine set1642, virtual machine set1643, and container set1644.

PROCESSOR SET1610includes one, or more, computer processors of any type now known or to be developed in the future. Processing circuitry1620may be distributed over multiple packages, for example, multiple, coordinated integrated circuit chips. Processing circuitry1620may implement multiple processor threads and/or multiple processor cores. Cache1621is memory that is located in the processor chip package(s) and is typically used for data or code that should be available for rapid access by the threads or cores running on processor set1610. Cache memories are typically organized into multiple levels depending upon relative proximity to the processing circuitry. Alternatively, some, or all, of the cache for the processor set may be located “off chip.” In some computing environments, processor set1610may be designed for working with qubits and performing quantum computing.

VOLATILE MEMORY1612is any type of volatile memory now known or to be developed in the future. Examples include dynamic type random access memory (RAM) or static type RAM. Typically, volatile memory1612is characterized by random access, but this is not required unless affirmatively indicated. In computer1601, the volatile memory1612is located in a single package and is internal to computer1601, but, alternatively or additionally, the volatile memory may be distributed over multiple packages and/or located externally with respect to computer1601.

PERSISTENT STORAGE1613is any form of non-volatile storage for computers that is now known or to be developed in the future. The non-volatility of this storage means that the stored data is maintained regardless of whether power is being supplied to computer1601and/or directly to persistent storage1613. Persistent storage1613may be a read only memory (ROM), but typically at least a portion of the persistent storage allows writing of data, deletion of data and re-writing of data. Some familiar forms of persistent storage include magnetic disks and solid state storage devices. Operating system1622may take several forms, such as various known proprietary operating systems or open source Portable Operating System Interface-type operating systems that employ a kernel. The code included in block110typically includes at least some of the computer code involved in performing the inventive methods.

END USER DEVICE (EUD)1603is any computer system that is used and controlled by an end user (for example, a customer of an enterprise that operates computer1601), and may take any of the forms discussed above in connection with computer1601. EUD1603typically receives helpful and useful data from the operations of computer1601. For example, in a hypothetical case where computer1601is designed to provide a recommendation to an end user, this recommendation would typically be communicated from network module1615of computer1601through WAN1602to EUD1603. In this way, EUD1603can display, or otherwise present, the recommendation to an end user. In some embodiments, EUD1603may be a client device, such as thin client, heavy client, mainframe computer, desktop computer and so on.

REMOTE SERVER1604is any computer system that serves at least some data and/or functionality to computer1601. Remote server1604may be controlled and used by the same entity that operates computer1601. Remote server1604represents the machine(s) that collect and store helpful and useful data for use by other computers, such as computer1601. For example, in a hypothetical case where computer1601is designed and programmed to provide a recommendation based on historical data, then this historical data may be provided to computer1601from remote database1630of remote server1604.

PRIVATE CLOUD1606is similar to public cloud1605, except that the computing resources are only available for use by a single enterprise. While private cloud1606is depicted as being in communication with WAN1602, in other embodiments a private cloud may be disconnected from the internet entirely and only accessible through a local/private network. A hybrid cloud is a composition of multiple clouds of different types (for example, private, community or public cloud types), often respectively implemented by different vendors. Each of the multiple clouds remains a separate and discrete entity, but the larger hybrid cloud architecture is bound together by standardized or proprietary technology that enables orchestration, management, and/or data/application portability between the multiple constituent clouds. In this embodiment, public cloud1605and private cloud1606are both part of a larger hybrid cloud.

In the described embodiment, variables a, b, c, i, n, m, p, r, etc., when used with different elements may denote a same or different instance of that element.

EXAMPLES

The foregoing description provides examples of embodiments of the invention, and variations and substitutions may be made in other embodiments. Several examples will now be provided to further clarify various aspects of the present disclosure:

Example 1: A computer-implemented method comprises, for each original record of a plurality of original records of a data set: perturbing the original record to generate a perturbed record; for the original record, obtaining an original outcome, using a classification model, and an original confidence value for each class of a plurality of classes; for the perturbed record, obtaining a perturbed outcome, using the classification model, and a perturbed confidence value for each class of the plurality of classes; determining a final confidence value using each original confidence value, each perturbed confidence value, and a direction of distance travelled; and determining whether the original record is biased based on the final confidence value. The computer-implemented method further comprises determining whether the classification model is biased based on how many original records are determined to be biased. The computer-implemented method further comprises, in response to determining that the classification model is biased, correcting the classification model. The computer-implemented method further comprises, in response to determining that the classification model is not biased, deploying the classification model.

Example 2: The limitations of any of Examples 1 and 3-7, wherein the computer-implemented method further comprises, for each original record and each perturbed record, determining a confidence change between the original record and the perturbed record for a class; in response to determining that bias is increasing, treating the confidence change as a positive value; and, in response to determining that the bias is decreasing, treating the confidence change as a negative value.

Example 3: The limitations of any of Examples 1-2 and 4-7, wherein the original record is determined to be biased when the final confidence value is equal to or below a record confidence threshold.

Example 4: The limitations of any of Examples 1-3 and 5-7, wherein the classification model is determined to be biased when a number of the original records exceeds a model bias threshold.

Example 5: The limitations of any of Examples 1˜4 and 6-7, wherein the computer-implemented method further comprises, in response to determining whether the original record is biased, labelling the original record as biased.

Example 6: The limitations of any of Examples 1-5 and 7, wherein the computer-implemented method further comprises re-training the classification model using each original record labelled as biased.

Example 7: The limitations of any of Examples 1-6, wherein the classification model is one of a binary classification model and a multi-class classification model.

Example 8: A computer program product, the computer program product comprising a computer readable storage medium having program code embodied therewith, the program code executable by at least one processor to perform a method according to any one of Examples 1-7.

Example 9: A computer system comprising one or more processors, one or more computer-readable memories and one or more computer-readable, tangible storage devices, and program instructions, stored on at least one of the one or more computer-readable, tangible storage devices for execution by at least one of the one or more processors via at least one of the one or more computer-readable memories, to perform a method according to any of Examples 1-7.