Skip to content

Commit

Permalink
fixes to instructions and requirements (Trusted-AI#30)
Browse files Browse the repository at this point in the history
* removes requirements3.txt
* also clarifies StandardDataset documentation
* adds data folders to .gitignore
* small fix to test_disparate_impact_remover
  • Loading branch information
hoffmansc authored Oct 12, 2018
1 parent 96cef24 commit 31df2ad
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
.pytest_cache/
.idea/
docs/build/
aif360/data/raw/**
!aif360/data/raw/*/*.md
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ Get in touch with us on [Slack](https://aif360.slack.com) (invitation [here](htt

## Setup

Installation is easiest on a Unix system running Python 3.6. See the [Troubleshooting](#troubleshooting) section if you have issues with other configurations.
Installation is easiest on a Unix-like system running Python 3.6 or Windows running Python 3.5. See the [Troubleshooting](#troubleshooting) section if you have issues with other configurations.

### (Optional) Create a Virtualenv environment
### (Optional) Create a virtual environment

#### Virtualenv

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.

Expand Down Expand Up @@ -67,13 +69,30 @@ Also, upgrade `pip` to be safe:
To deactivate the environment, run

```bash
deactivate
(aif360)$ deactivate
```

The prompt will return to `$ `.

See the [Virtualenv User Guide](https://virtualenv.pypa.io/en/stable/userguide/) for more details.

#### Conda

Some users may prefer to use `conda` to manage environments. It can be installed with the Anaconda distribution by following [these instructions](https://docs.anaconda.com/anaconda/install/). Then, to create a new Python 3.6 environment, run:

```bash
conda create --name aif360 python=3.6
conda activate aif360
```

and to deactivate, run

```bash
(aif360)$ conda deactivate
```

For simplicity, the following instructions will assume `virtualenv` but the same steps should work regardless of which you choose.

### Install with minimal dependencies

#### Installation with `pip`
Expand Down Expand Up @@ -132,7 +151,7 @@ TensorFlow is only required for use with the `aif360.algorithms.inprocessing.Adv

##### CVXPY

You may need to download the [Visual Studio C++ compiler for Python](https://www.microsoft.com/en-us/download/details.aspx?id=44266) and rerun
You may need to download the appropriate [Visual Studio C++ compiler for Python](https://wiki.python.org/moin/WindowsCompilers) and rerun

```bat
pip install cvxpy==0.4.11
Expand Down
15 changes: 9 additions & 6 deletions aif360/datasets/standard_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,18 @@ def __init__(self, df, label_name, favorable_classes,
processing.
label_name: Name of the label column in `df`.
favorable_classes (list or function): Label values which are
considered favorable (1) or a boolean function which returns
`True` if favorable (1). All others are unfavorable (0).
considered favorable or a boolean function which returns `True`
if favorable. All others are unfavorable. Label values are
mapped to 1 (favorable) and 0 (unfavorable) if they are not
already binary and numerical.
protected_attribute_names (list): List of names corresponding to
protected attribute columns in `df`.
privileged_classes (list(list or function)): Each element is
a list of values which are considered privileged (1) or a
boolean function which return `True` if privileged (1) for the
corresponding column in `protected_attribute_names`. All others
are unprivileged (0).
a list of values which are considered privileged or a boolean
function which return `True` if privileged for the corresponding
column in `protected_attribute_names`. All others are
unprivileged. Values are mapped to 1 (privileged) and 0
(unprivileged) if they are not already numerical.
instance_weights_name (optional): Name of the instance weights
column in `df`.
categorical_features (optional, list): List of column names in the
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ numba
tensorflow==1.1.0
networkx==1.11
BlackBoxAuditing;python_version>="3"
lime
17 changes: 0 additions & 17 deletions requirements3.txt

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_disparate_impact_remover.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_adult():
assert np.any(test.labels)

train.features = scaler.fit_transform(train.features)
test.features = scaler.fit_transform(test.features)
test.features = scaler.transform(test.features)

index = train.feature_names.index(protected)
X_tr = np.delete(train.features, index, axis=1)
Expand Down

0 comments on commit 31df2ad

Please sign in to comment.