auroc {HEMDAG}R Documentation

AUROC measures

Description

Compute the Area under the ROC Curve (AUROC) through precrec package.

Usage

auroc.single.class(labels, scores, folds = NULL, seed = NULL)

auroc.single.over.classes(target, predicted, folds = NULL, seed = NULL)

Arguments

labels

vector of the true labels (0 negative, 1 positive examples).

scores

a numeric vector of the values of the predicted labels (scores).

folds

number of folds on which computing the AUROC. If folds=NULL (def.), the AUROC is computed one-shot, otherwise the AUROC is computed averaged across folds.

seed

initialization seed for the random generator to create folds. Set seed only if folds\neqNULL. If seed=NULL and folds\neqNULL, the AUROC averaged across folds is computed without seed initialization.

target

annotation matrix: rows correspond to examples and columns to classes. target[i,j]=1 if example i belongs to class j, target[i,j]=0 otherwise.

predicted

a numeric matrix with predicted values (scores): rows correspond to examples and columns to classes.

Details

The AUROC (for a single class or for a set of classes) is computed either one-shot or averaged across stratified folds.

auroc.single.class computes the AUROC just for a given class.

auroc.single.over.classes computes the AUROC for a set of classes, including their average values across all the classes.

For all those classes having zero annotations, the AUROC is set to 0.5. These classes are included in the computing of the AUROC averaged across classes, both when the AUROC is computed one-shot or averaged across stratified folds.

The AUROC is set to 0.5 to all those classes having zero annotations. Names of rows and columns of labels and predicted must be provided in the same order, otherwise a stop message is returned.

Value

auroc.single.class returns a numeric value corresponding to the AUROC for the considered class; auprc.single.over.classes returns a list with two elements:

  1. average: the average AUROC across classes;

  2. per.class: a named vector with AUROC for each class. Names correspond to classes.

Examples

data(labels);
data(scores);
data(graph);
root <- root.node(g);
L <- L[,-which(colnames(L)==root)];
S <- S[,-which(colnames(S)==root)];
auc.single.class <- auroc.single.class(L[,3], S[,3], folds=5, seed=23);
auc.over.classes <- auroc.single.over.classes(L, S, folds=5, seed=23);

[Package HEMDAG version 2.7.4 Index]