| Neural Network Toolbox | |
| Provide feedback about this page |
Levenberg-Marquardt backpropagation
Syntax
Description
trainlm is a network training function that updates weight and bias values according to Levenberg-Marquardt optimization.
trainlm is often the fastest backpropagation algorithm in the toolbox, and is highly recommended as a first-choice supervised algorithm, although it does require more memory than other algorithms.
trainlm(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 |
Validation data created by train |
testV |
Test data created by train |
net |
Trained network | |
TR |
Training record of various values over each epoch | |
Each argument trainV, valV, and testV is a structure of these fields:
Training occurs according to trainlm's training parameters, shown here with their default values:
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 is the default training function for several network creationfunctions including newff, newcf, newtd, newdtdnn, and newnarx.
trainlm('info') returns useful information about this function.
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,
net.trainFcn to 'trainlm'. This sets net.trainParam to trainlm's default parameters.
net.trainParam properties to desired values.
In either case, calling train with the resulting network trains the network with trainlm.
See newff, newcf, and newelm for examples.
Algorithm
trainlm supports training with validation and test vectors if the network's NET.divideFcn property is set to a data division function. 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 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 states continue to decrease the amount of memory needed and increase training times.
Training stops when any of these conditions occurs:
epochs (repetitions) is reached.
time is exceeded.
goal.
min_grad.
mu exceeds mu_max.
max_fail times since the last time it decreased (when using validation).
See Also
newff, newcf, newtd, newdtdnn, newnarx, and template_train
| Provide feedback about this page |
![]() | traingdx | trainoss | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |