I want to implement LIME explainer to describe a three-dimensional Keras Sequential model (n_samples, n_timesteps, n_features).
I cannot understand whether I have to use Lime "RecurrentTabularExplainer" or "LimeTabularExplainer".
Also I cannot understand what the "classifier_fn" in "explain_instance" has to return and in what size.
For the moment I'm proceeding like this:
explainer = lime_tabular.RecurrentTabularExplainer(
X_train
, training_labels = y_train
, feature_names = features
, categorical_features = [3,5]
, class_names = ['Ko', 'Ok']
, mode = 'regression'
)
i = 40
exp = explainer.explain_instance(
X_test[ i ]
, classifier_f
, labels = y_test[ i ]
)
with
X_train.shape (4124,60,19)
y_train.shape (4124,60)
X_test.shape (938,60,19)
y_test.shape (938,60)
Model
Layer (type) Output Shape Param #
=================================================================
masking (Masking) (None, 60, 19) 0
gru (GRU) (None, 60, 100) 25800
batch_normalization (BatchN (None, 60, 100) 200
ormalization)
time_distributed (TimeDistr (None, 60, 1) 101
ibuted)
=================================================================
Thank you a lot in advance.