Alternative and expanded exercises .

Alternative and Expanded Exercises for Tutorial on Neural Systems Modeling
What follows are changes to, or expansions of, or corrections to, or even replacements for the
exercises in the first printed version of Tutorial on Neural Systems Modeling that would make
the exercises even easier to do.
Chapter 1
page 24, Exercise 1.1
Could note here that Gauss’s method can work for any positive, even or odd, integer.
page 25, Exercise 1.3, before middle
The exercise could be change as follows:
is now: Set the feedback weight w to some positive value less than 1, and find the response to the
step input. How would you describe the response? Both the pulse and the step responses move
from 1 to some asymptotic level. Is the rate of movement toward their respective asymptotes the
same for both the pulse and the step?
could be: Set the feedback weight w to some positive value less than 1, and compute both the
pulse and step responses. How would you compare them? Both the pulse and the step responses
move from 1 to some asymptotic level. Is the same proportion of the asymptote reached in about
the same time for both the pulse and the step responses? For example, do each of the pulse and
the step responses reach 50% of their asymptotic levels at around the same time point?
Chapter 2
page 60, Exercise 2.1, near the end
This exercise could be expanded as follows:
is now: connection weights are all 0.05. The responses
expand to: connection weights are all 0.05. To accommodate the larger network and its longer
response durations, zero and define the output array using y=zeros(n,nTs) and increase the
end time using tEnd=1000. The responses
page 61, Exercise 2.3, text continued from page 60, first line on page 61
This exercise should be corrected as follows:
is now: w12=0.44. We want the input to be
should be: w12=0.44. We want the input to be
(The number 0.44 must be negative here.)
page 61, Exercise 2.3, text continued from page 60, past the middle
This exercise should be corrected as follows:
is now: and x(start)=1. We also want the input to be v1=1 but v2=0. What is the
should be: and x(start)=1. What is the
(Remove the sentence “We also want the input to be v1=1 but v2=0.”)
1
Chpater 3
page 95, Exercise 3.4, past middle
This exercise could be expanded as follows:
is now: Gaussian with SD 3 and amplitude 1. What happens to the performance
expand to: Gaussian with SD 3 and amplitude 1. To better visualize the response, follow the
command plot(y) with the command axis([-25 25 0 11]), or just use mesh(y).
What happens to the performance
Chapter 4
page 133, Exercise 4.4, before middle
This exercise should be corrected as follows:
is now: P(1, [1:2:49])=1, P=(2, [1:5 11:15 21:25 31:35 41:45])=1,
P=(3, [2:2:50])=1.
should be: P(1, [1:2:49])=1, P(2, [1:5 11:15 21:25 31:35 41:45])=1,
P(3, [2:2:50])=1.
(Note that there should be no equals sign between the P and the open paren. Remove the equal
sign between P and ( two times. Specifically, P=(2, should be P(2, and P=(3, should be
P(3,. Note that P(1, in the first command is correct.)
Chapter 5
page 167, Exercise 5.3, near bottom
This exercise should be corrected as follows:
is now: midrange? Are the all the output units equally broadly tuned
should be: midrange? Are all the output units equally broadly tuned
page 167, Exercise 5.1
This exercise could be expanded as follows:
is now: the winning output unit was trained on any learning cycle), and no map formed. … [the
rest of the exercise from here could be changed]…
expand to: the winning output unit was trained on any learning cycle), and each unit became
specialized for its own, unique cluster. Now increase the number of output units to ten and
retrain the network either with neighbors (nHood=1) or without neighbors (nHood=0) and
compare their responses to the nine input patterns following training. (Make sure to normalize
the input patterns before training.) Do the output units specialize similarly in both cases
(nHood=1 and nHood=0)? Is the relationship between output unit location in the network and
output unit preferred input pattern that same in both networks? How can you account for any
differences you observe?
page 168, Exercise 5.4, near bottom, above Table E5.1
This exercise should be corrected as follows:
is now: with neighborhood size 1 (nHood=1), are retest the trained network
should be: with neighborhood size 1 (nHood=1), and retest the trained network
2
Chapter 6
page 210, Exercise 6.4, past middle
This exercise could be expanded as follows:
is now: according to the values in Table 6.17. Because the units are
expand to: according to the values in Table 6.17. Equip the network with 50 hidden units
(nHid=50). Because the units are
Chapter 7
page 247, Exercise 7.1, past middle
This exercise could be expanded as follows:
is now: use the non-overlapping (labeled line) patterns. Does it work?
expand to: use the non-overlapping (labeled line) patterns. Before training, make sure to
randomize the weight matrix: V=randn(1,4). Does it work?
page 247, Exercise 7.2, before middle
This exercise could be expanded as follows:
is now: use the non-overlapping (labeled line) patterns. To do perturbative
expand to: use the non-overlapping (labeled line) patterns. Before training, randomize the
weight matrix: V=randn(1,4). To do perturbative
page 247, Exercise 7.2, near bottom
This exercise should be corrected as follows:
is now: as when newer>=error is true
should be: as when newErr>=error is true
page 248, Exercise 7.4, past middle
This exercise should be corrected as follows:
is now: command call=wch*hear)*hear with call=0 in script
should be: command call=wch*hear with call=0 in script
(Just remove “)*hear” which is a typo. Note that what is being removed is a closing paren
“)”, a space, an asterisk “*“, and the word “hear”, all in monotype.)
page 248, Exercise 7.4, near end
This exercise should be corrected as follows:
is now: Is the time altered for the onset of the avoidance response?
should be: Is the time altered for the acquisition of the avoidance response?
Chapter 8
page 297, Exercise 8.2
This exercise could be expanded as follows:
is now: algorithm for 2000 passes through the
expand to: algorithm for nIts=2000 passes through the
3
page 297, Exercise 8.2
This exercise could be substantially further expanded as follows:
is now: to V and b, respectively. ... After training, test the network ...
expand to: to V and b, respectively. To do this, set a batch size bat=50, and make an array to
hold the bias input to the two units as B=zeros(2,bat). Training can be accomplished in
two, nested loops, with the outer loop for i=1:nIts, end and the inner loop for
j=1:nSam/bat, end. The bias input to the two units over the batch interval is
B(1,:)=b(1)*ones(1,bat) and B(2,:)=b(2)*ones(1,bat). The signal input over
the batch interval is x=mix(:,bat*(j-1)+1:bat*j). The weighted input sums to the two
units are then computed as q=V*x+B, and the output is squashed using y=1./(1+exp(-q)),
as in infoMax2x2. The weight updates are computed as
delV=a*(inv(V')+1/bat*((1-2*y)*x')) while the bias updates are computed as
delb=a*(1/bat*sum(1-2*y,2)), where the learning rate can be set to a=0.1. The
weight updates are applied for each batch using V=V+delV and b=b+delb, as in
infoMax2x2. It is important not to remove negative weights in V for this exercise. After
training, test the network by applying the signals in mix as inputs. The outputs should be
squashed versions of the original signals, as in Figure 8.2. Examine connectivity matrix V after
training. Is it proportional to the identity or flipped-identity matrix? Would you expect it to be?
page 297, Exercise 8.3
This exercise could be expanded as follows:
is now: background level to 0.9 (bg=0.9). Run the script
expand to: background level to 0.9 (bg=0.9), with the number of inputs states set at 20
(nX=20). Run the script
Chapter 9
page 338, Exercise 9.2, near bottom
This exercise could be changed as follows:
is now: Does the network need all 12 hidden units? Do the responses of the hidden units change
as you decrease their number? How does the performance of the network change as you decrease
the number of hidden units?
change to: Does the network need all 12 hidden units? Is it still able to accurately estimate the
posterior probabilities of the three fish species as you decrease the number of hidden units? Is it
still able to classify the fish?
Chapter 10
page 383, Exercise 10.2, past middle
This exercise could be expanded as follows:
is now: hidden units in the network to eight (nHid=8). How do the
expand to: hidden units in the network to eight (nHid=8), and train it with a learning rate of six
(a=6). How do the
4
page 384, Exercise 10.3
This exercise could be expanded as follows:
is now: This change mainly involves removing the second (“out”) gate and extending the
segment length sl. Then retrain the network several times,
expand to: This change mainly involves removing the second (“out”) gate, moving the first
(“in”) gate to an earlier time point, and extending the segment length sl. Note that desired
outputs are not needed for the stable-state test. Note also that this test involves the output unit
only, so the array Out could be redefined to have ten rows, one for each input item level, and sl
columns, one for the response of the output unit at each time point, using
Out=zeros(10,sl). Then retrain the network several times,
page 384, Exercise 10.4, near end
This exercise could be expanded as follows:
is now: network several times on the short-term memory task. Can you train a network
expand to: network several times on the short-term memory task. After each retraining, test the
network using the stable-state test (see Exercise 10.3). Can you train a network
Chapter 11
page 419, Exercise 11.1, near beginning
This exercise should be corrected as follows:
is now: reinforcement is available in gridWorldSetUp (see MATLAB Box 11.1).
should be: reinforcement is available in gridworldSetUp (see MATLAB Box 11.1).
(Note that the name of the m-file should also be gridworldSetUp.)
page 419, Exercise 11.3, near beginning
This exercise could be changed as follows:
is now: The simulated response backed up from the reward to the cue, and the estimated state
values (weights v) fully predicted the time of the reward (except, of course, on trial 100). Rerun
this simulation
change to: The simulated response backed up from the reward to the cue, and there was no
response activity at the invariable reward time (except, of course, on trial 100). Rerun this
simulation
page 419, Exercise 11.3, near end
This same exercise could be further changed as follows:
is now: Does the response completely back up from the reward to the cue in this case, in which
the reward time is not fully predictable?
change to: Does the response completely transfer from the reward to the cue in this case? Is
there any response activity at the now variable reward time?
5
page 420, Exercise 11.4
The whole bottom part of this exercise could be changed as follows:
is now: With the simplifications we employ in this exercise, the update command using
least-mean-squares learning for the whole weight vector v on each trial is
v=v+(rtgv)/(count+1). Try 20 trials of least-mean-squares learning. Set the reward to 1
on all trials (rtg=1) except on trial 10, in which you can set the reward to 0 (rtg=0). What
happens after the first trial? What happens at trial 10? Do the values fully recover by trial 20?
How does least-mean-squares learning compare with temporal-difference learning in this
example?
change to: With the simplifications we employ in this exercise, the update command using leastmean-squares learning for the whole weight vector v on each trial is
v=v+(rtgv)/(count+1). Be sure that count equals 0 for the first update. Note that this
simulation is much simpler than the one scripted in midbrainDopamine because it involves
only vector v; the vectors x, y, r, and z are not even needed. Try 20 trials of least-mean-squares
learning (nTrials=20) with only 5 time steps (nTimes=5). Set the reward to 1 on all trials
(rtg=1) except on trial 10, in which you can set the reward to 0 (rtg=0). After each update of
value vector v you can save it as a row of Tcourse, and then display Tcourse or plot it using
mesh(Tcourse) following training. What happens after the first learning trial? What happens
at trial 10? Do the values fully recover by trial 20? How would least-mean-squares learning
compare with temporal-difference learning in this example?
Chapter 12
pages 476 and 477, Exercise 12.2
All of Exercise 12.2 could be replaced with the following:
12.2. In the simulation of bottom-up/top-down processing using probabilistic inference
(BUTDprobInference, listed in MATLAB Box 12.4), we computed the posterior probability
of feature 1 given image 1 [P(F=1 | I=1)] when there was no expectation as to location or when
the expected location was left or right [P(L=1) = 0.5, 0.9, or 0.1]. We found that P(F=1 | I=1)
went up when P(L=1) = 0.9, and went down when P(L=1) = 0.1. Modify script
BUTDprobInference to compute the posterior probability of feature 1 given image 3 [P(F=1
| I=3)] when P(L=1) = 0.5, 0.9, or 0.1. To do this, i1 would need to be changed to i3 in all
variable names other than those used to set the prior and conditional probability distributions.
For example, variable names such as pf1gi1BayesU and pi1gc1 would be changed to
pf1gi3BayesU and pi3gc1, respectively. What is the posterior probability of feature 1 given
image 3 [P(F=1 | I=3)] when there is no expectation as to location or when the expected location
is left or right [P(L=1) = 0.5, 0.9, or 0.1]? How do these posteriors compare with those given
image 1 [P(F=1 | I=1)]? Do the differences make sense? How can you explain them?
Chapter 13
page 511, Exercise 13.1, past middle
This exercise could be expanded as follows:
is now: DesOut=[0; 1; 1; 0]. Is the same
expand to: DesOut=[0; 1; 1; 0]. Increase maxIts to 30,000. Is the same
6
page 511, Exercise 13.2, last two lines
This exercise could be changed as follows:
is now: number of units in the network to 5. Does the algorithm perform as well with 5 as with
20 units?
change to: number of units in the network to 2. Does the algorithm perform as well with 2 as
with 20 units?
page 512, Exercise 13.4 (continued from page 511), just past middle
This exercise should be corrected as follows:
is now: 5-bit genes. (Recall in gaBubble that each chromosome also had three genes, and the
first two were 5-bit but the third was only 4-bit).
should be: 5-bit genes. (Recall in gaBubble that each chromosome also had three genes, and
the last two were 5-bit but the first was only 4-bit.)
page 512, Exercise 13.4, near end, last few lines
This exercise could be expanded as follows:
is now: version of the Wilson CPG. Can you evolve
expand to: version of the Wilson CPG. You might find it useful to increase the population size
and the number of generations. Can you evolve
7