Skip to main content

# FastSHAP (V1) > This project brings in part of the SHAP library into fastai (V1) and make it compatible. Thank you to Nestor Demeure for his assistance with the project!

## Install

pip install fastshap

## How to use

First we’ll quickly train a ADULTS tabular model

` from fastai2.tabular.all import * `

` path = untar_data(URLs.ADULT_SAMPLE) df = pd.read_csv(path/'adult.csv') `

` dep_var = 'salary' cat_names = ['workclass', 'education', 'marital-status', 'occupation', 'relationship', 'race'] cont_names = ['age', 'fnlwgt', 'education-num'] procs = [Categorify, FillMissing, Normalize] `

` splits = IndexSplitter(list(range(800,1000)))(range_of(df)) to = TabularPandas(df, procs, cat_names, cont_names, y_names="salary", splits=splits) dls = to.dataloaders() `

` learn = tabular_learner(dls, layers=[200,100], metrics=accuracy) learn.fit(1, 1e-2) `

And now for some example usage!

` from fastshap.interp import * `

` exp = ShapInterpretation(learn, df.iloc[:100]) `

` exp.dependence_plot('age') `

Classification model detected, displaying score for the class <50k. (use class_id to specify another class)

![png](docs/images/output_13_2.png)

For more examples see [01_Interpret](https://muellerzr.github.io/fastshap//interpret)

For more unofficial fastai extensions, see the [Fastai Extensions Repository](https://github.com/nestordemeure/fastai-extensions-repository).

Metadata

Release files for fastshapv1 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastshapv1 0.0.10
File Size Uploaded
fastshapv1-0.0.10.tar.gz 10.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastshapv1 0.0.10
File Interpreter ABI Platform
fastshapv1-0.0.10-py2-none-any.whl Python 2 none any Details

Total release size: 18.3 kB

Release files / fastshapv1-0.0.10.tar.gz

Download URL fastshapv1-0.0.10.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
77d477475da3e0310021664d683a06f823398f12658732650cc35d554b750ccc
BLAKE2b-256 checksum
How to use checksums
5bd673fc1414b24b7a3434358183121cda5b307d19aa96e80016e1629fc2b782
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

Release files / fastshapv1-0.0.10-py2-none-any.whl

Download URL fastshapv1-0.0.10-py2-none-any.whl
Size 7.4 kB
Tags Python 2
SHA-256 checksum
How to use checksums
2614d5834319a55605ec1bfc3231f5109abf4b30aef26147005e7867d49fdc55
BLAKE2b-256 checksum
How to use checksums
ca137c31a09c9094c69df8b689b1335c37d8468aab69574a1516fb1cddc5b68e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

Release history Release notifications | RSS feed

This release

0.0.10 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page