Download Neural Network Toolbox User's Guide

Transcript
Training
Recall that the input vectors for adapt are to be in a cell array, so create such
an array from the original input signals with the following code.
Pseq = con2seq(P)
Tseq = con2seq(T)
Now apply adapt, and check on the results.
net = adapt(net,Pseq,Tseq);
wtsl1b = net.IW{1,1}
wtsl1b =
-2.2157
-0.0032
2.2221
-0.0027
-0.0027
1.2955
-0.0027
-1.2999
Now test the network with our original input vectors as we did before.
Y = sim(net,P);
Yc = vec2ind(Y);
Yc =
1
1
1
2
2
2
2
1
1
1
Here adapt and train give nearly the same results in about the same running
time. You may recall that when train is used for competitive networks, it
selects the input vectors in random order, and for that reason might give a
better result than adapt in some problems. In the problem studied here the
results given by train and adapt are about the same. Of course, one could
generate 1000 randomly ordered vectors from the 10 input vectors with the
following code.
TS = 1000;
ind = floor(rand(1,TS)*size(P,2))+1;
Pseq = con2seq(P(:,ind));
Tseq = con2seq(T(:,ind));
Finally then, we would need to make only one pass.
net.adaptparam.passes = 1;
net = adapt(net,Pseq,Tseq);
This code gives a network much like those from train and adapt that were
described previously.
8-13