BUG: Waterfall feature names IndexError #3553
Labels
awaiting feedback
Indicates that further information is required from the issue creator
bug
Indicates an unexpected problem or unintended behaviour
visualization
Relating to plotting
Projects
Issue Description
When a shapley explainer is given an
n
xn
feature matrix, the waterfall plot fails to be created because the feature names are not a list of then
feature names, but only the single feature at the sample position given.The
Explanation
object has this code in__init__
:The
Alias
dim
of thefeature_names
is set to 0 when the features and samples match which results in just the single feature "Feature_1" instead of the list of features "['Feature_1', 'Feature_2', 'Feature_x']". TheExplanation
object then saves theSlicer
object inself._s
which when the waterfall plot is created with just a single sampleshap_explainer[0]
,__get_item__
is called and then the slice uses thedim
from above to either select the index given (in this case0
) whendim=0
, orslice(None, None, None)
fordim=1
.Minimal Reproducible Example
Traceback
Expected Behavior
The slice should always get the full set of features when creating a waterfall plot.
Bug report checklist
Installed Versions
0.42.1
The text was updated successfully, but these errors were encountered: