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!
trainXtrainYtestXtestY fashionmnist.loaddata
The loaddata function will return the training data and its labels and the test data and its labels.
Analyze the data
printTraining data shape : trainXshape, trainYshape
printTesting data shape : testXshape, testYshape
Print the shape of the data to determine its size and print the output here. 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 npuniquetrainY
nClasses lenclasses
printTotal number of outputs : nClasses
printOutput classes : classes
Print the total number of output classes Please paste the output of your algorithm here mark
Displaying training and testing data
To display an image from the training and test data you may use the code given below. The trainX array element is displayed ie first image in the dataset. trainX : : means that the zeroth element of array trainX ie the first image and the : : all the values in along the x and y coordinate ie all pixels in the D plane. This indicates that the data does not have a third dimension otherwise the code would have mentioned trainX::: The output of two plots below, look like an ankle boot, and this class is assigned a class label of Similarly, other fashion products will have different labels, but similar products will have same labels. This means that all the ankle boot images will have a class label of
#Open a window for plotting data
pltfigurefigsize
# Display the first image in training data
pltsubplot
pltimshowtrainX:: cmap'gray'
plttitleGround Truth : formattrainY
# Display the first image in testing data
pltsubplot
pltimshowtestX:: cmap'gray'
plttitleGround Truth : formattestY
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
