GithubHelp home page GithubHelp logo

equialgo / fairness-in-ml Goto Github PK

View Code? Open in Web Editor NEW
115.0 9.0 47.0 27.21 MB

This repository contains the full code for the "Towards fairness in machine learning with adversarial networks" blog post.

License: MIT License

Jupyter Notebook 97.50% Python 2.50%

fairness-in-ml's Introduction

Fairness in Machine Learning

This project demonstrates how make fair machine learning models.

Fair training

Notebooks

Getting started

This repo uses conda's virtual environment for Python 3.

Install (mini)conda if not yet installed.

For MacOS:

$ wget http://repo.continuum.io/miniconda/Miniconda-latest-MacOSX-x86_64.sh -O miniconda.sh
$ chmod +x miniconda.sh
$ ./miniconda.sh -b

cd into this directory and create the conda virtual environment for Python 3 from environment.yml:

$ conda env create -f environment.yml

Activate the virtual environment:

$ source activate fairness-in-ml

Install the fairness library:

$ python setup.py develop

Contributing

If you have applied these models to a different dataset or implemented any other fair models, consider submitting a Pull Request!

fairness-in-ml's People

Contributors

hgrif avatar rogiervandergeer 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

fairness-in-ml's Issues

Serialize fair classifier

Nice work, thanks for sharing. Do you have a recommendation for serializing _trainable_clf_net to the exclusion of _trainable_adv_net.

For example,

from keras.models import load_model
_trainable_clf_net.save('fair_model.h5')

Regression Examples

Are there any example notebooks dealing with regression or any steps to change if anyone wants to leverage adversarial networks for fairness?

Classifier is trained on full dataset during third phase in Keras code, but single batch in PyTorch code

Hello Team/equialgo;

Thank you first of all for your very interesting article and implementations.

I have some questions please:

  1. while during the third phase, Keras code is training the classifier in the whole dataset, but not in the Pytorch code ?
  2. Why have you changed later on towards this "whole dataset training" for the unfair classifier ?
  3. Let's say we have a classification of gender, that is unfair, that we want to make fair against origins. Is this technique working on CNN models ? i've started in implementation on CNNs, but still want to confirm I'm on the right direction :).

Thank you very much !
Habib

Great work. This worked a year ago but now getting an issue I can't solve regarding attribute 'keys'

This is a great application.

I played around with this some for a custom application, and last year it worked well. However, when I tried to run it yesterday (pretraining and fitting) I experienced an error I'm having a hard time correcting. Any idea how to solve:

AttributeError: 'list' object has no attribute 'keys'

I assume it has to do with the class weights but am having challenges correcting.

Convert Pandas dataframes to Numpy arrays for the Keras estimator using .values

Nice post on a delicate and important subject. I've shared with G+ AI Machine & Deep Learning (moderated) and Deep Learning Community. In order to run it smoothly I've made small corrections.

Just before training the model (nn_classifier), since X_train and y_train are Pandas dataframes we need to convert them to Numpy arrays for the Keras estimator using .values

X_train = X_train.values
y_train = y_train.values

Is-it good to you?

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.