| Neural Network Toolbox | ![]() |
Batch training with weight and bias learning rules.
Syntax
[net,TR,Ac,El] = trainb(net,Pd,Tl,Ai,Q,TS,VV,TV)
Description
trainb is not called directly. Instead it is called by train for networks whose net.trainFcn property is set to 'trainb'.
trainb trains a network with weight and bias learning rules with batch updates. The weights and biases are updated at the end of an entire pass through the input data.
trainb(net,Pd,Tl,Ai,Q,TS,VV,TV) takes these inputs,
TR -- Training record of various values over each epoch:
Training occurs according to the trainb's training parameters, shown here with their default values:
net.trainParam.epochsMaximum number of epochs to train 100
net.trainParam.goal 0 Performance goal
net.trainParam.max_fail 5 Maximum validation failures
net.trainParam.show 25 Epochs between displays (NaN for no displays)
Dimensions for these variables are:
Pd -- No x Ni x TS cell array, each element Pd{i,j,ts} is a Dij x Q matrix
Tl -- Nl x TS cell array, each element P{i,ts} is a Vi x Q matrix or []
-- AiNl x LD cell array, each element Ai{i,k} is an Si x Q matrix
If VV or TV is not [], it must be a structure of vectors:
VV.PD, TV.PD -- Validation/test delayed inputs
VV.Tl, TV.Tl -- Validation/test layer targets
VV.Ai, TV.Ai -- Validation/test initial input conditions
Validation vectors are used to stop training early if the network performance on the validation vectors fails to improve or remains the same for max_fail epochs in a row. Test vectors are used as a further check that the network is generalizing well, but do not have any effect on training.
trainb(CODE) returns useful information for each CODE string:
Network Use
You can create a standard network that uses trainb by calling newlin.
To prepare a custom network to be trained with trainb
net.trainFcn to 'trainb'.
NET.inputWeights{i,j}.learnFcn to a learning function.
NET.layerWeights{i,j}.learnFcn to a learning function.
NET.biases{i}.learnFcn to a learning function. (Weight and bias learning parameters will automatically be set to default values for the given learning function.)
NET.trainParam properties to desired values.
train.
See newlin for training examples
Algorithm
Each weight and bias updates according to its learning function after each epoch (one pass through the entire set of input vectors).
Training stops when any of these conditions are met:
epochs (repetitions) is reached.
goal.
time has been exceeded.
max_fail times since the last time it decreased (when using validation).
See Also
| train | trainbfg | ![]() |
© 1994-2005 The MathWorks, Inc.