AUC.measures {PerfMeas} | R Documentation |
AUC measures
Description
Set of functions to compute the Area Under the ROC Curve (AUC)
Usage
AUC.single(pred, labels)
AUC.single.over.classes(target, predicted, g, root = "00")
AUC.n.single(pred, labels, n=50)
AUC.n.single.over.classes(target, predicted, g, n=50, root = "00")
compute.mean.AUC.single.over.classes(y)
Arguments
pred |
numeric vector (scores) of the values of the predicted labels |
labels |
numeric vector of the true labels (0 negative, 1 positive examples) |
target |
matrix with the target multilabels: 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. |
g |
a graph of class graphNEL (package graph) of the classes. If g is missing no per.level results are computed |
n |
number of negatives (def=50) |
root |
the name of the root node (def. "00") |
y |
a list of lists. The components of the outer list is a list returned from the function |
Details
AUC.single
computes the AUC for a single class.
AUC.single.over.classes
computes AUC for a set of classes, including their average values across classes and
the average values across the levels of the hierarchy (if any); level 1 classes are at distance 1 from the root,
level 2 the second level, till to last level correponding to the leaves. Note that if the argument g is missing no per-level values are computed.
AUC.n.single
computes the AUCn for a single class, i.e. the AUC by considering only the first n top ranked negatives, where n is the absolute
number of negative examples receiving the highest scores.
AUC.n.single.over.classes
computes AUCn for a set of classes, including their average values across classes and
the average values across the levels of the hierarchy (if any); level 1 classes are at distance 1 from the root,
level 2 the second level, till to last level correponding to the leaves. Note that if the argument g is missing no per-level values are computed.
compute.mean.AUC.single.over.classes
compute means across folds of AUC.single.over.classes. It can be used to automatically computed average values (for each class, level, or average across classes) across folds.
Value
AUC.single
returns a numeric value corresponding to the AUC.
AUC.single.over.classes
returns a list with three elements:
- average |
the average AUC across classes |
- per.level |
a named vector with average AUC for each level of the hierarchy; names correspond to levels |
- per.class |
a named vector with AUC for each class; names correspond to classes |
AUC.n.single
returns a numeric value corresponding to the AUCn.
AUC.n.single.over.classes
returns a list with three elements:
- average |
the average AUCn across classes |
- per.level |
a named vector with average AUCn for each level of the hierarchy; names correspond to levels |
- per.class |
a named vector with AUCn for each class; names correspond to classes |
compute.mean.AUC.single.over.classes
returns a list obtained by averaging the results across folds of the input y.
The components are:
- average |
the average AUC across classes |
- per.level |
a named vector with average AUC for each level of the hierarchy; names correspond to levels |
- per.class |
a named vector with AUC for each class; names correspond to classes |
See Also
Examples
# preparing pseudo.random scores and target-labels for examples: 100 examples
# and 10 classes
Scores <- matrix(runif(1000),nrow=100);
Targets <- matrix(integer(1000),nrow=100);
Targets[Scores>0.5] <- 1;
# adding noise to scores
Scores <- Scores + matrix(rnorm(1000, sd=0.3),nrow=100);
colnames(Scores) <-colnames(Targets) <- LETTERS[1:10];
# getting scores and labels of class "A"
scores <- Scores[,"A"];
labels <- Targets[,"A"];
# AUC for a single class
AUC.single(scores,labels);
# AUC for the 10 classes
AUC.single.over.classes(Targets, Scores);
# AUCn for a single class considering only the first top scored negatives
AUC.n.single(scores,labels, n=20);
# AUCn for the 10 classes considering only the first top scored negatives
AUC.n.single.over.classes(Targets, Scores, n=20);