Created
March 5, 2019 02:20
-
-
Save crawles/075fdfb0d5cfbd963821be930d4e5561 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
# Make predictions. | |
pred_dicts = list(est.experimental_predict_with_explanations(eval_input_fn)) | |
df_dfc = pd.DataFrame([pred['dfc'] for pred in pred_dicts]) | |
# Plot results. | |
ID = 182 | |
example = df_dfc.iloc[ID] # Choose ith example from evaluation set. | |
TOP_N = 8 # View top 8 features. | |
sorted_ix = example.abs().sort_values()[-TOP_N:].index | |
ax = example[sorted_ix].plot(kind='barh') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment