Neural Network Toolbox™ Previous page   Next Page 
traincgp
 Provide feedback about this page

Conjugate gradient backpropagation with Polak-Ribiére updates

Syntax

Description

traincgp is a network training function that updates weight and bias values according to conjugate gradient backpropagation with Polak-Ribiére updates.

traincgp(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

and returns

net
Trained network
TR
Training record of various values over each epoch

Each argument trainV, valV, and testV is a structure of these fields:

X
N x TS cell array of inputs for N inputs and TS time steps. X{i,ts} is an Ri x Q matrix for the ith input and TS time step.
Xi
N x Nid cell array of input delay states for N inputs and Nid delays. Xi{i,j} is an Ri x Q matrix for the ith input and jth state.
Pd
N x S x Nid cell array of delayed input states.
T
NoxTS cell array of targets for No outputs and TS time steps. T{i,ts} is an Si x Q matrix for the ith output and TS time step.
Tl
Nl x TS cell array of targets for Nl layers and TS time steps. Tl{i,ts} is an Si x Q matrix for the ith layer and TS time step.
Ai
Nl x TS cell array of layer delays states for Nl layers, TS time steps. Ai{i,j} is an Si x Q matrix of delayed outputs for layer i, delay j.

Training occurs according to traincgp'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 displays (NaN for no displays)
net.trainParam.showCommandLine
0

Generate command-line output
net.trainParam.showWindow
1

Show training GUI
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
'srchcha'

Name of line search routine to use

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

net.trainParam.scal_tol
20

Divide into delta to determine tolerance for linear search.
net.trainParam.alpha
0.001

Scale factor that determines sufficient reduction in perf
net.trainParam.beta
0.1

Scale factor that determines sufficiently large step size
net.trainParam.delta
0.01

Initial step size in interval location step
net.trainParam.gama
0.1

Parameter to avoid small reductions in performance, usually set to 0.1 (see srch_cha)
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
net.trainParam.minstep
1.0e-6

Minimum step length
net.trainParam.bmax
26

Maximum step size

Network Use

You can create a standard network that uses traincgp with newff, newcf, or newelm. To prepare a custom network to be trained with traincgp,

  1. Set net.trainFcn to 'traincgp'. This sets net.trainParam to traincgp's default parameters.
  2. Set net.trainParam properties to desired values.

In either case, calling train with the resulting network trains the network with traincgp.

Examples

Here is a problem consisting of inputs p and targets t to be solved with a network.

A feed-forward network is created with a hidden layer of 2 neurons.

Here the network is trained and tested.

Algorithm

traincgp 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 Polak-Ribiére variation of conjugate gradient, it is computed according to

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

Training stops when any of these conditions occurs:

Reference

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

See Also

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


 Provide feedback about this page 

Previous page traincgf traingd Next page

 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS