| Neural Network Toolbox | |
| Provide feedback about this page |
Syntax
To Get Help
Description
train trains a network net according to net.trainFcn and net.trainParam.
net |
Network |
P |
Network inputs |
T |
Network targets (default = zeros) |
Pi |
Initial input delay conditions (default = zeros) |
Ai |
Initial layer delay conditions (default = zeros) |
net |
New network |
tr |
Training record (epoch and perf) |
Y |
Network outputs |
E |
Network errors |
Pf |
Final input delay conditions |
Af |
Final layer delay conditions |
Note that T is optional and need only be used for networks that require targets. Pi and Pf are also optional and need only be used for networks that have input or layer delays. Optional arguments VV and TV are described below.
train's signal arguments can have two formats: cell array or matrix.
The cell array format is easiest to describe. It is most convenient for networks with multiple inputs and outputs, and allows sequences of inputs to be presented.
Ni |
= |
|
net.numInputs |
Nl |
= |
|
net.numLayers |
ID |
= |
|
net.numInputDelays |
LD |
= |
|
net.numLayerDelays |
TS |
= |
|
Number of time steps |
Q |
= |
|
Batch size |
Ri |
= |
|
net.inputs{i}.size |
Si |
= |
|
net.layers{i}.size |
The columns of Pi, Pf, Ai, and Af are ordered from the oldest delay condition to the most recent:
Pi{i,k} |
= |
|
Input i at time ts = k - ID |
Pf{i,k} |
= |
|
Input i at time ts = TS + k - D |
Ai{i,k} |
= |
|
Layer output i at time ts = k - LD |
Af{i,k} |
= |
|
Layer output i at time ts = TS + k - LD |
The matrix format can be used if only one time step is to be simulated (TS = 1). It is convenient for networks with only one input and output, but can be used with networks that have more.
Each matrix argument is found by storing the elements of the corresponding cell array argument in a single matrix:
Examples
Here input P and targets T define a simple function that you can plot:
Here newff is used to create a two-layer feed-forward network. The network has one hidden layer with ten neurons.
The network is trained for up to 50 epochs to an error goal of 0.01 and then resimulated.
net.trainParam.epochs = 50; net.trainParam.goal = 0.01; net = train(net,p,t); y2 = sim(net,p) plot(p,t,'o',p,y1,'x',p,y2,'*')
Algorithm
train calls the function indicated by net.trainFcn, using the training parameter values indicated by net.trainParam.
Typically one epoch of training is defined as a single presentation of all input vectors to the network. The network is then updated according to the results of all those presentations.
Training occurs until a maximum number of epochs occurs, the performance goal is met, or any other stopping condition of the function net.trainFcn occurs.
Some training functions depart from this norm by presenting only one input vector (or sequence) each epoch. An input vector (or sequence) is chosen randomly each epoch from concurrent input vectors (or sequences). newc and newsom return networks that use trainr, a training function that does this.
See Also
| Provide feedback about this page |
![]() | tansig | trainb | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |