Created
July 7, 2020 17:04
-
-
Save aagnone3/da80b350b5e03097799be6205aac38dc to your computer and use it in GitHub Desktop.
hummingbird-deepnote_11.py
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
# get predictions from the models for the same data | |
y_pred = clf.predict(X_test) | |
y_pred_cpu = clf_cpu.predict(X_test) | |
y_pred_gpu = clf_gpu.predict(X_test) | |
def plot_distributions(data_label_pairs, title='Score Distribution(s)'): | |
""" | |
Plot the distribution of a list of prediction vectors. | |
@param List data_label_pairs: | |
""" | |
plt.figure(figsize=(12, 6)) | |
for data, label in data_label_pairs: | |
sns.distplot(data, hist=False, label=label) | |
plt.legend() | |
plt.xlabel('x') | |
plt.ylabel('P(x)') | |
_ = plt.title(title) | |
plot_distributions( | |
[ | |
[y_pred_cpu - y_pred, 'Δ predictions for HB CPU'], | |
[y_pred_gpu - y_pred, 'Δ predictions for HB GPU'] | |
], | |
title='Checking the Predictive Distribution Divergence' | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment