Code Monkey home page Code Monkey logo

poloclub / gam-coach Goto Github PK

View Code? Open in Web Editor NEW
16.0 2.0 3.0 38.99 MB

Personal coach to help you obtain desired AI decisions!

Home Page: https://poloclub.github.io/gam-coach/

License: MIT License

Makefile 0.26% Python 12.03% JavaScript 57.64% CSS 1.48% HTML 0.62% Svelte 19.33% SCSS 8.53% Shell 0.11%
counterfactual-explanations generalized-additive-models integer-programming interactive-visualizations machine-learning recourse visualization

gam-coach's Introduction

GAM Coach

An interactive tool to help everyday users discover actionable strategies to obtain desired AI decisions.

build license doc npm pypi arxiv badge

๐Ÿš€ Live Demo ๐Ÿ“บ Demo Video ๐Ÿ“– Research Paper

What is GAM Coach?

GAM Coach is an interactive tool that helps everyday users understand and alter machine learning models' decisions. It shows users diverse ways to change their input data so that they can get a different output from the model, and it allows users to customize these suggestions through a few clicks! For example, if a user wants to get approved for a loan, GAM Coach may suggest they increase their credit score. If the user finds it difficult to increase their credit score, GAM Coach will search for alternative strategies, such as lowering the loan amount.

Live Demo

For a live demo, visit: https://poloclub.github.io/gam-coach/

Running Locally

Clone or download this repository:

git clone [email protected]:poloclub/gam-coach.git

# use --depth if you don't want to download the whole commit history
git clone --depth 1 [email protected]:poloclub/gam-coach.git

Install the dependencies:

cd gamcoach-ui
npm install

Then run GAM Coach:

npm run dev

Navigate to localhost:5005. You should see GAM Coach running in your browser :)

Use the Python Library

You can also use GAM Coach as a Python library to generate customizable counterfactual examples for generalized additive models (GAMs). You can install GAM Coach through pip.

Then, you only need one function call to generate customizable counterfactual examples for your GAM models!

import gamcoach as coach

# First create a GAM Coach object
# It requires to provide the training data, so it can generate better CFs based
# on the data distribution
my_coach = coach.GAMCoach(ebm, x_train)

cfs = my_coach.generate_cfs(
    cur_example,
    total_cfs=3,
    # List of features that the CFs can change
    features_to_vary=['loan_amnt', 'term', 'emp_length', 'home_ownership',
                      'annual_inc', 'purpose', 'dti', 'open_acc', 'revol_bal',
                      'revol_util', 'total_acc', 'application_type', 'mort_acc',
                      'fico_score'],
    # Some continuous features need to have integer values in practice
    continuous_integer_features=['open_acc', 'total_acc', 'mort_acc', 'fico_score']
)

For more details and examples, read our documentation.

pip install gamcoach

Set Up Your Own GAM Coach

In the demo page, we provide five demos with the most commonly used datasets in the algorithmic recourse literature. You can easily set up a GAM Coach for your own GAM model (with only one function call). See this documentation page for details.

You can also check out this example notebook to see how to extract GAM model weights for GAM Coach.

Credits

GAM Coach is a result of a collaboration between ML and visualization researchers from Georgia Tech and Microsoft Research. GAM Coach is created by Jay Wang, Jenn Wortman Vaughan, Rich Caruana, and Polo Chau.

Citation

To learn more about GAM Coach, please read our research paper (published at CHI 2023).

@article{wangGAMCoachInteractive2023,
  title = {{{GAM Coach}}: {{Towards Interactive}} and {{User-centered Algorithmic Recourse}}},
  author = {Wang, Zijie J. and Vaughan, Jennifer Wortman and Caruana, Rich and Chau, Duen Horng},
  year = {2023},
  doi = {10.1145/3544548.3580816}
  journal = {arXiv:2302.14165},
  url = {https://arxiv.org/abs/2302.14165},
  archiveprefix = {arXiv}
}

License

The software is available under the MIT License.

Contact

If you have any questions, feel free to open an issue or contact Jay Wang.

gam-coach's People

Contributors

xiaohk avatar

Stargazers

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

Watchers

 avatar  avatar

gam-coach's Issues

Additional instructions for adding new ebm models

Hello,

Thanks for the amazing job done on gam-coach.
I was working through the example of extracting a model and running locally, from (gam_coach_extract_model.ipynb).
I noticed the instructions (which was very easy to follow, by the way) ended after copying the generated json files to the appropriate folders. According to the tutorial, restarting npm should be enough to have the new model show up in the interface.
This didn't work for me and I had to make the following additions to the Article.svelte file.

index b583a4b..1e71cc3 100644
--- a/gamcoach-ui/src/components/article/Article.svelte
+++ b/gamcoach-ui/src/components/article/Article.svelte
@@ -44,6 +44,7 @@
   import samplesCompas from '../../config/data/compas-classifier-random-samples.json';
   import samplesCrime from '../../config/data/crime-classifier-random-samples.json';
   import samplesCrimeFull from '../../config/data/crime-full-classifier-random-samples.json';
+  import samplesMnist from '../../config/data/mnist-classifier-random-samples.json';
 
   export let modelName = 'lc';
 
@@ -59,7 +60,8 @@
     { name: 'adult', display: 'Adult Census Income' },
     { name: 'german', display: 'German Credit' },
     { name: 'compas', display: 'COMPAS' },
-    { name: 'credit', display: 'Credit' }
+    { name: 'credit', display: 'Credit' },
+    { name: 'mnist', display: 'Mnist' },
   ];
 
   const initModelInfo = () => {
@@ -100,6 +102,11 @@
         curIndex = 368;
         break;
       }
+      case 'mnist': {
+        curSamples = samplesMnist;
+        curIndex = 0;
+        break;
+      }
       default: {
         console.warn('Unknown model name');
         curSamples = samplesLC;

I am not sure if I missed something and this change is to be implemented automatically, or does a line or two need to be added in the instructions in the notebook for this?
I would be happy to assist in implementing this if required.

Thanks

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.