gamchanger


Namegamchanger JSON
Version 0.1.13 PyPI version JSON
download
home_pagehttps://github.com/xiaohk/gam-changer
SummaryA Python package to run GAM Changer in your computation notebooks.
upload_time2023-06-18 19:26:33
maintainer
docs_urlNone
authorJay Wang
requires_python>=3.6
licenseMIT license
keywords gamchanger
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1>
<a href="https://interpret.ml/gam-changer/"><img src='https://i.imgur.com/njlqCrQ.png' width='100%'></a>
</h1>

Interactive visualization tool to help domain experts and data scientists easily and responsibly edit Generalized Additive Models (GAMs).

<!-- [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/interpretml/gam-changer/master?urlpath=lab/tree/examples/gam_changer_adult.ipynb) -->

[![build](https://github.com/interpretml/GAMChanger/workflows/build/badge.svg)](https://github.com/interpretml/gam-changer/actions)
[![pypi](https://img.shields.io/pypi/v/gamchanger?color=blue)](https://pypi.org/project/gamchanger/)
[![Lite](https://gist.githubusercontent.com/xiaohk/9b9f7c8fa162b2c3bc3251a5c9a799b2/raw/a7fca1d0a2d62c2b49f60c0217dffbd0fe404471/lite-badge-launch-small.svg)](https://interpret.ml/gam-changer/notebook/retro/notebooks/?path=gam_changer_adult.ipynb)
[![license](https://img.shields.io/pypi/l/gamchanger?color=brightgreen)](https://github.com/interpretml/gam-changer/blob/master/LICENSE)
[![DOI:10.1145/3534678.3539074](https://img.shields.io/badge/DOI-10.1145/3534678.3539074-blue)](https://doi.org/10.1145/3534678.3539074)
[![arxiv badge](https://img.shields.io/badge/arXiv-2206.15465-red)](https://arxiv.org/abs/2206.15465)

<!-- <a href="https://youtu.be/D6whtfInqTc" target="_blank"><img src="https://i.imgur.com/J3C0aov.png" style="max-width:100%;"></a> -->

<table>
  <tr>
    <td colspan="2"><img src='https://i.imgur.com/eKzKJfl.png'></td>
  </tr>
  <tr></tr>
  <tr>
    <td><a href="https://youtu.be/D6whtfInqTc">📺 Video</a></td>
    <td><a href="https://dl.acm.org/doi/10.1145/3534678.3539074">📖 "Interpretability, Then What? Editing Machine Learning Models to Reflect Human Knowledge and Values"</a></td>
  </tr>
</table>

<!-- For more information, check out our manuscript:

[**GAM Changer: Editing Generalized Additive Models with Interactive Visualization**](https://arxiv.org/abs/2112.03245).
Zijie J. Wang, Alex Kale, Harsha Nori, Peter Stella, Mark Nunnally, Duen Horng Chau, Mihaela Vorvoreanu, Jennifer Wortman Vaughan, Rich Caruana.
*arXiv:2112.03245, 2021.* -->

## GAM Changer Features

<img align="center" width="600px" src="https://user-images.githubusercontent.com/15007159/184291928-c675b83e-be82-4206-bd30-47dc93008fec.gif">

---

## Get Started

For a live demo, visit: http://interpret.ml/gam-changer/

### How to Edit My Own GAMs?

You can use this demo to edit your own GAMs: choose the `my model` tab and upload the `model.json` (model weights) and `sample.json` (sample data to evaluate the model).

If you use [EBM](https://github.com/interpretml/interpret), you can generate these two files easily with the GAM Changer python package.

```shell
# First install the GAM Changer python package
pip install gamchanger
```

```python
import gamchanger as gc
from json import dump

# Extract model weights
model_data = gc.get_model_data(ebm)

# Generate sample data
sample_data = gc.get_sample_data(ebm, x_test, y_test)

# Save to `model.json` and `sample.json`
dump(model_data, open('./model.json', 'w'))
dump(sample_data, open('./sample.json', 'w'))
```

### Computational Notebook Widget

You can use GAM Changer directly in your computational notebooks (e.g., Jupyter Notebook, VSCode Notebook, Google Colab).

Check out three live notebook demos below.

|Jupyter Lite|Binder|Google Colab|
|:---:|:---:|:---:|
|[![Lite](https://gist.githubusercontent.com/xiaohk/9b9f7c8fa162b2c3bc3251a5c9a799b2/raw/a7fca1d0a2d62c2b49f60c0217dffbd0fe404471/lite-badge-launch-small.svg)](https://interpret.ml/gam-changer/notebook/retro/notebooks/?path=gam_changer_adult.ipynb)|[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/interpretml/gam-changer/master?urlpath=lab/tree/examples/gam_changer_adult.ipynb)|[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1OgAVZKqs2VwmY13QuOjCxlOEyexsYjtm?usp=sharing)|

Use the following snippet to load GAM Changer in your favorite notebooks:

```python
# Install the GAM Changer python package
!pip install gamchanger

import gamchanger as gc

# Load GAM Changer with the model and sample data
gc.visualize(ebm, x_feed, y_feed)
```

### Load Edited Models

After finishing editing a model, you can save the new model along with all the editing history to a `*.gamchanger` file by clicking the save button. You can load the new model in Python:

```python
from json import load
import gamchanger as gc

# Load the `*.gamchanger` file
gc_dict = load(open('./edit-8-27-2021.gamchanger', 'r'))

# This will return a deep copy of your original EBM where edits are applied
new_ebm = gc.get_edited_model(ebm, gc_dict)
```

## Development

Clone or download this repository:

```bash
git clone git@github.com:interpretml/gam-changer.git

# use degit if you don't want to download commit histories
degit interpretml/gam-changer.git
```

Install the dependencies:

```bash
npm install
```

Then run GAM Changer:

```bash
npm run dev
```

Navigate to [localhost:5000](https://localhost:5005). You should see GAM Changer running in your browser :)

## Credits

GAM Changer is created by <a href="https://zijie.wang">Jay Wang</a>,
<a href="http://students.washington.edu/kalea/">Alex Kale</a>,
<a href="https://www.linkedin.com/in/harshanori/">Harsha Nori</a>,
<a href="https://nyulangone.org/doctors/1548522964/peter-a-stella">Peter Stella</a>,
<a href="https://nyulangone.org/doctors/1144385360/mark-e-nunnally">Mark Nunnally</a>,
<a href="https://www.cc.gatech.edu/~dchau/">Polo Chau</a>,
<a href="https://www.microsoft.com/en-us/research/people/mivorvor/">Mickey Vorvoreanu</a>,
<a href="http://www.jennwv.com">Jenn Wortman Vaughan</a>,
and <a href="https://www.microsoft.com/en-us/research/people/rcaruana/">Rich Caruana</a>,
which was the result of a research collaboration between
Microsoft Research, NYU Langone Health, Georgia Tech and University of Washington.
Jay Wang and Alex Kale were summer interns at Microsoft Research.

We thank Steven Drucker, Adam Fourney, Saleema Amershi, Dean Carignan, Rob DeLine, Haekyu Park, and the InterpretML team for their support and constructive feedback.

## Citation

```bibTeX
@inproceedings{wangInterpretabilityThenWhat2022,
  title = {Interpretability, {{Then What}}? {{Editing Machine Learning Models}} to {{Reflect Human Knowledge}} and {{Values}}},
  shorttitle = {Interpretability, {{Then What}}?},
  booktitle = {Proceedings of the 28th {{ACM SIGKDD International Conference}} on {{Knowledge Discovery}} \& {{Data Mining}}},
  author = {Wang, Zijie J. and Kale, Alex and Nori, Harsha and Stella, Peter and Nunnally, Mark E. and Chau, Duen Horng and Vorvoreanu, Mihaela and Vaughan, Jennifer Wortman and Caruana, Rich},
  year = {2022},
  url = {https://interpret.ml/gam-changer},
}
```

## License

The software is available under the [MIT License](./LICENSE).

## Contact

If you have any questions, feel free to [open an issue](https://github.com/interpretml/gam-changer/issues/new) or contact [Jay Wang](https://zijie.wang).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/xiaohk/gam-changer",
    "name": "gamchanger",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "gamchanger",
    "author": "Jay Wang",
    "author_email": "jayw@zijie.wang",
    "download_url": "https://files.pythonhosted.org/packages/65/b9/9a1202cb59856a1a41533ff1ed3bd744633bfc8ce45ce897667764fb7ec3/gamchanger-0.1.13.tar.gz",
    "platform": null,
    "description": "<h1>\n<a href=\"https://interpret.ml/gam-changer/\"><img src='https://i.imgur.com/njlqCrQ.png' width='100%'></a>\n</h1>\n\nInteractive visualization tool to help domain experts and data scientists easily and responsibly edit Generalized Additive Models (GAMs).\n\n<!-- [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/interpretml/gam-changer/master?urlpath=lab/tree/examples/gam_changer_adult.ipynb) -->\n\n[![build](https://github.com/interpretml/GAMChanger/workflows/build/badge.svg)](https://github.com/interpretml/gam-changer/actions)\n[![pypi](https://img.shields.io/pypi/v/gamchanger?color=blue)](https://pypi.org/project/gamchanger/)\n[![Lite](https://gist.githubusercontent.com/xiaohk/9b9f7c8fa162b2c3bc3251a5c9a799b2/raw/a7fca1d0a2d62c2b49f60c0217dffbd0fe404471/lite-badge-launch-small.svg)](https://interpret.ml/gam-changer/notebook/retro/notebooks/?path=gam_changer_adult.ipynb)\n[![license](https://img.shields.io/pypi/l/gamchanger?color=brightgreen)](https://github.com/interpretml/gam-changer/blob/master/LICENSE)\n[![DOI:10.1145/3534678.3539074](https://img.shields.io/badge/DOI-10.1145/3534678.3539074-blue)](https://doi.org/10.1145/3534678.3539074)\n[![arxiv badge](https://img.shields.io/badge/arXiv-2206.15465-red)](https://arxiv.org/abs/2206.15465)\n\n<!-- <a href=\"https://youtu.be/D6whtfInqTc\" target=\"_blank\"><img src=\"https://i.imgur.com/J3C0aov.png\" style=\"max-width:100%;\"></a> -->\n\n<table>\n  <tr>\n    <td colspan=\"2\"><img src='https://i.imgur.com/eKzKJfl.png'></td>\n  </tr>\n  <tr></tr>\n  <tr>\n    <td><a href=\"https://youtu.be/D6whtfInqTc\">\ud83d\udcfa Video</a></td>\n    <td><a href=\"https://dl.acm.org/doi/10.1145/3534678.3539074\">\ud83d\udcd6 \"Interpretability, Then What? Editing Machine Learning Models to Reflect Human Knowledge and Values\"</a></td>\n  </tr>\n</table>\n\n<!-- For more information, check out our manuscript:\n\n[**GAM Changer: Editing Generalized Additive Models with Interactive Visualization**](https://arxiv.org/abs/2112.03245).\nZijie J. Wang, Alex Kale, Harsha Nori, Peter Stella, Mark Nunnally, Duen Horng Chau, Mihaela Vorvoreanu, Jennifer Wortman Vaughan, Rich Caruana.\n*arXiv:2112.03245, 2021.* -->\n\n## GAM Changer Features\n\n<img align=\"center\" width=\"600px\" src=\"https://user-images.githubusercontent.com/15007159/184291928-c675b83e-be82-4206-bd30-47dc93008fec.gif\">\n\n---\n\n## Get Started\n\nFor a live demo, visit: http://interpret.ml/gam-changer/\n\n### How to Edit My Own GAMs?\n\nYou can use this demo to edit your own GAMs: choose the `my model` tab and upload the `model.json` (model weights) and `sample.json` (sample data to evaluate the model).\n\nIf you use [EBM](https://github.com/interpretml/interpret), you can generate these two files easily with the GAM Changer python package.\n\n```shell\n# First install the GAM Changer python package\npip install gamchanger\n```\n\n```python\nimport gamchanger as gc\nfrom json import dump\n\n# Extract model weights\nmodel_data = gc.get_model_data(ebm)\n\n# Generate sample data\nsample_data = gc.get_sample_data(ebm, x_test, y_test)\n\n# Save to `model.json` and `sample.json`\ndump(model_data, open('./model.json', 'w'))\ndump(sample_data, open('./sample.json', 'w'))\n```\n\n### Computational Notebook Widget\n\nYou can use GAM Changer directly in your computational notebooks (e.g., Jupyter Notebook, VSCode Notebook, Google Colab).\n\nCheck out three live notebook demos below.\n\n|Jupyter Lite|Binder|Google Colab|\n|:---:|:---:|:---:|\n|[![Lite](https://gist.githubusercontent.com/xiaohk/9b9f7c8fa162b2c3bc3251a5c9a799b2/raw/a7fca1d0a2d62c2b49f60c0217dffbd0fe404471/lite-badge-launch-small.svg)](https://interpret.ml/gam-changer/notebook/retro/notebooks/?path=gam_changer_adult.ipynb)|[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/interpretml/gam-changer/master?urlpath=lab/tree/examples/gam_changer_adult.ipynb)|[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1OgAVZKqs2VwmY13QuOjCxlOEyexsYjtm?usp=sharing)|\n\nUse the following snippet to load GAM Changer in your favorite notebooks:\n\n```python\n# Install the GAM Changer python package\n!pip install gamchanger\n\nimport gamchanger as gc\n\n# Load GAM Changer with the model and sample data\ngc.visualize(ebm, x_feed, y_feed)\n```\n\n### Load Edited Models\n\nAfter finishing editing a model, you can save the new model along with all the editing history to a `*.gamchanger` file by clicking the save button. You can load the new model in Python:\n\n```python\nfrom json import load\nimport gamchanger as gc\n\n# Load the `*.gamchanger` file\ngc_dict = load(open('./edit-8-27-2021.gamchanger', 'r'))\n\n# This will return a deep copy of your original EBM where edits are applied\nnew_ebm = gc.get_edited_model(ebm, gc_dict)\n```\n\n## Development\n\nClone or download this repository:\n\n```bash\ngit clone git@github.com:interpretml/gam-changer.git\n\n# use degit if you don't want to download commit histories\ndegit interpretml/gam-changer.git\n```\n\nInstall the dependencies:\n\n```bash\nnpm install\n```\n\nThen run GAM Changer:\n\n```bash\nnpm run dev\n```\n\nNavigate to [localhost:5000](https://localhost:5005). You should see GAM Changer running in your browser :)\n\n## Credits\n\nGAM Changer is created by <a href=\"https://zijie.wang\">Jay Wang</a>,\n<a href=\"http://students.washington.edu/kalea/\">Alex Kale</a>,\n<a href=\"https://www.linkedin.com/in/harshanori/\">Harsha Nori</a>,\n<a href=\"https://nyulangone.org/doctors/1548522964/peter-a-stella\">Peter Stella</a>,\n<a href=\"https://nyulangone.org/doctors/1144385360/mark-e-nunnally\">Mark Nunnally</a>,\n<a href=\"https://www.cc.gatech.edu/~dchau/\">Polo Chau</a>,\n<a href=\"https://www.microsoft.com/en-us/research/people/mivorvor/\">Mickey Vorvoreanu</a>,\n<a href=\"http://www.jennwv.com\">Jenn Wortman Vaughan</a>,\nand <a href=\"https://www.microsoft.com/en-us/research/people/rcaruana/\">Rich Caruana</a>,\nwhich was the result of a research collaboration between\nMicrosoft Research, NYU Langone Health, Georgia Tech and University of Washington.\nJay Wang and Alex Kale were summer interns at Microsoft Research.\n\nWe thank Steven Drucker, Adam Fourney, Saleema Amershi, Dean Carignan, Rob DeLine, Haekyu Park, and the InterpretML team for their support and constructive feedback.\n\n## Citation\n\n```bibTeX\n@inproceedings{wangInterpretabilityThenWhat2022,\n  title = {Interpretability, {{Then What}}? {{Editing Machine Learning Models}} to {{Reflect Human Knowledge}} and {{Values}}},\n  shorttitle = {Interpretability, {{Then What}}?},\n  booktitle = {Proceedings of the 28th {{ACM SIGKDD International Conference}} on {{Knowledge Discovery}} \\& {{Data Mining}}},\n  author = {Wang, Zijie J. and Kale, Alex and Nori, Harsha and Stella, Peter and Nunnally, Mark E. and Chau, Duen Horng and Vorvoreanu, Mihaela and Vaughan, Jennifer Wortman and Caruana, Rich},\n  year = {2022},\n  url = {https://interpret.ml/gam-changer},\n}\n```\n\n## License\n\nThe software is available under the [MIT License](./LICENSE).\n\n## Contact\n\nIf you have any questions, feel free to [open an issue](https://github.com/interpretml/gam-changer/issues/new) or contact [Jay Wang](https://zijie.wang).\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "A Python package to run GAM Changer in your computation notebooks.",
    "version": "0.1.13",
    "project_urls": {
        "Homepage": "https://github.com/xiaohk/gam-changer"
    },
    "split_keywords": [
        "gamchanger"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "366e7a6e5788bdbda3cad3fcd66fb5109a07a3d4719ae8af2af4730821d0a8a2",
                "md5": "d6fedc38ef509e7c6e6db60e87b280fd",
                "sha256": "f1fd7e5f169ae59bbd8d45da8ef6dc28df41d85848a45b81f0e4966dba81db79"
            },
            "downloads": -1,
            "filename": "gamchanger-0.1.13-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d6fedc38ef509e7c6e6db60e87b280fd",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 200799,
            "upload_time": "2023-06-18T19:26:31",
            "upload_time_iso_8601": "2023-06-18T19:26:31.143068Z",
            "url": "https://files.pythonhosted.org/packages/36/6e/7a6e5788bdbda3cad3fcd66fb5109a07a3d4719ae8af2af4730821d0a8a2/gamchanger-0.1.13-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "65b99a1202cb59856a1a41533ff1ed3bd744633bfc8ce45ce897667764fb7ec3",
                "md5": "7ae29d8b1c34dc09d27e5788c0e3fc60",
                "sha256": "8c31ee6991158a625229c56b1c37559f121141a9cf2742248a9ba05e7cf7879d"
            },
            "downloads": -1,
            "filename": "gamchanger-0.1.13.tar.gz",
            "has_sig": false,
            "md5_digest": "7ae29d8b1c34dc09d27e5788c0e3fc60",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 195731,
            "upload_time": "2023-06-18T19:26:33",
            "upload_time_iso_8601": "2023-06-18T19:26:33.656928Z",
            "url": "https://files.pythonhosted.org/packages/65/b9/9a1202cb59856a1a41533ff1ed3bd744633bfc8ce45ce897667764fb7ec3/gamchanger-0.1.13.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-18 19:26:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xiaohk",
    "github_project": "gam-changer",
    "github_not_found": true,
    "lcname": "gamchanger"
}
        
Elapsed time: 0.08713s