Giter VIP home page Giter VIP logo

bhaktipriya / model-remediation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tensorflow/model-remediation

0.0 1.0 0.0 1.54 MB

Model Remediation is a library that provides solutions for machine learning practitioners working to create and train models in a way that reduces or eliminates user harm resulting from underlying performance biases.

Home Page: https://www.tensorflow.org/responsible_ai/model_remediation?hl=en

License: Apache License 2.0

Python 100.00%

model-remediation's Introduction

TensorFlow Model Remediation

TensorFlow Model Remediation is a library that provides solutions for machine learning practitioners working to create and train models in a way that reduces or eliminates user harm resulting from underlying performance biases.

PyPI version

Tutorial

Overview

Installation

You can install the package from pip:

$ pip install tensorflow-model-remediation

Note: Make sure you are using TensorFlow 2.x.

Documentation

This library contains a collection of machine learning remediation techniques for addressing potential bias in a model.

Currently TensorFlow Model Remediation contains the below techniques:

  • MinDiff technique: Typically used to ensure that a model predicts the preferred label equally well for all values of a sensitive attribute. Helpful when trying to achieve equality of opportunity.

  • Counterfactual Logit Pairing technique: Typically used to ensure that a model’s prediction does not change between “counterfactual pairs”, where the sensitive attribute referenced in a feature is different. Helpful when trying to achieve counterfactual fairness.

We recommend starting with the overview guide to get an idea of TensorFlow Model Remediation. Next try one of our interactive guides like the

MinDiff tutorial notebook.

Counterfactual tutorial notebook.

import tensorflow_model_remediation as tfmr

import tensorflow as tf

# Start by defining a Keras model.

original_model = ...

# Next pick the remediation technique you'd like to use. For example, a
# MinDiff implementation might look like the below:
# Set the MinDiff weight and choose a loss.

min_diff_loss = tfmr.min_diff.losses.MMDLoss()

min_diff_weight = 1.0  # Hyperparamater to be tuned.

# Create a MinDiff model.

min_diff_model = tfmr.min_diff.keras.MinDiffModel(

   original_model, min_diff_loss, min_diff_weight)

# Compile the MinDiff model as you normally would do with the original model.

min_diff_model.compile(...)

# Create a MinDiff Dataset and train the min_diff_model on it.

min_diff_model.fit(min_diff_dataset, ...)

Disclaimers

If you're interested in learning more about responsible AI practices, including

fairness, please see Google AI's Responsible AI Practices.

tensorflow/model_remediation is Apache 2.0 licensed. See the LICENSE file.

model-remediation's People

Contributors

anirudh161 avatar askerry avatar bhaktipriya avatar haifeng-jin avatar itaiz-google avatar lamberta avatar markdaoust avatar markmcd avatar martinwicke avatar rchao avatar samuelmarks avatar seano314 avatar tgreensp avatar theadactyl avatar

Watchers

 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.