Git Product home page Git Product logo

fairness-comparison's Introduction

This repository is meant to facilitate the benchmarking of fairness aware machine learning algorithms.

The associated paper is:

A comparative study of fairness-enhancing interventions in machine learning by Sorelle A. Friedler, Carlos Scheidegger, Suresh Venkatasubramanian, Sonam Choudhary, Evan P. Hamilton, and Derek Roth. https://arxiv.org/abs/1802.04422

To install this software run:

$ pip3 install fairness

The below instructions are still in the process of being updated to work with the new pip install-able version.

To run the benchmarks:

$ from fairness.benchmark import run
$ run()

This will write out metrics for each dataset to the results/ directory.

To generate graphs and other analysis run:

$ python3 analysis.py

If you do not yet have all the packages installed, you may need to run:

$ pip install -r requirements.txt

Optional: The benchmarks rely on preprocessed versions of the datasets that have been included in the repository. If you would like to regenerate this preprocessing, run the below command before running the benchmark script:

$ python3 preprocess.py

To add new datasets or algorithms, see the instructions in the readme files in those directories.

OS-specific things

On Ubuntu

(We tested on Ubuntu 16.04, your mileage may vary)

You'll need python3-dev:

$ sudo apt-get install python3-dev

Additional analysis-specific requirements

To regenerate figures (this is messy right now. we're working on it)

Python requirements (use pip):

  • ggplot

System requirements:

R package requirements (use install.packages):

  • rmarkdown
  • stringr
  • ggplot2
  • dplyr
  • magrittr
  • corrplot
  • robust

fairness-comparison's People

Contributors

cscheid avatar dbroth avatar evanphamilton avatar jnim avatar kvsroyal avatar olliethomas avatar sonamchoudhary avatar sorelle avatar yli11 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fairness-comparison's Issues

UndefinedMetricWarning and run parameters {} failed

using python 3.7 on Windows 10. installed with pip3 utilized

from fairness.benchmark import run
Available algorithms:
SVM
GaussianNB
LR
DecisionTree
Kamishima
Calders
ZafarBaseline
ZafarFairness
ZafarAccuracy
Kamishima-accuracy
Kamishima-DIavgall
Feldman-SVM
Feldman-GaussianNB
Feldman-LR
Feldman-DecisionTree
Feldman-SVM-DIavgall
Feldman-SVM-accuracy
Feldman-GaussianNB-DIavgall
Feldman-GaussianNB-accuracy

run()
Datasets: '['ricci', 'adult', 'german', 'propublica-recidivism', 'propublica-violent-recidivism']'

Evaluating dataset:ricci
Sensitive attribute:Race
Algorithm: SVM
supported types: {'numerical', 'numerical-binsensitive'}
C:\Users\kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sklearn\metrics_classification.py:1221: UndefinedMetricWarning: Recall is ill-defined and being set to 0.0 due to no true samples. Use zero_division parameter to control this behavior.
_warn_prf(average, modifier, msg_start, len(result))
C:\Users\kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sklearn\metrics_classification.py:1221: UndefinedMetricWarning: Recall is ill-defined and being set to 0.0 due to no true samples. Use zero_division parameter to control this behavior.


C:\Users\kevin\Documents\GitHub\fairness-comparison-master\fairness\algorithms\kamishima\KamishimaAlgorithm.py:99: UserWarning: loadtxt: Empty input file: "C:\Users\kevin\AppData\Local\Temp\tmps24_t_kk"
m = numpy.loadtxt(output_name)
run for parameters {} failed: too many indices for array
C:\Users\kevin\Documents\GitHub\fairness-comparison-master\fairness\algorithms\kamishima\KamishimaAlgorithm.py:99: UserWarning: loadtxt: Empty input file: "C:\Users\kevin\AppData\Local\Temp\tmp86i67yum"
m = numpy.loadtxt(output_name)
run for parameters {} failed: too many indices for array
C:\Users\kevin\Documents\GitHub\fairness-comparison-master\fairness\algorithms\kamishima\KamishimaAlgorithm.py:99: UserWarning: loadtxt: Empty input file: "C:\Users\kevin\AppData\Local\Temp\tmp3q3uqt1g"
m = numpy.loadtxt(output_name)
run for parameters {} failed: too many indices for array

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.