roc

Receiver operating characteristic

Syntax

[tpr,fpr,thresholds] = roc(targets,outputs)

Description

The receiver operating characteristic is a metric used to check the quality of classifiers. For each class of a classifier, roc applies threshold values across the interval [0,1] to outputs. For each threshold, two values are calculated, the True Positive Ratio (the number of outputs greater or equal to the threshold, divided by the number of one targets), and the False Positive Ratio (the number of outputs less than the threshold, divided by the number of zero targets).

You can visualize the results of this function with plotroc.

[tpr,fpr,thresholds] = roc(targets,outputs) takes these arguments:

targets

S-by-Q matrix, where each column vector contains a single 1 value, with all other elements 0. The index of the 1 indicates which of S categories that vector represents.

outputs

S-by-Q matrix, where each column contains values in the range [0,1]. The index of the largest element in the column indicates which of S categories that vector presents. Alternately, 1-by-Q vector, where values greater or equal to 0.5 indicate class membership, and values below 0.5, nonmembership.

and returns these values:

tpr

1-by-S cell array of 1-by-N true-positive/positive ratios.

fpr

1-by-S cell array of 1-by-N false-positive/negative ratios.

thresholds

1-by-S cell array of 1-by-N thresholds over interval [0,1].

roc(targets,outputs) takes these arguments:

targets

1-by-Q matrix of Boolean values indicating class membership.

outputs

S-by-Q matrix, of values in [0,1] interval, where values greater than or equal to 0.5 indicate class membership.

and returns these values:

tpr

1-by-N vector of true-positive/positive ratios.

fpr

1-by-N vector of false-positive/negative ratios.

thresholds

1-by-N vector of thresholds over interval [0,1].

Examples

load iris_dataset
net = patternnet(20);
net = train(net,irisInputs,irisTargets);
irisOutputs = sim(net,irisInputs);
[tpr,fpr,thresholds] = roc(irisTargets,irisOutputs)

See Also

|

Was this topic helpful?