8000 DOC Add example comparing permutation importance and SHAP by lucyleeow · Pull Request #18139 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

DOC Add example comparing permutation importance and SHAP #18139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 64 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
dd7ca9e
wip
lucyleeow Jul 28, 2020
f03c518
wip
lucyleeow Aug 4, 2020
aef17ce
wip
lucyleeow Aug 7, 2020
6b45ba4
wip
lucyleeow Aug 9, 2020
5cbd962
wip
lucyleeow Aug 10, 2020
4300f6e
first draft
lucyleeow Aug 11, 2020
2734bdf
add dep
lucyleeow Aug 11, 2020
2c79eee
lint
lucyleeow Aug 11, 2020
ce78252
add to min dep
lucyleeow Aug 11, 2020
6c2ac89
Merge branch 'master' into doc_shap_fpi
lucyleeow Aug 11, 2020
f5e0934
circular import
lucyleeow Aug 11, 2020
cb675b0
formatting
lucyleeow Aug 11, 2020
adbab69
lint
lucyleeow Aug 11, 2020
98d38ca
lint
lucyleeow Aug 11, 2020
4ab7a92
formatting, some wording changes
lucyleeow Aug 11, 2020
c022ac2
fix spelling
lucyleeow Aug 11, 2020
c49b290
typo
lucyleeow Aug 12, 2020
95cec6e
tree code
lucyleeow Aug 13, 2020
1715ed4
merge main, update ver
Oct 9, 2021
810e3da
Update examples/inspection/plot_permutation_importance_SHAP.py
lucyleeow Oct 9, 2021
9b8e728
Update examples/inspection/plot_permutation_importance_SHAP.py
lucyleeow Oct 9, 2021
91d475f
Update examples/inspection/plot_permutation_importance_SHAP.py
lucyleeow Oct 9, 2021
3cb8185
suggestions
Oct 9, 2021
5cd0c47
Merge branch 'doc_shap_fpi' of https://github.com/lucyleeow/scikit-le…
Oct 9, 2021
41eee1b
black
Oct 9, 2021
2e71c76
use arxiv directive
Oct 9, 2021
0fc8457
Merge branch 'main' into doc_shap_fpi
Oct 9, 2021
7970080
add shap version
Oct 14, 2021
812d7c6
try version
Oct 15, 2021
6e11cbf
fix version?
Oct 15, 2021
79f57b1
add to doc
Oct 16, 2021
1be5700
typo
Oct 16, 2021
4f2c91e
Merge branch 'main' into doc_shap_fpi
Oct 19, 2021
91bcaf1
update readme
Nov 20, 2021
c025cec
typo
Nov 20, 2021
e4a5292
Merge branch 'main' into doc_shap_fpi
jjerphan Nov 20, 2021
8358bf3
try doc py 3.9
Nov 24, 2021
ae8c8ed
Merge branch 'doc_shap_fpi' of github.com:lucyleeow/scikit-learn into…
Nov 24, 2021
c0aff0b
merge main
Nov 24, 2021
e08ba45
merge main
Nov 24, 2021
0beb714
Merge remote-tracking branch 'origin/main' into pr/lucyleeow/18139
glemaitre Dec 2, 2021
bb4a8b7
Update examples/inspection/plot_permutation_importance_SHAP.py
lucyleeow Dec 7, 2021
449b814
Update examples/inspection/plot_permutation_importance_SHAP.py
lucyleeow Dec 7, 2021
193e3db
Update examples/inspection/plot_permutation_importance_SHAP.py
lucyleeow Dec 7, 2021
735df58
Update examples/inspection/plot_permutation_importance_SHAP.py
lucyleeow Dec 7, 2021
38fc88d
Update examples/inspection/plot_permutation_importance_SHAP.py
lucyleeow Dec 7, 2021
64b2107
merge main
Dec 7, 2021
e9780cb
suggestions
Dec 8, 2021
059fa24
fix column name warn
Dec 8, 2021
588b56c
update code pd -> array
Dec 8, 2021
74e2c2d
suggestions
Dec 14, 2021
e1fff73
use new shap api
Dec 14, 2021
0b053fb
specific warning
Dec 14, 2021
929edc0
to pd
Dec 14, 2021
1e65087
formatting
Dec 14, 2021
1c10f18
typo
Dec 14, 2021
43df53d
typo
Dec 14, 2021
8ca5e92
fix warning
Dec 15, 2021
278e93b
Merge branch 'main' into doc_shap_fpi
ogrisel Mar 9, 2022
604c2b1
Use mambaforge as possible to avoid re-installing the numpy dependenc…
ogrisel Mar 9, 2022
a00bacc
Bump-up dependency on scikit-image to be able to install it from cond…
ogrisel Mar 9, 2022
594a96d
scikit-image 0.15.0 is not supported by Python 3.8
ogrisel Mar 9, 2022
cdcf011
Fix plotting functions
ogrisel Mar 9, 2022
ca6f9a5
Typo in scikit-image version number
ogrisel Mar 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .binder/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ scikit-image
pandas
sphinx-gallery
scikit-learn
shap
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How stable are the APIs of shap that we rely on here? should we pin this dependency?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small follow-up: do you know if APIs of shap are stable enough, @lucyleeow?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be


2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- NUMPYDOC_VERSION: 'min'
- SPHINX_PROMPT_VERSION: 'min'
- SPHINXEXT_OPENGRAPH_VERSION: 'min'
- SHAP_VERSION: 'min'
steps:
- checkout
- run: ./build_tools/circle/checkout_merge_commit.sh
Expand Down Expand Up @@ -67,6 +68,7 @@ jobs:
- NUMPYDOC_VERSION: 'latest'
- SPHINX_PROMPT_VERSION: 'latest'
- SPHINXEXT_OPENGRAPH_VERSION: 'latest'
- SHAP_VERSION: 'latest'
steps:
- checkout
- run: ./build_tools/circle/checkout_merge_commit.sh
Expand Down
13 changes: 9 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@
.. |JoblibMinVersion| replace:: 1.0.0
.. |ThreadpoolctlMinVersion| replace:: 2.0.0
.. |MatplotlibMinVersion| replace:: 3.1.2
.. |Scikit-ImageMinVersion| replace:: 0.14.5
.. |Scikit-ImageMinVersion| replace:: 0.16.2
.. |PandasMinVersion| replace:: 1.0.5
.. |SeabornMinVersion| replace:: 0.9.0
.. |PytestMinVersion| replace:: 5.0.1
.. |SHAPMinVersion| replace::0.35.0

.. image:: https://raw.githubusercontent.com/scikit-learn/scikit-learn/main/doc/logos/scikit-learn-logo.png
:target: https://scikit-learn.org/
Expand Down Expand Up @@ -81,9 +82,13 @@ scikit-learn 1.1 and later require Python 3.8 or newer.
Scikit-learn plotting capabilities (i.e., functions start with ``plot_`` and
classes end with "Display") require Matplotlib (>= |MatplotlibMinVersion|).
For running the examples Matplotlib >= |MatplotlibMinVersion| is required.
A few examples require scikit-image >= |Scikit-ImageMinVersion|, a few examples
require pandas >= |PandasMinVersion|, some examples require seaborn >=
|SeabornMinVersion|.

Some examples require independently:

- scikit-image >= |Scikit-ImageMinVersion|
- pandas >= |PandasMinVersion|
- seaborn >= |SeabornMinVersion|
- SHAP >= |SHAPMinVersion|

User installation
~~~~~~~~~~~~~~~~~
Expand Down
27 changes: 18 additions & 9 deletions build_tools/circle/build_doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,13 @@ if [[ `type -t deactivate` ]]; then
deactivate
fi

MINICONDA_PATH=$HOME/miniconda
# Install dependencies with miniconda
# Install dependencies with mambaforge. Note that the mambaforge installer
# automatically configures the conda-forge channel by default.
MAMBAFORGE_PATH=$HOME/mambaforge
wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh \
-O miniconda.sh
chmod +x miniconda.sh && ./miniconda.sh -b -p $MINICONDA_PATH
export PATH="/usr/lib/ccache:$MINICONDA_PATH/bin:$PATH"
-O mambaforge.sh
chmod +x mambaforge.sh && ./mambaforge.sh -b -p $MAMBAFORGE_PATH
export PATH="/usr/lib/ccache:$MAMBAFORGE_PATH/bin:$PATH"

ccache -M 512M
export CCACHE_COMPRESS=1
Expand All @@ -173,20 +174,28 @@ mamba create -n $CONDA_ENV_NAME --yes --quiet \
"$(get_dep matplotlib $MATPLOTLIB_VERSION)" \
"$(get_dep sphinx $SPHINX_VERSION)" \
"$(get_dep pandas $PANDAS_VERSION)" \
"$(get_dep shap $SHAP_VERSION)" \
"$(get_dep scikit-image $SCIKIT_IMAGE_VERSION)" \
"$(get_dep sphinx-gallery $SPHINX_GALLERY_VERSION)" \
"$(get_dep numpydoc $NUMPYDOC_VERSION)" \
"$(get_dep sphinx-prompt $SPHINX_PROMPT_VERSION)" \
joblib memory_profiler packaging seaborn pillow pytest coverage \
compilers

source activate testenv
pip install "$(get_dep scikit-image $SCIKIT_IMAGE_VERSION)"
pip install "$(get_dep sphinx-gallery $SPHINX_GALLERY_VERSION)"
pip install "$(get_dep numpydoc $NUMPYDOC_VERSION)"
pip install "$(get_dep sphinx-prompt $SPHINX_PROMPT_VERSION)"

# sphinxext-opengraph not in conda-forge for now, use pip instead:
pip install "$(get_dep sphinxext-opengraph $SPHINXEXT_OPENGRAPH_VERSION)"

# Set parallelism to 3 to overlap IO bound tasks with CPU bound tasks on CI
# workers with 2 cores when building the compiled extensions of scikit-learn.
export SKLEARN_BUILD_PARALLEL=3

# Note: installing scikit-learn from source in develop mode should hopefully
# override the scikit-learn potentially already installed as a dependency of
# shap.
python setup.py develop
python -c "import sklearn; sklearn.show_versions()"

export OMP_NUM_THREADS=1

Expand Down
Loading
0