marcotcr / lime

Lime: Explaining the predictions of any machine learning classifier
BSD 2-Clause "Simplified" License
11.5k stars 1.79k forks source link

Lime for 1D CNN for Tabular Data #570

Closed Abbas2021 closed 3 years ago

Abbas2021 commented 3 years ago

Hi,

I'm trying to use LIME for 1D CNN model. However because I have changed the training and testing data shape to 3d to suits the CNN model.

explainer3 = lime_tabular.LimeTabularExplainer(X_train, feature_names=features_names, discretize_continuous=True, class_names=['P','H'] ) print(X_train.shape) (291, 57, 1)

print(features_names.shape) (57,)

I'm getting the following error: IndexError: boolean index did not match indexed array along dimension 1; dimension is 57 but corresponding boolean dimension is 1.

Could you kindly advice me what to do?

marcotcr commented 3 years ago

LimeTabular takes in a 1d array. If you want to use images, consider LimeImage