Neural Network Toolbox |
Network Generalization
Of course, even if the network detects the amplitudes of the training wave forms, it may not detect the amplitude of a sine wave with an amplitude it has not seen before.
The following code defines a new wave form made up of two repetitions of a sine wave with amplitude 1.6 and another with amplitude 1.2.
p3 = sin(1:20)*1.6; t3 = ones(1,20)*1.6; p4 = sin(1:20)*1.2; t4 = ones(1,20)*1.2; pg = [p3 p4 p3 p4]; tg = [t3 t4 t3 t4]; pgseq = con2seq(pg);
The input sequence pg
and target sequence tg
are used to test the ability of our network to generalize to new amplitudes.
Once again the function sim
is used to simulate the Elman network and the results are plotted.
This time the network did not do as well. It seems to have a vague idea as to what it should do, but is not very accurate!
Improved generalization could be obtained by training the network on more amplitudes than just 1.0 and 2.0. The use of three or four different wave forms with different amplitudes can result in a much better amplitude detector.
Improving Performance
Run appelm1
to see plots similar to those above. Then make a copy of this file and try improving the network by adding more neurons to the recurrent layer, using longer training times, and giving the network more examples in its training data.
Network Testing | Appcr1: Character Recognition |
© 1994-2005 The MathWorks, Inc.