Last active
November 17, 2018 21:00
-
-
Save edunuke/a86d8b4971762095f50ffeb4bb176e5f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| from lime import submodular_pick | |
| #set up sp lime with 20 samples. The more amount of samples time increases dramatically | |
| sp_obj = submodular_pick.SubmodularPick(explainer, | |
| X_train.values[:500], | |
| predict, | |
| sample_size=20, | |
| num_features=9, | |
| num_exps_desired=5) | |
| #get explanation matrix | |
| W_matrix = pd.DataFrame([dict(this.as_list()) for this in sp_obj.explanations]) | |
| #get overall mean explanation for each feature | |
| matrix_mean = W_matrix.mean() | |
| plt.figure(figsize=(14,6)) | |
| matrix_mean.sort_values(ascending=False).plot.bar() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment