multilabel.F.measure {HEMDAG} | R Documentation |
multilabel F-measure
Description
Method for computing Precision, Recall, Specificity, Accuracy and F-measure for multiclass and multilabel classification.
Usage
F.measure.multilabel(target, predicted, b.per.example = FALSE)
## S4 method for signature 'matrix,matrix'
F.measure.multilabel(target, predicted, b.per.example = FALSE)
Arguments
target |
matrix with the target multilabel: rows correspond to examples and columns to classes.
|
predicted |
a numeric matrix with discrete predicted values: rows correspond to examples and columns to classes.
|
b.per.example |
a boolean value.
|
Details
Names of rows and columns of target
and predicted
matrix must be provided in the same order, otherwise a stop message is returned.
Value
Two different outputs respect to the input parameter b.per.example
:
-
b.per.example==FALSE
: a list with a single element average. A named vector with average precision (P), recall (R), specificity (S), F-measure (F), average F-measure (avF) and Accuracy (A) across examples. F is the F-measure computed as the harmonic mean between the average precision and recall; av.F is the F-measure computed as average across examples; -
b.per.example==FALSE
: a list with two elements:average: a named vector with average precision (P), recall (R), specificity (S), F-measure (F), average F-measure (avF) and Accuracy (A) across examples;
per.example: a named matrix with the Precision (P), Recall (R), Specificity (S), Accuracy (A), F-measure (F) and av.F-measure (av.F) for each example. Row names correspond to examples, column names correspond respectively to Precision (P), Recall (R), Specificity (S), Accuracy (A), F-measure (F) and av.F-measure (av.F);
Examples
data(labels);
data(scores);
data(graph);
root <- root.node(g);
L <- L[,-which(colnames(L)==root)];
S <- S[,-which(colnames(S)==root)];
S[S>0.7] <- 1;
S[S<0.7] <- 0;
fscore <- F.measure.multilabel(L,S);