Neural Networks Learning Solution




In this exercise, you will implement the backpropagation algorithm for neural networks and apply it to the task  of hand-written digit recognition.  Before starting  on the programming  exercise, we strongly recommend watching the video lectures and completing the review questions for the associated topics.

To get started with the  exercise, you will need to download the  starter code and unzip its contents  to the directory where you wish to complete the exercise.  If needed, use the cd command  in Octave/MATLAB to change to this directory  before starting  this exercise.

You can also find instructions  for installing Octave/MATLAB in the “En- vironment Setup Instructions” of the course website.



Files included in  this exercise

ex4.m – Octave/MATLAB script that  steps you through  the exercise

ex4data1.mat – Training  set of hand-written digits

ex4weights.mat – Neural network parameters for exercise 4

submit.m – Submission script that  sends your solutions to our servers

displayData.m – Function  to help visualize the dataset fmincg.m – Function  minimization  routine  (similar to fminunc) sigmoid.m – Sigmoid function

computeNumericalGradient.m – Numerically compute gradients checkNNGradients.m – Function  to help check your gradients debugInitializeWeights.m – Function  for initializing weights predict.m – Neural network prediction  function

[?] sigmoidGradient.m – Compute  the gradient of the sigmoid function

[?] randInitializeWeights.m – Randomly initialize weights

[?] nnCostFunction.m – Neural network cost function


? indicates  files you will need to complete


Throughout the exercise, you will be using the script ex4.m. These scripts set up the dataset for the problems and make calls to functions that  you will write.  You do not need to modify the script.  You are only required to modify functions in other files, by following the instructions  in this assignment.



Submission and Grading


After completing various parts  of the assignment,  be sure to use the submit function system to submit  your solutions to our servers.  The following is a breakdown of how each part  of this exercise is scored.


Part Submitted File Points
Feedforward  and Cost Function

Regularized Cost Function



30 points

15 points

Sigmoid Gradient sigmoidGradient.m 5 points
Neural     Net    Gradient     Function

(Backpropagation) Regularized Gradient




40 points



10 points

Total  Points 100 points

You are allowed to submit your solutions multiple times, and we will take only the highest score into consideration.

error: Content is protected !!