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: SHAP force plots HTML is broken (regression) #3448

Closed
3 of 4 tasks
richarddli opened this issue Jan 5, 2024 · 3 comments · Fixed by #3464
Closed
3 of 4 tasks

BUG: SHAP force plots HTML is broken (regression) #3448

richarddli opened this issue Jan 5, 2024 · 3 comments · Fixed by #3464
Assignees
Labels
bug Indicates an unexpected problem or unintended behaviour

Comments

@richarddli
Copy link
Contributor

richarddli commented Jan 5, 2024

Issue Description

In 95493ce#diff-2c2e80cfb3ae153160970a29182c8943d1174f829138b2d944fc66479ccf6201, .format was switched to use f-strings. However, the code change replaced a single call to id_generator() with two calls. By design, id_generator returns a random ID each time.

The consequence of this change is that the IDs will not match, which means the force plot is never displayed. This issue is present in 0.44 but not in 0.43.

Minimal Reproducible Example

        shap_values_single = explainer.shap_values(row, nsamples=NSHAP_SAMPLES)
        shap.force_plot(explainer.expected_value, shap_values_single, row).html()

Note that the IDs returned in the html do not match.

Traceback

No response

Expected Behavior

No response

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

Master

@richarddli richarddli added the bug Indicates an unexpected problem or unintended behaviour label Jan 5, 2024
@richarddli richarddli changed the title BUG: ID generator bug on master BUG: SHAP force plots HTML is broken (regression) Jan 5, 2024
@CloseChoice
Copy link
Collaborator

CloseChoice commented Jan 17, 2024

Good catch, thanks for reporting. I will have a look and fix this.

@connortann : Could we get a regression tag?

@connortann
Copy link
Collaborator

The fix is now in master and will be in the next hotfix release 0.44.1, which will hopefully be out in a day or two.

@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.

3 participants