Main Content

mae

Mean absolute error performance function

Description

example

perf= mae(E,Y,X)takes a matrix or cell array of error vectors,E, and optionally a matrix or cell array of output vectors,Y, a vector of all weight and bias values,X, and returns network performance as the mean of absolute errors,perf.

dPerf_dx= mae('dx',E,Y,X,perf)returns the derivative ofperfwith respect toX.

info = mae('code')returns useful information for eachcodecharacter 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

collapse all

This example shows how to calculate the network performance as the mean of absolute errors.

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 inputsP. The error is calculated by subtracting the outputAfrom targetT. 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 thatmaecan be called with only one argument because the other arguments are ignored.maesupports those arguments to conform to the standard performance function argument list.

Input Arguments

collapse all

Errors, specified as a vector, a matrix, or a cell array.

Network outputs, specified as a vector, a matrix, or a cell array.

Weight and bias values, specified as a vector.

Output Arguments

collapse all

Network performance as the mean of absolute errors, returned as a scalar.

Derivative ofperfwith respect toX, returned as a scalar.

More About

collapse all

Network Use

You can create a standard network that usesmaewithperceptron.

To prepare a custom network to be trained withmae, setnet.performFcnto'mae'. This automatically setsnet.performParamto the empty matrix[], becausemaehas no performance parameters.

In either case, callingtrainoradapt, results inmaebeing used to calculate performance.

See Also

|

Introduced before R2006a