Neural Network Toolbox
  Go to function:
    Search    Help Desk 
trainscg    Examples   See Also

Scaled conjugate gradient backpropagation

Syntax

[net,tr] = trainscg(net,Pd,Tl,Ai,Q,TS,VV)

info = trainscg(code)

Description

trainscg is a network training function that updates weight and bias values according to the scaled conjugate gradient method.

trainscg(net,Pd,Tl,Ai,Q,TS,VV,TV) takes these inputs,

and returns,

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

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.

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

Create and Test a Network

Train and Retest the Network

See newff, newcf, and newelm for other examples.

Network Use

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

To prepare a custom network to be trained with trainscg:

   1.
Set net.trainFcn to 'trainscg'. This will set net.trainParam to trainscg'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 trainscg.

Algorithm

trainscg 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.

The scaled conjugate gradient algorithm is based on conjugate directions, as in traincgp, traincgf and traincgb, but this algorithm does not perform a line search at each iteration. See Moller (Neural Networks, vol. 6, 1993, pp.525-533) for a more detailed discussion of the scaled conjugate gradient algorithm.

Training stops when any of these conditions occur:

   1.
The maximum number of epochs (repetitions) is reached.
   2.
The maximum amount of time has been exceeded.
   3.
Performance has been minimized to the goal.
   4.
The performance gradient falls below mingrad.
   5.
Validation performance has increased more than max_fail times since the last time it decreased (when using validation).

See Also

newff, newcf, traingdm, traingda, traingdx, trainlm, trainrp, traincgf, traincgb, trainbfg, traincgp, trainoss

References

Moller, M. F., "A scaled conjugate gradient algorithm for fast supervised learning," Neural Networks, vol. 6, pp. 525-533, 1993.



[ Previous | Help Desk | Next ]