Skip to main content

IBM AI Fairness 360

Project description

AI Fairness 360 (AIF360 v0.1.0)

Build Status

The AI Fairness 360 toolkit is an open-source library to help detect and remove bias in machine learning models. The AI Fairness 360 Python package includes a comprehensive set of metrics for datasets and models to test for biases, explanations for these metrics, and algorithms to mitigate bias in datasets and models.

The AI Fairness 360 interactive experience provides a gentle introduction to the concepts and capabilities. The tutorials and other notebooks offer a deeper, data scientist-oriented introduction. The complete API is also available.

Being a comprehensive set of capabilities, it may be confusing to figure out which metrics and algorithms are most appropriate for a given use case. To help, we have created some guidance material that can be consulted.

We have developed the package with extensibility in mind. This library is still in development. We encourage the contribution of your metrics, explainers, and debiasing algorithms.

Get in touch with us on Slack (invitation here)!

Supported bias mitigation algorithms

Supported fairness metrics

  • Comprehensive set of group fairness metrics derived from selection rates and error rates
  • Comprehensive set of sample distortion metrics
  • Generalized Entropy Index (Speicher et al., 2018)

Setup

Installation is easiest on a Unix system running Python 3.6. See the Troubleshooting section if you have issues with other configurations.

(Optional) Create a Virtualenv environment

AIF360 requires specific versions of many Python packages which may conflict with other projects on your system. Virtualenv creates an isolated virtual Python environment where these dependencies may be installed safely. If you have trouble installing AIF360, try this first.

mkdir ~/virtualenvs && cd ~/virtualenvs  # this can be wherever you like storing virtualenvs
virtualenv -p python3 aif360             # or substitute your preferred version of Python
source aif360/bin/activate

For Windows, this is a little different:

md C:\virtualenvs             # this can be wherever you like storing virtualenvs
cd C:\virtualenvs
virtualenv -p python3 aif360  # or substitute your preferred version of Python
aif360/Scripts/activate

The shell should now look like (aif360) $.

Also, upgrade pip to be safe:

(aif360)$ pip install --upgrade pip

To deactivate the environment, run

deactivate

The prompt will return to $ .

See the Virtualenv User Guide for more details.

Install with minimal dependencies

Installation with pip

pip install aif360

This package supports Python 2.7, 3.5, and 3.6. However, for Python 2, the BlackBoxAuditing package must be installed manually.

Manual installation

Clone the latest version of this repository:

git clone https://github.com/IBM/AIF360

If you'd like to run the examples, download the datasets now and place them in their respective folders as described in aif360/data/README.md.

Then, navigate to the root directory of the project and run:

pip install .

Run the Examples

To run the example notebooks, install the additional requirements as follows:

pip install -r requirements.txt

Then, follow the Getting Started instructions from PyTorch to download and install the latest version for your machine.

Finally, if you did not already, download the datasets as described in aif360/data/README.md but place them in the appropriate sub-folder in ~/virtualenvs/aif360/lib/pythonX.X/site-packages/aif360/data/raw where pythonX.X is the version of python you are using.

Troubleshooting

If you encounter any errors during the installation process, look for your issue here and try the solutions.

Windows

TensorFlow

Note: TensorFlow 1.1.0 only supports Python 3.5 officially on Windows. You can get it from python.org.

Then, try:

pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.1.0-cp35-cp35m-win_amd64.whl

TensorFlow is only required for use with the aif360.algorithms.inprocessing.AdversarialDebiasing class.

CVXPY

You may need to download the Visual Studio C++ compiler for Python and rerun

pip install cvxpy==0.4.11

CVXPY is only required for use with the aif360.algorithms.preprocessing.OptimPreproc class.

Python 2

Some additional installation is required to use aif360.algorithms.preprocessing.DisparateImpactRemover with Python 2.7. In a directory of your choosing, run:

git clone https://github.com/algofairness/BlackBoxAuditing

In the root directory of BlackBoxAuditing, run:

echo -n $PWD/BlackBoxAuditing/weka.jar > python2_source/BlackBoxAuditing/model_factories/weka.path
echo "include python2_source/BlackBoxAuditing/model_factories/weka.path" >> MANIFEST.in
pip install --no-deps .

This will produce a minimal installation which satisfies our requirements.

Using AIF360

The examples directory contains a diverse collection of jupyter notebooks that use AI Fairness 360 in various ways. Both tutorials and demos illustrate working code using AIF360. Tutorials provide additional discussion that walks the user through the various steps of the notebook. See the details about tutorials and demos here

Citing AIF360

Please ask in Slack channel.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aif360-0.1.0.tar.gz (103.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

aif360-0.1.0-py3-none-any.whl (164.6 kB view details)

Uploaded Python 3

aif360-0.1.0-py2-none-any.whl (164.6 kB view details)

Uploaded Python 2

File details

Details for the file aif360-0.1.0.tar.gz.

File metadata

  • Download URL: aif360-0.1.0.tar.gz
  • Upload date:
  • Size: 103.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.15

File hashes

Hashes for aif360-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1a90ba8d9b2341a10e9e7d1db65b5bc33fbf2491462e68cf1b7df9e547358514
MD5 f8e3c8754f3d531fc080f217224ca7e3
BLAKE2b-256 8d90206e933c26b32d69fb59ded82c29018b665c2fba5765ee9a449d967b97e6

See more details on using hashes here.

File details

Details for the file aif360-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: aif360-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 164.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.6

File hashes

Hashes for aif360-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84ab3d4739510b58043441c99358024906b63320093de870233b927ff38e2c7b
MD5 39849afe5d281cdf783d12d72ecdb83e
BLAKE2b-256 3cd994edb6eedff636847d1ce0b6c4672ecae8cb389ed055bb4feb1c02a95a60

See more details on using hashes here.

File details

Details for the file aif360-0.1.0-py2-none-any.whl.

File metadata

  • Download URL: aif360-0.1.0-py2-none-any.whl
  • Upload date:
  • Size: 164.6 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.15

File hashes

Hashes for aif360-0.1.0-py2-none-any.whl
Algorithm Hash digest
SHA256 0f9fb91193fbdc3b35c062a676895f9b325c52175ccfeafd1ee8cbc9eac58790
MD5 67cd8c6596ab7ac1e043689a3237719f
BLAKE2b-256 24f93f641ff42483fcdb86a83bcc78e9eb1a431108cb10bf5e9575b9750409be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page