III.

Tools for evaluating fairness in your AI model

In the previous section we went through the various metrics and methods that can be used for testing for and mitigating bias in a model. In this section, we’ll list a few existing toolkits that integrate these metrics and methods, and that can be used for debiasing. Note that all the listed toolkits are open source and available on GitHub. This isn’t an exhaustive list, nor are the tools perfect for every context. Developers are likely to create their own toolkits for specialized purposes or modify existing open-source toolkits for better performance. The purpose of these readily-available tools is to provide an easy way for developers to access state-of-the-art debiasing processes that they can then refit for their own models.

For the purposes of this section, we encourage you to take a look at these toolkits to gain an understanding of what the methods that we have up to this point described actually look like in practice.

IBM AI Fairness 360 (AIF360)

AIF360 is a tool provided by IBM that is available in both Python and R. The packages contain a set of different metrics and mitigation algorithms, including Statistical Parity, Equal Opportunity, and Disparate Impact, as well as mitigation techniques such as Reweighing and Adversarial Debiasing. The package also allows for easy user extension of their own metrics and algorithms.

Link: AI Fairness 360 (project page) / GitHub

Microsoft Fairlearn

Fairlearn is an open-source toolkit for debiasing. It contains an interactive dashboard for visualizing the debiasing process as well as a set of mitigation algorithms. The available algorithms include both a preprocessing and a postprocessing algorithm, as well as two adversarial algorithms – one for binary classification and one for regression problems. Fairlearn is available in Python and can easily be installed via pip or conda-forge.

Link: / GitHub

Google What-if Tool

What-If Tool is an extension to Jupyter, Colaboratory, and Cloud AI Platform notebooks that aims to allow for intuitive and interactive exploration of a model with minimal coding involved. It’s also compatible with TensorBoard. True to its name, it allows users to check for nearest counterfactuals and customizable thresholds.

Link: What-If Tool (pair-code.github.io)

Aequitas

Aequitas is an open-source toolkit for diagnosing bias. It allows for simple uploading of data, selection of protected groups, metrics, and disparity intolerance, then generates a report based on these settings. The available metrics by default include Equal Parity, Proportional Parity, False Positive/Negative Rate Parity, and False Discovery/Omission Rate Parity. The web function also provides a fairness tree to help decide which of these metrics to use.

Link: / GitHub


Part summary

In this chapter we learned that...

  • Bias most commonly enters the AI model already in the data collection process and in the pre-processing step

  • One way to assess bias is to do a diagnosis of the data already in the pre-processing phase. This means critically checking the source of the data and utilizing domain knowledge in detecting risks of bias, especially the risk of historical or sampling bias.

  • After detecting bias in the data, there are several approaches to mitigate it. The pre-processing methods include relabeling, perturbation, sampling, and reweighing

  • In-processing methods for mitigating bias are for example regularization and constraint optimization, and adversarial learning.

  • Thresholding is the most common approach to take when mitigating bias in the post-processing stage of the AI model development.

  • There are several tools that you can openly use to evaluate the fairness of your AI model. These include IBM AI Fairness 360 (AIF360), Microsoft Fair Learn, Google What-if Tool, and Aequitas.

Next Chapter
3. Dissecting the internal logic of machine learning