poloclub / gam-coach

Personal coach to help you obtain desired AI decisions!
https://poloclub.github.io/gam-coach/
MIT License
17 stars 3 forks source link

Additional instructions for adding new ebm models #1

Open Lagyamfi opened 1 year ago

Lagyamfi commented 1 year ago

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

xiaohk commented 1 year ago

Hello @Lagyamfi, thanks for trying out GAM Coach!! Yup, your approach is correct! I should be more clear that users need to add these changes in the Article.svelte file to use the new datasets.

I will also consider adding a new page where users can drag-and-drop their json files into the interface (like GAM Changer)

Just curious, what's your use case with GAM Coach? Is mnist the image dataset? 🤔

img

Lagyamfi commented 1 year ago

Thanks for your response. Yes definitely, this sort of interface would help a lot. It avoids one having to mess with some of the files unless absolutely required. I am using MNIST hand digits dataset. My research is on visualization of counterfactuals generally for model builders and end users, and i started the exploration with this dataset but the idea is to transfer it to more real world datasets. Recently discovered your GAM changer and your accompanying paper; so far one of the best ideas on visualisation of counterfactuals. It is definitely in the right direction. I will be watching this, and contribute where required.