trainb
Purpose
Batch training with weight and bias learning rules
Syntax
[net,TR] = trainb(net,TR,trainV,valV,testV)
info = trainb('info')
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,TR,trainV,valV,testV) takes these inputs,
net
|
Neural network
|
TR
|
Initial training record created by train
|
trainV
|
Training data created by train
|
valV
|
Initial input conditions
|
testV
|
Test data created by train
|
and returns
net
|
Trained network
|
TR
|
Training record of various values over each epoch
|
Each argument trainV, valV, and testV is a structure of these fields:
X
|
N x TS cell array of inputs for N inputs and TS time steps. X{i,ts} is an Ri x Q matrix for the ith input and ts time step.
|
Xi
|
N x Nid cell array of input delay states for N inputs and Nid delays. Xi{i,j} is an Ri x Q matrix for the ith input and jth state.
|
Pd
|
N x S x Nid cell array of delayed input states.
|
T
|
No x TS cell array of targets for No outputs and TS time steps. T{i,ts} is an Si x Q matrix for the ith output and TS time step.
|
Tl
|
Nl x TS cell array of targets for Nl layers and TS time steps. Tl{i,ts} is an Si x Q matrix for the ith layer and TS time step.
|
Ai
|
Nl x TS cell array of layer delays states for Nl layers, TS time steps. Ai{i,j} is an Si x Q matrix of delayed outputs for layer i, delay j.
|
Training occurs according to trainb's training parameters, shown here with their default values:
net.trainParam.epochs
|
100
|
|
Maximum number of epochs to train
|
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)
|
net.trainParam.showCommandLine
|
false
|
|
Generate command-line output
|
net.trainParam.showWindow
|
true
|
|
Show training GUI
|
net.trainParam.time
|
inf
|
|
Maximum time to train in seconds
|
trainb('info') returns useful information about this function.
Network Use
You can create a standard network that uses trainb by calling newlin.
To prepare a custom network to be trained with trainb,
- Set net.trainFcn to 'trainb'. This sets net.trainParam to trainb's default parameters.
- Set each net.inputWeights{i,j}.learnFcn to a learning function. Set each net.layerWeights{i,j}.learnFcn to a learning function. Set each net.biases{i}.learnFcn to a learning function. (Weight and bias learning parameters are automatically set to default values for the given learning function.)
To train the network,
- Set net.trainParam properties to desired values.
- Set weight and bias learning parameters to desired values.
- Call train.
See newlin for training examples.
Algorithm
Each weight and bias is updated according to its learning function after each epoch (one pass through the entire set of input vectors).
Training stops when any of these conditions is met:
- The maximum number of epochs (repetitions) is reached.
- Performance is minimized to the goal.
- The maximum amount of time is exceeded.
- Validation performance has increased more than max_fail times since the last time it decreased (when using validation).
See Also
newp, newlin, train
| | Provide feedback about this page |
 | train | | trainbfg |  |
Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
Get the Interactive Kit