Skip to content

Commit

Permalink
This fixes bug when hovering over values (#218)
Browse files Browse the repository at this point in the history
* switched to unified hover

* plotly v 5.14.1
  • Loading branch information
Tyler W committed Jun 9, 2023
1 parent 5aedd73 commit d97064c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion explainer/attributions/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def shap_waterwall_plot(expected_value: float,
"""
if hasattr(feature_values, "values"):
feature_values = feature_values.values
fig = go.Figure()
fig = go.Figure(layout=go.Layout(hovermode='y unified'))
pred = expected_value + shap_values.sum()
if sort:
ind = abs(shap_values).argsort()
Expand Down Expand Up @@ -112,6 +112,7 @@ def shap_waterwall_plot(expected_value: float,
textposition="bottom center",
showlegend=False,
line=dict(color="#c7c7c7", width=2, dash='dot'),
hoverinfo="skip",
))

fig.add_trace(go.Scatter(
Expand All @@ -121,6 +122,7 @@ def shap_waterwall_plot(expected_value: float,
textposition="bottom center",
showlegend=False,
line=dict(color="#c7c7c7", width=2, dash='dot'),
hoverinfo="skip",
))

if y_pred:
Expand All @@ -131,6 +133,7 @@ def shap_waterwall_plot(expected_value: float,
textposition="bottom center",
showlegend=False,
line=dict(color="#c7c7c7", width=2, dash='dot'),
hoverinfo="skip",
))

if y_true is not None:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
'shap',
'torch==1.13.1',
'transformers',
'plotly==1.14.1'
]

CAM_PKGS = [
Expand Down

0 comments on commit d97064c

Please sign in to comment.