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,
E -
Matrix or cell array of error vector(s).
X
-
Vector of all weight and bias values.
PP -
Performance parameter.
where PP
defines one performance parameters,
PP.ratio -
Relative importance of errors vs. weight and bias values.
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,
E - Nt
x TS
cell array, each element E{i,ts}
is an Vi
x Q
matrix or []
.
E -
(sum of Vi
) x Q
matrix
msereg(E,net)
takes an alternate argument to X
and PP
,
net -
Neural network from which X
and PP
can be obtained.
msereg(code)
returns useful information for each code
string:
deriv
'
- Name of derivative function.
'name
' -
Full name.
'pnames
'
- Names of training parameters.
'pdefaults
'
- Default training parameters.
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 | ![]() |