Skip to content

Instantly share code, notes, and snippets.

@aagnone3
Created July 7, 2020 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aagnone3/da80b350b5e03097799be6205aac38dc to your computer and use it in GitHub Desktop.
Save aagnone3/da80b350b5e03097799be6205aac38dc to your computer and use it in GitHub Desktop.
hummingbird-deepnote_11.py
# 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