Created
December 14, 2020 11:25
-
-
Save betterdatascience/a05e65acdad0d3c8ec5c47dce545a8b2 to your computer and use it in GitHub Desktop.
004_lime_vs_shap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lime | |
from lime import lime_tabular | |
lime_explainer = lime_tabular.LimeTabularExplainer( | |
training_data=np.array(X_train), | |
feature_names=X_train.columns, | |
class_names=['bad', 'good'], | |
mode='classification' | |
) | |
lime_exp = lime_explainer.explain_instance( | |
data_row=test_1, | |
predict_fn=model.predict_proba | |
) | |
lime_exp.show_in_notebook(show_table=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment