Fairness metrics overview

When you configure the IBM Watson OpenScale fairness monitor, you can generate a set of metrics to evaluate the fairness of your model. You can use the fairness metrics to determine if your model produces biased outcomes.

The fairness monitor generates a set of metrics every hour by default. You can generate these metrics on demand by clicking Evaluate fairness now or by using the Python client.

With Watson OpenScale, you can specify the features from your model that you want the fairness monitor to evaluate for bias. To evaluate features for bias with the fairness monitor, you must also specify values for each feature that help detect bias.

Among the values that you specify, you must select a monitored group and a reference group. For example, you can set the Female value as the monitored group and the Male value as the reference group for the Sex feature when you configure the fairness monitor. You can specify any features or values when you are configuring the fairness monitor to detect bias for your model.

You must also specify the output schema for a model or function in Machine Learning to enable fairness monitoring in Watson OpenScale. You can specify the output schema by using the client.repository.ModelMetaNames.OUTPUT_DATA_SCHEMA property in the metadata section of the store_model API. For more information, see the IBM Watson Machine Learning client documentation.

How it works

On the Insights dashboard, you can view the results of the model evaluations that you enable when you configure the fairness monitor.

When you click a model deployment tile, the Fairness section displays a summary of the metrics that describe the outcomes of the evaluation. You can click the arrow navigation arrow to see a chart that provides metrics from the results of your model evaluation during specific time periods. For more information, see Viewing data for a deployment.

You can click a data point on the chart to view more details about how the fairness score was calculated. For each monitored group, you can view the calculations for the following types of data sets:

A record is excluded from your fairness results in two scenarios:

For example, suppose that a record has Married for the Marital Status attribute, Female for the Sex attribute, and the prediction is No Risk. This record is considered in the fairness calculation for both Marital Status and Sex because both attributes contain values that are in either the reference or monitored groups. Suppose that another record has Unmarried for the Marital Status attribute, Other for the Sex attribute, and the prediction is Risk. This record is considered in the fairness calculation for Marital Status because Unmarried is in the monitored group. However, this record isn't considered in the fairness calculation for Sex because Other isn't in the reference or monitored groups.

If you have a batch subscription, the total number of records analyzed doesn't necessarily include all of the records that were read. Instead, the total number of records analyzed includes only the records that have one of the prediction values that you specify in the fairness configuration. If you have a batch subscription and a record is excluded from the fairness results, the total number of records analyzed might be larger than the sum of the favorable and unfavorable outcomes that appears in the fairness chart. If you have an online subscription, the total number of records analyzed includes all of the records that were read, regardless of whether any records were excluded from the fairness results.

Do the math

The Watson OpenScale algorithm computes bias on an hourly basis by using the last N records that are present in the payload logging table and the value of N is specified when you configure the fairness monitor. The algorithm perturbs these last N records to generate additional data.

The perturbation changes the values of the feature from the reference group to the monitored group, or vice-versa. The perturbed data is then sent to the model to evaluate its behavior. The algorithm looks at the last N records in the payload table, and the behavior of the model on the perturbed data, to decide if the model is acting in a biased manner.

A model is biased if the percentage of favorable outcomes for the monitored group is less than the percentage of favorable outcomes for the reference group, by some threshold value. This threshold value is specified when you configure the fairness monitor.

Fairness values can be more than 100%. This calculation means that the monitored group received more favorable outcomes than the reference group. In addition, if no new scoring requests are sent, then the fairness value remains constant.

Balanced data and perfect equality

For balanced data sets, the following concepts apply:

The following mathematical formula is used for calculating perfect equality:

Perfect equality =   Percentage of favorable outcomes for all reference transactions, 
                     including the synthesized transactions from the monitored group

For example, if the monitored feature is SEX and the monitored group is FEMALE, the following formula shows the equation for perfect equality:

Perfect equality for `SEX` =  Percentage of favorable outcomes for `MALE` transactions, 
                                 including the synthesized transactions that were initially `FEMALE` but changed to `MALE`

Supported models

Watson OpenScale supports bias detection only for the models and Python functions that use structured data in the feature vector.

Fairness metrics are calculated based on the scoring payload data.

For proper monitoring purposes, every scoring request must be logged in Watson OpenScale. Payload data logging is automated for IBM Watson Machine Learning engines.

For other machine learning engines, the payload data can be provided either by using the Python client or the REST API.

For machine learning engines other than IBM Watson Machine Learning, fairness monitoring creates additional scoring requests on the monitored deployment.

You can review the following information with the fairness monitor:

Supported fairness metrics

The following fairness metrics are supported by Watson OpenScale:

Supported fairness details

The following details for fairness metrics are supported by Watson OpenScale:

Parent topic: Watson OpenScale