AttributeError Traceback (most recent call last)
<ipython-input-134-897caeed2066> in <module>
----> 1 import shap
2
3 # load JS visualization code to notebook
4 shap.initjs()
~\AppData\Local\Continuum\anaconda3\envs\py37\lib\site-packages\shap\__init__.py in <module>
9 from .explainers.gradient import GradientExplainer
10 from .explainers.linear import LinearExplainer
---> 11 from .plots.summary import summary_plot
12 from .plots.dependence import dependence_plot
13 from .plots.force import force_plot, initjs, save_html
~\AppData\Local\Continuum\anaconda3\envs\py37\lib\site-packages\shap\plots\summary.py in <module>
13 pass
14 from . import labels
---> 15 from . import colors
16
17 # TODO: remove unused title argument / use title argument
~\AppData\Local\Continuum\anaconda3\envs\py37\lib\site-packages\shap\plots\colors.py in <module>
23 red_lch = [54., 90., 0.35470565 + 2* np.pi]
24 gray_lch = [55., 0., 0.]
---> 25 blue_rgb = lch2rgb(blue_lch)
26 red_rgb = lch2rgb(red_lch)
27 gray_rgb = lch2rgb(gray_lch)
~\AppData\Local\Continuum\anaconda3\envs\py37\lib\site-packages\shap\plots\colors.py in lch2rgb(x)
13
14 def lch2rgb(x):
---> 15 return skimage.color.lab2rgb(skimage.color.lch2lab([[x]]))[0][0]
16
17 # define our colors using Lch
AttributeError: module 'skimage' has no attribute 'color'
This is in a conda environment with the following package versions:
# Name Version Build Channel
attrs 19.1.0 pypi_0 pypi
backcall 0.1.0 pypi_0 pypi
blas 1.0 mkl
ca-certificates 2019.3.9 hecc5488_0 conda-forge
certifi 2019.3.9 py37_0 conda-forge
chardet 3.0.4 pypi_0 pypi
cloudpickle 0.8.0 py_0 conda-forge
colorama 0.4.1 pypi_0 pypi
cycler 0.10.0 pypi_0 pypi
cytoolz 0.9.0.1 py37hfa6e2cd_1001 conda-forge
dask-core 1.1.4 py_0 conda-forge
decorator 4.4.0 py_0 conda-forge
eli5 0.8.1 pypi_0 pypi
freetype 2.10.0 h5db478b_0 conda-forge
icc_rt 2019.0.0 h0cc432a_1
idna 2.8 pypi_0 pypi
imageio 2.5.0 py37_0 conda-forge
intel-openmp 2019.1 144
ipykernel 5.1.0 pypi_0 pypi
ipython 7.3.0 pypi_0 pypi
ipython-genutils 0.2.0 pypi_0 pypi
jedi 0.13.3 pypi_0 pypi
jinja2 2.10 pypi_0 pypi
joblib 0.13.2 pypi_0 pypi
jpeg 9c hfa6e2cd_1001 conda-forge
jupyter-client 5.2.4 pypi_0 pypi
jupyter-core 4.4.0 pypi_0 pypi
kiwisolver 1.0.1 pypi_0 pypi
libblas 3.8.0 4_mkl conda-forge
libcblas 3.8.0 4_mkl conda-forge
liblapack 3.8.0 4_mkl conda-forge
libpng 1.6.36 h7602738_1000 conda-forge
libtiff 4.0.10 h36446d0_1001 conda-forge
lime 0.1.1.31 pypi_0 pypi
markupsafe 1.1.1 pypi_0 pypi
matplotlib 3.0.3 pypi_0 pypi
matplotlib-base 3.0.3 py37h3e3dc42_0 conda-forge
mkl 2019.1 144
networkx 2.2 pypi_0 pypi
numpy 1.16.2 py37h8078771_1 conda-forge
olefile 0.46 py_0 conda-forge
openssl 1.1.1b hfa6e2cd_1 conda-forge
pandas 0.24.2 pypi_0 pypi
parso 0.3.4 pypi_0 pypi
pdpbox 0.2.0 pypi_0 pypi
pickleshare 0.7.5 pypi_0 pypi
pillow 5.4.1 pypi_0 pypi
pip 19.0.3 py37_0
prompt-toolkit 2.0.9 pypi_0 pypi
psutil 5.6.1 pypi_0 pypi
pygments 2.3.1 pypi_0 pypi
pyparsing 2.3.1 py_0 conda-forge
python 3.7.2 h8c8aaf0_10
python-dateutil 2.8.0 py_0 conda-forge
python-graphviz 0.10.1 pypi_0 pypi
pytz 2018.9 pypi_0 pypi
pywavelets 1.0.2 py37h452e1ab_0 conda-forge
pywt 1.0.6 pypi_0 pypi
pyzmq 18.0.1 pypi_0 pypi
requests 2.21.0 pypi_0 pypi
scikit-image 0.14.2 py37h6538335_1 conda-forge
scikit-learn 0.20.3 pypi_0 pypi
scipy 1.2.1 pypi_0 pypi
setuptools 40.8.0 py37_0
shap 0.28.5 pypi_0 pypi
six 1.12.0 pypi_0 pypi
sklearn 0.0 pypi_0 pypi
sqlite 3.27.2 he774522_0
tabulate 0.8.3 pypi_0 pypi
tk 8.6.9 hfa6e2cd_1000 conda-forge
toolz 0.9.0 pypi_0 pypi
tornado 6.0.1 py37hfa6e2cd_0 conda-forge
tqdm 4.31.1 pypi_0 pypi
traitlets 4.3.2 pypi_0 pypi
typing 3.6.6 pypi_0 pypi
urllib3 1.24.1 pypi_0 pypi
vc 14.1 h0510ff6_4
vs2015_runtime 14.15.26706 h3a45250_0
wcwidth 0.1.7 pypi_0 pypi
wheel 0.33.1 py37_0
wincertstore 0.2 py37_0
zlib 1.2.11 h2fa13f4_1004 conda-forge
I have tried installing SHAP with both pip and conda, getting the same error.
I changed
import skimage.color
to
from skimage.color import lab2rgb, lch2lab
and
return skimage.color.lab2rgb(skimage.color.lch2lab([[x]]))[0][0]
to
return lab2rgb(lch2lab([[x]]))[0][0]
and I am able to avoid the above error.
Fantastic. Thanks a lot ... have no clue what i am doing ... but managed to get it fixed this way. Thanks a ton!
Most helpful comment
I changed
import skimage.colorto
from skimage.color import lab2rgb, lch2laband
return skimage.color.lab2rgb(skimage.color.lch2lab([[x]]))[0][0]to
return lab2rgb(lch2lab([[x]]))[0][0]and I am able to avoid the above error.