Skip to content

Error during plot_features_importances #10

@valevalerio

Description

@valevalerio

Hello,I have got this error when trying to run the plot_features_importance in the tabular_explanations_example.ipynb example

`ValueError Traceback (most recent call last)
Cell In[9], line 1
----> 1 exp.plot_features_importance()

File ~/xaihac/XAI-Lib/src/xailib/explainers/shap_explainer_tab.py:42, in ShapXAITabularExplanation.plot_features_importance(self, fontDimension)
38 else:
39 feature_values = self.exp[0]
---> 42 arr=np.c_[np.array(self.feature_names), feature_values]
43 dataToPlot=pd.DataFrame(arr,columns=['name','value'])
44 dataToPlot['value'] = dataToPlot['value'].astype('float64')

File ~/.venv/lib/python3.10/site-packages/numpy/lib/index_tricks.py:418, in AxisConcatenator.getitem(self, key)
414 # concatenate could do cast, but that can be overriden:
415 objs = [array(obj, copy=False, subok=True,
416 ndmin=ndmin, dtype=final_dtype) for obj in objs]
--> 418 res = self.concatenate(tuple(objs), axis=axis)
420 if matrix:
421 oldndim = res.ndim

ValueError: all the input array dimensions except for the concatenation axis must match exactly, but along dimension 0, the array at index 0 has size 61 and the array at index 1 has size 2`
What could cause this error? looks like an indexing issue of the couple relative to the explanations for the two classes...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions