Skip to content

Instantly share code, notes, and snippets.

@IamRash-7
Created August 29, 2021 10:22
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 IamRash-7/6f98170a6591407638aa8282bd1ca1ff to your computer and use it in GitHub Desktop.
Save IamRash-7/6f98170a6591407638aa8282bd1ca1ff to your computer and use it in GitHub Desktop.
fig = plt.figure(figsize=(18, 18))
for i, idx in enumerate(np.random.choice(X_test.shape[0], size=9, replace=False)):
ax = fig.add_subplot(3, 3, i + 1, xticks=[], yticks=[])
ax.imshow(np.squeeze(X_test[idx]), cmap='gray')
pred_idx = y_test_predict[idx]
true_idx = np.argmax(y_test[idx])
ax.set_title("{} ({})".format(names[pred_idx], names[true_idx]),color=("#4876ff" if pred_idx == true_idx else "darkred"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment