https://github.com/csinva/transformation-importance

Using / reproducing TRIM from the paper "Transformation Importance with Applications to Cosmology" 🌌 (ICLR Workshop 2020)

https://github.com/csinva/transformation-importance

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • â—‹
    CITATION.cff file
  • ✓
    codemeta.json file
    Found codemeta.json file
  • â—‹
    .zenodo.json file
  • â—‹
    DOI references
  • ✓
    Academic publication links
    Links to: arxiv.org
  • â—‹
    Academic email domains
  • â—‹
    Institutional organization owner
  • â—‹
    JOSS paper metadata
  • â—‹
    Scientific vocabulary similarity
    Low similarity (11.7%) to scientific vocabulary

Keywords

ai artificial-intelligence attribution data-science deep-learning deep-neural-networks explainability explainable-ai feature-engineering feature-importance frequency-domain interpretability interpretation machine-learning ml neural-network pytorch transform transformation wavelet-analysis
Last synced: 5 months ago · JSON representation

Repository

Using / reproducing TRIM from the paper "Transformation Importance with Applications to Cosmology" 🌌 (ICLR Workshop 2020)

Basic Info
Statistics
  • Stars: 9
  • Watchers: 5
  • Forks: 1
  • Open Issues: 1
  • Releases: 0
Topics
ai artificial-intelligence attribution data-science deep-learning deep-neural-networks explainability explainable-ai feature-engineering feature-importance frequency-domain interpretability interpretation machine-learning ml neural-network pytorch transform transformation wavelet-analysis
Created over 6 years ago · Last pushed about 5 years ago
Metadata Files
Readme License

readme.md

Official code for using / reproducing TRIM from the paper Transformation Importance with Applications to Cosmology (ICLR 2020 Workshop). This code shows examples and provides useful wrappers for calculating importance in a transformed feature space.

This repo is actively maintained. For any questions please file an issue.

trim

examples/documentation

  • dependencies: depends on the pip-installable acd package
  • examples: different folders (e.g. ex_cosmology, exfakenews, ex_mnist, exurbansound contain examples for using TRIM in different settings)
  • src: the core code is in the trim folder, containing wrappers and code for different transformations
  • requirements: tested with python 3.7 and pytorch > 1.0

| Attribution to different scales in cosmological images | Fake news attribution to different topics | | ------------------------------------------------------ | ----------------------------------------- | | | |

| Attribution to different NMF components in MNIST classification | Attribution to different frequencies in audio classification | | ------------------------------------------------------------ | ------------------------------------------------------------ | | | |

sample usage

```python import torch import torch.nn as nn from trim import TrimModel from functools import partial

setup a trim model

model = nn.Sequential(nn.Linear(10, 10), nn.ReLU(), nn.Linear(10, 1)) # orig model transform = partial(torch.rfft, signalndim=1, onesided=False) # fft invtransform = partial(torch.irfft, signalndim=1, onesided=False) # inverse fft modeltrim = TrimModel(model=model, invtransform=invtransform) # trim model

get a data point

x = torch.randn(1, 10) s = transform(x)

can now use any attribution method on the trim model

get (inputxgradient) attribution in the fft space

s.requiresgrad = True modeltrim(s).backward() inputxgradient = s.grad * s ``` - see notebooks for more detailed usage

related work

  • ACD (ICLR 2019 pdf, github) - extends CD to CNNs / arbitrary DNNs, and aggregates explanations into a hierarchy
  • CDEP (ICML 2020 pdf, github) - penalizes CD / ACD scores during training to make models generalize better
  • DAC (arXiv 2019 pdf, github) - finds disentangled interpretations for random forests
  • PDR framework (PNAS 2019 pdf) - an overarching framewwork for guiding and framing interpretable machine learning

reference

  • feel free to use/share this code openly
  • if you find this code useful for your research, please cite the following:

r @article{singh2020transformation, title={Transformation Importance with Applications to Cosmology}, author={Singh, Chandan and Ha, Wooseok and Lanusse, Francois, and Boehm, Vanessa, and Liu, Jia and Yu, Bin}, journal={arXiv preprint arXiv:2003.01926}, year={2020}, url={https://arxiv.org/abs/2003.01926}, }

Owner

  • Name: Chandan Singh
  • Login: csinva
  • Kind: user
  • Location: Microsoft research
  • Company: Senior researcher

Senior researcher @Microsoft interpreting ML models in science and medicine. PhD from UC Berkeley.

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • AhmedRedaElmahalawy (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

requirements.txt pypi
  • acd *
  • imodels *
  • numpy *
  • pandas *
  • scipy *
  • torch *
  • tqdm *
setup.py pypi
  • numpy *
  • scikit-image *
  • scipy *
  • torch *
  • tqdm *