I need to implement a code for Handwritten digits recognition( Using MNIST data set) using Stochastic gradient descent, backpropogation with momentum and using sigmoid activation function.

7 views (last 30 days)
Hello all, I am given 5000 mnist numbers in the form a text file ( 5000 rows of each digit with 784 values in each row for each digit) and also an MNIST labels text file( with 5000 labels for all the 5000 digits) I have to implement an algorithm for 1 hidden layer neural network with 784 inputs, 100 hidden neurons, 10 outputs(one for each digit) with backpropagation algorithm using momentum and stochastic gradient descent. I have no clue how to start with this. Please help me out with this.
  1 Comment
Jme McQ
Jme McQ on 29 Nov 2021
Hello, DL enthusiast
did you ever manage to implement the backpropogation altgorithm? I have a similar problem;
1 input, (vector)
3 hidden layers,
1 output (vector)
Any advice greatly appreciated!
JM

Sign in to comment.

Answers (2)

Sushi2526
Sushi2526 on 31 Mar 2017
It is quite simple to implement but would take some time to understand how to. You need to initialize the weights first using the dimensions of number of neurons in hidden layer x the length of each data set. If you have more than 1 hidden layer in your code, the hidden weights for each hidden layer would be the number of neurons in the next layer and the number of neurons in the previous layer. And finally the output weights have to be the dimension in the same manner.
Hope this helps you to start with the problem.

yanqi liu
yanqi liu on 2 Dec 2021
yes,sir
1 hidden layer neural network with 784 inputs, 100 hidden neurons, 10 outputs(one for each digit) with backpropagation algorithm using momentum and stochastic gradient descent.
TF1 = 'tansig';
TF2 = 'tansig';
TF3 = 'tansig';
bp_net = newff(minmax(data), [784,100,10], {TF1 TF2 TF3}, 'traingdm');

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!