Neural Network Toolbox |
Initialization
Initialize your network with the following line of code.
Reference the network's biases and weights again to see how they have changed.
Training
Define the following cell array of two input vectors (one with two elements, one with five) for two time steps (i.e., two columns).
We want the network to respond with the following target sequence.
Before training, we can simulate the network to see whether the initial network's response Y is close to the target T.
The second row of the cell array Y
is the output sequence of the second network output, which is also the output sequence of the third layer. The values you got for the second row may differ from those shown due to different initial weights and biases. However, they will almost certainly not be equal to our targets T, which is also true of the values shown.
The next task is to prepare the training parameters. The following line of code displays the default Levenberg-Marquardt training parameters (which were defined when we set net.trainFcn
to trainlm
).
The following properties should be displayed.
ans = epochs: 100 goal: 0 max_fail: 5 mem_reduc: 1 min_grad: 1.0000e-10 mu: 1.0000e-03 mu_dec: 0.1000 mu_inc: 10 mu_max: 1.0000e+10 show: 25 time: \xb0
Change the performance goal to 1e-10
.
Next, train the network with the following call.
Below is a typical training plot.
After training you can simulate the network to see if it has learned to respond correctly.
Note that the second network output (i.e., the second row of the cell array Y
), which is also the third layer's output, does match the target sequence T
.
Network Definition | Additional Toolbox Functions |
© 1994-2005 The MathWorks, Inc.