Open Mjuve360 opened 3 years ago
Can you share the lines where you instantiate the explainer? It looks as if X_test has a different shape than whatever you use to start the tabular explainer.
Other people have had the same issue (me included). It comes from a previous line in LimetabularExplainer.__data_inverse
where categorical_features
is overridden like so : categorical_features = range(num_cols)
line 508. This happens even when you have specifically set categorical_features
to an empty list at instanciation of the object.
This may happen if the training data you give to the LimeTabularExplainer
has $n$ columns but the row you want to explain has $n+1$ columns because you forgot to remove the target column
Dear @marcotcr Im using a two class data set with 6 features. everything properly works except this block of code:
i = np.random.randint(0, X_test.shape[0]) exp = explainer.explain_instance(X_test[i], rf.predict_proba, num_features=6, top_labels=1)
and the error is not understandable KeyError Traceback (most recent call last)