GithubHelp home page GithubHelp logo

fairmi's Introduction

Source Code


In Fair Classification without Constraints: A feature Pruning Approach, we propose a pre-processing approach that prunes the features that are highly correlated with the protected attributes. In this repository, we conduct several experiments to compare test error, fairness violation, and runtime among different methods.

Setup

  • Recommended Python version: 3.7.7
  • Python package installation:
$ pip install -r requirements.txt 
  • Create directory for results and figures
$ mkdir figures
$ mkdir results
  • Create directory for CelebA processed data
$ mkdir celeba

which should include the following files generated by celeba.ipynb

  • celeba.test.npy
  • celeba.train.npy
  • celeba_label.test.npy
  • celeba_label.train.npy

Usage

Run Pipeline and Plot Figures

python main.py [options arguments here]
optional arguments:
    -n                  int, number of features to drop, default: 20
    --noise_rate        float, the percentage of samples to add noise, default: 0.0
    --repeats           int, number of times to repeat the experiment, default: 5
    --grid_size         int, number of Lagrange multipliers to generate in the grid, default: 5
    --asymmetric_noise  boolean, whether the noise is asymmetric, default: False
    --lambda_value      float, lambda value for dropping features, default: 0.0
    --model             string, specify the base classifier for training, should be one of 'LR'(Logistic Regression), 'SVM'(Support Vector Machine), 'MLP'(Multi-layer Perceptron), default: 'LR'
    --constraints       string, specify fairness violation, should be one of 'DP'(Demographic Parity) and 'EO'(Equalized Odds), default: 'DP'
    --partitions        int, the number of partitions for constraint weight in GridSearch. For example, if partitions=5, then the program will use 0. , 0.2, 0.4, 0.6, 0.8, and 1. as constraint weight for training perspectively. default: 5
    --datasets          string, the dataset used for training, should be one of 'adult_sex'(adult dataset, sex as sensitive attribtue), 'adult_race'(adult dataset, race as sensitive attribtue), 'adult_sex_race'(adult dataset, sex and race as sensitive attribtues), 'compas'(compas dataset, race as sensitive attribtue), 'celeba'(CelebA dataset, gender as sensitive attribute), 'celeba_young_male'(CelebA dataset, young and gender as sensitive attribtues). default: 'adult_sex'

Example:

$ python main.py --dataset=celeba -n=128 --constraint=EO --noise_rate=0.3 --asymmetric_noise=True

Runtime Analysis

python runtime_analysis.py [options arguments here]

Option arguments same as above. Example:

$ python runtime_analysis.py --dataset=celeba -n=128 --constraint=EO --noise_rate=0.3 --asymmetric_noise=True

fairmi's People

Contributors

faldict avatar hk-mp5a3 avatar

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.