mae

Mean absolute error performance function

Syntax

perf = mae(E,Y,X,FP)

Description

mae is a network performance function. It measures network performance as the mean of absolute errors.

perf = mae(E,Y,X,FP) takes E and optional function parameters,

E

Matrix or cell array of error vectors

Y

Matrix or cell array of output vectors (ignored)

X

Vector of all weight and bias values (ignored)

FP

Function parameters (ignored)

and returns the mean absolute error.

dPerf_dx = mae('dx',E,Y,X,perf,FP) returns the derivative of perf with respect to X.

info = mae('code') returns useful information for each code character vector:

mae('name') returns the name of this function.

mae('pnames') returns the names of the training parameters.

mae('pdefaults') returns the default function parameters.

Examples

Create and configure a perceptron to have one input and one neuron:

net = perceptron;
net = configure(net,0,0);

The network is given a batch of inputs P. The error is calculated by subtracting the output A from target T. Then the mean absolute error is calculated.

p = [-10 -5 0 5 10];
t = [0 0 1 1 1];
y = net(p)
e = t-y
perf = mae(e)

Note that mae can be called with only one argument because the other arguments are ignored. mae supports those arguments to conform to the standard performance function argument list.

Network Use

You can create a standard network that uses mae with perceptron.

To prepare a custom network to be trained with mae, set net.performFcn to 'mae'. This automatically sets net.performParam to the empty matrix [], because mae has no performance parameters.

In either case, calling train or adapt, results in mae being used to calculate performance.

See Also

|

Introduced before R2006a