fmax {HEMDAG} | R Documentation |
Compute Fmax
Description
Compute the best hierarchical Fmax either one-shot or averaged across folds
Usage
compute.fmax(
target,
predicted,
n.round = 3,
verbose = TRUE,
b.per.example = FALSE,
folds = NULL,
seed = NULL
)
Arguments
target |
matrix with the target multilabel: rows correspond to examples and columns to classes.
|
predicted |
a numeric matrix with predicted values (scores): rows correspond to examples and columns to classes. |
n.round |
number of rounding digits to be applied to predicted ( |
verbose |
a boolean value. If |
b.per.example |
a boolean value.
|
folds |
number of folds on which computing the Fmax If |
seed |
initialization seed for the random generator to create folds. Set |
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 7 elements relative to the best result in terms of the F.measure: Precision (P), Recall (R), Specificity (S), F.measure (F), av.F.measure (av.F), Accuracy (A) and the best selected Threshold (T). F is the F-measure computed as the harmonic mean between the average precision and recall; av.F is the F-measure computed as the average across examples and T is the best selected threshold; -
b.per.example==FALSE
: a list with two elements:average: a named vector with with 7 elements relative to the best result in terms of the F.measure: Precision (P), Recall (R), Specificity (S), F.measure (F), av.F.measure (av.F), Accuracy (A) and the best selected Threshold (T);
per.example: a named matrix with the Precision (P), Recall (R), Specificity (S), Accuracy (A), F-measure (F), av.F-measure (av.F) and the best selected Threshold (T) for each example. Row names correspond to examples, column names correspond respectively to Precision (P), Recall (R), Specificity (S), Accuracy (A), F-measure (F), av.F-measure (av.F) and the best selected Threshold (T);
Examples
data(graph);
data(labels);
data(scores);
root <- root.node(g);
L <- L[,-which(colnames(L)==root)];
S <- S[,-which(colnames(S)==root)];
fmax <- compute.fmax(L, S, n.round=3, verbose=TRUE, b.per.example=TRUE, folds=5, seed=23);