Let's test the trained model against the test set part of the CIFAR-10 dataset. First, we are going to define a helper function that will help us to visualize the predictions of some sample images and their corresponding true labels:
#A helper function to visualize some samples and their corresponding predictionsdef display_samples_predictions(input_features, target_labels, samples_predictions): num_classes = 10 cifar10_class_names = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck']label_binarizer = LabelBinarizer() label_binarizer.fit(range(num_classes)) label_inds = label_binarizer.inverse_transform(np.array(target_labels))fig, axies = plt.subplots(nrows=4, ncols=2) fig.tight_layout() ...