Cogsci 109 Assignment 6
Due Friday December 2, 11:59pm
1. Training Neural Networks with Gradient Descent
For this question you will use the XOR data
and modify the program
xorbplay.m
For each modification to the program you will want to run
the network several (about 30) times (with different initial conditions)
a) First run the network (several times) with the code as is. Keep track
of the number of times the network correctly converges and about how long
it takes. Which training algorithm is being used?
b) Try increasing the learning rate to 10 and then 50. What do you conclude?
(Keep track of the number of times the network correctly converges and about how long it takes.)
c) Now change the training algorithm to use the Fletcher-Reeves conjugate
gradient algorithm. Does the network converge faster (on average)? Does
it converge to a correct solution more often? What other advantage does it
have?
d) Now pick your favorite algorithm of the ones you tried above and change
the network architecture to have 2 hidden units. How often does the network
correctly converge? Now try 6 hidden units. How often does the nework
converge correctly?
2. Overfitting in Neural Networks
For this question you will again use the data files:
xdata
ydata
xdata holds the x-coordinates of a set of data and ydata holds
the corresponding y-coordinates. You might want to look
at the matlab command : load
In this question we will try to find a neural network that generalizes
well.
You may modify the following code and use your favorite training
method.
hw6q2.m
Make sure you understand how the line yp=sim(net,xp);
is used to construct the curve of the network output. For this
question you will only have to run each network a few times (2-5).
a) Run the code hw6q2 a few times. Try changing the number of hidden units
(e.g. 6,10,20).
b) Uncomment the lines
net.performFcn='msereg';
net.performParam.ratio=0.95;
to run the weight decay code.
Try varying the weighting of the weight decay? What happens when
net.performParam.ratio is too low?
c) Now recomment the above two lines and use the Bayesian regression
method. Try for a few different numbers of hidden units.
d) You can also run the early stopping version of the code in
hw6q2d.m . Again try a few different number
of hidden units.
What to Hand In
Hand in your function file xorbplay.m (the last version from part d)).
For question 2c) hand in your modified code hw6q2.m.
Also hand in a simple plain text file (NO WORD
DOCUMENTS) called hw6answers.txt that contains the folowing
words (with the blanks filled in) (Feel free to add other (brief) textual remarks)
1a) The training algorithm is ___________________________________.
Of 30 runs, the network converged correctly ___________ times.
It took on average _____________ iterations for a correct solution and
_________________ iterations for an incorrect solution.
1b) With learning rate of 10, the network converged correctly __________ times
(out of 30). It took on average ____________ iterations for a correct solution,_________________ iterations for an incorrect solution.
With learning rate of 50, the network converged correctly __________ times
(out of 30). It took on average ____________ iterations for a correct solution,_________________ iterations for an incorrect solution.
1c) With the conjugate gradient algorithm, the network converged correctly __________ times (out of 30). It took on average ____________ iterations for a correct solution,_________________ iterations for an incorrect solution.
1d) With 2 hidden units, the network converged correctly ____________
times (out of 30). With 6 hidden units it converged correctly ____________
times (out of 30).
Results from my experiments in Question 2 are (Describe how the curves
look for the different manipulations):
2.a)
2 b)
2 c)
2 d)
Use the turnin
program. (Note this must be done from your icogsci1 account). Please also
leave a copy in your icogsci1 account in case submission doesn't work -- We can
retrieve (and check dates/times) on files in your account if necessary. THIS
IS SAFER AND LESS HASSLE FOR US THAN EMAILING US THE FILES.
There is no need to hand in graphs.