Neural Network Toolbox |
Mean squared error with regularization performance function
Syntax
Description
msereg
is a network performance function. It measures network performance as the weight sum of two factors: the mean squared error and the mean squared weight and bias values.
msereg(E,X,PP)
takes from three arguments,
where PP
defines one performance parameters,
and returns the sum of mean squared errors (times PP.ratio
) with the mean squared weight and bias values (times 1--PP.ratio
).
The errors E
can be given in cell array form,
msereg(E,net)
takes an alternate argument to X
and PP
,
msereg(code)
returns useful information for each code
string:
Examples
Here a two-layer feed-forward is created with a one-element input ranging from -2 to 2, four hidden tansig neurons, and one purelin output neuron.
Here the network is given a batch of inputs P
. The error is calculated by subtracting the output A
from target T
. Then the mean squared error is calculated using a ratio of 20/(20+1). (Errors are 20 times as important as weight and bias values).
p = [-2 -1 0 1 2]; t = [0 1 1 1 0]; y = sim(net,p) e = t-y net.performParam.ratio = 20/(20+1); perf = msereg(e,net)
Network Use
You can create a standard network that uses msereg
with newff
, newcf
, or newelm
.
To prepare a custom network to be trained with msereg
, set net.performFcn
to 'msereg
'. This will automatically set net.performParam
to msereg
's default performance parameters.
In either case, calling train
or adapt
will result in msereg
being used to calculate performance.
See newff
or newcf
for examples.
See Also
mse | negdist |
© 1994-2005 The MathWorks, Inc.