Main Content


Calculate network performance



perf = perform(net,t,y,ew) takes a network net, targets T, outputs Y, and optionally error weights EW, and returns network performance calculated according to the net.performFcn and net.performParam property values.

The target and output data must have the same dimensions. The error weights may be the same dimensions as the targets, in the most general case, but may also have any of its dimensions be 1. This gives the flexibility of defining error weights across any dimension desired.


collapse all

This example shows how to calculate the performance of a feed-forward network with the perform function.

Create a feed-forward network using the data from the simple fit data set and calculate its performance.

[x,t] = simplefit_dataset;
net = feedforwardnet(20);
net = train(net,x,t);
y = net(x);
perf = perform(net,t,y)
perf =


Input Arguments

collapse all

Input network, specified as a network object. To create a network object, use for example, feedforwardnet or narxnet.

Network targets, specified as a matrix or cell array.

Network outputs, specified as a matrix or cell array.

Error weights, specified as a vector, matrix, or cell array.

Error weights can be defined by sample, output element, time step, or network output:

ew = [1.0 0.5 0.7 0.2]; % Across 4 samples
ew = [0.1; 0.5; 1.0]; % Across 3 elements
ew = {0.1 0.2 0.3 0.5 1.0}; % Across 5 timesteps
ew = {1.0; 0.5}; % Across 2 outputs

The error weights can also be defined across any combination, such as across two time-series (i.e., two samples) over four timesteps.

ew = {[0.5 0.4],[0.3 0.5],[1.0 1.0],[0.7 0.5]};

In the general case, error weights may have exactly the same dimensions as targets, in which case each target value will have an associated error weight.

The default error weight treats all errors the same.

ew = {1}

Output Arguments

collapse all

Network performance, returned as a scalar.

Version History

Introduced in R2010b

See Also

| |