Skip to content

Commit

Permalink
Adding AIF360-R components (#168)
Browse files Browse the repository at this point in the history
* Adding AIF360 R components

* Updating README to refer to R documentation for R users

* adding updated test

* adding updated test

* update readme

* update readme

* update readme

* update readme

* update tf

* update pandas

* update pandas

* update readme example

* add travis

* add travis

* update travis

* update travis

* update travis

* update travis

* update travis

* update travis

* update travis

* update travis

* update travis

* update travis

* add python

* update python

* update python

* update python

* update python

* update python virtual env tool

* remove virtual env

* update test file

* update test file

* update test

* add folder change

* change folder path

* change folder path

* change folder path

* change folder path

* change folder path

* change folder path

* change folder path

* merge

* merge

* Add gitignore

* Add .Rbuildignore

* Add cran-comments.md

* Add GH repo url and issues url to DESCRIPTION

* oops - Rename .gitgnore

* Update .Rbuildignore

* Typos

Co-authored-by: srnghn <[email protected]>
Co-authored-by: Gabriela de Queiroz <[email protected]>
  • Loading branch information
3 people authored May 23, 2020
1 parent 92235db commit ae55ccc
Show file tree
Hide file tree
Showing 55 changed files with 34,586 additions and 27 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ docs/source/modules/generated
aif360/version.py
aif360/data/raw/**
!aif360/data/raw/*/*.md
aif360/sklearn/data/
aif360/sklearn/data/
.Rproj.user
72 changes: 47 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,52 @@
language: python

python: "3.6"
# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r

env:
global:
- UCI_HTTPS_URL="https://archive.ics.uci.edu/ml/machine-learning-databases"

branches:
only:
- master

install:
- pip install -r requirements.txt
- pip install flake8
- if ! wget ${UCI_HTTPS_URL}/adult/adult.data -P aif360/data/raw/adult/ ; then wget ${UCI_HTTPS_URL}/adult/adult.data --no-check-certificate -P aif360/data/raw/adult/ ; fi
- if ! wget ${UCI_HTTPS_URL}/adult/adult.test -P aif360/data/raw/adult/ ; then wget ${UCI_HTTPS_URL}/adult/adult.test --no-check-certificate -P aif360/data/raw/adult/; fi
- if ! wget ${UCI_HTTPS_URL}/adult/adult.names -P aif360/data/raw/adult/ ; then wget ${UCI_HTTPS_URL}/adult/adult.names --no-check-certificate -P aif360/data/raw/adult/; fi
- if ! wget ${UCI_HTTPS_URL}/statlog/german/german.data -P aif360/data/raw/german/ ; then wget ${UCI_HTTPS_URL}/statlog/german/german.data --no-check-certificate -P aif360/data/raw/german/; fi
- if ! wget ${UCI_HTTPS_URL}/statlog/german/german.doc -P aif360/data/raw/german/ ; then wget ${UCI_HTTPS_URL}/statlog/german/german.doc --no-check-certificate -P aif360/data/raw/german/; fi
- wget https://raw.githubusercontent.com/propublica/compas-analysis/master/compas-scores-two-years.csv -P aif360/data/raw/compas/

before_script:
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

script:
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
- travis_wait pytest tests
matrix:
include:
- language: python
python: "3.6"
install:
- pip install -r requirements.txt
- pip install flake8
- if ! wget ${UCI_HTTPS_URL}/adult/adult.data -P aif360/data/raw/adult/ ; then wget ${UCI_HTTPS_URL}/adult/adult.data --no-check-certificate -P aif360/data/raw/adult/ ; fi
- if ! wget ${UCI_HTTPS_URL}/adult/adult.test -P aif360/data/raw/adult/ ; then wget ${UCI_HTTPS_URL}/adult/adult.test --no-check-certificate -P aif360/data/raw/adult/; fi
- if ! wget ${UCI_HTTPS_URL}/adult/adult.names -P aif360/data/raw/adult/ ; then wget ${UCI_HTTPS_URL}/adult/adult.names --no-check-certificate -P aif360/data/raw/adult/; fi
- if ! wget ${UCI_HTTPS_URL}/statlog/german/german.data -P aif360/data/raw/german/ ; then wget ${UCI_HTTPS_URL}/statlog/german/german.data --no-check-certificate -P aif360/data/raw/german/; fi
- if ! wget ${UCI_HTTPS_URL}/statlog/german/german.doc -P aif360/data/raw/german/ ; then wget ${UCI_HTTPS_URL}/statlog/german/german.doc --no-check-certificate -P aif360/data/raw/german/; fi
- wget https://raw.githubusercontent.com/propublica/compas-analysis/master/compas-scores-two-years.csv -P aif360/data/raw/compas/
before_script:
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
script:
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
- travis_wait pytest tests

- language: R
cache: packages
warnings_are_errors: false
before_install:
- cd aif360/aif360-r
install:
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a
- conda create -q -n test-env python=3.7
- source activate test-env
- R -q -e "install.packages('reticulate')"
- R -q -e "install.packages('rstudioapi')"
- R -q -e "install.packages('testthat')"
- pip install aif360 -q
- pip install numba -q
- pip install BlackBoxAuditing -q
- pip install tensorflow==1.15.0 -q
- pip install pandas -q
before_script:
- R CMD INSTALL .
18 changes: 18 additions & 0 deletions AIF360.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

BuildType: Package
PackageUseDevtools: Yes
PackagePath: aif360/aif360-r
PackageInstallArgs: --no-multiarch --with-keep.source
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ Get in touch with us on [Slack](https://aif360.slack.com) (invitation

## Setup

Supported Configurations:
AIF360 is available for both Python and R. For R setup, please refer to instructions [here](aif360/aif360-r/README.md).

Supported Python Configurations:

| OS | Python version |
| ------- | -------------- |
Expand Down
12 changes: 12 additions & 0 deletions aif360/aif360-r/.Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
^.*\.Rproj$ # Automatically added by RStudio,
^\.Rproj\.user$ # used for temporary files.
^README\.Rmd$ # An Rmarkdown file used to generate README.md
^NEWS\.md$ # A news file written in Markdown
^\.travis\.yml$ # Used for continuous integration testing with travis
^LICENSE\.md$
^raif360\.Rproj$
^README\.Rmd$
^CONDUCT\.md$
^CONTRIBUTING\.md$
^CODEOFCONDUCT\.md$
^cran-comments\.md$
7 changes: 7 additions & 0 deletions aif360/aif360-r/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
.httr-oauth
.*.Rnb.cached
.DS_Store
44 changes: 44 additions & 0 deletions aif360/aif360-r/CODEOFCONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

# Contributor Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/),
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
30 changes: 30 additions & 0 deletions aif360/aif360-r/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Contributing to the AIF360 R package

This guide is divided into three main parts:

1. Filing a bug report or feature request in an issue.
2. Suggesting a change via a pull request.
3. New features or enhancements to AIF360 functionality.

If you're not familiar with git or GitHub, please start by reading <http://r-pkgs.had.co.nz/git.html>

Please note that the AIF360 R package is released with a [Contributor Code of Conduct](CODEOFCONDUCT.md). By contributing to this project,
you agree to abide by its terms.

## Issues

If you find a bug, please search GitHub under [Issues](https://github.com/IBM/AIF360/issues) to ensure the bug was not already reported.
If you’re unable to find an open issue addressing the problem, [open a new one](https://github.com/IBM/AIF360/issues/new). Please include a title and clear description, as much relevant information as possible (such as required packages, data, etc.), and a code sample to replicate the issue.

## Pull requests

To contribute a change to the AIF360 R package, you follow these steps:

* Create a branch in git and make your changes.
* Push branch to GitHub and open a new pull request (PR).
* Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.

## New Features

The AIF360 R package is part of [AI Fairness 360](https://github.com/IBM/AIF360), developed with extensibility in mind. If you wish to suggest new metrics, explainers, algorithms or datasets. Please get in touch on [Slack]( https://aif360.slack.com) (invitation [here](https://aif360.slack.com/join/shared_invite/zt-5hfvuafo-X0~g6tgJQ~7tIAT~S294TQ))!

24 changes: 24 additions & 0 deletions aif360/aif360-r/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Package: aif360
Type: Package
Title: Help Detect and Mitigate Bias in Machine Learning Models
Version: 0.1.0
Authors@R: c(
person("Gabriela", "de Queiroz", email = "[email protected]", role = "aut"),
person("Stacey", "Ronaghan", email = "[email protected]", role = "aut"),
person("Saishruthi", "Swaminathan", email = "[email protected]",
role = c("aut", "cre")))
Description: The AI Fairness 360 toolkit is an open-source library to help detect
and mitigate bias in machine learning models. The AI Fairness 360 R 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.
License: Apache License (>= 2.0)
Encoding: UTF-8
LazyData: true
URL: https://github.com/IBM/AIF360
BugReports: https://github.com/IBM/AIF360/issues
Imports:
reticulate,
rstudioapi
RoxygenNote: 7.1.0
Suggests:
testthat
Loading

0 comments on commit ae55ccc

Please sign in to comment.