marcotcr / lime

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

LIME explainer not working for Logistic Classifier #668

Open jgdpsingh opened 2 years ago

jgdpsingh commented 2 years ago

I'm using Logistic Classifier on a categorical dataset and after I did everything right, I got the following error:

NotImplementedError Traceback (most recent call last) /tmp/ipykernel_33/3771634090.py in 2 k=5 3 exp_lime = explainer.explain_instance( ----> 4 X_test2[i], lr.predict, num_features=k)

/opt/conda/lib/python3.7/site-packages/lime/lime_tabular.py in explain_instance(self, data_row, predict_fn, labels, top_labels, num_features, num_samples, distance_metric, model_regressor) 359 if self.mode == "classification": 360 if len(yss.shape) == 1: --> 361 raise NotImplementedError("LIME does not currently support " 362 "classifier models without probability " 363 "scores. If this conflicts with your "

NotImplementedError: LIME does not currently support classifier models without probability scores. If this conflicts with your use case, please let us know: https://github.com/datascienceinc/lime/issues/16

Logistic Classifier does support probability scores