marcotcr / lime

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

ISSUES: Problem related LIME Xai implementation in tabular form dataset for multiclass classification. #631

Closed RabeyaMuna closed 3 years ago

RabeyaMuna commented 3 years ago

I am using LIME XAI tool to explain my model for multiclass classification. But I am unable to get any code or proper explanation of the tool how it works and what is the meaning of the output. I tried to implement the code :
`import lime from lime import lime_tabular explainer = lime.lime_tabular.LimeTabularExplainer(x_train, mode = 'classification', feature_names=x_train.columns, class_names=['DoS-Synflooding', 'MITM ARP Spoofing','Mirai-Ackflooding','Mirai-HTTP Flooding','Mirai-Hostbruteforceg','Mirai-UDP Flooding','Normal','Scan Hostport','Scan Port OS'], discretize_continuous=False) # this line works

explainer.explain_instance(x_train,xgb_estimator1.predict_proba,top_labels=9) # this line throws the error` ISSUES: 1) My whole system got crash after running the code and I am not understanding either I should use x or x_train in LimeTabularExplainer(). 2) Can anybody provide me a reliable source to implement it with proper explanation to understand how it's actually working.

  1. Where is the problem in my code and how to solve it ?
marcotcr commented 3 years ago

explainer.explain_instance takes as first argument a single instance, rather than the whole training set. Have you looked at this tutorial, by any chance?