Question
let's use the imshow function to look at the first few images in the training set. # Create a figure with subplots. This returns a
let's use the imshow function to look at the first few images in the training set.
# Create a figure with subplots. This returns a list of object handles in axs
# which we can use to populate the plots.
fig, axs = plt.subplots(nrows=1, ncols=5, figsize=(10,5))
for i in range(5):
image = X_train[i]
label = Y_train[i]
label_name = label_names[label]
axs[i].imshow(image, cmap='gray')
axs[i].set_title(label_name)
axs[i].axis('off')
plt.show()
Now, Display the first 5 images for each class in a 10x5 grid. Feel free to use the code above to get started. need to use matplotlib documentation.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started