maxidl / MMD-critic

A PyTorch based implementation of MMD-critic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MMD-critic

Work-in-progress implementation of

Examples are not Enough, Learn to Criticize! Criticism for Interpretability. Been Kim, Rajiv Khanna, Sanmi Koyejo. NeurIPS 2016

Setup

git clone https://github.com/maxidl/MMD-critic.git
cd MMD-critic

Installing Dependencies

  • pytorch (for now everything is run on cpu)
  • matplotlib
  • scikit-learn (for digits only)
  • torchvision (for imagenet only)
  • tqdm (for imagenet only)

Example dependency install using conda with cpu only pytorch:

conda create -n mmd-critic python=3.8 scikit-learn matplotlib
conda activate mmd-critic
conda install -c pytorch pytorch cpuonly 

Downloading data for the digits example

mkdir ./data
wget https://raw.githubusercontent.com/BeenKim/MMD-critic/master/data/usps -P ./data
wget https://raw.githubusercontent.com/BeenKim/MMD-critic/master/data/usps.t -P ./data

Digits example

python digits.py

Imagenet example

python imagenet.py

This example requires the ImageNet dataset. Make sure to set imagenet_root inside of imagenet.py.

Some example plots for class_name = 'Blenheim spaniel'

Using image embeddings (2084 dim) from resnet50

Using raw images (flattened):

Reference

To-Do

  • add 1NN classifier
  • add more examples

About

A PyTorch based implementation of MMD-critic

License:MIT License


Languages

Language:Python 100.0%