Neural Network Toolbox |
Conjugate gradient backpropagation with Powell-Beale restarts
Syntax
[net,TR,Ac,El] = traincgb(net,Pd,Tl,Ai,Q,TS,VV,TV)
Description
traincgb
is a network training function that updates weight and bias values according to the conjugate gradient backpropagation with Powell-Beale restarts.
traincgb(net,Pd,Tl,Ai,Q,TS,VV,TV)
takes these inputs,
Ai
-- Initial input delay conditions
VV
-- Either empty matrix []
or structure of validation vectors
TR
-- Training record of various values over each epoch:
Training occurs according to the traincgb
's training parameters, shown here with their default values:
net.trainParam.epochs 100
Maximum number of epochs to train
net.trainParam.show 25
Epochs between showing progress
net.trainParam.goal 0
Performance goal
net.trainParam.time inf
Maximum time to train in seconds
net.trainParam.min_grad 1e-6
Minimum performance gradient
net.trainParam.max_fail 5
Maximum validation failures
net.trainParam.searchFcn
Name of line search routine to use.'srchcha'
Parameters related to line search methods (not all used for all methods):
net.trainParam.low_lim 0.1
Lower limit on change in step size.
net.trainParam.up_lim 0.5
Upper limit on change in step size.
net.trainParam.maxstep 100
Maximum step length.
Dimensions for these variables are
Pd
-- No
x Ni
x TS
cell array, each element P{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.
Ai
-- Nl
x LD
cell array, each element Ai{i,k}
is an Si
x Q
matrix.
If VV
is not []
, it must be a structure of validation vectors,
VV.PD
-- Validation delayed inputs.
VV.Tl
-- Validation layer targets.
VV.Ai
-- Validation initial input conditions.
which is 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.
If TV
is not []
, it must be a structure of validation vectors,
TV.PD
-- Validation delayed inputs.
TV.Tl
-- Validation layer targets.
TV.Ai
-- Validation initial input conditions.
which is used to test the generalization capability of the trained network.
traincgb(code)
returns useful information for each code
string:
Examples
Here is a problem consisting of inputs p
and targets t
that we would like to solve with a network.
Here a two-layer feed-forward network is created. The network's input ranges from [0 to 10]
. The first layer has two tansig neurons, and the second layer has one logsig neuron. The traincgb
network training function is to be used.
net = newff([0 5],[2 1],{'tansig','logsig'},'traincgb
');
a = sim(net,p)
net.trainParam.epochs = 50;
net.trainParam.show = 10;
net.trainParam.goal = 0.1;
net = train(net,p,t);
a = sim(net,p)
See newff
,
newcf
, and newelm
for other examples.
Network Use
You can create a standard network that uses traincgb
with newff
, newcf
, or newelm
.
To prepare a custom network to be trained with traincgb
net.trainFcn
to 'traincgb
'. This will set net.trainParam
to traincgb
's default parameters.
net.trainParam
properties to desired values.
In either case, calling train with the resulting network will train the network with traincgb
.
Algorithm
traincgb
can train any network as long as its weight, net input, and transfer functions have derivative functions.
Backpropagation is used to calculate derivatives of performance perf
with respect to the weight and bias variables X
. Each variable is adjusted according to the following:
where dX
is the search direction. The parameter a
is selected to minimize the performance along the search direction. The line search function searchFcn
is used to locate the minimum point. The first search direction is the negative of the gradient of performance. In succeeding iterations the search direction is computed from the new gradient and the previous search direction according to the formula:
where gX
is the gradient. The parameter Z
can be computed in several different ways. The Powell-Beale variation of conjugate gradient is distinguished by two features. First, the algorithm uses a test to determine when to reset the search direction to the negative of the gradient. Second, the search direction is computed from the negative gradient, the previous search direction, and the last search direction before the previous reset. See Powell, Mathematical Programming, for a more detailed discussion of the algorithm.
Training stops when any of these conditions occur:
epochs
(repetitions) is reached.
time
has been exceeded.
goal
.
mingrad
.
max_fail
times since the last time it decreased (when using validation).
See Also
newff
,
newcf
,
traingdm
,
traingda
,
traingdx
,
trainlm
,
traincgp
,
traincgf
,
traincgb
,
trainscg
,
trainoss
,
trainbfg
References
Powell, M. J. D.,"Restart procedures for the conjugate gradient method," Mathematical Programming, vol. 12, pp. 241-254, 1977.
trainc | traincgf |
© 1994-2005 The MathWorks, Inc.