Neural Network Toolbox |
Levenberg-Marquardt backpropagation
Syntax
Description
trainlm is a network training function that updates weight and bias values according to Levenberg-Marquardt optimization.
trainlm(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.
TV
-- Either empty matrix [] or structure of validation vectors.
Training occurs according to the trainlm'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.mem_reduc 1
Factor to use for memory/speed
tradeoff
net.trainParam.min_grad 1e-10
Minimum performance gradient
Initial Mu
net.trainParam.mu 0.001
net.trainParam.mu_dec 0.1
Mu decrease factor
net.trainParam.mu_inc 10
Mu increase factor
net.trainParam.mu_max 1e10
Maximum Mu
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
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.
trainlm(code)
returns useful information for each code
string:
Network Use
You can create a standard network that uses trainlm with newff
, newcf
, or newelm
.
To prepare a custom network to be trained with trainlm
.trainFcn
to 'trainlm'. This will set net.trainParam
to trainlm's default parameters.
.trainParam
properties to desired values.
In either case, calling train
with the resulting network will train the network with trainlm.
See newff
, newcf
, and newelm
for examples.
Algorithm
trainlm can train any network as long as its weight, net input, and transfer functions have derivative functions.
Backpropagation is used to calculate the Jacobian jX
of performance perf
with respect to the weight and bias variables X
. Each variable is adjusted according to Levenberg-Marquardt,
where E
is all errors and I
is the identity matrix.
The adaptive value mu
is increased by mu_inc
until the change above results in a reduced performance value. The change is then made to the network and mu
is decreased by mu_dec
.
The parameter mem_reduc
indicates how to use memory and speed to calculate the Jacobian jX
. If mem_reduc
is 1, then trainlm runs the fastest, but can require a lot of memory. Increasing mem_reduc
to 2 cuts some of the memory required by a factor of two, but slows trainlm somewhat. Higher values continue to decrease the amount of memory needed and increase training times.
Training stops when any of these conditions occur:
epochs
(repetitions) is reached.
time
has been exceeded.
goal
.
mingrad
.
mu
exceeds mu_max
.
max_fail
times since the last time it decreased (when using validation).
See Also
traingdx | trainoss |
© 1994-2005 The MathWorks, Inc.