Neural Network Toolbox | Search  Help Desk |
trainoss | Examples See Also |
One step secant backpropagation
[net,tr] = trainoss(net,Pd,Tl,Ai,Q,TS,VV)
info = trainoss(code)
trainoss
is a network training function that updates weight and bias values according to the one step secant method.
trainoss(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 test vectors.
TR -
Training record of various values over each epoch:
trainoss
'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 showing progress
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
Name of line search routine to use'srchcha'
net.trainParam.scal_tol 20
Divide into delta
to determine tolerance for linear search.
net.trainParam.alpha 0.001
Scale factor which determines sufficient reduction in perf
.
net.trainParam.beta 0.1
Scale factor which 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 use in 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.
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.
Dij = Ri * length(net.inputWeights{i,j}.delays)
VV
is not []
, it must be a structure of validation vectors,
VV.PD -
Validation delayed inputs.
VV.Tl -
Validation layer targets.
VV.Ai -
Validation initial input conditions.
VV.TS -
Validation time steps.
max_fail
epochs in a row.
If TV
is not []
, it must be a structure of validation vectors,
TV.PD -
Validation delayed inputs.
TV.Tl -
Validation layer targets.
TV.Ai -
Validation initial input conditions.
TV.TS -
Validation time steps.
trainoss(code)
returns useful information for each code
string:
Here is a problem consisting of inputs P
and targets T
that we would like to solve with a network.
P = [0 1 2 3 4 5]; T = [0 0 0 1 1 1];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 trainoss
network training function is to be used.
Create and Test a Network
net = newff([0 5],[2 1],{'tansig','logsig'},'trainoss
');
a = sim(net,p)
Train and Retest the Network
net.trainParam.epochs = 50; net.trainParam.show = 10; net.trainParam.goal = 0.1; net = train(net,p,t); a = sim(net,p)See
newff
,
newcf
, and newelm
for other examples.
You can create a standard network that uses trainoss
with newff
, newcf
, or newelm
.
To prepare a custom network to be trained with trainoss
:
.net.trainFcn
to 'trainoss
'. This will set net.trainParam
to trainoss
's
default parameters.
.net.trainParam
properties to desired values.
trainoss
.
trainoss
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:
X = X + a*dX;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 steps and gradients according to the following formula:
dX = -gX + Ac*X_step + Bc*dgX;where
gX
is the gradient, X_step
is the change in the weights on the previous iteration, and dgX
is the change in the gradient from the last iteration. See Battiti (Neural Computation, vol. 4, 1992, pp. 141-166) for a more detailed discussion of the one step secant algorithm.
Training stops when any of these conditions occur:
.epochs
(repetitions) is reached.
.time
has been exceeded.
.goal
.
.mingrad
.
.max_fail
times since the
last time it decreased (when using validation).
newff
,
newcf
,
traingdm
,
traingda
,
traingdx
,
trainlm
,
trainrp
,
traincgf
,
traincgb
,
trainscg
,
traincgp
,
trainbfg
R. Battiti, "First and second order methods for learning: Between steepest descent and Newton's method," Neural Computation, vol. 4, no. 2, pp. 141-166, 1992.