ModelOriented / DALEX

moDel Agnostic Language for Exploration and eXplanation
https://dalex.drwhy.ai
GNU General Public License v3.0
1.38k stars 166 forks source link

explainer.predict_parts does not work correctly with numpy array data #207

Closed TymekDev closed 4 years ago

TymekDev commented 4 years ago

I have encountered an error in Python version of the package. It happend while using data which was numpy arrays - X_train being a matrix and y_train a vector. When trying to call method predict_parts on the explainer I have gotten following error: image

Clearly the X_train[0, :] is a numpy.ndarray while the error message suggests it is not. The model used was ExtraTreesClassifier from sklearn.ensemble.

I have tried the same with data being pandas dataframes and it worked just fine: image

hbaniecki commented 4 years ago

Hi, Thanks for the notice. Indeed, I see the inconsistency here.

https://github.com/ModelOriented/DALEX/blob/84550e0c05765575083ddb269c51860cc038c8ea/python/dalex/dalex/instance_level/_break_down/checks.py#L16

https://github.com/ModelOriented/DALEX/blob/84550e0c05765575083ddb269c51860cc038c8ea/python/dalex/dalex/instance_level/_shap/checks.py#L12

https://github.com/ModelOriented/DALEX/blob/84550e0c05765575083ddb269c51860cc038c8ea/python/dalex/dalex/instance_level/_ceteris_paribus/checks.py#L19

hbaniecki commented 4 years ago

fixed in #209