Skip to content

nathanwang000/Shapley-Flow

Repository files navigation

Shapley Flow

This repository contains implementation for the AISTATS 2021 paper ”Shapley Flow: A Graph-based Approach to Interpreting Model Predictions”.

The directory is organized as the following.

notebooks/ contains case studies and experiments for the paper

archive/ include note and experiments for previous iterations of the project.

Files in the current directory include implementations of the algorithm and baselines.

Installation

We rely on pygraphviz for visualization. Installing pygraphviz requires to install graphviz first, see this post if pygraphviz fails to install.

install dependencies via pip

pip3 install shapflow
from shapflow import flow
flow.example_concise() # running the sanity check example in flow.py

get graphviz related packages

brew install graphviz # for mac os
python -m pip install \
 --global-option=build_ext \
 --global-option="-I$(brew --prefix graphviz)/include/" \
 --global-option="-L$(brew --prefix graphviz)/lib/" \
 pygraphviz # see https://github.com/pygraphviz/pygraphviz/issues/398 for an explanation
pip install graphviz

Now it should be able to run

python flow.py # should output a print out of flow credit for a sample graph

manually installing via pip one by one

python3 -m venv venv # create virtual env, I'm using python 3.10.8
. venv/bin/activate
pip install xgboost
pip install pandas
pip install tqdm
pip install joblib
pip install dill
pip install scikit-learn

One can check that the installation works:

python flow.py # should output a print out of flow credit for a sample graph

install via pipenv

Some users reported errors installing using pipenv, try the above 2 methods first

Install dependencies using pipenv

pip install pipenv
pipenv shell # create a shell that can later deactivate by Ctrl-d
pipenv install # install all packages in Pipfile

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published