trainb
(To be removed) Batch training with weight and bias learning rules
trainb will be removed in a future release. For more information,
see Transition Legacy Neural Network Code to dlnetwork Workflows.
For advice on updating your code, see Version History.
Syntax
net.trainFcn = 'trainb'
[net,tr] = train(net,...)
Description
trainb is not called directly. Instead it is called by
train for networks whose net.trainFcn property
is set to 'trainb', thus:
net.trainFcn = 'trainb' sets the network
trainFcn property.
[net,tr] = train(net,...) trains the network with
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.
Training occurs according to trainb’s training parameters, shown
here with their default values:
net.trainParam.epochs | 1000 | Maximum number of epochs to train |
net.trainParam.goal | 0 | Performance goal |
net.trainParam.max_fail | 6 | Maximum validation failures |
net.trainParam.min_grad | 1e-6 | Minimum performance gradient |
net.trainParam.show | 25 | Epochs between 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 |
Network Use
You can create a standard network that uses trainb by calling
linearlayer.
To prepare a custom network to be trained with trainb,
Set
net.trainFcnto'trainb'. This setsnet.trainParamtotrainb’s default parameters.Set each
net.inputWeights{i,j}.learnFcnto a learning function. Set eachnet.layerWeights{i,j}.learnFcnto a learning function. Set eachnet.biases{i}.learnFcnto 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.trainParamproperties to desired values.Set weight and bias learning parameters to desired values.
Call
train.
Algorithms
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
timeis exceeded.Validation performance (validation error) has increased more than
max_failtimes since the last time it decreased (when using validation).
Version History
Introduced before R2006aSee Also
Time Series
Modeler | fitrnet (Statistics and Machine Learning Toolbox) | fitcnet (Statistics and Machine Learning Toolbox) | trainnet | trainingOptions | dlnetwork