Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, I am in need of help using python [Python] The MNIST dataset is divided into training and test sets. Each set comprises a series

Hello, I am in need of help using python [Python] The MNIST dataset is divided into training and test sets. Each set comprises a series of images (28 x 28-pixel images of handwritten digits) and their respective labels (values from 0 - 9, representing which digit the image corresponds to).

image text in transcribed

I am able to understand a-d, but I am confused in the following e-i, any help would be apreciated, will upvote

a) Use mnist function in keras.datasets to load and split the MNIST dataset into the y _test. Print the following: The number of images in each training and testing set and the image width and height. b) Write a function that takes two inputs: 1) images of ten digits and 2 ) their corresponding labels and plots a figure with 10 subplots for each 09 digits. Each subplot has the number of the handwritten digit in its title. c) Create a loop to call the function in (b) and plot images from the training set to create a figure that includes all the 10 digits (09). d) Select the 0 and 8 digits from the training and testing sets and name them: x train_01, ytrain_01 and x test_01, ytest_01. e) In machine learning, we typically divide the training set into two training and validation sets to adjust the machine learning model parameters. In your code, randomly select 500 training images and their corresponding labels (from x_valid_01 and y_valid_01, respectively. Name the remaining training images and their labels as x train_01 and ytrain_01, respectively. Note: that there are no overlaps between the two sets. f) Print the number of images in each training, validation, and testing set. g) Use the function created in part (b) to plot 10 images from the validation set. h) Convert each image in the three training, validation and testing sets to one attribute by calculating the average of all the pixel values in the center 44 grid of the image. i) Plot the attribute values of the 500 images in the validation set that you calculated in part (h). Use different colors and shapes for 0 's and 8's. The x-axis in your figure is the image number (1 to 500), and the y-axis is the calculated attribute. Label the axes and add legends appropriately. j) Based on your observation from the plot (i.e., validation set), guess a threshold on the attribute you think would differentiate the two classes with the highest accuracy. k) Calculate the training, validation, and testing accuracies based on the selected threshold on the corresponding sets and print them

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

What role does communication play in developing personal identity?

Answered: 1 week ago