Question

In: Computer Science

1) Code in python for solving the MNIST classification problem (for full size of the training...

1) Code in python for solving the MNIST classification problem (for

full size of the training set

Classify two digits from MNIST dataset

2) Logistic regression (LR) with L1 regularization

where LR is differentiable, But L1 norm is not

• Use proximal gradient descent

• For L1 norm, that’s soft-thresholding

• Use tensorflow library

Solutions

Expert Solution

The MNIST dataset is an acronym that stands for the Modified National Institute of Standards and Technology dataset.

It is a dataset of 60,000 small square 28×28 pixel grayscale images of handwritten single digits between 0 and 9.

The task is to classify a given image of a handwritten digit into one of 10 classes representing integer values from 0 to 9, inclusively.

It is a widely used and deeply understood dataset and, for the most part, is “solved.” Top-performing models are deep learning convolutional neural networks that achieve a classification accuracy of above 99%, with an error rate between 0.4 %and 0.2% on the hold out test dataset.

The example below loads the MNIST dataset using the Keras API and creates a plot of the first nine images in the training dataset.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

# example of loading the mnist dataset

from keras.datasets import mnist

from matplotlib import pyplot

# load dataset

(trainX, trainy), (testX, testy) = mnist.load_data()

# summarize loaded dataset

print('Train: X=%s, y=%s' % (trainX.shape, trainy.shape))

print('Test: X=%s, y=%s' % (testX.shape, testy.shape))

# plot first few images

for i in range(9):

# define subplot

pyplot.subplot(330 + 1 + i)

# plot raw pixel data

pyplot.imshow(trainX[i], cmap=pyplot.get_cmap('gray'))

# show the figure

pyplot.show()


Related Solutions

construct A*star algorithm for solving the 8-puzzle problem . Use MATLAB or Python .Your code should...
construct A*star algorithm for solving the 8-puzzle problem . Use MATLAB or Python .Your code should include two heuristic functions -misplaced tiles and calculation of manhattan distance. The code should work for all cases of puzzle.
Use Python to solve each problem. Answers should be written in full sentences. Define a code...
Use Python to solve each problem. Answers should be written in full sentences. Define a code that will give users the option to do one of the following. Convert an angle from radians to degrees, Convert an angle from degrees to radians, Return the sine, cosine, or tangent of a given angle (need to know if angle is given in degrees or radians).
Problem-Solving Case: Training Call Center Employees The employees in a call center need to be able...
Problem-Solving Case: Training Call Center Employees The employees in a call center need to be able to speak to customers politely, but their skill set is more complicated than etiquette. They also need to handle a range of questions and problems about particular products. Whenever their company adds a new line of products or services, the employees have to be prepared to answer a new set of questions. Thus, training is an ongoing con- cern in call centers. The traditional...
In Python I have a code: here's my problem, and below it is my code. Below...
In Python I have a code: here's my problem, and below it is my code. Below that is the error I received. Please assist. Complete the swapCaps() function to change all lowercase letters in string to uppercase letters and all uppercase letters to lowercase letters. Anything else remains the same. Examples: swapCaps( 'Hope you are all enjoying October' ) returns 'hOPE YOU ARE ALL ENJOYING oCTOBER' swapCaps( 'i hope my caps lock does not get stuck on' ) returns 'I...
Problem 1. Determine the length, the size, and the minimal distance for each q-ary code C...
Problem 1. Determine the length, the size, and the minimal distance for each q-ary code C below. How many errors can each code correct? detect? (a) C = { (0, 0, 0, 0, 0, 0), (0, 1, 1, 1, 1, 0), (1, 0, 0, 0, 0, 1), (1, 1, 1, 1, 1, 1) }. Here q = 2. (b) C = { (0, 0, 0, 0, 0, 0, 0), (2, 1, 0, 2, 1, 0, 1), (2, 2, 2, 2,...
This is in Python: Alter your code for previous Do It Now problem, with the change...
This is in Python: Alter your code for previous Do It Now problem, with the change that the row should only be printed by the second number that the user enters. For example, the user enters two numbers of 5 and 7 for the two input lines in the code, and the following will be printed: 5 x 1 = 5 5 x 2 = 10 5 x 3 = 15 5 x 4 = 20 5 x 5 =...
Discuss differences in brain activity associated with solving a problem by insight and solving a problem...
Discuss differences in brain activity associated with solving a problem by insight and solving a problem through step-by-step analysis.
please answer this in a simple python code 1. Write a Python program to construct the...
please answer this in a simple python code 1. Write a Python program to construct the following pattern (with alphabets in the reverse order). It will print the following if input is 5 that is, print z one time, y two times … v five times. The maximum value of n is 26. z yy xxx wwww vvvvvv
Discuss differences in brain activity associated with solving problem by insight and solving a problem through...
Discuss differences in brain activity associated with solving problem by insight and solving a problem through step-by-step analysis.
Problem: Write a Python module (a text file containing valid Python code) named p5.py. This file...
Problem: Write a Python module (a text file containing valid Python code) named p5.py. This file must satisfy the following. Define a function named rinsert. This function will accept two arguments, the first a list of items to be sorted and the second an integer value in the range 0 to the length of the list, minus 1. This function shall insert the element corresponding to the second parameter into the presumably sorted list from position 0 to one less...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT