Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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