Question: Loading Our Data In this data set we will not be doing data augmentation. Let's start by loading our training and testing data! ( train

Loading Our Data
In this data set we will not be doing data augmentation.
Let's start by loading our training and testing data!
(train_X,train_Y),(test_X,test_Y)= fashion_mnist.load_data()
The load_data function will return the training data and its labels and the test data and its labels.
Analyze the data
print('Training data shape : ', train_X.shape, train_Y.shape)
print('Testing data shape : ', test_X.shape, test_Y.shape)
Print the shape of the data to determine its size and print the output here.[1 mark]
Next, lets try to identify the number of unique classes in the training dataset. This can be done by determined by identifying the unique elements in the label vector. This can be done by using the unique function in the numpy library.
# Find the unique numbers from the train labels
classes = np.unique(train_Y)
nClasses = len(classes)
print('Total number of outputs : ', nClasses)
print('Output classes : ', classes)
Print the total number of output classes (Please paste the output of your algorithm here).[1 mark]
Displaying training and testing data
To display an image from the training and test data you may use the code given below. The train_X array element 0 is displayed i.e. first image in the dataset. train_X[0, :, :] means that the zeroth element of array train_X i.e. the first image and the :, : all the values in along the x and y coordinate i.e. all pixels in the 2D plane. This indicates that the data does not have a third dimension otherwise the code would have mentioned train_X[0,:,:,:]. The output of two plots below, look like an ankle boot, and this class is assigned a class label of 9. Similarly, other fashion products will have different labels, but similar products will have same labels. This means that all the 7,000 ankle boot images will have a class label of 9.
#Open a window for plotting data
plt.figure(figsize=[5,5])
# Display the first image in training data
plt.subplot(121)
plt.imshow(train_X[0,:,:], cmap='gray')
plt.title("Ground Truth : {}".format(train_Y[0]))
# Display the first image in testing data
plt.subplot(122)
plt.imshow(test_X[0,:,:], cmap='gray')
plt.title("Ground Truth : {}".format(test_Y[0]))
Please print the output of above given commands[

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!