Answered step by step
Verified Expert Solution
Question
1 Approved Answer
***************************************************************************************** Matlab code to help with the following program, please solve as many steps as possible ************************************************************************************************* Two data files are included: Image Data File:
*****************************************************************************************
Matlab code to help with the following program, please solve as many steps as possible
*************************************************************************************************
Two data files are included: Image Data File: MNISTnumImages5000.trt is a text file that has data for 5,000 digits, each a grayscale image of size 28 x 28 pixels (i.e., 784 pixels each). Each row of the data file has 784 values representing the intensities of the image for one digit between 0 and 9. The first hundred images are shown in the included file first100.jpg. Label Data File: MNISTnumLabels5000.trt is a text file with one integer in each row, indicating the correct label of the image in the corresponding row in the image data file. Thus, the first entry "7 indicates that the first row of the image data file has data for a handwritten number 7, You need to do the following: 1. Write a program implementing multi-layer feed-forward neural networks and training them with back propagation including momentum. Your program must be able to handle any number of hidden layers and hidden neurons, and should allow the user to specify these at run-time 2. Randomly choose 4,000 data points from the data files to form a training set, and use the remaining 1,000 data points to form a test set. 3. Train a 1-hidden layer neural network to recognize the digits using the training set. You will probably need a fairly large number of hidden neurons in the range of 100 to 200. Since there are 10 classes, you should use 10 output neurons - one for each digit - such that the correct neuron is required to produce a 1 and the rest 0 (one-hot codes). To evaluate performance during training, you can use 0 and 1, or make things a little easier by using "target values" such as 0.75 and 0.25, as discussed in class. You will probably need hundreds of epochs for learning, so consider using stochastic gradient descent, where only a random subset of the 4,000 points is shown to the network in each epoch. The performance of the network in any epoch is measured by the fraction of correctly classified training set points in that epoch (Hit-Rate). Save this value at the beginning, and then in every tenth epoch (as in Homework 2) 4. After the network is trained, test it on the test set. To evaluate performance on the test data, you can use a max-threshold approach, where you consider the output correct if the correct output neuron produces the largest output among all 10 output neurons. Two data files are included: Image Data File: MNISTnumImages5000.trt is a text file that has data for 5,000 digits, each a grayscale image of size 28 x 28 pixels (i.e., 784 pixels each). Each row of the data file has 784 values representing the intensities of the image for one digit between 0 and 9. The first hundred images are shown in the included file first100.jpg. Label Data File: MNISTnumLabels5000.trt is a text file with one integer in each row, indicating the correct label of the image in the corresponding row in the image data file. Thus, the first entry "7 indicates that the first row of the image data file has data for a handwritten number 7, You need to do the following: 1. Write a program implementing multi-layer feed-forward neural networks and training them with back propagation including momentum. Your program must be able to handle any number of hidden layers and hidden neurons, and should allow the user to specify these at run-time 2. Randomly choose 4,000 data points from the data files to form a training set, and use the remaining 1,000 data points to form a test set. 3. Train a 1-hidden layer neural network to recognize the digits using the training set. You will probably need a fairly large number of hidden neurons in the range of 100 to 200. Since there are 10 classes, you should use 10 output neurons - one for each digit - such that the correct neuron is required to produce a 1 and the rest 0 (one-hot codes). To evaluate performance during training, you can use 0 and 1, or make things a little easier by using "target values" such as 0.75 and 0.25, as discussed in class. You will probably need hundreds of epochs for learning, so consider using stochastic gradient descent, where only a random subset of the 4,000 points is shown to the network in each epoch. The performance of the network in any epoch is measured by the fraction of correctly classified training set points in that epoch (Hit-Rate). Save this value at the beginning, and then in every tenth epoch (as in Homework 2) 4. After the network is trained, test it on the test set. To evaluate performance on the test data, you can use a max-threshold approach, where you consider the output correct if the correct output neuron produces the largest output among all 10 output neuronsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started