Shap: Doesn't seem to run in jupyter lab

Created on 14 May 2018  Â·  10Comments  Â·  Source: slundberg/shap

In jupyter lab the example cut and pasted from the read me results in the "Visualization omitted, Javascript library not loaded!" error message. However the exact same code works in jupyter notebook for me.

Is there a setting or something for jupyter lab or anything I can do to work around this?

Thanks.

Most helpful comment

Any idea why this error also occurs when running in a Jupiter notebook?
python 3.7.1
jupyter 1.0.0

All 10 comments

Same problem here, trying to run the example from README but got the error
screen shot 2018-05-14 at 12 40 40

Unfortunately the JS force_plot Jupyter visualizations are blocked by new
security features in jupyter lab. At some point they need to be made into a
jupyter module I think, but I have not worked on that yet.
On Sun, May 13, 2018 at 11:41 PM Aditya Kurniawan notifications@github.com
wrote:

Same problem here, trying to run the example from README but got the
error. I attach the error as well
[image: screen shot 2018-05-14 at 12 40 40]
https://user-images.githubusercontent.com/4723643/39980054-149c1692-5774-11e8-95e9-ae3d74d45fd6.png

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/slundberg/shap/issues/82#issuecomment-388702793, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ADkTxVZF1kHnQsWwBw-RYj7q5hE-l_COks5tyRkJgaJpZM4T9BFj
.

I think a note about Jupyter Lab should be added to the displayed error message.

@chrisadas good point. Done.

Any idea why this error also occurs when running in a Jupiter notebook?
python 3.7.1
jupyter 1.0.0

@staplet14 I am not sure (other than the common reasons stated in the error message). My jupyter is version 4.4.0 perhaps 1.0 is a fairly old install?

@slundberg The example from the README works, but I'm on shap version 0.24.0 rather than 0.25.2. Could that be a reason for the error @staplet14 is seeing? Not sure what change could be driving it besides maybe commit 226be328a72239d6e99279d4137e5412d50169a5.

@ezhangsfl and @slundberg, I got it to work by installing from conda-forge into a conda env, shap v0.25.1, Jupiter core v4.4.0, py 3.6.

Previously I was pip installing into a conda env.

Kernel dead when running:
shap_values = shap.TreeExplainer(model).shap_values(X)

Thanks @Herm41, if you provide a self contained example I can run I'll look into it.

Was this page helpful?
0 / 5 - 0 ratings