Question: Here are what we need to do: What are the dimensions of train_images, train_labels, test_images, and test_labels? What are the lengths of train_labels and test_labels?

 Here are what we need to do: What are the dimensions

Here are what we need to do:

  1. What are the dimensions of train_images, train_labels, test_images, and test_labels?
  2. What are the lengths of train_labels and test_labels?
  3. Please show some of train and test labels.
  4. Please show the digital content of image index 5 in the training dataset.
  5. Please plot the image of the index 5 in the training dataset.
  6. What is the label for the index 5 in the train_label and looking up in the above list, what does it mean?
  7. Please show the digital content of image index 500 in the testing dataset.
  8. Please plot the image of the index 500 in the testing dataset.
  9. What is the label for the index 500 in the test_label and looking up in the above list, what does it mean?
  10. Please import models and layers from the keras library.
  11. Define a sequential model and call it myNetwork.
  12. Reshape the images from 28x28 to one column with 784 neurons (flattening) (use 2 methods).
  13. Also, please normalize the image by dividing the image by 255 (use 2 methods).
  14. Add one hidden layer that has 512 neurons, using relu activation function.
  15. Add another hidden layer that has 128 neurons, using relu activation function.
  16. Add the last layer as a 10-neuron dense layer that uses the softmax as the activation function. Why we use softmax for the last layer? How does it work under the hood?
  17. Use the following two settings for the compiler and run them separately and see what the differences are.
  • Optimizer adam, loss 'sparse_categorical_crossentropy', metrics[accuracy]
  • Optimizer ramsprop, loss 'categorical_crossentropy', metrics[accuracy]
  1. Now after the compilation, please try to find the pattern using the fit command. The epochs need to be 10 for this example.
  2. How do you compare the fashion_MNIST with what we learned in the class using the MNIST? What can we infer from the differences in the accuracy? What could be the reasons for that?
  3. Use the evaluate to calculate the achieved accuracy and loss over the test images and labels. Do we have overfitting?

Fashion MNIST is an alternative to MNIST and another default dataset that we can access through Keras. Fashion MNIST is a dataset of 60,000 28x28 grayscale images of 10 fashion categories, along with a test set of 10,000 images. This dataset can be used as a drop-in replacement for MNIST. The class labels are: 0 T-shirt/tup 1. Trouser 2 Pullover 3. Dress 4 Coal 5. Sandal 6. Shirt 7. Sneaker 8. Bag 9. Ankle boot The dataset is a bit more challenging compared to MNIST, and the achieved accuracy is normally less than what we can get from the classical MNIST. This is where we will start importing and loading our dataset: + Code + Text MA Dak Editing fron keras.datasets iront fashion_onist (train_images, train_labels), (test_inages, test_labels) - Fashion_onist load_data

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!