Neural Network Toolbox Previous page   Next Page
traincgf

Conjugate gradient backpropagation with Fletcher-Reeves updates

Syntax

[net,TR,Ac,El] = traincgf(net,Pd,Tl,Ai,Q,TS,VV,TV)

info = traincgf(code)

Description

traincgf is a network training function that updates weight and bias values according to the conjugate gradient backpropagation with Fletcher-Reeves updates.

traincgf(NET,Pd,Tl,Ai,Q,TS,VV,TV) takes these inputs,

and returns,

Training occurs according to the traincgf's training parameters, shown here with their default values:

Parameters related to line search methods (not all used for all methods):

Dimensions for these variables are:

where

If VV is not [], it must be a structure of validation vectors,

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,

which is used to test the generalization capability of the trained network.

traincgf(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 traincgf network training function is to be used.

Create and Test a Network

See newff, newcf, and newelm for other examples.

Network Use

You can create a standard network that uses traincgf with newff, newcf, or newelm.

To prepare a custom network to be trained with traincgf

  1. Set net.trainFcn to 'traincgf'. This will set net.trainParam to traincgf's default parameters.
  2. Set net.trainParam properties to desired values.

In either case, calling train with the resulting network will train the network with traincgf.

Algorithm

traincgf 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. For the Fletcher-Reeves variation of conjugate gradient it is computed according to

where norm_sqr is the norm square of the previous gradient and normnew_sqr is the norm square of the current gradient. See page 78 of Scales (Introduction to Non-Linear Optimization) for a more detailed discussion of the algorithm.

Training stops when any of these conditions occur:

See Also

newff, newcf, traingdm, traingda, traingdx, trainlm, traincgp, traincgb, trainscg, traincgp, trainoss, trainbfg

References

Scales, L. E., Introduction to Non-Linear Optimization, New York: Springer-Verlag, 1985.


Previous page  traincgb traincgp Next page

© 1994-2005 The MathWorks, Inc.