Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

hello please help ill upbote (in phyton) here is the previous question, i dont know if its relevant to questiln 3 but there is no

image text in transcribed hello please help ill upbote (in phyton)
image text in transcribed here is the previous question, i dont know if its relevant to questiln 3 but there is no samples or data other than what i posted
Problem 3) MNIST dataset - The MNIST dataset is divided into two sets - training and test. 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). a) Use mnist function in keras datasets to split the MNIST dataset into the training and testing sets. Print the following: The number of images in each training and testing set, and the image width and height. b) Write a function (with images of ten digits and labels as the input) that plots a figure with 10 subplots for each 0-9 digits. Each subplot has the number of the handwritten digit in the title. c) Create a loop to call the plot function in (b) with images from each set to create three figures. Note: the code has to select the images randomly. Include all the 10 digits in each figure. Show the results of your code. d) In machine learning, we usually divide the training set into two sets of training and validation sets to adjust a machine learning model parameters. In your code, randomly select 20% of the training images and their corresponding labels and name them as x_valid and y_valid, respectively. Name the remaining training images and their labels as x_train and y_train, respectively. Print the number of images in each training and validation set. Note: that there are no overlaps between the two sets. Problem 2) Threshold-based Classifier - We have a two-class classification problem (i.e., Cl and C2). Each data sample is represented by two attributes (x,y). The three data samples in class C1 1 are {(2, 2), (3, 2), (2, 3)) and {(1, 2), (1, 1), (2, 1)) in class C2. Perform the followings in Python: a) Plot the data samples. The data points in classes C1 and C2 have to be in two different colors and shapes. Label the axes and add legends as appropriate. b) The code asks the user to enter two thresholds th, and thy. c) Your code calculates and prints the training accuracy based on the user-entered thresholds. To do so, assume that for any data point (x,y) with x>th, and y? thy, the data sample belongs to class C1, and C2 if otherwise. Using this rule and the user- entered thresholds, the code calculates the classification accuracy for the six data samples. The classification accuracy is defined as the number of correctly classified data points over the total number of data points (6 in here). d) The code asks the user to enter a new data sample by entering both x and y e) Plot the new data sample on the plot in part (a). 1) The code determines and prints the class (CI or C2) of the new data sample using the user-entered thresholds. g) The user can enter new data points, and the code repeats parts (d)-(f) unless the user writes *x' as the input h) The code asks the user for new threshold values and starts from part (b) i) Select the best thresholds that will give the highest accuracy, Run part (e) using these thresholds. What classification accuracy did you achieve? Was it the highest possible accuracy for the given six data samples

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions

Question

Would I do better on the test if I studied more?

Answered: 1 week ago