Installation Guide
Installation_Guide
User Manual:
Open the PDF directly: View PDF .
Page Count: 5
Installation Guide for AI Fairness 360 Toolkit
Introduction
We will describe how to install AI Fairness 360 toolkit (AIF360) in a standard machine running a
Windows, Linux, MacOS operating systems. This guide is created for the audience at the tutorial
at O’Reilly Artificial Intelligence Conference 2019. The audience are requested to sign up to the
slack channel since a lot of discussion is expected to happen there. Remote support is also provided
through the channel.
Additional help can be obtained from the following places:
1. Tutorial website: https://github.com/IBM/AIF360/wiki/O'Reilly-Artificial-Intelligence-
Conference-@-New-York-City---2019-Tutorial
2. AIF360 landing page: http://aif360.mybluemix.net
3. AIF360 Github page: https://github.com/ibm/aif360
4. Slack workspace: https://aif360.slack.com/ (request invitation here:
https://join.slack.com/t/aif360/shared_invite/enQtNDI5Nzg2NTk0MTMyLTU4N2UwO
DVmMTYxZWMwZmEzZmZkODdjMTk5NWUwZDNhNDhlMzNkZDNhOTYwZDNl
ODc1MTdjYzY5OTU2OWQ1ZmY). Please join the #oreilly-tutorial-2019 channel
(https://aif360.slack.com/messages/CHNDTSAP3/), where all discussions will happen
during the tutorial.
5. One of the instructors
All commands and console messages will be given in Lucida Console font.
Requirements
1. Python 3.5 [Anaconda or Pure Python]
a. Anaconda distribution can be downloaded from
https://www.anaconda.com/download/
Anaconda is the recommended base distribution to use AIF360 and it is likely the
easiest way to install AIF360.
b. Pure python can be downloaded from https://www.python.org/downloads/
Pure python is not recommended, but instructions are given for expert users.
2. Access to command prompt/terminal (no GUI install available).
Initial Verification:
1. Check if you have python installed by typing python in command prompt/terminal. If
this is not installed install it. In Windows, command prompt will not work, you have to
use Anaconda Prompt for working with Anaconda throughout the tutorial.
2. If the header message says Anaconda skip to Installation with Anaconda. If not there are
2 choices:
a. Install Anaconda using the instructions above [recommended].
b. Continue to instructions in Installation with Pure Python.
3. In case you want to try the Optimized Pre-processing yourself install the cvxpy package.
The instructions are available in Installing CVXPY section. Note that this is non-trivial for
Windows and Linux platforms due to complicated dependencies.
Installation with Anaconda
1. Create and activate environment:
conda create --name aif360 python=3.5.6
conda activate aif360
The shell should not look like (aif360) $
To exit this environment and deactivate the shell use
conda deactivate
Do not deactivate until you completed doing experiments with AIF360. The advantage in
using environments is that you can fully remove the environment if something goes
wrong with the installation (conda env remove --name aif360)
2. Install AIF360
pip install aif360
should install the latest stable version.
3. Download tutorial_files.zip from the #oreilly-tutorial-2019 slack channel to the
Downloads folder and unzip it in place. Change to tutorial_files directory.
Windows:
cd C:\Users\%USERNAME%\Downloads\tutorial_files
Linux and MacOS:
cd ~/Downloads/tutorial_files
4. Run the script copy_datasets.py in the Downloads folder to copy the datasets to the
correct location in the AIF360 toolbox.
python copy_datasets.py
NOTE: By running this script, you acknowledge the responsibility for reading and
abiding by any copyright/usage rules and restrictions as stated on the corresponding links.
• Adult / Census Income
https://archive.ics.uci.edu/ml/datasets/adult
• German Credit Data
https://archive.ics.uci.edu/ml/datasets/Statlog+%28German+Credit+Data%29
• ProPublica Recidivism/COMPAS
https://github.com/propublica/compas-analysis
• Medical Expenditure Panel Survey (MEPS)
https://meps.ahrq.gov/data_stats/data_use.jsp
5. Take Download examples from https://github.com/IBM/AIF360/tree/master/examples to
tutorial_files/examples folder. The easiest way to do this is to download the entire
repository https://github.com/IBM/AIF360/archive/master.zip and copy the examples
folder from there.
6. Download UTK dataset Face dataset from https://susanqq.github.io/UTKFace/
• Choose Aligned&cropped option and download the UTKFace.tar.gz file.
7. Install additional packages
pip install --upgrade numpy
pip install -r requirements.txt
8. Install PyTorch (for running gender classification tutorial)
Download page: https://pytorch.org
Windows: conda install pytorch-cpu torchvision-cpu -c pytorch
Linux: conda install pytorch-cpu torchvision-cpu -c pytorch
MacOS: conda install pytorch torchvision -c pytorch
Install torchsummary:
pip install torchsummary
Installation with Pure Python
1. Download and install Python 3.5.4
Download page: https://www.python.org/downloads/release/python-354/
Windows: https://www.python.org/ftp/python/3.5.4/python-3.5.4-amd64.exe
Linux: Manual install only, see download page
MacOS: https://www.python.org/ftp/python/3.5.4/python-3.5.4-macosx10.6.pkg
2. Create virtual environment:
Use virtualenv to create a virtual environment. Syntax for this command is:
virtualenv –python=<<full path to python3.5.4 executable binary>>
<<virtual environment folder>>
In MacOS for example, this command may work.
virtualenv -
python=/Library/Frameworks/Python.framework/Versions/3.5/bin/python3
~/.aif360
3. Activate the virtual environment:
In MacOS for example, this command may work.
source ~/.aif360/bin/activate
The prompt should start with (.aif360)
Deactivation can be just done using deactivate command. Do not deactivate until you
completed doing experiments with AIF360. Removing the environment can be done by
deleting the entire ~/.aif360 directory.
4. Perform steps 2-6 under Installation with Anaconda
5. Install PyTorch (for running gender classification tutorial)
Download page: https://pytorch.org
Windows:
pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.0-cp35-cp35
m-win_amd64.whl
pip3 install torchvision
Linux:
pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.0-cp35-cp35
m-linux_x86_64.whl
pip3 install torchvision
MacOS:
pip3 install torch torchvision
Installing CVXPY [Optional and Non-Trivial]
Windows only
1
: This step needs to be done to install the CVXPY package. If you do not
want this package, you can skip this step and go to step c. RUNNING THIS STEP WILL
DOWNLOAD AND INSTALL ABOUT 5GB WORTH OF SOFTWARE.
• Go to: https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-
2017
• Select free download under Visual Studio Community 2017
• Run the installer.
• Under workload tab:
i. Under Windows there are 3 choices, select Desktop development with
C++ only.
1
Courtesy: https://stackoverflow.com/questions/48541801/microsoft-visual-c-14-0-is-required-get-it-with-
microsoft-visual-c-build-t
ii. Under Web & Cloud there are 7 choices, select Python development only
• Proceed and finish installation.
• Install CVXPY.
pip install numpy==1.8
pip install cvxpy
Linux:
pip install numpy==1.8
pip install cvxpy
MacOS: You may have to install XCode tools using xcode-select --install for this to
work.
pip install numpy==1.8
pip install cvxpy
That’s all Folks!