Skip to content
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

BUG: Force plot JS Not Initialized #3431

Closed
2 of 4 tasks
Clovinlee opened this issue Dec 9, 2023 · 4 comments · Fixed by #3464
Closed
2 of 4 tasks

BUG: Force plot JS Not Initialized #3431

Clovinlee opened this issue Dec 9, 2023 · 4 comments · Fixed by #3464
Labels
bug Indicates an unexpected problem or unintended behaviour
Milestone

Comments

@Clovinlee
Copy link

Issue Description

Javascript Not Initialized error occurs whenever I tries to use the SHAP force plot.
It works fine with other visualization though.

I even used the example code from SHAP github page.

Minimal Reproducible Example

import xgboost
import shap

# train an XGBoost model
X, y = shap.datasets.california()
model = xgboost.XGBRegressor().fit(X, y)

# explain the model's predictions using SHAP
# (same syntax works for LightGBM, CatBoost, scikit-learn, transformers, Spark, etc.)
explainer = shap.Explainer(model)
shap_values = explainer(X)

# visualize the first prediction's explanation
shap.initjs()
shap.plots.force(shap_values[0])

Traceback

No response

Expected Behavior

The plot showing normally

Bug report checklist

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest release of shap.
  • I have confirmed this bug exists on the master branch of shap.
  • I'd be interested in making a PR to fix this bug

Installed Versions

latest right now : 0.44.0

@Clovinlee Clovinlee added the bug Indicates an unexpected problem or unintended behaviour label Dec 9, 2023
@yacin-h
Copy link

yacin-h commented Dec 13, 2023

Hello, I encountered the same problem when I ran it on Google Colab. It works fine with shap==0.43.0 though.

@Clovinlee
Copy link
Author

Hello, I encountered the same problem when I ran it on Google Colab. It works fine with shap==0.43.0 though.

Yes, fortunately it only happen on 0.44
Downgrading the version to 0.43 works fine

@richarddli
Copy link
Contributor

See #3448 for the explanation and fix.

@connortann connortann added this to the 0.44.1 milestone Jan 23, 2024
@connortann
Copy link
Collaborator

This should be fixed in the latest release 0.44.1 which has been published to PyPI and will shortly be on conda-forge. Please let us know if you still encounter the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behaviour
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants